/* ============================================================
   Salão SaaS — Foundation styles
   Tokens are set by themes.jsx via root inline style.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans, "Inter", system-ui, sans-serif);
  font-feature-settings: "ss01", "cv11";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: color-mix(in oklab, var(--accent) 32%, transparent); color: var(--text); }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--text) 12%, transparent);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in oklab, var(--text) 22%, transparent); background-clip: padding-box; border: 2px solid transparent; }

/* ============================================================
   App shell
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w, 248px) 1fr;
  grid-template-rows: 100%;
  height: 100vh;
  width: 100vw;
  background: var(--bg);
  color: var(--text);
}
.app.collapsed { grid-template-columns: 76px 1fr; }
@media (max-width: 900px) {
  .app, .app.collapsed { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* Sidebar */
.sidebar {
  height: 100vh;
  border-right: 1px solid var(--border);
  background: var(--surface-1);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 5;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 64px;
}
.sidebar-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent-grad);
  display: grid; place-items: center;
  color: var(--accent-fg);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -.01em;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 14px -2px color-mix(in oklab, var(--accent) 40%, transparent);
}
.sidebar-logo img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.1; overflow: hidden; }
.sidebar-brand-name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  color: var(--text);
}
.sidebar-brand-slogan {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  margin-top: 2px;
}
.app.collapsed .sidebar-brand-text { display: none; }

.sidebar-nav {
  padding: 12px 10px;
  display: flex; flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
}
.sidebar-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 14px 10px 6px;
}
.app.collapsed .sidebar-section { opacity: 0; height: 8px; padding: 0; overflow: hidden; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--surface-active);
  color: var(--text);
  font-weight: 600;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 8px; bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-item .nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-item.active .nav-icon { opacity: 1; color: var(--accent); }
.app.collapsed .nav-item { justify-content: center; padding: 10px; }
.app.collapsed .nav-item .nav-label { display: none; }

.sidebar-foot {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.app.collapsed .sidebar-foot { padding: 12px 8px; justify-content: center; }
.app.collapsed .sidebar-foot .user-meta { display: none; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-3);
  display: grid; place-items: center;
  font-weight: 600; font-size: 12px;
  color: var(--text);
  flex-shrink: 0;
  overflow: hidden;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.user-meta strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 11px; color: var(--text-muted); }

/* Main */
.main {
  display: grid;
  grid-template-rows: 64px 1fr;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: relative;
  z-index: 4;
}
.topbar-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.005em;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.topbar-title-crumb { color: var(--text-muted); font-weight: 500; }
.topbar-search {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  margin: 0 auto 0 24px;
  font-size: 13px;
}
.topbar-search input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); }
.topbar-search kbd {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--surface-1);
  transition: all .15s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn.has-dot { position: relative; }
.icon-btn.has-dot::after {
  content: ""; position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--bg);
}

.content {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 32px 60px;
  scrollbar-gutter: stable;
}
@media (max-width: 900px) {
  .content { padding: 20px 16px 60px; }
  .topbar { padding: 0 14px; }
  .topbar-search { display: none; }
}

/* ============================================================
   Buttons, badges, controls
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: 0 1px 0 0 color-mix(in oklab, white 18%, transparent) inset,
              0 4px 14px -2px color-mix(in oklab, var(--accent) 50%, transparent);
}
.btn-primary:hover { filter: brightness(1.05) saturate(1.05); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { color: var(--text-muted); padding: 8px 10px; }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn .icon { width: 15px; height: 15px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  letter-spacing: .01em;
  line-height: 1.4;
  white-space: nowrap;
}
.badge.success { background: color-mix(in oklab, var(--success) 14%, transparent); color: var(--success); border-color: color-mix(in oklab, var(--success) 28%, transparent); }
.badge.warn    { background: color-mix(in oklab, var(--warn) 14%, transparent); color: var(--warn); border-color: color-mix(in oklab, var(--warn) 28%, transparent); }
.badge.danger  { background: color-mix(in oklab, var(--danger) 14%, transparent); color: var(--danger); border-color: color-mix(in oklab, var(--danger) 28%, transparent); }
.badge.accent  { background: color-mix(in oklab, var(--accent) 14%, transparent); color: var(--accent); border-color: color-mix(in oklab, var(--accent) 28%, transparent); }
.badge.subtle  { background: transparent; border-color: var(--border); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Input fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .02em;
}
.input, .textarea, .select {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
  outline: 0;
  appearance: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: color-mix(in oklab, var(--accent) 60%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent);
}
.select {
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
  color: var(--text);
}
.textarea { min-height: 80px; resize: vertical; }

/* Toggle */
.toggle {
  width: 36px; height: 22px;
  background: var(--surface-3);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background .2s;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--text);
  border-radius: 50%;
  transition: transform .2s;
}
.toggle.on { background: var(--accent); border-color: transparent; }
.toggle.on::after { transform: translateX(14px); background: var(--accent-fg); }

/* ============================================================
   Cards, panels
   ============================================================ */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
}
.card.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.005em;
}
.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* KPI */
.kpi {
  padding: 22px;
  display: flex; flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}
