/* Vùng 1 CRM - Custom Styles */
* { box-sizing: border-box; }

/* ===== LIGHT THEME (default) ===== */
:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --card2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0ea5e9;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --purple: #7c3aed;
  --bottom-nav-h: 60px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --topbar-bg: #ffffff;
  --sidebar-bg: #ffffff;
  --input-bg: #ffffff;
  --modal-overlay: rgba(15,23,42,0.45);
  --scrollbar-track: #f1f5f9;
  --scrollbar-thumb: #cbd5e1;
}

/* ===== DARK THEME ===== */
html.dark {
  --bg: #0f172a;
  --card: #1e293b;
  --card2: #263348;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #a78bfa;
  --shadow: 0 1px 4px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --topbar-bg: #1e293b;
  --sidebar-bg: #1e293b;
  --input-bg: #0f172a;
  --modal-overlay: rgba(0,0,0,0.65);
  --scrollbar-track: #1e293b;
  --scrollbar-thumb: #334155;
}

/* ===== THEME TRANSITION ===== */
body, .card, .sidebar, .topbar, .modal, .modal-header, .modal-footer,
.input, .btn-secondary, .bottom-nav, .stat-card, .table-wrap,
.dropdown-menu, .gs-step-card, .gs-auth-option, .gs-sync-option {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); -webkit-tap-highlight-color: transparent; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Sidebar */
.sidebar { width: 260px; min-height: 100vh; background: var(--sidebar-bg); border-right: 1px solid var(--border); position: fixed; top: 0; left: 0; z-index: 100; transition: transform 0.3s, background-color 0.25s; box-shadow: var(--shadow-md); }
.sidebar.collapsed { transform: translateX(-260px); }
.sidebar-logo { padding: 20px; border-bottom: 1px solid var(--border); }
.sidebar-logo h1 { font-size: 1.2rem; font-weight: 700; color: var(--accent); letter-spacing: -0.5px; }
.sidebar-logo p { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 20px; cursor: pointer; border-radius: 0; transition: all 0.2s; color: var(--muted); font-size: 0.9rem; text-decoration: none; }
.nav-item:hover { color: var(--text); background: rgba(56,189,248,0.07); }
.nav-item.active { color: var(--accent); background: rgba(56,189,248,0.12); border-right: 3px solid var(--accent); }
.nav-item i { width: 20px; text-align: center; font-size: 0.95rem; }
.nav-section { padding: 12px 20px 4px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }

/* Sidebar overlay (mobile backdrop) */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 99; backdrop-filter: blur(2px); }
.sidebar-overlay.active { display: block; }

/* Main content */
.main-content { margin-left: 260px; min-height: 100vh; transition: margin 0.3s; }
.main-content.full { margin-left: 0; }
.topbar { height: 60px; background: var(--topbar-bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow); }
.topbar h2 { font-size: 1rem; font-weight: 600; flex: 1; }
.page-content { padding: 24px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 8px; transition: border-color 0.2s; }
.stat-card:hover { border-color: var(--accent); }
.stat-value { font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 0.85rem; font-weight: 500; cursor: pointer; border: none; transition: all 0.2s; }
.btn-primary { background: var(--accent); color: #0f172a; }
.btn-primary:hover { background: #7dd3fc; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-secondary { background: var(--card2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-warning { background: var(--warning); color: #0f172a; }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-icon { padding: 6px 10px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Inputs */
.input { background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--text); font-size: 0.85rem; width: 100%; transition: border-color 0.2s, background-color 0.25s; outline: none; }
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--muted); }
.label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group { margin-bottom: 16px; }
select.input option { background: var(--card); color: var(--text); }
textarea.input { resize: vertical; min-height: 80px; }

/* Table */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead { background: var(--card2); }
th { padding: 12px 14px; text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
td { padding: 11px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: rgba(56,189,248,0.04); }

/* Status badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.badge-cold { background: rgba(148,163,184,0.15); color: #94a3b8; }
.badge-warm { background: rgba(251,146,60,0.15); color: #fb923c; }
.badge-hot { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-info { background: rgba(56,189,248,0.15); color: #38bdf8; }
.badge-profile { background: rgba(167,139,250,0.15); color: #a78bfa; }
.badge-closed { background: rgba(34,197,94,0.15); color: #22c55e; }
.badge-admin { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-senior { background: rgba(167,139,250,0.15); color: #a78bfa; }
.badge-sale { background: rgba(56,189,248,0.15); color: #38bdf8; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: var(--modal-overlay); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-title { font-size: 1rem; font-weight: 700; }

/* Notification badge */
.notif-badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: white; font-size: 0.65rem; font-weight: 700; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* Login page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 30% 30%, rgba(56,189,248,0.08) 0%, transparent 60%), var(--bg); }
.login-card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-md); }

