/* ==========================================================
   Elama AI Insights — pure white, mobile-first, Safari-tuned
   Palette: #0B0B0C / #C2F03A / #9CC723 / #FFFFFF
   ========================================================== */
:root {
  --black: #0B0B0C;
  --lime: #C2F03A;
  --lime-deep: #9CC723;
  --lime-soft: #ECF8B7;
  --lime-tint: #F6FCDD;
  --white: #FFFFFF;
  --gray-50: #FAFAF9;
  --gray-100: #F4F4F2;
  --gray-200: #E8E9E4;
  --gray-300: #D6D7D1;
  --text: #0B0B0C;
  --text-mute: #5A5E55;
  --text-faint: #8E9484;
  --danger: #C03434;
  --danger-soft: #FEEAEA;
  --shadow-xs: 0 1px 2px rgba(11,11,12,0.04);
  --shadow-sm: 0 2px 8px rgba(11,11,12,0.05);
  --shadow-md: 0 8px 24px rgba(11,11,12,0.07);
  --shadow-lg: 0 20px 48px rgba(11,11,12,0.10);
  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --topbar-h: 56px;
  --drawer-w: 280px;
  /* Safari safe-area */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html, body {
  height: 100%; background: var(--white);
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px; line-height: 1.55; color: var(--text);
  background: var(--white);
  min-height: 100vh;
  min-height: 100dvh;   /* Safari mobile: dynamic viewport unit */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: contain;
}

/* iOS Safari: prevent input zoom by ensuring 16px+ on inputs */
input, select, textarea, button {
  font-family: inherit; font-size: 16px;
  -webkit-appearance: none; appearance: none;
}
/* Re-shrink fonts in places that don't need 16px on desktop */
@media (min-width: 901px) {
  input, select, textarea { font-size: 14px; }
}

/* When drawer is open on mobile, lock body scroll */
body.drawer-open { overflow: hidden; }

/* ---------- icon system ---------- */
.icon {
  width: 18px; height: 18px;
  flex-shrink: 0; vertical-align: -3px;
  pointer-events: none;
}
.btn-primary .icon, .btn-ghost .icon, .btn-danger .icon { width: 16px; height: 16px; }
.tab-btn .icon { width: 20px; height: 20px; }

/* ---------- LOGIN ---------- */
.login-screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-top)) calc(20px + var(--safe-right)) calc(24px + var(--safe-bot)) calc(20px + var(--safe-left));
  background: var(--white);
  background-image:
    radial-gradient(circle 600px at 90% -10%, var(--lime-tint), transparent),
    radial-gradient(circle 700px at -10% 110%, var(--lime-tint), transparent);
}
.login-card {
  width: 100%; max-width: 420px;
  padding: 44px 36px;
  border-radius: var(--radius-lg);
  background: var(--white);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-md);
}
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 32px; }
.brand-tag { font-size: 11px; letter-spacing: 4px; text-transform: uppercase; color: var(--text-mute); font-weight: 600; }
.login-form { display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: 11px; font-weight: 700; color: var(--text-mute); letter-spacing: 0.4px; text-transform: uppercase; }
.field input, .field select, .field textarea {
  padding: 12px 14px;
  min-height: 44px;            /* Apple HIG touch target */
  border-radius: var(--radius-xs);
  border: 1px solid var(--gray-200); background: var(--white); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--black);
  box-shadow: 0 0 0 4px rgba(11,11,12,0.05);
}
.field select { background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235A5E55' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.error-msg { color: var(--danger); font-size: 13px; min-height: 18px; text-align: center; }
.login-footer { text-align: center; font-size: 11px; color: var(--text-faint); margin-top: 24px; letter-spacing: 0.6px; }

/* ---------- BUTTONS ---------- */
.btn-primary, .btn-ghost, .btn-danger {
  font: inherit; font-weight: 600;
  padding: 12px 20px;
  min-height: 44px;
  border-radius: var(--radius-xs); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s, color 0.15s;
  white-space: nowrap;
  touch-action: manipulation;
}
.btn-primary { background: var(--black); color: var(--white); border: 1px solid var(--black); }
@media (hover: hover) {
  .btn-primary:hover:not(:disabled) { background: #1c1c1f; transform: translateY(-1px); box-shadow: var(--shadow-md); }
  .btn-ghost:hover { border-color: var(--black); }
  .btn-danger:hover { background: var(--danger); color: var(--white); border-color: var(--danger); }
}
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: var(--white); color: var(--text); border: 1px solid var(--gray-200); }
.btn-danger { background: var(--white); color: var(--danger); border: 1px solid var(--gray-200); }
.btn-sm { padding: 8px 14px; min-height: 36px; font-size: 13px; }
.icon-btn {
  background: transparent; border: 0; padding: 10px; cursor: pointer; color: var(--text-mute);
  border-radius: var(--radius-xs); display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  min-width: 44px; min-height: 44px;
  touch-action: manipulation;
}
@media (hover: hover) {
  .icon-btn:hover { background: var(--gray-100); color: var(--text); }
}
.icon-btn:active { background: var(--gray-200); }

/* ---------- APP LAYOUT ---------- */
#app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh; min-height: 100dvh;
  background: var(--white);
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  padding: 20px 16px calc(20px + var(--safe-bot));
  display: flex; flex-direction: column; gap: 24px;
  background: var(--gray-50);
  border-right: 1px solid var(--gray-200);
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
}
.sidebar-brand { display: flex; flex-direction: column; gap: 4px; padding: 4px 8px 0; }
.sidebar-tag { font-size: 10px; letter-spacing: 3px; text-transform: uppercase; color: var(--text-faint); font-weight: 600; padding-left: 4px; }