.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.kpi-label .ic {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  color: var(--accent);
  display: grid; place-items: center;
}
.kpi-value {
  font-family: var(--font-display, var(--font-sans));
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--text);
  line-height: 1.05;
}
.kpi-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-weight: 600;
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 6px;
}
.delta.up { color: var(--success); background: color-mix(in oklab, var(--success) 12%, transparent); }
.delta.down { color: var(--danger); background: color-mix(in oklab, var(--danger) 12%, transparent); }
.kpi-spark {
  position: absolute;
  right: 0; bottom: 0;
  width: 50%; height: 60%;
  opacity: .8;
  pointer-events: none;
}

/* Grids */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* Page header */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-family: var(--font-display, var(--font-sans));
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -.02em;
  color: var(--text);
}
.page-head p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 0;
  max-width: 56ch;
}
.page-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Tables */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  background: var(--surface-1);
  position: sticky; top: 0; z-index: 1;
}
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num { font-variant-numeric: tabular-nums; font-weight: 500; }
.table td.muted { color: var(--text-muted); }
.table .row-avatar {
  display: flex; align-items: center; gap: 10px;
}
.avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  flex-shrink: 0;
}

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab:hover { color: var(--text); }

/* Empty / placeholder */
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: color-mix(in oklab, var(--bg-deep) 70%, transparent);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn .15s ease;
}
.modal {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px -10px rgba(0,0,0,.5);
  animation: popIn .2s ease;
}
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 22px; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* Skeleton + helpers */
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.num { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--border); margin: 12px 0; border: 0; }
.h-scroll { overflow-x: auto; }

/* Filter chip group */
.chip-group { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--border); gap: 2px; }
.chip {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 7px;
  color: var(--text-muted);
  transition: all .15s;
  cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--surface-1); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.04); font-weight: 600; }

/* Insights cards (Inteligência) */
.insight {
  padding: 16px;
  border-radius: 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  display: flex; gap: 14px; align-items: flex-start;
}
.insight-ic {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent-grad);
  color: var(--accent-fg);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.insight strong { display: block; font-size: 13.5px; margin-bottom: 4px; font-weight: 600; }
.insight p { margin: 0; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

/* Toast */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,.3);
  animation: slideUp .25s ease;
  min-width: 220px;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Calendar / agenda */
.cal {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.cal-head {
  display: grid;
  grid-template-columns: 64px repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}
.cal-head > div {
  padding: 12px 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-right: 1px solid var(--border);
}
.cal-head > div:last-child { border-right: 0; }
.cal-head .cal-day-num {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  margin-top: 2px;
  text-transform: none;
}
.cal-head .cal-day-num.today {
  color: var(--accent-fg);
  background: var(--accent);
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  margin: 2px auto 0;
}
.cal-body {
  display: grid;
  grid-template-columns: 64px repeat(7, minmax(0, 1fr));
  position: relative;
  max-height: 640px;
  overflow-y: auto;
}
.cal-hour-col {
  border-right: 1px solid var(--border);
}
.cal-hour-cell {
  height: 60px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-faint);
  padding: 4px 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cal-col {
  border-right: 1px solid var(--border);
  position: relative;
}
.cal-col:last-child { border-right: 0; }
.cal-col-cell {
  height: 60px;
  border-bottom: 1px solid var(--border);
}
.appt {
  position: absolute;
  left: 4px; right: 4px;
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
  background: color-mix(in oklab, var(--accent) 18%, var(--surface-1));
  border-left: 3px solid var(--accent);
  overflow: hidden;
  line-height: 1.3;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.appt:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -4px color-mix(in oklab, var(--accent) 30%, transparent); z-index: 2; }
.appt.confirmed { background: color-mix(in oklab, var(--success) 18%, var(--surface-1)); border-left-color: var(--success); }
.appt.pending { background: color-mix(in oklab, var(--warn) 18%, var(--surface-1)); border-left-color: var(--warn); }
.appt.done { background: var(--surface-2); border-left-color: var(--text-muted); color: var(--text-muted); }
.appt.cancelled { background: color-mix(in oklab, var(--danger) 12%, var(--surface-1)); border-left-color: var(--danger); color: var(--danger); text-decoration: line-through; opacity: .65; }
.appt strong { display: block; font-weight: 600; font-size: 12px; }
.appt small { display: block; font-size: 10.5px; opacity: .8; font-weight: 500; }

/* Service / staff tile */
.tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex; flex-direction: column;
  gap: 12px;
  transition: border-color .15s, transform .15s;
  cursor: pointer;
}
.tile:hover { border-color: color-mix(in oklab, var(--accent) 35%, var(--border)); transform: translateY(-2px); }
.tile-avatar {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--accent-grad);
  color: var(--accent-fg);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.01em;
  overflow: hidden;
}
.tile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tile h4 { margin: 0; font-size: 14px; font-weight: 600; }
.tile .muted-sm { font-size: 12px; color: var(--text-muted); }

/* Pill list */
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* Mobile-only top header */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 900px) {
  .mobile-header { display: flex; }
}

