/* ParcelPilot — Dark Theme Shipping Dashboard */
:root {
  --bg-deep: #0d1117;
  --bg-sidebar: #111820;
  --bg-card: #161b22;
  --bg-surface: #1c2128;
  --bg-input: #0d1117;
  --bg-hover: #1c2128;
  --accent: #22c55e;
  --accent-dim: #16a34a;
  --accent-glow: rgba(34, 197, 94, 0.12);
  --accent-bg: rgba(34, 197, 94, 0.08);
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-dim: #6e7681;
  --border: #21262d;
  --border-light: #30363d;
  --danger: #f85149;
  --warning: #d29922;
  --info: #58a6ff;
  --sidebar-width: 260px;
  --header-height: 0px;
  --radius: 8px;
  --radius-lg: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===== AUTH PAGES ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-deep);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  justify-content: center;
}

.auth-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.auth-logo-text {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  text-align: center;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 28px;
}

/* ===== ONBOARDING ===== */
.onboarding-card {
  max-width: 480px;
}

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.option-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  text-align: center;
  user-select: none;
}

.option-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.option-card:hover {
  border-color: var(--border-light);
  background: var(--bg-surface);
}

.option-card.selected,
.option-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: 0 0 0 1px var(--accent);
}

.option-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.option-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.option-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder {
  color: var(--text-dim);
}