.workspace-block {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}
.workspace-label { font-size: 10px; font-weight: 700; color: var(--text-faint); letter-spacing: 0.5px; text-transform: uppercase; }
.workspace-static { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 15px; color: var(--text); }
.workspace-select {
  font: inherit; padding: 10px 36px 10px 12px; font-weight: 600;
  border-radius: var(--radius-xs); border: 1px solid var(--gray-200);
  background: var(--white); color: var(--text); width: 100%;
  min-height: 40px;
}
.workspace-select:focus { outline: none; border-color: var(--black); }
#tenant-picker-wrap { display: flex; flex-direction: column; gap: 8px; }
#new-tenant { justify-content: flex-start; padding-left: 10px; }

.tab-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; }
.tab-btn {
  font: inherit; font-weight: 500; font-size: 14px;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  min-height: 44px;
  border-radius: var(--radius-xs); border: 0; background: transparent;
  color: var(--text-mute); cursor: pointer; text-align: left;
  transition: background 0.15s, color 0.15s;
  touch-action: manipulation;
}
@media (hover: hover) { .tab-btn:hover { background: var(--white); color: var(--text); } }
.tab-btn:active { background: var(--gray-100); }
.tab-btn.active { background: var(--black); color: var(--white); }
.tab-btn.active .icon { color: var(--lime); }

.sidebar-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}
.user-card { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--black); color: var(--lime);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.user-meta { min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }

/* ---------- MOBILE TOPBAR & DRAWER ---------- */
.mobile-topbar {
  display: none;
  align-items: center; gap: 8px;
  padding: 8px calc(12px + var(--safe-right)) 8px calc(12px + var(--safe-left));
  padding-top: calc(8px + var(--safe-top));
  height: calc(var(--topbar-h) + var(--safe-top));
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 50;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.mobile-topbar svg[viewBox] { margin-right: auto; }
.mobile-topbar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--black); color: var(--lime);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.drawer-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 80;
  background: rgba(11,11,12,0.40);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity 0.2s;
}

/* ---------- CONTENT ---------- */
.content { padding: 32px 40px 64px; min-width: 0; }
.tab-panel { display: none; max-width: 1280px; margin: 0 auto; }
.tab-panel.active { display: block; }

