:root {
  --bg: #0e0e10;
  --surface: #18181b;
  --surface2: #222226;
  --border: #2e2e34;
  --text: #e4e4e7;
  --muted: #71717a;
  --violet: #a78bfa;
  --amber: #fbbf24;
  --sky: #38bdf8;
  --emerald: #34d399;
  --red: #f87171;
  --accent: #7c3aed;
  --sidebar-w: 240px;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--violet); text-decoration: none; }
button { font-family: inherit; }

.hidden { display: none !important; }

/* ── TOPNAV ── */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between; height: 52px;
}
.nav-left { display: flex; align-items: center; gap: 0.75rem; }
.nav-logo { font-weight: 800; font-size: 1rem; letter-spacing: -0.02em; color: var(--text); }
.nav-logo span { color: var(--violet); }
.nav-right { display: flex; align-items: center; gap: 0.75rem; font-size: 0.8rem; }

.hamburger-btn {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 32px; height: 32px; background: none; border: none; cursor: pointer; padding: 4px; flex-shrink: 0;
}
.hamburger-btn span {
  display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 149;
  background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
}
.nav-email { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-role {
  font-size: 0.62rem; font-weight: 700; padding: 0.12rem 0.45rem; border-radius: 999px;
  border: 1px solid; text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-admin { color: var(--amber); border-color: rgba(251,191,36,.35); }

.lang-switch {
  display: inline-flex; gap: 0; border: 1px solid var(--border); border-radius: 0.45rem; overflow: hidden;
}
.lang-switch .lang-btn {
  background: transparent; color: var(--muted); border: none; padding: 0.3rem 0.6rem;
  font-size: 0.7rem; font-weight: 700; cursor: pointer; letter-spacing: 0.03em;
}
.lang-switch .lang-btn + .lang-btn { border-left: 1px solid var(--border); }
.lang-switch .lang-btn.active { background: rgba(124,58,237,.15); color: var(--violet); }

/* ── LAYOUT ── */
.app-layout {
  display: flex; padding-top: 52px; min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  position: fixed; top: 52px; bottom: 0; left: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto;
}

.sidebar-agent {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sa-avatar {
  width: 44px; height: 44px; border-radius: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 800; flex-shrink: 0; margin-bottom: 0.6rem;
}
.sa-name { font-weight: 700; font-size: 0.9rem; }
.sa-sub { font-size: 0.7rem; color: var(--muted); margin-top: 0.15rem; }

.sidenav { padding: 0.5rem 0; flex: 1; }
.sidenav-section { padding: 0.5rem 0; border-top: 1px solid var(--border); }
.sidenav-section:first-child { border-top: none; }
.sidenav-label {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); padding: 0.75rem 1.1rem 0.4rem;
}
.sidenav-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 1.1rem; font-size: 0.83rem; color: var(--muted);
  cursor: pointer; border-left: 2px solid transparent;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
  user-select: none;
}
.sidenav-item:hover { color: var(--text); background: var(--surface2); }
.sidenav-item.active { color: var(--text); border-left-color: var(--accent); background: rgba(124,58,237,.08); font-weight: 600; }
.sidenav-item .nav-icon { font-size: 0.95rem; width: 18px; text-align: center; flex-shrink: 0; color: var(--violet); }
.sidenav-item .nav-soon { font-size: 0.6rem; color: var(--muted); margin-left: auto; }

/* ── MAIN ── */
.main-content {
  flex: 1; margin-left: var(--sidebar-w);
  padding: 2rem 2rem 4rem;
  max-width: 1100px;
}

.panel { display: none; }
.panel.active { display: block; }

.view-title {
  font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 1.5rem;
}
.view-title span { color: var(--violet); }

/* ── AGENT HEADER (used by Home) ── */
.agent-header { background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; padding: 1.5rem; margin-bottom: 1.25rem; }
.agent-top { display: flex; align-items: flex-start; gap: 1rem; }
.agent-avatar { width: 52px; height: 52px; border-radius: 1rem; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; font-weight: 800; flex-shrink: 0; }
.agent-name { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.03em; }
.agent-bio { color: var(--muted); font-size: 0.83rem; margin-top: 0.25rem; }
.badges { display: flex; gap: 0.4rem; margin-top: 0.5rem; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 0.62rem; font-weight: 700; padding: 0.12rem 0.45rem; border-radius: 999px; border: 1px solid; text-transform: uppercase; letter-spacing: 0.05em; }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); margin-right: 0.3rem; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.65rem; margin-top: 1.25rem; }
.stat { background: var(--surface2); border-radius: 0.75rem; padding: 0.8rem; text-align: center; }
.stat-val { font-size: 1.15rem; font-weight: 800; }
.stat-lbl { font-size: 0.65rem; color: var(--muted); margin-top: 0.2rem; }

