/* ============================================================
   KCC Admin — design tokens + base styles
   Aesthetic: Linear chrome × Bloomberg data density
   ============================================================ */

:root {
  /* Surfaces — cool near-black */
  --bg-0: oklch(0.135 0.006 250);          /* page */
  --bg-1: oklch(0.165 0.006 250);          /* sidebar, raised */
  --bg-2: oklch(0.195 0.006 250);          /* card */
  --bg-3: oklch(0.225 0.006 250);          /* card hover, input */
  --bg-4: oklch(0.27 0.007 250);           /* subtle highlight */
  --bg-overlay: oklch(0.135 0.006 250 / 0.78);

  /* Borders */
  --border: oklch(0.27 0.007 250);
  --border-strong: oklch(0.34 0.008 250);
  --border-subtle: oklch(0.22 0.006 250);

  /* Text */
  --text: oklch(0.965 0.003 250);
  --text-muted: oklch(0.68 0.012 250);
  --text-dim: oklch(0.5 0.01 250);
  --text-faint: oklch(0.4 0.008 250);

  /* Accent — electric blue, used sparingly */
  --accent: oklch(0.72 0.17 248);
  --accent-soft: oklch(0.72 0.17 248 / 0.14);
  --accent-glow: oklch(0.72 0.17 248 / 0.32);
  --accent-strong: oklch(0.78 0.18 248);

  /* Semantic */
  --green: oklch(0.74 0.16 156);
  --green-soft: oklch(0.74 0.16 156 / 0.15);
  --amber: oklch(0.78 0.15 75);
  --amber-soft: oklch(0.78 0.15 75 / 0.15);
  --red: oklch(0.68 0.21 24);
  --red-soft: oklch(0.68 0.21 24 / 0.16);
  --violet: oklch(0.7 0.18 295);
  --violet-soft: oklch(0.7 0.18 295 / 0.16);
  --cyan: oklch(0.78 0.14 200);
  --cyan-soft: oklch(0.78 0.14 200 / 0.16);

  /* User colors */
  --user-clarens: oklch(0.7 0.16 245);
  --user-kevin:   oklch(0.74 0.16 156);
  --user-carly:   oklch(0.7 0.18 295);

  /* Type */
  --font-ui: "Inter", "SF Pro Text", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;

  /* Density */
  --row-h: 36px;
  --row-h-tight: 32px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;

  /* Shadows */
  --shadow-1: 0 1px 0 0 oklch(1 0 0 / 0.03) inset, 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-pop: 0 0 0 1px var(--border), 0 20px 50px -10px oklch(0 0 0 / 0.6), 0 8px 16px -4px oklch(0 0 0 / 0.5);
  --shadow-glow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft);
}

/* Light theme */
:root[data-theme="light"] {
  --bg-0: oklch(0.985 0.003 250);
  --bg-1: oklch(1 0 0);
  --bg-2: oklch(0.975 0.003 250);
  --bg-3: oklch(0.95 0.004 250);
  --bg-4: oklch(0.92 0.005 250);
  --bg-overlay: oklch(0.985 0.003 250 / 0.78);

  --border: oklch(0.9 0.005 250);
  --border-strong: oklch(0.82 0.006 250);
  --border-subtle: oklch(0.93 0.004 250);

  --text: oklch(0.18 0.008 250);
  --text-muted: oklch(0.42 0.01 250);
  --text-dim: oklch(0.56 0.01 250);
  --text-faint: oklch(0.68 0.008 250);

  --accent-soft: oklch(0.72 0.17 248 / 0.1);
  --shadow-1: 0 1px 0 0 oklch(1 0 0 / 0.6) inset, 0 1px 2px oklch(0 0 0 / 0.06);
  --shadow-pop: 0 0 0 1px var(--border), 0 20px 40px -8px oklch(0 0 0 / 0.12), 0 6px 12px -2px oklch(0 0 0 / 0.06);
}

/* ============================================================ Base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg-0); color: var(--text); }
body {
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.45;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-glow); color: var(--text); }

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; border: 2px solid transparent; }

/* ============================================================ App shell */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w, 240px) 1fr;
  grid-template-rows: 100vh;        /* fallback */
  grid-template-rows: 100dvh;       /* Safari : tient compte de la barre d'URL */
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}
.app[data-sidebar="collapsed"] { --sidebar-w: 60px; }

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-0);
  overflow: hidden;
}
.view {
  flex: 1 1 0;
  min-height: 0;                    /* nécessaire pour que flex enfant puisse scroll dans Safari */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;/* momentum scroll iOS */
  position: relative;
}

