/* ══════════════════════════════════════════════════════════
   ReadySMS Admin Panel — Mercury Light Design System
   Pixel-matched to app.readysms.io production
   ══════════════════════════════════════════════════════════ */

:root {
  /* ── Brand ─────────────────────────────── */
  --brand:          #2563eb;
  --brand-dim:      #1d4ed8;
  --brand-tint:     #eff6ff;
  --brand-tint-2:   rgba(59,130,246,.04);
  --gradient:       linear-gradient(135deg, #3b82f6, #0ea5e9);

  /* ── Surfaces ──────────────────────────── */
  --bg:             #ffffff;
  --bg-raised:      #f5f7fa;
  --card:           #ffffff;
  --card-hover:     #fafbfc;
  --sidebar:        #ffffff;
  --topbar:         #ffffff;

  /* ── Borders ───────────────────────────── */
  --border:         #e5e7eb;
  --border-subtle:  #f0f1f3;
  --border-strong:  #d1d5db;

  /* ── Text ──────────────────────────────── */
  --text:           #1a1a2e;
  --text-2:         #374151;
  --text-muted:     #9ca3af;
  --text-faint:     #d1d5db;
  --text-secondary: #6b7280;

  /* ── Status ────────────────────────────── */
  --green:          #10b981;
  --green-bg:       rgba(16,185,129,.08);
  --red:            #ef4444;
  --red-bg:         rgba(239,68,68,.08);
  --amber:          #f59e0b;
  --amber-bg:       rgba(245,158,11,.08);
  --blue:           #2563eb;
  --blue-bg:        rgba(37,99,235,.08);
  --cyan:           #06b6d4;
  --purple:         #8b5cf6;

  /* ── Charts ────────────────────────────── */
  --chart-1:        #3b82f6;
  --chart-2:        #10b981;
  --chart-3:        #f59e0b;
  --chart-4:        #6366f1;
  --chart-5:        #0ea5e9;
  --chart-6:        #ef4444;

  /* ── Shadows ───────────────────────────── */
  --shadow-card:    0 1px 2px rgba(0,0,0,.04), 0 1px 4px rgba(0,0,0,.02);
  --shadow-lg:      0 4px 16px rgba(0,0,0,.08);

  /* ── Layout ────────────────────────────── */
  --sidebar-w:      190px;
  --topbar-h:       56px;
  --radius:         10px;
  --radius-sm:      6px;
  --radius-lg:      12px;
}

/* ── Reset ────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ── Scrollbar — matches production ──────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
* { scrollbar-color: #d1d5db transparent; scrollbar-width: thin; }

/* ══════════════════════════════════════════
   LAYOUT SHELL
   ══════════════════════════════════════════ */
.shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar — matches production exactly ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-header {
  padding: 18px 16px 14px;
  display: flex; align-items: center;
  cursor: pointer;
}
.logo-icon { display: none; }
.logo-text-wrap { flex: 1; min-width: 0; }
.logo-title {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 17px; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em;
}
.logo-ready {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-sms {
  color: var(--text);
}
.logo-sub { display: none; }
.logo-chevron { display: none; }

/* Nav */
.nav-scroll {
  flex: 1; overflow-y: auto; padding: 4px 0;
}
.nav-section { padding: 0 10px; }
.nav-label {
  font-size: 10px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  padding: 14px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 7px;
  font-size: 13px; font-weight: 400; color: var(--text-secondary);
  cursor: pointer; transition: all .1s;
  border: none;
  position: relative;
  margin-bottom: 1px;
}
.nav-item:hover {
  background: #f5f7fa;
  color: var(--text);
}
.nav-item.active {
  background: var(--brand-tint);
  color: var(--brand);
  font-weight: 500;
}
.nav-item.active::before { display: none; }
.nav-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  stroke: currentColor; fill: none; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  color: var(--text-muted);
}
.nav-item.active .nav-icon { color: var(--brand); }
.nav-item:hover .nav-icon { color: var(--text-secondary); }

/* Sidebar bottom */
.sidebar-bottom {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 7px;
  cursor: pointer; transition: background .1s;
}
.sidebar-user:hover { background: #f5f7fa; }
.user-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 9px; color: #fff;
  flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 500; color: var(--text); }
.user-role { font-size: 10px; color: var(--text-muted); text-transform: capitalize; }

/* ── Main area ────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }

/* Top bar — matches production */
.topbar {
  height: var(--topbar-h);
  background: var(--topbar);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 12px; flex-shrink: 0;
}
.topbar-search {
  margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 10px;
  background: #f5f7fa; border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px;
  min-width: 320px;
  transition: border-color .15s;
}
.topbar-search:hover { border-color: var(--border-strong); }
.topbar-search kbd {
  font-family: inherit; font-size: 10px; color: var(--text-muted);
  background: #fff; padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--border); margin-left: auto;
}
.topbar-icon {
  width: 20px; height: 20px; color: var(--text-muted);
  cursor: pointer; transition: color .1s;
  stroke: currentColor; fill: none; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.topbar-icon:hover { color: var(--text); }
.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; color: #fff;
  cursor: pointer;
}

/* ── Content area ─────────────────────────── */
.content {
  flex: 1; overflow-y: auto; padding: 16px 28px 48px;
  background: var(--bg);
}

/* ══════════════════════════════════════════
   SHARED COMPONENTS
   ══════════════════════════════════════════ */

/* ── Page header ──────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px;
}
.page-title {
  font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--text);
}
.page-subtitle {
  font-size: 13px; color: var(--text-muted); margin-top: 2px;
}

/* ── Date toggle — matches production ────── */
.date-toggle {
  display: flex; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border); background: #fff;
}
.date-toggle button {
  padding: 6px 14px; font-size: 12px; font-weight: 500;
  border: none; background: transparent; color: var(--text-muted);
  transition: all .1s;
}
.date-toggle button:not(:last-child) { border-right: 1px solid var(--border); }
.date-toggle button.active {
  background: var(--text); color: #fff; font-weight: 600;
}
.date-toggle button:hover:not(.active) { color: var(--text-2); background: #f9fafb; }

/* ── KPI cards ────────────────────────────── */
.kpi-grid {
  display: grid; gap: 14px; margin-bottom: 20px;
}
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }
.kpi-grid-6 { grid-template-columns: repeat(6, 1fr); }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ══════════════════════════════════════════
   SKELETON LOADING (panel-wide)
   Every tab renders its structure immediately with shimmering placeholders
   and fills in as data lands — instead of a blocking "Loading data..." spinner.
   This centralizes what command-center did inline: it turns each page's
   .loading-pulse (a pulsing em-dash) into a shimmer bar (!important overrides the
   per-page pulse definitions), hides the old full-page loading overlays, and
   keeps the real content visible from first paint.
   ══════════════════════════════════════════ */