/* Alert */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 0.85rem; margin-bottom: 12px; }
.alert-error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
.alert-success { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: #4ade80; }
.alert-info { background: rgba(56,189,248,0.12); border: 1px solid rgba(56,189,248,0.3); color: #38bdf8; }

/* Pagination */
.pagination { display: flex; gap: 6px; align-items: center; }
.page-btn { padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; font-size: 0.82rem; transition: all 0.2s; }
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: #0f172a; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Avatar */
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--purple)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; color: #0f172a; flex-shrink: 0; }

/* Progress bar */
.progress { background: var(--border); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.3s; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }

/* Tag/chip */
.chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px; font-size: 0.72rem; background: var(--card2); color: var(--muted); border: 1px solid var(--border); }

/* Dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--border); border-radius: 10px; min-width: 180px; box-shadow: var(--shadow-md); z-index: 300; overflow: hidden; }
.dropdown-item { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; font-size: 0.85rem; color: var(--text); transition: background 0.15s; }
.dropdown-item:hover { background: var(--card2); }
.dropdown-item.danger { color: var(--danger); }

/* Timeline */
.timeline { border-left: 2px solid var(--border); padding-left: 20px; }
.timeline-item { position: relative; margin-bottom: 16px; }
.timeline-item::before { content: ''; position: absolute; left: -25px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--card); }
.timeline-time { font-size: 0.72rem; color: var(--muted); }
.timeline-text { font-size: 0.85rem; margin-top: 2px; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fadeIn 0.3s ease; }
.slide-in { animation: slideIn 0.3s ease; }
.spin { animation: spin 1s linear infinite; }

/* Loading spinner */
.loader { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }

/* Search highlight */
.highlight { background: rgba(56,189,248,0.25); border-radius: 2px; }

/* Tooltip */
[data-tip] { position: relative; }
[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: #1e293b; color: var(--text); padding: 4px 8px; border-radius: 6px; font-size: 0.72rem; white-space: nowrap; pointer-events: none; z-index: 999; border: 1px solid var(--border); }

/* Filter bar */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-bar .input { width: auto; min-width: 140px; }

/* Notification panel — desktop dropdown */
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: calc(100vw - 24px); background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-md); z-index: 400; overflow: hidden; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.notif-item:hover { background: var(--card2); }
.notif-item.unread { border-left: 3px solid var(--accent); background: rgba(56,189,248,0.05); }
.notif-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; }