/* ============================================================ Sidebar */
.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.logo {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(155deg, oklch(0.78 0.17 248), oklch(0.55 0.18 258));
  color: white;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 1px oklch(1 0 0 / 0.08) inset, 0 1px 2px oklch(0 0 0 / 0.4);
  flex-shrink: 0;
  font-family: var(--font-ui);
}
.logo-wrap { display: flex; flex-direction: column; line-height: 1.15; overflow: hidden; }
.logo-wrap .name { font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em; }
.logo-wrap .org { font-size: 11px; color: var(--text-dim); }

.app[data-sidebar="collapsed"] .logo-wrap,
.app[data-sidebar="collapsed"] .nav-label,
.app[data-sidebar="collapsed"] .nav-section-title,
.app[data-sidebar="collapsed"] .nav-tag,
.app[data-sidebar="collapsed"] .sidebar-footer-meta { display: none; }

.sidebar-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.search-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 30px;
  padding: 0 8px;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 120ms;
}
.search-pill:hover { border-color: var(--border); }
.search-pill kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  background: var(--bg-1);
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
}
.nav-section + .nav-section { margin-top: 12px; }
.nav-section-title {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 6px 8px 4px;
  font-weight: 500;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 30px;
  padding: 0 8px;
  margin: 1px 0;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  position: relative;
  transition: background 100ms, color 100ms;
  white-space: nowrap;
}
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item[data-active="true"] {
  background: var(--bg-3);
  color: var(--text);
}
.nav-item[data-active="true"] .nav-icon { color: var(--accent); }
.nav-icon {
  width: 16px; height: 16px;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: var(--text-dim);
}
.nav-tag {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  background: var(--bg-3);
  color: var(--text-muted);
  border-radius: 4px;
  min-width: 18px;
  text-align: center;
}
.nav-tag[data-tone="red"] { background: var(--red-soft); color: var(--red); }
.nav-tag[data-tone="amber"] { background: var(--amber-soft); color: var(--amber); }
.nav-tag[data-tone="accent"] { background: var(--accent-soft); color: var(--accent); }

.nav-sub { padding-left: 22px; }
.app[data-sidebar="collapsed"] .nav-sub { display: none; }

.sidebar-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-footer-meta { display: flex; flex-direction: column; line-height: 1.2; overflow: hidden; flex: 1; min-width: 0; }
.sidebar-footer-meta .who { font-size: 12.5px; font-weight: 550; }
.sidebar-footer-meta .role { font-size: 11px; color: var(--text-dim); }

/* ============================================================ Topbar */
.topbar {
  height: 48px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  background: var(--bg-0);
  position: sticky; top: 0; z-index: 10;
}
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px;
  min-width: 0;
  flex-shrink: 0;
  white-space: nowrap;
}
.breadcrumb .crumb { color: var(--text-muted); }
.breadcrumb .crumb.last { color: var(--text); font-weight: 550; }
.breadcrumb .sep { color: var(--text-faint); }

.topbar-spacer { flex: 1; min-width: 8px; }

.topbar-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.session-pill { flex-shrink: 0; white-space: nowrap; }
.team-switcher { flex-shrink: 0; }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--text-muted);
  position: relative;
}
.icon-btn:hover { background: var(--bg-2); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--bg-0);
}

.session-pill {
  display: flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 8px 0 6px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.session-pill .live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
  animation: pulse 2s infinite;
}

/* Team switcher — 3 cofounders synced */
.team-switcher {
  display: flex; align-items: center; gap: 2px;
  padding: 2px; margin-left: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-1);
}
.team-pick {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: 999px;
  border: 0; background: transparent; padding: 0;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.team-pick:hover { opacity: 0.85; }
.team-pick[data-active="true"] {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--accent);
  transform: scale(1.04);
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--green-soft); }
  50% { box-shadow: 0 0 0 5px oklch(0.74 0.16 156 / 0.06); }
}

.avatar {
  display: grid; place-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--user-clarens);
  color: white;
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--font-ui);
  flex-shrink: 0;
  box-shadow: 0 0 0 1.5px var(--bg-0);
}
.avatar[data-user="kevin"]  { background: var(--user-kevin); }
.avatar[data-user="carly"]  { background: var(--user-carly); }
.avatar[data-user="clarens"]{ background: var(--user-clarens); }
.avatar[data-size="lg"] { width: 36px; height: 36px; font-size: 13px; }
.avatar[data-size="sm"] { width: 20px; height: 20px; font-size: 9.5px; }

