/* ============================================================
   VAIDEO — Prototype · styles d'application
   (s'appuie sur assets/tokens.css)
   ============================================================ */

#root, .app { min-height: 100vh; }

/* ===== Layout shell ===== */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.shell.collapsed { grid-template-columns: 72px 1fr; }

/* ----- Sidebar ----- */
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; }
.sb-top { padding: 16px 16px 10px; display: flex; align-items: center; gap: 11px; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: linear-gradient(145deg, var(--primary), color-mix(in oklch, var(--primary) 55%, var(--spark)));
  box-shadow: var(--shadow-sm); }
.logo-mark svg { width: 15px; height: 15px; }
.logo-wm { font-weight: var(--fw-black); font-size: 1.16rem; letter-spacing: -0.03em; }
.logo-wm b { color: var(--primary); }
.collapsed .logo-wm, .collapsed .tenant, .collapsed .nav-label, .collapsed .sb-foot-txt { display: none; }

.tenant { margin: 6px 12px 12px; padding: 9px 10px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface-2); display: flex; align-items: center; gap: 9px; cursor: pointer; transition: var(--dur) var(--ease); }
.tenant:hover { border-color: var(--border-strong); }
.tenant .tav { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: none;
  font-weight: var(--fw-bold); font-size: 12px; color: #fff; background: oklch(0.55 0.13 280); }
.tenant .tn { font-weight: var(--fw-semibold); font-size: var(--t-sm); line-height: 1.2; }
.tenant .tt { font-size: var(--t-xs); color: var(--text-subtle); }
.tenant .chev { margin-left: auto; color: var(--text-faint); }
.tenant { background: var(--surface-2); font-family: inherit; }
.proj-menu { position: absolute; top: calc(100% + 4px); left: 12px; right: 12px; z-index: 19; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 6px; }
.proj-menu-lbl { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-subtle);
  font-weight: var(--fw-bold); padding: 8px 8px 6px; }
.proj-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; background: transparent;
  border-radius: var(--r-sm); cursor: pointer; font-family: inherit; transition: var(--dur); text-align: left; }
.proj-opt:hover { background: var(--surface-2); }
.proj-opt.active { background: var(--primary-tint); }
.proj-opt .tav { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none;
  font-weight: var(--fw-bold); font-size: 13px; color: #fff; }
.proj-opt .badge { min-width: 18px; height: 18px; border-radius: 99px; background: var(--st-failed-bg); color: var(--st-failed-fg);
  font-size: var(--t-xs); font-weight: var(--fw-bold); display: grid; place-items: center; padding: 0 5px; }
.proj-menu-sep { height: 1px; background: var(--border-subtle); margin: 5px 0; }
.proj-add { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none;
  border: 1px dashed var(--border-strong); color: var(--text-subtle); }

.nav { padding: 4px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-sec { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-subtle);
  font-weight: var(--fw-bold); padding: 14px 10px 6px; }
.collapsed .nav-sec { text-align: center; font-size: 0; padding: 10px 0 2px; }
.collapsed .nav-sec::after { content:'·'; font-size: 14px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text); font-size: var(--t-base); font-weight: var(--fw-medium); cursor: pointer; background: transparent;
  transition: var(--dur) var(--ease); border: 1px solid transparent; position: relative; }
.nav-item .ic { color: var(--text-subtle); transition: var(--dur) var(--ease); }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:hover .ic { color: var(--text); }
.nav-item.active { background: var(--primary-tint); color: var(--primary); font-weight: var(--fw-semibold); }
.nav-item.active .ic { color: var(--primary); }
.collapsed .nav-item.active { background: var(--primary-tint); }
.nav-item .ic { width: 19px; height: 19px; flex: none; }
.nav-item .badge { margin-left: auto; min-width: 20px; height: 20px; border-radius: 99px; background: var(--st-failed-bg);
  color: var(--st-failed-fg); font-size: var(--t-xs); font-weight: var(--fw-bold); display: grid; place-items: center; padding: 0 6px; }
.collapsed .nav-item { justify-content: center; padding: 9px 0; }
.collapsed .nav-item .badge { position: absolute; top: 2px; right: 10px; margin: 0; min-width: 16px; height: 16px; }