/* ── SECTIONS / CARDS ── */
.sec { margin-bottom: 1.25rem; }
.sec-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.65rem; }
.sec-title-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.65rem; }
.sec-title-row .sec-title { margin-bottom: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; overflow: hidden; }
.row { display: flex; align-items: center; gap: 0.75rem; padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--border); font-size: 0.83rem; }
.row:last-child { border-bottom: none; }
.row.inline-row { border-bottom: none; padding: 0.4rem 0; }
.row-left { flex: 1; min-width: 0; }
.row-label { font-weight: 600; }
.row-sub { font-size: 0.7rem; color: var(--muted); margin-top: 0.15rem; }
.row-right { text-align: right; flex-shrink: 0; }
.row-val { font-weight: 700; }

.card-block {
  background: var(--surface); border: 1px solid var(--border); border-radius: 1rem;
  padding: 1.25rem 1.25rem 1.1rem; margin-bottom: 1.25rem;
}

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1rem; background: var(--accent); border: none; border-radius: 0.5rem;
  color: white; font-weight: 700; font-size: 0.82rem; cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn-primary:hover { background: #6d28d9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 0.5rem;
  font-weight: 600; font-size: 0.78rem; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.btn-secondary:hover { border-color: var(--accent); background: rgba(124,58,237,.08); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.action-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.row-actions { display: flex; gap: 0.6rem; margin-bottom: 1rem; }

/* ── FORMS ── */
.form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.form-grid label {
  display: flex; flex-direction: column; gap: 0.3rem;
  font-size: 0.73rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.form-grid label.full { grid-column: 1 / -1; }
.form-grid label.inline {
  flex-direction: row; align-items: center; gap: 0.5rem; text-transform: none; letter-spacing: 0;
  color: var(--text); font-size: 0.82rem; font-weight: 500;
}
.form-grid input,
.form-grid select,
.form-grid textarea {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border); border-radius: 0.5rem;
  padding: 0.55rem 0.7rem; font-family: inherit; font-size: 0.85rem;
  outline: none;
  transition: border-color 0.12s;
  width: 100%;
}
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus { border-color: var(--accent); }
.form-grid input[type="color"] { padding: 0.2rem; height: 36px; }
.form-grid input[type="checkbox"] { width: auto; }

.preset-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.preset-btn {
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.3rem 0.8rem; font-size: 0.72rem; font-weight: 600;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.preset-btn:hover { border-color: var(--accent); }
.preset-btn.active { background: rgba(124,58,237,.15); color: var(--violet); border-color: var(--violet); }

.format-help { color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.hint { color: var(--muted); font-size: 0.78rem; line-height: 1.5; }

.status { font-size: 0.75rem; color: var(--muted); margin-top: 0.6rem; min-height: 1rem; }
.status.ok { color: var(--emerald); }
.status.err { color: var(--red); }

/* ── STUDIO MODES ── */
.studio-modes {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.65rem; margin-bottom: 1.25rem;
}
.studio-mode {
  background: var(--surface); border: 1px solid var(--border); border-radius: 0.875rem;
  padding: 0.9rem 0.85rem; text-align: left; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; gap: 0.15rem;
  transition: border-color 0.15s, transform 0.1s, background 0.15s;
}
.studio-mode:hover { border-color: var(--accent); transform: translateY(-1px); }
.studio-mode.active { border-color: var(--violet); background: rgba(124,58,237,.08); }
.studio-mode .sm-icon { font-size: 1.4rem; color: var(--violet); margin-bottom: 0.1rem; }
.studio-mode strong { font-size: 0.88rem; font-weight: 700; }
.studio-mode .sm-sub { font-size: 0.7rem; color: var(--muted); }

/* ── CARDS GRID (lists) ── */
.grid-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem; margin-top: 0.65rem;
}
.grid-cards .item-card {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 0.875rem;
  padding: 0.95rem; display: flex; flex-direction: column; gap: 0.4rem;
}
.grid-cards .item-card .ic-title { font-weight: 700; font-size: 0.88rem; overflow-wrap: break-word; word-break: break-word; }
.grid-cards .item-card .ic-sub { font-size: 0.72rem; color: var(--muted); overflow-wrap: break-word; word-break: break-word; }
.grid-cards .item-card .ic-tag {
  display: inline-block; align-self: flex-start;
  font-size: 0.6rem; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 999px;
  border: 1px solid rgba(167,139,250,.35); color: var(--violet); text-transform: uppercase; letter-spacing: 0.05em;
}
.grid-cards .item-card .ic-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.4rem; }

/* ── Compatibilite: classes historiques (history-item, meta, history-actions) ── */
.history-item {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 0.875rem;
  padding: 0.95rem 1rem; display: flex; flex-direction: column; gap: 0.4rem;
  font-size: 0.85rem;
}
.history-item .meta {
  font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.history-item strong { font-size: 0.88rem; font-weight: 700; overflow-wrap: break-word; word-break: break-word; }
.history-item p { font-size: 0.8rem; line-height: 1.5; color: var(--text); white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word; }
.history-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.4rem; }

.history-item .actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.4rem; }
.history-item .actions button,
.history-item button:not(.btn-primary):not(.btn-secondary) {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 0.45rem;
  padding: 0.35rem 0.7rem; font-size: 0.72rem; font-weight: 600; cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.history-item .actions button:hover,
.history-item button:hover:not(.btn-primary):not(.btn-secondary) {
  border-color: var(--accent); background: rgba(124,58,237,.08);
}

.history-item.assistant {
  background: rgba(124,58,237,.08); border-color: rgba(124,58,237,.35);
}
.history-item.user {
  background: var(--surface);
}

/* ── RESULT CARDS (Studio) ── */
.result-cards {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.85rem; margin-bottom: 1.25rem;
}
.result-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 0.875rem;
  padding: 1rem;
}
.rc-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.4rem; }
.result-text { font-size: 0.88rem; line-height: 1.55; white-space: pre-wrap; }
.result-tags { font-size: 0.78rem; color: var(--violet); }