/* Kanban status colors */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-lanh { background: #64748b; }
.dot-thamkhao { background: #f97316; }
.dot-quantamsau { background: #ef4444; }
.dot-profilenet { background: #a78bfa; }
.dot-chot { background: #22c55e; }

/* Chart container */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

/* ============================================================
   DASHBOARD GRIDS — responsive
   ============================================================ */
/* 2-column equal grid */
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* 2:1 leaderboard + recent */
.dash-grid-leaderboard { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* Status chart layout */
.status-chart-wrap { display: flex; gap: 16px; align-items: center; }
.status-donut-canvas { width: 130px; height: 130px; flex-shrink: 0; position: relative; }
.status-donut-canvas canvas { width: 100% !important; height: 100% !important; }
.status-legend { flex: 1; min-width: 0; }

/* Timeline header + controls */
.tl-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.tl-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tl-input { width: auto !important; min-width: 0 !important; }

/* ============================================================
   BOTTOM NAVIGATION BAR (mobile only, hidden on desktop)
   ============================================================ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 98;
  /* safe area for iPhone notch */
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-inner {
  display: flex;
  height: 60px;
  align-items: stretch;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 600;
  transition: color 0.2s;
  position: relative;
  border: none;
  background: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.bottom-nav-item i { font-size: 1.15rem; }
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item.active i { filter: drop-shadow(0 0 6px rgba(56,189,248,0.5)); }
.bottom-nav-item .notif-badge { position: absolute; top: 6px; right: calc(50% - 16px); }

/* FAB (Floating Action Button) */
.fab {
  display: none;
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom, 0px));
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #0f172a;
  font-size: 1.4rem;
  border: none;
  cursor: pointer;
  z-index: 97;
  box-shadow: 0 4px 16px rgba(56,189,248,0.4);
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.fab:active { transform: scale(0.92); box-shadow: 0 2px 8px rgba(56,189,248,0.3); }

/* ============================================================
   CUSTOMER CARD LAYOUT (mobile)
   ============================================================ */
.customer-cards { display: none; flex-direction: column; gap: 10px; }
.customer-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  animation: slideUp 0.2s ease;
  position: relative;
}
.customer-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.customer-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #0f172a;
  flex-shrink: 0;
}
.customer-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  cursor: pointer;
  line-height: 1.2;
}
.customer-card-date { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.customer-card-body { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: 0.8rem; margin-bottom: 10px; }
.customer-card-field label { display: block; font-size: 0.67rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.customer-card-field span { color: var(--text); font-weight: 500; word-break: break-word; }
.customer-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.customer-card-actions .btn { flex: 1; justify-content: center; min-height: 36px; font-size: 0.8rem; }
.customer-card-detail-preview {
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--bg);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}

/* ============================================================
   MOBILE RESPONSIVE — max 768px
   ============================================================ */
@media (max-width: 768px) {
  /* Sidebar becomes overlay drawer */
  .sidebar {
    transform: translateX(-260px);
    z-index: 200;
    min-height: 100vh;
    height: 100%;
    /* ensure nav items are touchable */
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { transform: translateX(-260px); }
  .nav-item { min-height: 44px; }

  /* Main content fills full width, leave bottom space for nav */
  .main-content { margin-left: 0 !important; padding-bottom: var(--bottom-nav-h); }

  /* Topbar compact */
  .topbar { padding: 0 12px; height: 54px; }
  .topbar h2 { font-size: 0.9rem; }

  /* Page content tighter padding */
  .page-content { padding: 12px; padding-bottom: calc(var(--bottom-nav-h) + 16px); }

  /* Bottom nav visible on mobile */
  .bottom-nav { display: flex; flex-direction: column; }

  /* FAB visible on mobile when on customers page */
  .fab { display: flex; }

  /* Stat grid: 2 cols on mobile */
  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Stat card compact */
  .stat-value { font-size: 1.5rem; }
  .stat-card { padding: 14px; }

  /* Filter bar: stack vertically, full width inputs */
  .filter-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .filter-bar .input { width: 100%; min-width: unset; }
  .filter-bar .btn { width: 100%; justify-content: center; }

  /* Table hidden on mobile → cards shown */
  .table-wrap { display: none !important; }
  .customer-cards { display: flex; }

  /* Modal: full screen bottom-sheet on mobile */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    /* slide up animation */
    animation: slideUp 0.3s ease;
  }
  .modal-header { padding: 16px 20px; }
  .modal-body { padding: 16px 20px; }
  .modal-footer { padding: 12px 20px; }

  /* Inputs touch-friendly */
  .input { min-height: 44px; font-size: 1rem; }
  select.input { min-height: 44px; }

  /* Buttons touch-friendly */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; }

  /* Chart grid single column */
  .chart-grid { grid-template-columns: 1fr !important; }

  /* Notification panel: handled by JS renderNotifPanel for mobile */

  /* Cards full padding */
  .card { padding: 14px; border-radius: 12px; }

  /* Login card on mobile */
  .login-card { border-radius: 0; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; border: none; }

  /* Hide bulk actions text, show icon only */
  .hide-mobile { display: none !important; }

  /* Pagination: compact */
  .pagination { gap: 4px; }
  .page-btn { padding: 8px 12px; min-width: 36px; min-height: 36px; text-align: center; }

  /* Toast position above bottom nav */
  .toast-fixed { bottom: calc(var(--bottom-nav-h) + 12px) !important; }

  /* Global alert above bottom nav */
  #global-alert { bottom: calc(var(--bottom-nav-h) + 12px) !important; }

  /* Dashboard grids → single column on mobile */
  .dash-grid-2 { grid-template-columns: 1fr !important; }
  .dash-grid-leaderboard { grid-template-columns: 1fr !important; }

  /* Status chart: stack vertically on mobile */
  .status-chart-wrap { flex-direction: column; align-items: flex-start; gap: 12px; }
  .status-donut-canvas { width: 100px; height: 100px; margin: 0 auto; }

  /* Timeline controls: wrap to 2 per row */
  .tl-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .tl-controls { width: 100%; }
  .tl-controls .tl-input { flex: 1; min-width: 0 !important; }
  .tl-controls select.tl-input { flex: 1; }
}

/* Very small screens */
@media (max-width: 360px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .stat-value { font-size: 1.25rem; }
  .page-content { padding: 8px; }
  .customer-card { padding: 10px; }
}

/* Desktop: hide bottom nav and FAB always */
@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
  .fab { display: none !important; }
  .sidebar-overlay { display: none !important; }
}

/* ===== GOOGLE SHEET SETTINGS STYLES ===== */
.gs-main-card { transition: border-color .3s; }

.gs-step-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
}

.gs-step-num {
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: var(--accent);
  color: #0f172a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  margin-top: 2px;
}

.gs-step-title {
  font-size: .88rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.gs-step-desc {
  font-size: .78rem;
  color: var(--muted);
}

/* Auth mode radio cards */
.gs-auth-option {
  flex: 1;
  min-width: 160px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--bg);
  transition: border-color .2s, background .2s;
}
.gs-auth-option:hover { border-color: var(--accent); }
.gs-auth-option.gs-auth-active {
  border-color: var(--accent);
  background: rgba(56,189,248,.07);
}

/* Sync mode radio cards */
.gs-sync-option {
  flex: 1;
  min-width: 130px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--bg);
  text-align: center;
  transition: border-color .2s, background .2s;
}
.gs-sync-option:hover { border-color: var(--accent); }
.gs-sync-option.gs-sync-active {
  border-color: var(--success);
  background: rgba(34,197,94,.07);
}