.loading-pulse {
  display: inline-block !important; min-width: 2.2em; height: 0.72em; border-radius: 6px;
  color: transparent !important; vertical-align: middle; user-select: none;
  background: linear-gradient(90deg, #edf0f4 25%, #e0e5ec 37%, #edf0f4 63%) !important;
  background-size: 400% 100% !important;
  animation: skeleton-shimmer 1.4s ease infinite !important;
}
@keyframes skeleton-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .loading-pulse { animation: none !important; } }
/* Retire the blocking "Loading data..." overlays; reveal content immediately. */
#finance-loading, #ops-loading, #mkt-loading, #op-loading, #team-loading, #sup-loading, #home-loading { display: none !important; }
#finance-content, #ops-content, #mkt-content, #op-content, #team-content, #sup-content, #home-content { display: block !important; }

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  transition: box-shadow .15s;
}
.kpi-card:hover { box-shadow: var(--shadow-lg); }
.kpi-header {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
.kpi-icon {
  width: 15px; height: 15px; color: var(--text-muted);
  stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.kpi-label {
  font-size: 12px; font-weight: 500; color: var(--text-muted);
}
.kpi-value {
  font-size: 24px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text); line-height: 1.1;
}
.kpi-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; margin-top: 6px;
  padding: 2px 6px; border-radius: 5px;
}
.kpi-trend.up { color: var(--green); background: var(--green-bg); }
.kpi-trend.down { color: var(--red); background: var(--red-bg); }
.kpi-trend.neutral { color: var(--amber); background: var(--amber-bg); }