.preview-image {
  margin-top: 0.75rem; border-radius: 0.75rem; max-height: 220px; border: 1px solid var(--border);
}

.raw-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 0.875rem;
  padding: 0.85rem 1rem; margin-bottom: 1.25rem;
}
.raw-box summary { cursor: pointer; font-size: 0.78rem; color: var(--muted); }
.raw-result { font-size: 0.72rem; color: var(--muted); white-space: pre-wrap; max-height: 360px; overflow: auto; margin-top: 0.6rem; }

/* ── IMAGE COMPARE ── */
.image-compare { padding-bottom: 1.25rem; }
.compare-stage {
  position: relative; width: 100%; max-width: 720px; aspect-ratio: 4/3;
  background: #000; border-radius: 0.875rem; overflow: hidden; margin-bottom: 0.8rem;
}
.compare-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare-after-wrap { position: absolute; inset: 0; width: 50%; overflow: hidden; }
.compare-after-wrap .compare-img { width: 200%; }
.compare-label {
  position: absolute; top: 0.6rem; padding: 0.2rem 0.55rem; border-radius: 999px;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  background: rgba(0,0,0,.5); color: #fff;
}
.compare-label.before { left: 0.6rem; }
.compare-label.after { right: 0.6rem; background: rgba(124,58,237,.7); }
.compare-slider-label {
  display: flex; flex-direction: column; gap: 0.3rem;
  font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.compare-slider-label input[type="range"] { width: 100%; accent-color: var(--violet); }

/* ── CHECKLIST (Home) ── */
.checklist { list-style: none; padding: 0.6rem 1.1rem 1rem; margin: 0; }
.checklist li {
  font-size: 0.82rem; color: var(--muted); padding: 0.35rem 0;
  display: flex; align-items: center; gap: 0.5rem;
}
.checklist li::before {
  content: "○"; color: var(--muted); font-size: 1rem;
}
.checklist li.done { color: var(--text); }
.checklist li.done::before { content: "●"; color: var(--emerald); }

/* ── CHATBOT FLOATING ── */
.chatbot-widget {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 200;
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.6rem;
}
.chatbot-toggle {
  background: var(--accent); color: white; border: none; border-radius: 999px;
  padding: 0.7rem 1.2rem; font-weight: 700; font-size: 0.85rem; cursor: pointer;
  box-shadow: 0 12px 30px rgba(124,58,237,.35);
  transition: background 0.15s, transform 0.1s;
}
.chatbot-toggle:hover { background: #6d28d9; transform: translateY(-1px); }
.chatbot-panel {
  width: min(380px, calc(100vw - 2rem));
  max-height: 70vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 1rem;
  padding: 1rem; box-shadow: 0 18px 40px rgba(0,0,0,.45);
}
.chatbot-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.6rem; font-size: 0.85rem;
}
.chatbot-header button {
  background: none; color: var(--muted); border: 1px solid var(--border);
  border-radius: 0.4rem; padding: 0.2rem 0.55rem; font-size: 0.7rem; cursor: pointer;
}
.chatbot-header button:hover { color: var(--red); border-color: var(--red); }

/* ── STUDIO SUB-NAV (accordéon) ── */
.sidenav-subnav {
  border-left: 2px solid rgba(124,58,237,.15);
  margin: 0 0 0 1.55rem;
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 0.22s ease, opacity 0.18s ease, margin 0.22s ease;
}
.sidenav-subnav.open {
  max-height: 200px; opacity: 1;
  margin-bottom: 0.3rem; margin-top: 0.1rem;
}
.sidenav-sub {
  display: flex; align-items: center;
  padding: 0.38rem 0.9rem; font-size: 0.78rem; color: var(--muted);
  cursor: pointer; border-left: 2px solid transparent;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
  margin-left: -2px; text-decoration: none;
  border-radius: 0 0.35rem 0.35rem 0;
}
.sidenav-sub:hover { color: var(--text); background: rgba(255,255,255,.04); }
.sidenav-sub.active { color: var(--violet); border-left-color: var(--violet); background: rgba(124,58,237,.07); font-weight: 600; }

/* ── STUDIO SUB-PANELS ── */
.studio-subpanel { display: none; }
.studio-subpanel.active { display: block; }

/* ── CALENDAR GRID ── */
.cal-month-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem; gap: 0.5rem;
}
.cal-month-label {
  font-weight: 700; font-size: 0.88rem; flex: 1; text-align: center; text-transform: capitalize;
}
.cal-view-toggle { display: flex; gap: 0.4rem; }
.cal-view-btn { padding: 0.3rem 0.7rem; font-size: 0.72rem; }
.cal-view-btn.active { background: rgba(124,58,237,.15); color: var(--violet); border-color: var(--violet); }