.page-header {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 28px;
}
.page-eyebrow { font-size: 11px; font-weight: 700; color: var(--lime-deep); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }
.page-titles h1 { font-family: 'Poppins', sans-serif; font-size: 30px; font-weight: 700; letter-spacing: -0.6px; margin-bottom: 6px; line-height: 1.15; }
.page-titles p { color: var(--text-mute); font-size: 14px; max-width: 600px; }
.page-actions { display: flex; gap: 12px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.meta-pill {
  font-size: 12px; color: var(--text-mute); padding: 7px 12px;
  border-radius: 999px; background: var(--gray-50); border: 1px solid var(--gray-200);
  font-feature-settings: "tnum";
}

/* ---------- UPLOAD ---------- */
.dropzone {
  border-radius: var(--radius-lg);
  padding: 56px 24px; text-align: center;
  border: 2px dashed var(--gray-300); background: var(--gray-50);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer; touch-action: manipulation;
}
@media (hover: hover) { .dropzone:hover { border-color: var(--lime-deep); background: var(--lime-tint); } }
.dropzone.drag-over { border-color: var(--lime-deep); background: var(--lime-tint); }
.dz-icon { width: 44px; height: 44px; color: var(--text-mute); margin-bottom: 14px; }
.dz-headline { font-family: 'Poppins', sans-serif; font-size: 18px; font-weight: 600; }
.dz-sub { color: var(--text-mute); margin-top: 6px; font-size: 14px; }
.dz-link { color: var(--text); font-weight: 600; cursor: pointer; border-bottom: 2px solid var(--lime); padding-bottom: 1px; display: inline-block; min-height: 24px; }
.dz-formats { margin-top: 20px; font-size: 11px; color: var(--text-faint); letter-spacing: 1px; font-weight: 600; text-transform: uppercase; }
.section-label { font-size: 11px; font-weight: 700; color: var(--text-faint); letter-spacing: 1px; text-transform: uppercase; margin: 28px 0 10px; }
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-row {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
@media (hover: hover) { .file-row:hover { border-color: var(--gray-300); box-shadow: var(--shadow-xs); } }
.file-icon-box {
  width: 36px; height: 36px; border-radius: var(--radius-xs);
  background: var(--lime-tint); color: var(--lime-deep);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.file-icon-box .icon { width: 18px; height: 18px; }
.file-meta { flex: 1; min-width: 0; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-sub { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.file-row .btn-danger { padding: 8px 12px; font-size: 12px; min-height: 36px; flex-shrink: 0; }
.file-row .btn-danger .icon { width: 14px; height: 14px; }

/* ---------- DASHBOARD ---------- */
.empty-state {
  border-radius: var(--radius-lg);
  padding: 80px 32px; text-align: center;
  max-width: 560px; margin: 24px auto 0;
  background: var(--gray-50);
  border: 1px dashed var(--gray-200);
}
.empty-icon { width: 56px; height: 56px; color: var(--gray-300); margin-bottom: 20px; }
.empty-state h2 { font-family: 'Poppins', sans-serif; font-size: 20px; margin-bottom: 6px; }
.empty-state p { color: var(--text-mute); }
.dashboard-title { font-family: 'Poppins', sans-serif; font-size: 28px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 8px; line-height: 1.2; }
.dashboard-summary { color: var(--text-mute); font-size: 15px; max-width: 800px; margin-bottom: 28px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 28px; }
.kpi-card { border-radius: var(--radius-md); padding: 18px; background: var(--white); border: 1px solid var(--gray-200); }
.kpi-label { font-size: 11px; color: var(--text-mute); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-family: 'Poppins', sans-serif; font-size: 24px; font-weight: 700; margin: 8px 0; letter-spacing: -0.5px; line-height: 1.2; }
.kpi-delta { font-size: 11px; padding: 4px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.kpi-delta .icon { width: 12px; height: 12px; }
.kpi-delta.up { background: var(--lime-tint); color: var(--lime-deep); }
.kpi-delta.down { background: var(--danger-soft); color: var(--danger); }
.kpi-delta.flat { background: var(--gray-100); color: var(--text-mute); }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; margin-bottom: 28px; }
.chart-card { border-radius: var(--radius-md); padding: 20px; background: var(--white); border: 1px solid var(--gray-200); }
.chart-card h3 { font-family: 'Poppins', sans-serif; font-size: 15px; margin-bottom: 4px; }
.chart-card .chart-desc { font-size: 12px; color: var(--text-mute); margin-bottom: 14px; line-height: 1.5; }
.chart-canvas-wrap { position: relative; height: 280px; }

.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.insight-col h2 { font-family: 'Poppins', sans-serif; font-size: 18px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.insight-col h2 .icon { width: 18px; height: 18px; }
.insight-item {
  background: var(--white); border: 1px solid var(--gray-200); border-left: 3px solid var(--gray-300);
  border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 10px;
}
.insight-item.insight { border-left-color: var(--lime-deep); }
.insight-item.warning { border-left-color: var(--danger); }
.insight-headline { font-weight: 600; margin-bottom: 4px; }
.insight-detail { color: var(--text-mute); font-size: 13px; line-height: 1.55; }

/* ---------- CARD / SYSTEM PROMPT ---------- */
.card { border-radius: var(--radius-lg); padding: 24px; background: var(--white); border: 1px solid var(--gray-200); }
.prompt-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.prompt-actions .meta-pill { margin-right: auto; }
.sysprompt-textarea {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px;
  width: 100%; min-height: 520px; resize: vertical;
  padding: 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: var(--gray-50); color: var(--text);
  line-height: 1.6;
  -webkit-appearance: none; appearance: none;
}
.sysprompt-textarea:focus { outline: none; border-color: var(--black); background: var(--white); }

/* ---------- USER TABLE ---------- */
.user-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -24px; padding: 0 24px; }
.user-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 720px; }
.user-table th, .user-table td { padding: 14px 16px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--gray-200); }
.user-table th { font-weight: 700; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.4px; font-size: 11px; background: var(--gray-50); white-space: nowrap; }
.user-table tr:last-child td { border-bottom: 0; }
.user-table td .btn-ghost, .user-table td .btn-danger { padding: 6px 10px; font-size: 12px; min-height: 32px; }
.role-tag { font-size: 11px; padding: 4px 10px; border-radius: 999px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; display: inline-block; white-space: nowrap; }
.role-tag.superadmin { background: var(--black); color: var(--lime); }
.role-tag.user { background: var(--gray-100); color: var(--text); }
.owner-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--lime-deep); white-space: nowrap; }
.owner-badge .icon { width: 14px; height: 14px; }

/* ---------- MODAL ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(11,11,12,0.50);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: calc(20px + var(--safe-top)) calc(20px + var(--safe-right)) calc(20px + var(--safe-bot)) calc(20px + var(--safe-left));
  overflow-y: auto;
}
.modal {
  width: 100%; max-width: 460px;
  border-radius: var(--radius-lg); padding: 28px;
  background: var(--white); box-shadow: var(--shadow-lg);
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal h2 { font-family: 'Poppins', sans-serif; font-size: 20px; margin-bottom: 8px; }
.modal p { color: var(--text-mute); font-size: 13px; }
.modal-form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.checkbox-field { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.checkbox-field input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--lime-deep); -webkit-appearance: checkbox; appearance: checkbox; }

/* ---------- ADMIN GATING ---------- */
body.is-superadmin .admin-only { display: flex; }
body:not(.is-superadmin) .admin-only { display: none !important; }

/* ====================================================================
   MOBILE LAYOUT (≤900px)
   - Sidebar becomes a left-slide drawer
   - Top bar with hamburger menu becomes visible
   - All charts stack to single column
   ==================================================================== */
@media (max-width: 900px) {
  #app {
    grid-template-columns: 1fr;
    display: block;        /* top bar + content stack normally */
  }

  .mobile-topbar { display: flex; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; z-index: 90;
    width: var(--drawer-w); max-width: 86vw;
    height: 100vh; height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.22s ease-out;
    box-shadow: 0 0 0 0 transparent;
    border-right: 1px solid var(--gray-200);
    padding-top: calc(20px + var(--safe-top));
    padding-bottom: calc(20px + var(--safe-bot));
  }
  body.drawer-open .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  body.drawer-open .drawer-backdrop { display: block; opacity: 1; }

  .content {
    padding: 20px calc(16px + var(--safe-right)) calc(48px + var(--safe-bot)) calc(16px + var(--safe-left));
  }

  .page-header {
    flex-direction: column; align-items: stretch; gap: 16px;
    margin-bottom: 24px;
  }
  .page-titles h1 { font-size: 24px; }
  .page-actions { width: 100%; }
  .page-actions .btn-primary, .page-actions .btn-ghost { flex: 1; }
  .meta-pill { font-size: 11px; padding: 6px 10px; }

  .dropzone { padding: 40px 16px; }
  .dz-headline { font-size: 16px; }

  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 20px; }

  .chart-grid { grid-template-columns: 1fr; }
  .chart-canvas-wrap { height: 240px; }

  .insight-grid { grid-template-columns: 1fr; gap: 14px; }

  .card { padding: 16px; }
  .sysprompt-textarea { min-height: 320px; padding: 14px; }

  /* Tables h-scroll inside the card */
  .card .user-table { display: block; }
  .user-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .user-table thead, .user-table tbody, .user-table tr { display: table; width: 100%; min-width: 720px; }

  .file-row { padding: 12px 14px; }
  .file-name { font-size: 14px; }
  .file-sub { font-size: 11px; }

  .login-card { padding: 32px 24px; }
  .dashboard-title { font-size: 22px; }
  .dashboard-summary { font-size: 14px; margin-bottom: 20px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page-titles h1 { font-size: 22px; }
  .modal { padding: 22px; border-radius: var(--radius-md); }
  .login-card { padding: 28px 20px; }
}

/* iOS Safari home-indicator safe area */
@supports (padding: max(0px)) {
  .sidebar { padding-bottom: max(20px, var(--safe-bot)); }
  .content { padding-bottom: max(48px, calc(48px + var(--safe-bot))); }
}