select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e7681' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: rgba(248, 81, 73, 0.1);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 12px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 12px 28px;
  font-size: 1rem;
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== LAYOUT ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 24px;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.sidebar-logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-section {
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  padding: 8px 12px 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--accent-bg);
  color: var(--accent);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--accent);
  color: #000;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-user:hover {
  background: var(--bg-hover);
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.sidebar-user-email {
  font-size: 0.75rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-logout {
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s;
}

.sidebar-logout:hover {
  color: var(--danger);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  max-width: 1200px;
}

.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ===== STATS CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-card-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.stat-card-change {
  font-size: 0.78rem;
  margin-top: 6px;
}

.stat-card-change.positive { color: var(--accent); }
.stat-card-change.negative { color: var(--danger); }

/* ===== TABLE ===== */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.table-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-title {
  font-size: 1rem;
  font-weight: 600;
}

.table-search {
  padding: 7px 12px 7px 34px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  width: 240px;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e7681' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}

.table-search:focus {
  border-color: var(--accent);
}

.table-filters {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-select {
  padding: 7px 30px 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236e7681' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 10px 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

td {
  padding: 12px 20px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg-hover);
}

.table-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-dim);
}

.table-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.table-empty-text {
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.table-empty-sub {
  font-size: 0.8rem;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-draft { background: rgba(139, 148, 158, 0.15); color: var(--text-secondary); }
.badge-label_created { background: rgba(88, 166, 255, 0.15); color: var(--info); }
.badge-in_transit { background: rgba(210, 153, 34, 0.15); color: var(--warning); }
.badge-out_for_delivery { background: rgba(34, 197, 94, 0.15); color: var(--accent); }
.badge-delivered { background: rgba(34, 197, 94, 0.25); color: var(--accent); }
.badge-returned { background: rgba(248, 81, 73, 0.15); color: var(--danger); }
.badge-cancelled { background: rgba(248, 81, 73, 0.15); color: var(--danger); }

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.carrier-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.carrier-usps { background: rgba(0, 82, 165, 0.2); color: #5ba0e0; }
.carrier-ups { background: rgba(100, 53, 0, 0.25); color: #d4a853; }
.carrier-fedex { background: rgba(70, 0, 130, 0.2); color: #b87dff; }
.carrier-dhl { background: rgba(212, 175, 55, 0.2); color: #d4af37; }

/* ===== CARDS / SECTIONS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title-icon {
  color: var(--accent);
}

/* ===== SHIPMENT FORM ===== */
.shipment-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.address-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.address-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.address-section-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.from-icon { background: rgba(88, 166, 255, 0.15); color: var(--info); }
.to-icon { background: rgba(34, 197, 94, 0.15); color: var(--accent); }

/* ===== SETTINGS ===== */
.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.toggle-group:last-child {
  border-bottom: none;
}

.toggle-label {
  font-size: 0.875rem;
}

.toggle-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-light);
  border-radius: 12px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ===== MESSAGES ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-error {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.2);
  color: var(--danger);
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--accent);
}

.alert-info {
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.2);
  color: var(--info);
}

/* ===== LOADING ===== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  flex-direction: column;
  gap: 12px;
  color: var(--text-dim);
}

/* ===== MISC ===== */
.link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.link:hover {
  text-decoration: underline;
}

.text-dim { color: var(--text-dim); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.85em; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }

.clickable-row {
  cursor: pointer;
}

.actions-cell {
  display: flex;
  gap: 4px;
}

/* ===== MOBILE ===== */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.mobile-menu-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: var(--radius);
}

.mobile-menu-btn:hover {
  background: var(--bg-hover);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 45;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .mobile-header {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .shipment-form-grid {
    grid-template-columns: 1fr;
  }

  .form-row, .form-row-3 {
    grid-template-columns: 1fr;
  }

  .table-header {
    flex-direction: column;
    align-items: stretch;
  }

  .table-search {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== ALERTS ===== */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.alert-item:last-child {
  border-bottom: none;
}

.alert-item:hover {
  background: var(--bg-hover);
}

.alert-unread {
  background: rgba(34, 197, 94, 0.04);
  border-left: 3px solid var(--accent);
}

.alert-icon-wrap {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--bg-surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-top: 2px;
}

.alert-unread-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.alert-content {
  flex: 1;
  min-width: 0;
}

.alert-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.alert-message {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 4px;
}

.alert-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.alert-right {
  flex-shrink: 0;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.alert-time {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.alert-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ===== ANALYTICS CHARTS ===== */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding: 8px 0 4px;
}

.chart-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 8px;
  gap: 4px;
}

.chart-bar-value {
  width: 100%;
  min-width: 4px;
  border-radius: 4px 4px 0 0;
  transition: opacity 0.2s;
  cursor: default;
  min-height: 4px;
}

.chart-bar-value:hover {
  opacity: 0.8;
}

.chart-bar-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

/* ===== EMAIL BRANDING ===== */
.color-swatch {
  transition: transform 0.15s, border-color 0.15s;
}

.color-swatch:hover {
  transform: scale(1.15);
}

@media (max-width: 768px) {
  .alert-item {
    gap: 10px;
    padding: 12px 16px;
  }

  .alert-right {
    display: none;
  }

  /* Analytics two-col -> one-col on mobile */
  [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ===== LEGAL PAGES (Terms & Privacy) ===== */
.legal-page {
  min-height: 100vh;
  background: var(--bg-deep);
  padding: 40px 20px 80px;
}

.legal-container {
  max-width: 760px;
  margin: 0 auto;
}

.legal-header {
  text-align: center;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.legal-title {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.legal-meta {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.legal-body section {
  margin-bottom: 36px;
}

.legal-body h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.legal-body h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 16px 0 8px;
}

.legal-body p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}

.legal-body ul {
  list-style: none;
  padding: 0;
  margin-bottom: 12px;
}

.legal-body ul li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding: 4px 0 4px 20px;
  position: relative;
}

.legal-body ul li::before {
  content: '–';
  position: absolute;
  left: 4px;
  color: var(--accent);
}

.legal-body a {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.legal-body a:hover {
  text-decoration: underline;
}

.legal-footer-nav {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.legal-footer-nav .link {
  cursor: pointer;
}

/* ===== AUTH LEGAL FOOTER ===== */
.auth-legal-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ===== TOS CHECKBOX ===== */
.tos-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tos-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}

.tos-checkbox-label a {
  color: var(--accent);
  cursor: pointer;
}

.tos-checkbox-label a:hover {
  text-decoration: underline;
}

/* ===== SIDEBAR LEGAL LINKS ===== */
.sidebar-legal-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.72rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

.sidebar-legal-links a {
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s;
}

.sidebar-legal-links a:hover {
  color: var(--text-secondary);
}