/* Guide steps */
.gs-guide-step {
  display: flex;
  gap: 10px;
  font-size: .8rem;
  color: var(--muted);
  align-items: flex-start;
  line-height: 1.6;
}
.gs-guide-num {
  width: 22px;
  min-width: 22px;
  font-size: .85rem;
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 768px) {
  .gs-step-card { flex-direction: column; gap: 10px; }
  .gs-step-num { width: 24px; height: 24px; min-width: 24px; font-size: .72rem; }
  .gs-auth-option, .gs-sync-option { min-width: 120px; padding: 10px 12px; }
}

/* ===== THEME TOGGLE BUTTON ===== */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--card2);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(14,165,233,0.08);
  transform: rotate(20deg);
}
/* Sun icon for dark mode (clicking → go light) */
/* Moon icon for light mode (clicking → go dark) */
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: opacity 0.2s, transform 0.3s;
}
html.dark .theme-toggle .icon-sun  { opacity: 1; transform: scale(1); }
html.dark .theme-toggle .icon-moon { opacity: 0; transform: scale(0.5); }
html:not(.dark) .theme-toggle .icon-sun  { opacity: 0; transform: scale(0.5); }
html:not(.dark) .theme-toggle .icon-moon { opacity: 1; transform: scale(1); }

/* Light mode: table header subtle */
html:not(.dark) thead { background: #f8fafc; }
html:not(.dark) td { color: var(--text); }
html:not(.dark) .card { box-shadow: var(--shadow); }
html:not(.dark) .stat-card { box-shadow: var(--shadow); }
html:not(.dark) .btn-secondary { background: #f1f5f9; color: #334155; border-color: #e2e8f0; }
html:not(.dark) .btn-secondary:hover { background: #e2e8f0; }
html:not(.dark) .btn-primary { color: #fff; }
html:not(.dark) .nav-item:hover { background: rgba(14,165,233,0.07); }
html:not(.dark) .nav-item.active { background: rgba(14,165,233,0.10); }
html:not(.dark) .sidebar-overlay { background: rgba(15,23,42,0.35); }
html:not(.dark) select.input option { background: #fff; color: #0f172a; }
html:not(.dark) .gs-step-card { background: #f8fafc; }
html:not(.dark) .gs-auth-option,
html:not(.dark) .gs-sync-option { background: #f8fafc; }
html:not(.dark) .gs-auth-option.gs-auth-active { background: rgba(14,165,233,0.07); }
html:not(.dark) .gs-sync-option.gs-sync-active { background: rgba(22,163,74,0.07); }

/* ===== TEAM BADGE ===== */
.team-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(56,189,248,.13);
  color: var(--tc, #38bdf8);
  border: 1px solid rgba(56,189,248,.3);
  white-space: nowrap;
}
.team-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tc, #38bdf8);
  flex-shrink: 0;
}

/* ===== TEAM SETTINGS ROW ===== */
.team-settings-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.team-settings-row:last-child { border-bottom: none; }

/* ===== TEAM MEMBER CHIP (settings) ===== */
.team-member-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

html:not(.dark) .team-settings-row:hover { background: #f8fafc; }

/* ===== MULTI SELECT ===== */
.multi-select-wrap {
  position: relative;
}
.multi-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: .9rem;
  min-height: 40px;
  transition: border-color .15s;
}
.multi-select-trigger:hover { border-color: var(--primary); }
.multi-select-wrap.open .multi-select-trigger { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.multi-select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 200;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px 0;
}
.multi-select-wrap.open .multi-select-dropdown { display: block; }
.multi-select-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: .88rem;
  color: var(--text);
  transition: background .1s;
}
.multi-select-item:hover { background: var(--bg); }
.multi-select-item input[type=checkbox] {
  width: 15px; height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