/* ── Panels / Cards ───────────────────────── */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.panel-title {
  font-size: 15px; font-weight: 600; color: var(--text);
}
.panel-subtitle {
  font-size: 12px; color: var(--text-muted); margin-top: 1px;
}

/* ── Tab bar ──────────────────────────────── */
.tab-bar {
  display: flex; gap: 0; margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.tab-item {
  flex: 1; text-align: center;
  padding: 10px 18px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: all .1s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none; border-top: none; border-left: none; border-right: none;
}
.tab-item:hover { color: var(--text-2); }
.tab-item.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Pulse bar ────────────────────────────── */
.pulse-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }
.pulse-label {
  font-size: 10px; font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-left: 8px;
}
.pulse-stats { display: flex; gap: 24px; }
.pulse-val {
  font-size: 14px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.pulse-val.highlight { color: var(--green); }
.pulse-stat-label { font-size: 10px; color: var(--text-muted); margin-left: 5px; }

/* ── Data table ───────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 11px 12px; font-size: 13px; color: var(--text-2);
  border-bottom: 1px solid var(--border-subtle);
}
.data-table tr:hover td { background: #f9fafb; }
.data-table .text-right { text-align: right; }

/* ── Badges ───────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600; padding: 3px 8px;
  border-radius: var(--radius-sm);
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue { background: #eff6ff; color: #2563eb; }
.badge-brand { background: var(--brand-tint); color: var(--brand); }
.badge-muted { background: #f3f4f6; color: var(--text-muted); }
.badge-purple { background: #f3e8ff; color: #7e22ce; }

/* ── Status dot ───────────────────────────── */
.status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

/* ── Buttons ──────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  border: none; transition: all .1s;
}
.btn-primary {
  background: var(--brand); color: #fff;
  box-shadow: 0 1px 4px rgba(59,130,246,.20);
}
.btn-primary:hover { background: var(--brand-dim); }
.btn-ghost {
  background: transparent; color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: #f9fafb; border-color: var(--border-strong); }
.btn-sm { padding: 5px 10px; font-size: 11.5px; border-radius: 6px; }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,.14); }

/* ── Progress bar ─────────────────────────── */
.progress-track {
  height: 5px; background: #f0f1f3; border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 3px; background: var(--gradient);
  transition: width .4s ease;
}

/* ── Alert banner ─────────────────────────── */
.alert-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: var(--radius);
  margin-bottom: 20px;
}
.alert-banner.severity-red {
  background: var(--red-bg); border: 1px solid rgba(239,68,68,.12);
}
.alert-banner.severity-amber {
  background: var(--amber-bg); border: 1px solid rgba(245,158,11,.12);
}
.alert-banner .alert-icon { flex-shrink: 0; }
.alert-banner .alert-text { flex: 1; font-size: 13px; color: var(--text-2); }
.alert-banner .alert-text strong { color: var(--text); font-weight: 600; }