.sb-foot { padding: 12px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: var(--fw-bold); font-size: 12px; color: #fff; }
.sb-foot-txt { line-height: 1.2; min-width: 0; }
.sb-foot-txt .n { font-weight: var(--fw-semibold); font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-foot-txt .r { font-size: var(--t-xs); color: var(--text-subtle); }

/* ----- Main / topbar ----- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 14px;
  padding: 0 24px; background: color-mix(in oklch, var(--bg) 82%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border); }
.crumb { display: flex; align-items: center; gap: 8px; font-size: var(--t-sm); color: var(--text-muted); min-width: 0; }
.crumb a { cursor: pointer; } .crumb a:hover { color: var(--text); }
.crumb .sep { color: var(--text-faint); }
.crumb .cur { color: var(--text); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.icon-btn { width: var(--control-h); height: var(--control-h); border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); display: grid; place-items: center; cursor: pointer; transition: var(--dur) var(--ease); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }

.searchbox { display: flex; align-items: center; gap: 8px; height: var(--control-h); padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-subtle); min-width: 220px; cursor: text; }
.searchbox input { border: 0; background: transparent; outline: none; color: var(--text); font-family: inherit; font-size: var(--t-sm); width: 100%; }
.kbd { font-family: var(--font-mono); font-size: 10px; border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; color: var(--text-faint); }

.content { padding: 28px; max-width: 1240px; width: 100%; margin: 0 auto; }
.content.wide { max-width: 1400px; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-h); padding: 0 16px;
  border-radius: var(--r-sm); font-size: var(--t-base); font-weight: var(--fw-semibold); cursor: pointer;
  border: 1px solid transparent; transition: var(--dur) var(--ease); white-space: nowrap; font-family: inherit; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-fg); box-shadow: var(--shadow-xs); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--st-failed-bg); color: var(--st-failed-fg); border-color: var(--st-failed-bd); }
.btn-danger:hover { background: color-mix(in oklch, var(--st-failed-bg) 85%, var(--st-failed-fg)); }
.btn-sm { height: 34px; padding: 0 12px; font-size: var(--t-sm); }
.btn-lg { height: 46px; padding: 0 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn .ic { width: 17px; height: 17px; }

/* ===== Pills & chips ===== */
.pill { display: inline-flex; align-items: center; gap: 7px; height: 25px; padding: 0 10px 0 8px; border-radius: var(--r-pill);
  font-size: var(--t-sm); font-weight: var(--fw-semibold); border: 1px solid; white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill.draft     { color: var(--st-draft-fg); background: var(--st-draft-bg); border-color: var(--st-draft-bd); }
.pill.scheduled { color: var(--st-scheduled-fg); background: var(--st-scheduled-bg); border-color: var(--st-scheduled-bd); }
.pill.running   { color: var(--st-running-fg); background: var(--st-running-bg); border-color: var(--st-running-bd); }
.pill.running .dot { animation: blink 1.3s var(--ease) infinite; }
.pill.live      { color: var(--st-live-fg); background: var(--st-live-bg); border-color: var(--st-live-bd); }
.pill.failed    { color: var(--st-failed-fg); background: var(--st-failed-bg); border-color: var(--st-failed-bd); }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

.pf { display: inline-flex; align-items: center; gap: 7px; height: 27px; padding: 0 10px 0 7px; border-radius: var(--r-pill);
  font-size: var(--t-sm); font-weight: var(--fw-semibold); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.pf.bare { background: transparent; border: 0; padding: 0; height: auto; gap: 6px; }
.pf .glyph { width: 17px; height: 17px; border-radius: 5px; display: grid; place-items: center; flex: none;
  color: #fff; font-size: 9px; font-weight: 800; font-family: var(--font-mono); }
.pf .glyph.lg { width: 30px; height: 30px; border-radius: 8px; font-size: 14px; }

/* ===== Content meter (axe 1) ===== */
.meter { display: flex; align-items: center; gap: 5px; }
.meter .seg-bar { height: 5px; border-radius: 99px; background: var(--track); flex: 1; min-width: 8px; overflow: hidden; transition: var(--dur); }
.meter .seg-bar.done { background: var(--track-fill); }
.meter-label { font-size: var(--t-xs); color: var(--text-subtle); font-weight: var(--fw-medium); white-space: nowrap; }

.stepdots { display: inline-flex; align-items: center; }
.stepdots .node { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); flex: none; }
.stepdots .node.done { background: var(--track-fill); border-color: var(--track-fill); }
.stepdots .node.curr { border-color: var(--track-fill); box-shadow: 0 0 0 3px var(--primary-ring); }
.stepdots .link { width: 18px; height: 2px; background: var(--border-strong); }
.stepdots .link.done { background: var(--track-fill); }

/* ===== Cards ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card.flat { box-shadow: none; }
.card-pad { padding: var(--pad-card); }
.card-head { padding: 16px var(--pad-card); border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; gap: 12px; }
.card-head h3 { font-size: var(--t-h3); }
.card-head .spacer { flex: 1; }
.section-title { font-size: var(--t-h2); font-weight: var(--fw-bold); letter-spacing: -0.02em; }
.label-xs { font-size: var(--t-xs); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-subtle); }

/* ===== Thumb ===== */
.thumb { background: repeating-linear-gradient(135deg, var(--surface-3) 0 11px, var(--surface-2) 11px 22px);
  position: relative; display: grid; place-items: center; overflow: hidden; }
.thumb .ph { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; }
.thumb .dur { position: absolute; right: 7px; bottom: 7px; font-family: var(--font-mono); font-size: var(--t-xs);
  background: oklch(0.15 0.01 265 / 0.78); color: #fff; padding: 2px 6px; border-radius: 5px; }
.thumb .ribbon { position: absolute; inset: 0; opacity: 0.5; mix-blend-mode: overlay; }

/* ===== Media card ===== */
.mcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: var(--dur) var(--ease); cursor: pointer; display: flex; flex-direction: column; }
.mcard:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.mcard .thumb { aspect-ratio: 16/9; }
.mcard .body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.mcard .title { font-weight: var(--fw-semibold); font-size: var(--t-base); line-height: 1.32;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mcard .sub { font-size: var(--t-sm); color: var(--text-subtle); }

/* ===== Fields ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: var(--t-sm); font-weight: var(--fw-semibold); color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.field .hint { font-size: var(--t-xs); color: var(--text-subtle); }
.field .req { color: var(--st-failed-fg); }
.field .ai-fill { margin-left: auto; font-size: var(--t-xs); color: var(--primary); font-weight: var(--fw-semibold);
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer; background: var(--primary-tint); padding: 2px 8px; border-radius: 99px; }
.input, .select, .textarea { border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); padding: 0 12px; font-size: var(--t-base); font-family: inherit; transition: var(--dur) var(--ease); width: 100%; }
.input, .select { height: var(--control-h); }
.textarea { padding: 10px 12px; min-height: 80px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input.prefilled, .textarea.prefilled { border-color: var(--primary-tint-2); background: color-mix(in oklch, var(--primary-tint) 35%, var(--surface)); }
.count { font-size: var(--t-xs); color: var(--text-faint); font-family: var(--font-mono); }

/* toggle */
.toggle { width: 40px; height: 23px; border-radius: 99px; background: var(--border-strong); position: relative; cursor: pointer; transition: var(--dur); border: 0; flex: none; }
.toggle::after { content:''; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: var(--dur) var(--ease); box-shadow: var(--shadow-xs); }
.toggle[aria-checked="true"] { background: var(--primary); }
.toggle[aria-checked="true"]::after { left: 19px; }

/* radio segmented */
.segmented { display: inline-flex; background: var(--surface-inset); border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 3px; gap: 3px; flex-wrap: nowrap; }
.segmented button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: var(--t-sm);
  font-weight: var(--fw-semibold); padding: 6px 13px; border-radius: calc(var(--r-sm) - 2px); transition: var(--dur); font-family: inherit; white-space: nowrap; }
.segmented button:hover { color: var(--text); background: color-mix(in oklch, var(--surface) 60%, transparent); }
.segmented button[aria-pressed="true"] { background: var(--primary); color: var(--primary-fg); box-shadow: var(--shadow-sm); font-weight: var(--fw-bold); }
.segmented button[aria-pressed="true"]:hover { background: var(--primary); }
.segmented.seg-wrap { flex-wrap: wrap; }

/* tags input */
.tags-in { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); }
.tag { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px;
  padding: 3px 6px 3px 10px; font-size: var(--t-sm); }
.tag button { border: 0; background: transparent; color: var(--text-faint); cursor: pointer; font-size: 13px; line-height: 1; padding: 2px; border-radius: 50%; }
.tag button:hover { color: var(--st-failed-fg); background: var(--st-failed-bg); }

/* ===== Table ===== */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-subtle);
  font-weight: var(--fw-semibold); padding: 10px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); font-size: var(--t-sm); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: var(--dur); }