/* ============================================================ Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 100ms, border-color 100ms;
}
.btn:hover { background: var(--bg-3); border-color: var(--border-strong); }
.btn[data-variant="primary"] {
  background: var(--accent);
  border-color: var(--accent);
  color: oklch(0.15 0.04 250);
  font-weight: 600;
}
.btn[data-variant="primary"]:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn[data-variant="ghost"] { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn[data-variant="ghost"]:hover { background: var(--bg-2); color: var(--text); }
.btn[data-variant="danger"] { background: var(--red-soft); border-color: oklch(0.68 0.21 24 / 0.4); color: var(--red); }
.btn[data-size="sm"] { height: 24px; padding: 0 8px; font-size: 11.5px; }
.btn[data-size="lg"] { height: 32px; padding: 0 12px; font-size: 13px; }

/* ============================================================ Card */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.card-title { font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.card-sub { font-size: 11.5px; color: var(--text-dim); }
.card-body { padding: 14px; }

/* ============================================================ Badge / Status */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-3);
  color: var(--text-muted);
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge[data-tone="green"]  { background: var(--green-soft);  color: var(--green); }
.badge[data-tone="amber"]  { background: var(--amber-soft);  color: var(--amber); }
.badge[data-tone="red"]    { background: var(--red-soft);    color: var(--red); }
.badge[data-tone="blue"]   { background: var(--accent-soft); color: var(--accent); }
.badge[data-tone="violet"] { background: var(--violet-soft); color: var(--violet); }
.badge[data-tone="cyan"]   { background: var(--cyan-soft);   color: var(--cyan); }
.badge[data-tone="muted"]  { background: var(--bg-3);        color: var(--text-muted); }

/* ============================================================ Mono */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ============================================================ Table */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.table th {
  position: sticky; top: 0;
  background: var(--bg-1);
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  z-index: 2;
}
.table th:hover { color: var(--text); }
.table td {
  padding: 0 10px;
  height: var(--row-h);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.table tr:hover td { background: var(--bg-2); }
.table tr[data-selected="true"] td { background: var(--accent-soft); }

/* ============================================================ Inputs */
.input {
  display: flex; align-items: center;
  height: 30px;
  padding: 0 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12.5px;
  width: 100%;
  transition: border-color 100ms, box-shadow 100ms;
}
.input:focus, .input:focus-within {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--text-faint); }

/* ============================================================ Sparkline / chart helpers */
.spark { width: 100%; height: 28px; display: block; }

/* ============================================================ Layout helpers */
.grid { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }

.page {
  padding: 18px 20px 60px;
  max-width: 1600px;
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
}
.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.1;
}
.page-sub {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ============================================================ Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: oklch(0 0 0 / 0.55);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: grid; place-items: center;
  padding: 40px;
}
.modal {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  max-width: 100%;
  max-height: 100%;
  overflow: auto;
}

/* ============================================================ Toasts */
.toasts {
  position: fixed; bottom: 16px; right: 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  box-shadow: var(--shadow-pop);
  animation: toast-in 200ms ease-out;
  min-width: 240px;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================ Misc */
.divider { height: 1px; background: var(--border-subtle); margin: 14px 0; }
.kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  background: var(--bg-1);
}
.focusable:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-0), 0 0 0 4px var(--accent);
  border-radius: 6px;
}

/* hide scrollbar on horizontal scroll containers */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* ============================================================ Responsive — Tablette / iPad / Mobile */

/* iPad Pro 12.9" landscape & smaller : sidebar collapsée automatiquement */
@media (max-width: 1280px) {
  .app { --sidebar-w: 64px; }
  .nav-label,
  .nav-tag,
  .nav-section-title,
  .sidebar-search,
  .sidebar-head .logo-wrap,
  .sidebar-head .icon-btn,
  .sidebar-footer-meta,
  .sidebar-footer .icon-btn { display: none !important; }
  .nav-item { justify-content: center; padding: 8px 0 !important; }
  .nav-icon { margin: 0 !important; }
  .sidebar-head { justify-content: center; padding: 12px 0; }
  .sidebar-head .logo { margin: 0 auto; }
  .sidebar-footer { padding: 10px 0; justify-content: center; }
  .sidebar-footer .avatar { margin: 0 auto; }
}