/* ── Kanban ───────────────────────────────── */
.kanban-board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; flex-wrap: nowrap; max-height: calc(100vh - 260px); }
.kanban-col {
  min-width: 170px; flex: 1;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px;
  display: flex; flex-direction: column; overflow: hidden;
}
.kanban-col > .kanban-col-header { flex-shrink: 0; }
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.kanban-col-title {
  font-size: 12px; font-weight: 650; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.kanban-col-count {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  background: #fff; padding: 2px 7px; border-radius: 4px;
  border: 1px solid var(--border);
}
.kanban-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  margin-bottom: 8px; cursor: pointer; transition: all .1s;
  box-shadow: var(--shadow-card);
}
.kanban-card:hover { border-color: var(--brand); box-shadow: var(--shadow-lg); }
.kanban-card-name { font-size: 13px; font-weight: 600; color: var(--text); }
.kanban-card-company { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.kanban-card-meta {
  display: flex; gap: 12px; margin-top: 8px;
  font-size: 11px; color: var(--text-muted);
}

/* ── Funnel ───────────────────────────────── */
.funnel { display: flex; flex-direction: column; gap: 0; }
.funnel-step {
  display: flex; align-items: center; gap: 14px; padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.funnel-step:last-child { border-bottom: none; }
.funnel-bar-wrap { flex: 1; }
.funnel-bar {
  height: 28px; border-radius: 6px; display: flex; align-items: center;
  padding: 0 12px; font-size: 12px; font-weight: 600; color: #fff;
  min-width: 40px; transition: width .4s ease;
}
.funnel-step-label {
  width: 120px; flex-shrink: 0;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
}
.funnel-step-val {
  width: 60px; flex-shrink: 0; text-align: right;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.funnel-step-pct {
  width: 50px; flex-shrink: 0; text-align: right;
  font-size: 11.5px; font-weight: 600; color: var(--text-muted);
}

/* ── Grids ────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 20px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; margin-bottom: 20px; }

/* ── Chart placeholder ────────────────────── */
.chart-area {
  height: 200px; border-radius: var(--radius);
  background: linear-gradient(180deg, var(--brand-tint-2), transparent);
  position: relative; overflow: hidden;
  display: flex; align-items: flex-end;
}
.chart-bars { display: flex; align-items: flex-end; gap: 4px; padding: 0 16px 0; width: 100%; height: 85%; }
.chart-bar {
  flex: 1; border-radius: 4px 4px 0 0;
  background: var(--brand); opacity: .3;
  transition: opacity .1s;
}
.chart-bar:hover { opacity: .6; }

/* ── Responsive ───────────────────────────── */
@media (max-width: 1200px) {
  .kpi-grid-5, .kpi-grid-6 { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════
   MOBILE — max-width: 768px
   All rules scoped to media query so desktop is untouched.
   ══════════════════════════════════════════ */

/* ── Hamburger button (hidden on desktop, shown on mobile) ── */
.mobile-hamburger { display: none; }
.mobile-sidebar-overlay { display: none; }

@media (max-width: 768px) {

  /* ── Layout shell ─────────────────────── */
  .shell { flex-direction: column; }

  /* ── Sidebar — hidden by default, slides in as overlay ── */
  .sidebar {
    display: none;
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 260px; z-index: 200;
    box-shadow: 4px 0 24px rgba(0,0,0,.15);
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.mobile-open {
    display: flex;
    transform: translateX(0);
  }

  /* Sidebar overlay backdrop */
  .mobile-sidebar-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 199;
    background: rgba(0,0,0,.4);
    animation: compFadeIn .15s ease-out;
  }
  .mobile-sidebar-overlay.open { display: block; }

  /* ── Hamburger button ─────────────────── */
  .mobile-hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 8px;
    border: none; background: transparent;
    color: var(--text); cursor: pointer;
    flex-shrink: 0; padding: 0;
  }
  .mobile-hamburger:hover { background: var(--bg-raised); }

  /* ── Top bar — compact mobile layout ──── */
  .topbar {
    height: 50px;
    padding: 0 12px;
    gap: 8px;
  }
  .topbar-search { display: none; }
  .topbar-avatar { width: 28px; height: 28px; font-size: 10px; }

  /* ── Main area ────────────────────────── */
  .main { min-width: 0; width: 100%; }

  /* ── Content area — tighter padding ───── */
  .content {
    padding: 12px 14px 80px;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Page header — stack on mobile ────── */
  .page-header {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }
  .page-title { font-size: 20px; }

  /* ── Date toggle — scrollable ─────────── */
  .date-toggle {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
  }
  .date-toggle button { white-space: nowrap; padding: 6px 10px; font-size: 11px; }

  /* ── KPI cards — 1 col on small, 2 col on larger mobile ── */
  .kpi-grid { gap: 10px; margin-bottom: 14px; }
  .kpi-grid-6, .kpi-grid-5, .kpi-grid-4, .kpi-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .kpi-card { padding: 12px 14px; }
  .kpi-value { font-size: 20px; }
  .kpi-label { font-size: 11px; }

  /* ── Panels — tighter ─────────────────── */
  .panel { padding: 14px; }
  .panel-header { margin-bottom: 12px; }
  .panel-title { font-size: 14px; }

  /* ── Tab bar — scrollable ─────────────── */
  .tab-bar {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap; gap: 0;
    margin-bottom: 16px;
    scrollbar-width: none;
  }
  .tab-bar::-webkit-scrollbar { display: none; }
  .tab-item {
    white-space: nowrap; flex: none;
    padding: 8px 14px; font-size: 12px;
  }

  /* ── Pulse bar — stack ────────────────── */
  .pulse-bar {
    flex-direction: column; align-items: flex-start;
    gap: 8px; padding: 10px 14px;
  }
  .pulse-stats { gap: 16px; flex-wrap: wrap; }

  /* ── Grids — all single column ────────── */
  .grid-2, .grid-2-1, .grid-1-2, .grid-3 { grid-template-columns: 1fr; gap: 12px; }

  /* ── Data tables — horizontal scroll ──── */
  .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table th { white-space: nowrap; padding: 8px 10px; font-size: 10px; }
  .data-table td { padding: 8px 10px; font-size: 12px; white-space: nowrap; }

  /* ── Kanban — vertical stack ──────────── */
  .kanban-board {
    flex-direction: column;
    max-height: none; overflow-x: visible;
    gap: 12px;
  }
  .kanban-col { min-width: unset; }
  .kanban-card { padding: 10px; }
  .kanban-card-name { font-size: 12px; }
  .kanban-card-meta { font-size: 10px; gap: 8px; }

  /* ── Funnel — compact ─────────────────── */
  .funnel-step { gap: 8px; padding: 8px 0; }
  .funnel-step-label { width: 80px; font-size: 11px; }
  .funnel-bar { height: 22px; font-size: 11px; padding: 0 8px; }
  .funnel-step-val { width: 40px; font-size: 12px; }
  .funnel-step-pct { width: 40px; font-size: 10px; }

  /* ── Buttons ──────────────────────────── */
  .btn { padding: 7px 12px; font-size: 12px; }
  .btn-sm { padding: 5px 8px; font-size: 11px; }

  /* ── Badges ───────────────────────────── */
  .badge { font-size: 10px; padding: 2px 6px; }

  /* ── Chart area ───────────────────────── */
  .chart-area { height: 150px; }

  /* ── Actions overlay — full screen ────── */
  .actions-overlay { padding-top: 0; align-items: flex-end; }
  .actions-menu {
    max-width: 100%; border-radius: 14px 14px 0 0;
    max-height: 85vh; overflow-y: auto;
    animation: mobileSlideUp .25s ease-out;
  }
  .actions-grid { grid-template-columns: 1fr; gap: 6px; padding: 10px 14px 14px; }
  .action-card { padding: 12px 14px; }

  /* ── Compose modal — full screen ──────── */
  .compose-overlay { align-items: flex-end; }
  .compose-modal {
    max-width: 100%; border-radius: 14px 14px 0 0;
    max-height: 90vh; overflow-y: auto;
  }
  .compose-body { padding: 14px; }
  .compose-header { padding: 12px 14px; }
  .compose-footer { padding: 10px 14px; }
  .compose-templates { gap: 4px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .compose-tpl-btn { white-space: nowrap; flex-shrink: 0; }

  /* ── Toast — bottom safe area ─────────── */
  .compose-toast { bottom: 16px; left: 12px; right: 12px; transform: none; text-align: center; }

  /* ── Scrollbar — hide on mobile ───────── */
  ::-webkit-scrollbar { display: none; }
  * { scrollbar-width: none; }

  /* ── Mobile slide-up animation ────────── */
  @keyframes mobileSlideUp {
    from { opacity: 0; transform: translateY(100%); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* ── Extra small — phones < 400px ────────── */
@media (max-width: 400px) {
  .kpi-grid-6, .kpi-grid-5, .kpi-grid-4, .kpi-grid-3 { grid-template-columns: 1fr; }
  .content { padding: 10px 10px 80px; }
  .page-title { font-size: 18px; }
  .kpi-value { font-size: 18px; }
  .kanban-card-meta { flex-wrap: wrap; }
}