.table tbody tr:hover { background: var(--surface-2); }
.table.clickable tbody tr { cursor: pointer; }

/* ===== Stat ===== */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .v { font-size: 1.7rem; font-weight: var(--fw-bold); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .k { font-size: var(--t-sm); color: var(--text-muted); }
.stat .delta { font-size: var(--t-xs); font-weight: var(--fw-semibold); }
.delta.up { color: var(--st-live-fg); } .delta.down { color: var(--st-failed-fg); }

/* ===== Toast ===== */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: flex-start; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 12px 14px; box-shadow: var(--shadow-lg); max-width: 360px; animation: toastIn 0.3s var(--ease-out); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } }
.toast .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 800; }
.toast.ok .ic { background: var(--st-live-bg); color: var(--st-live-fg); }
.toast.err .ic { background: var(--st-failed-bg); color: var(--st-failed-fg); }
.toast.info .ic { background: var(--primary-tint); color: var(--primary); }
.toast .tt { font-weight: var(--fw-semibold); font-size: var(--t-sm); }
.toast .td { font-size: var(--t-sm); color: var(--text-muted); margin-top: 2px; }

/* ===== Modal / sheet ===== */
.overlay { position: fixed; inset: 0; background: oklch(0.1 0.02 265 / 0.55); backdrop-filter: blur(3px); z-index: 100;
  display: grid; place-items: center; padding: 24px; animation: fade 0.2s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-pop);
  width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; animation: modalIn 0.25s var(--ease-out); }
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } }

/* ===== Utilities ===== */
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.muted { color: var(--text-muted); } .subtle { color: var(--text-subtle); }
.tiny { font-size: var(--t-sm); } .xs { font-size: var(--t-xs); }
.bold { font-weight: var(--fw-bold); } .semi { font-weight: var(--fw-semibold); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.trunc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2,1fr); } .g3 { grid-template-columns: repeat(3,1fr); } .g4 { grid-template-columns: repeat(4,1fr); }
.divider { height: 1px; background: var(--border-subtle); margin: 16px 0; border: 0; }
.empty { text-align: center; padding: 40px 20px; color: var(--text-subtle); }
.empty .em-ic { width: 48px; height: 48px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 12px; color: var(--text-faint); }

/* mobile nav button hidden on desktop */
.mobile-only { display: none; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-only { display: inline-flex; }
  .content { padding: 18px 16px 90px; }
  .searchbox { display: none; }
  .g4 { grid-template-columns: repeat(2,1fr); }
  .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .g2, .g4 { grid-template-columns: 1fr; }
}

/* mobile bottom tab bar */
.tabbar { display: none; }
@media (max-width: 1024px) {
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; height: 62px;
    background: color-mix(in oklch, var(--surface) 92%, transparent); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border); padding: 6px 8px env(safe-area-inset-bottom); }
  .tabbar .tb { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--text-subtle); font-size: 10px; font-weight: var(--fw-semibold); cursor: pointer; border-radius: var(--r-sm); position: relative; }
  .tabbar .tb.active { color: var(--primary); }
  .tabbar .tb .ic { width: 22px; height: 22px; }
  .tabbar .tb .badge { position: absolute; top: 2px; right: 50%; margin-right: -18px; min-width: 15px; height: 15px; border-radius: 99px;
    background: var(--st-failed-fg); color: #fff; font-size: 9px; display: grid; place-items: center; font-weight: 800; }
}