/* Drawer for mobile sidebar */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  display: none;
}
@media (max-width: 900px) {
  .drawer-open .drawer-backdrop { display: block; }
  .drawer-open .sidebar {
    display: flex;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 280px;
    z-index: 95;
    animation: slideIn .2s ease;
  }
}
@keyframes slideIn { from { transform: translateX(-100%); } to { transform: none; } }

/* Animations utility — pure-transform entry; no opacity (iframes throttle paused frames) */
.fade-in { animation: fadeInEnter .3s ease forwards; }
.slide-up { animation: slideUp .3s ease forwards; }
@keyframes fadeInEnter { 0% { transform: translateY(4px); } 100% { transform: none; } }
@keyframes slideUp { from { transform: translateY(8px); } to { transform: none; } }

/* ============================================================ MOBILE */
button,a{touch-action:manipulation;}
.bottom-nav{display:none;}
.bottom-nav-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;flex:1;padding:8px 4px;color:var(--text-muted);font-size:10px;font-weight:600;position:relative;transition:color .15s;-webkit-tap-highlight-color:transparent;}
.bottom-nav-btn svg{width:22px;height:22px;}
.bottom-nav-btn.active{color:var(--accent);}
.bottom-nav-btn.active::after{content:"";position:absolute;top:0;left:50%;transform:translateX(-50%);width:28px;height:2.5px;background:var(--accent);border-radius:0 0 3px 3px;}
.bottom-nav-label{font-size:10px;font-weight:600;}
.fab{display:none;position:fixed;right:18px;bottom:76px;width:52px;height:52px;border-radius:16px;background:var(--accent);color:var(--accent-fg);box-shadow:0 8px 24px -4px color-mix(in oklab,var(--accent) 60%,transparent);z-index:49;align-items:center;justify-content:center;transition:transform .15s;-webkit-tap-highlight-color:transparent;}
.fab:active{transform:scale(.92);}
.kpi-mobile-scroll{display:none;gap:10px;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;padding-bottom:6px;}
.kpi-mobile-scroll::-webkit-scrollbar{display:none;}
.kpi-mobile-scroll>.kpi{min-width:148px;max-width:180px;flex-shrink:0;padding:16px;}
.kpi-mobile-scroll>.kpi .kpi-value{font-size:21px;}
.kpi-mobile-scroll>.kpi .kpi-spark{display:none;}
@media(max-width:900px){
  .main{grid-template-rows:54px 1fr;}
  .topbar{padding:0 12px;gap:8px;min-height:54px;}
  .topbar-title{font-size:13.5px;}
  .topbar-search{display:none !important;}
  .topbar-actions .muted{display:none;}
  .content{padding:16px 14px calc(68px + env(safe-area-inset-bottom,0px)) 14px !important;overflow-x:hidden;}
  .page-head{flex-direction:column;align-items:flex-start;gap:10px;margin-bottom:16px;}
  .page-head h1{font-size:21px;}
  .page-head p{font-size:12.5px;}
  .page-head-actions{width:100%;gap:8px;}
  .bottom-nav{display:flex;position:fixed;bottom:0;left:0;right:0;height:calc(58px + env(safe-area-inset-bottom,0px));padding-bottom:env(safe-area-inset-bottom,0px);background:color-mix(in oklab,var(--surface-1) 92%,transparent);backdrop-filter:blur(24px) saturate(160%);-webkit-backdrop-filter:blur(24px) saturate(160%);border-top:1px solid var(--border);z-index:50;}
  .fab{display:flex;}
  .modal-backdrop{align-items:flex-end;padding:0;}
  .modal{max-width:100% !important;width:100% !important;border-radius:20px 20px 0 0 !important;max-height:93dvh !important;animation:slideUpSheet .28s cubic-bezier(.32,.72,0,1) !important;}
  @keyframes slideUpSheet{from{transform:translateY(100%)}to{transform:none}}
  .input,.textarea,.select{font-size:16px !important;}
  .sidebar{position:fixed !important;top:0 !important;bottom:0 !important;left:-290px !important;width:280px !important;z-index:95 !important;transition:left .25s cubic-bezier(.32,.72,0,1) !important;}
  .drawer-open .sidebar{left:0 !important;display:flex !important;box-shadow:0 0 60px rgba(0,0,0,.4);}
  .drawer-backdrop{position:fixed;inset:0;z-index:90;background:rgba(0,0,0,.45);backdrop-filter:blur(4px);display:none;}
  .drawer-open .drawer-backdrop{display:block;}
  .btn{min-height:40px;}.icon-btn{width:40px;height:40px;}.chip{padding:7px 13px;}.tab{padding:10px 12px;}.nav-item{min-height:44px;}
  .table th,.table td{padding:10px 12px;}
  .h-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;}
  .chip-group{flex-wrap:wrap;}
  .tile:hover{transform:none;}
  .kpi-mobile-scroll{display:flex;}
  .kpi-grid-desktop{display:none;}
}
@media(max-width:480px){
  .content{padding:12px 10px calc(68px + env(safe-area-inset-bottom,0px)) 10px !important;}
  .page-head h1{font-size:19px;}
  .kpi-mobile-scroll>.kpi{min-width:136px;}
}