.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 0.75rem;
}
.cal-header-day {
  text-align: center; font-size: 0.62rem; font-weight: 700;
  text-transform: uppercase; color: var(--muted); padding: 0.35rem 0;
}
.cal-day {
  min-height: 72px; background: var(--surface2); border-radius: 0.4rem;
  padding: 0.3rem; border: 1px solid var(--border); overflow: hidden;
}
.cal-day.other-month { opacity: 0.25; }
.cal-day.today { border-color: var(--violet); }
.cal-day-num {
  font-size: 0.65rem; color: var(--muted); font-weight: 600; margin-bottom: 0.2rem; line-height: 1;
}
.cal-day.today .cal-day-num { color: var(--violet); }
.cal-item-badge {
  display: block; font-size: 0.58rem; padding: 0.1rem 0.28rem; border-radius: 3px;
  margin-bottom: 2px; cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; font-weight: 600;
  transition: opacity 0.1s;
}
.cal-item-badge:hover { opacity: 0.8; }
.cal-item-badge.text { background: rgba(167,139,250,.2); color: var(--violet); }
.cal-item-badge.image { background: rgba(56,189,248,.2); color: var(--sky); }
.cal-item-badge.video { background: rgba(251,191,36,.2); color: var(--amber); }
.cal-item-badge.img2img { background: rgba(52,211,153,.2); color: var(--emerald); }
.cal-item-badge.more { background: transparent; color: var(--muted); font-style: italic; }

.cal-detail {
  background: var(--surface); border: 1px solid var(--border); border-radius: 0.875rem;
  padding: 1rem 1.1rem; margin-top: 0.5rem; font-size: 0.83rem;
}
.cal-detail .meta { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.4rem; }
.cal-detail strong { display: block; margin-bottom: 0.5rem; }
.cal-detail .actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.6rem; }
.cal-detail .actions button {
  background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 0.45rem;
  padding: 0.3rem 0.65rem; font-size: 0.72rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: border-color 0.12s, background 0.12s;
}
.cal-detail .actions button:hover { border-color: var(--accent); background: rgba(124,58,237,.08); }
.cal-detail .actions button.danger:hover { border-color: var(--red); background: rgba(248,113,113,.08); color: var(--red); }

.cal-date-edit { cursor: pointer; border-bottom: 1px dashed var(--muted); }
.cal-date-edit:hover { color: var(--violet); border-color: var(--violet); }

/* ── RESPONSIVE ── */
@media (max-width: 920px) {
  :root { --sidebar-w: 200px; }
  .form-grid { grid-template-columns: 1fr; }
  .studio-modes { grid-template-columns: repeat(2, 1fr); }
  .result-cards { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .topnav { padding: 0 0.9rem; }
  .nav-email { max-width: 110px; }
  .hamburger-btn { display: flex; }
  .sidebar {
    width: 260px; position: fixed; top: 52px; bottom: 0; left: -260px;
    z-index: 150; transition: left 0.25s ease; border-right: 1px solid var(--border);
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; padding: 1.25rem 1rem 4rem; }
  .app-layout { padding-top: 52px; }
}