/* iPad portrait & tablettes ≤1024px : densité réduite, padding réduit */
@media (max-width: 1024px) {
  .view { padding: 0 !important; }
  .topbar { padding: 10px 14px; }
  .topbar-search { max-width: 320px; }
  /* Tables : autoriser scroll horizontal */
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .card, .panel { padding: 14px !important; }
  h1 { font-size: 22px !important; }
  h2 { font-size: 18px !important; }
  /* Toolbars : permettre wrap + scroll horizontal des segmented controls */
  .row { flex-wrap: wrap; }
  .row button { white-space: nowrap; }
  /* Empêcher les boutons groupés (segmented) de chevaucher leur texte */
  .row > .row { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
}

/* Mobile / iPad mini portrait ≤768px : sidebar en overlay */
@media (max-width: 768px) {
  .app {
    /* Sidebar passe en position:fixed → on garde 1 seule colonne pour .main */
    grid-template-columns: 1fr;
    --sidebar-w: 0px;
  }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 240px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 40px oklch(0 0 0 / 0.3);
  }
  .app[data-mobile-nav="open"] .sidebar {
    transform: translateX(0);
  }
  /* En overlay mobile, on remontre tout */
  .nav-label,
  .nav-tag,
  .nav-section-title,
  .sidebar-search,
  .sidebar-head .logo-wrap,
  .sidebar-head .icon-btn,
  .sidebar-footer-meta,
  .sidebar-footer .icon-btn { display: revert !important; }
  .nav-item { justify-content: flex-start; padding: 8px 12px !important; }
  .sidebar-head { justify-content: flex-start; padding: 14px 14px 12px; }
  .sidebar-footer { padding: 14px; justify-content: flex-start; }

  /* Bouton hamburger visible (à ajouter dans topbar via JSX si pas déjà là) */
  .mobile-menu-toggle { display: inline-flex !important; }

  /* Topbar compact mobile : on dégage tout ce qui n'est pas essentiel */
  .topbar { padding: 6px 8px; gap: 6px; height: auto; min-height: 48px; }
  .topbar-search { display: none; }
  .topbar-actions { gap: 2px; }
  .topbar-actions .icon-btn { width: 32px; height: 32px; }
  /* Breadcrumb : ne garder que la page courante */
  .breadcrumb .crumb:not(.last),
  .breadcrumb .sep { display: none !important; }
  .breadcrumb { font-size: 13px; min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
  .breadcrumb .crumb.last { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Session pill + team switcher cachés sur mobile (trop de bruit) */
  .session-pill,
  .team-switcher { display: none !important; }

  /* Grids 2/3/4-col → 1-col (force inclus les inline styles via !important) */
  .grid,
  .grid-2, .grid-3, .grid-4,
  [class*="grid"],
  [style*="grid-template-columns"],
  [style*="gridTemplateColumns"] {
    grid-template-columns: 1fr !important;
  }
  /* Cartes qui spannent plusieurs colonnes : reset à 1 colonne */
  [style*="grid-column"],
  [style*="gridColumn"] {
    grid-column: 1 / -1 !important;
  }
  /* Page : padding mobile + empêcher tout débordement horizontal */
  .page { padding: 14px !important; max-width: 100% !important; }
  .page-head { flex-wrap: wrap; gap: 8px; }
  .view > *, .view > * > * { max-width: 100% !important; }
  /* Enfants de grid/flex doivent pouvoir shrink */
  .view * { min-width: 0; }
  /* Texte/nombres très grands : autoriser le wrap */
  .num, .stat-value, h1, h2 { word-break: break-word; overflow-wrap: anywhere; }
  /* SVG charts : ne pas dépasser le conteneur */
  .view svg:not(.icon) { max-width: 100% !important; height: auto !important; }
  body, html { overflow-x: hidden; }

  /* Inputs plus grands pour tactile */
  input, select, textarea, button { min-height: 36px; }

  body { font-size: 14px; }
}

/* Phone ≤480px : full mobile */
@media (max-width: 480px) {
  .topbar-title { font-size: 14px; }
  h1 { font-size: 18px !important; }
  .card, .panel { padding: 12px !important; border-radius: 10px; }
  .stat-value { font-size: 20px !important; }
}

/* Overlay backdrop quand sidebar mobile ouverte */
@media (max-width: 768px) {
  .app[data-mobile-nav="open"]::before {
    content: "";
    position: fixed;
    inset: 0;
    background: oklch(0 0 0 / 0.5);
    z-index: 999;
  }
}

/* Bouton hamburger : caché par défaut, affiché en mobile via media query */
.mobile-menu-toggle { display: none; }

/* ============================================================ Editable fields */
.editable { transition: background 100ms ease; position: relative; }
.editable:hover {
  background: var(--bg-2);
  outline: 1px dashed var(--accent-soft);
  outline-offset: 1px;
}
.editable:hover::after {
  content: "✎";
  position: absolute;
  right: 4px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--accent);
  pointer-events: none; opacity: 0.6;
}

/* JARVIS animations */
@keyframes jv-rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes jv-pulse  { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes jv-bounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }
@keyframes jv-slide-in { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes jv-ring   { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.4); opacity: 0; } }
