/* ==========================================================================
   Architech PM — Design System
   Built on the MY VELTO token set (Mytecglobal Sdn. Bhd.)
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* Brand / primary */
  --c-primary:        #3b82f6;
  --c-primary-hover:  #2563eb;
  --c-primary-strong: #1d4ed8;
  --c-primary-light:  #eff6ff;
  --c-primary-soft:   #dbeafe;
  --c-primary-softer: #bfdbfe;
  --c-primary-grad:   linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --c-focus-ring:     rgba(59, 130, 246, .14);

  /* Text */
  --c-text:      #1e293b;
  --c-text-2:    #64748b;
  --c-text-3:    #94a3b8;
  --c-text-inv:  #ffffff;

  /* Surface */
  --c-page:   #f5f7fa;
  --c-card:   #ffffff;
  --c-hover:  #f1f5f9;
  --c-muted:  #fafbfc;
  --c-sunken: #f8fafc;

  /* Border */
  --c-border:       #e6eaf0;
  --c-border-light: #f1f5f9;
  --c-border-hover: #cbd5e1;

  /* Status */
  --c-green:   #10b981;  --c-green-bg:  #ecfdf5;  --c-green-dk:  #047857;
  --c-amber:   #f59e0b;  --c-amber-bg:  #fffbeb;  --c-amber-dk:  #b45309;
  --c-red:     #ef4444;  --c-red-bg:    #fef2f2;  --c-red-dk:    #b91c1c;
  --c-blue:    #3b82f6;  --c-blue-bg:   #eff6ff;  --c-blue-dk:   #1d4ed8;
  --c-purple:  #8b5cf6;  --c-purple-bg: #f5f3ff;  --c-purple-dk: #6d28d9;
  --c-teal:    #14b8a6;  --c-teal-bg:   #f0fdfa;  --c-teal-dk:   #0f766e;
  --c-pink:    #ec4899;  --c-pink-bg:   #fdf2f8;  --c-pink-dk:   #be185d;
  --c-slate:   #64748b;  --c-slate-bg:  #f8fafc;  --c-slate-dk:  #334155;
  --c-indigo:  #6366f1;  --c-indigo-bg: #eef2ff;  --c-indigo-dk: #4338ca;

  /* Typography */
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Radius */
  --r-sm: 6px; --r: 10px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;

  /* Shadow */
  --sh-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --sh-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --sh:    0 2px 8px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --sh-md: 0 6px 20px rgba(15, 23, 42, .08), 0 2px 6px rgba(15, 23, 42, .04);
  --sh-lg: 0 18px 44px rgba(15, 23, 42, .14), 0 4px 12px rgba(15, 23, 42, .06);

  /* Layout */
  --topbar-h: 58px;
  --rail-w: 68px;
  --side-w: 244px;
  --maxw: 1560px;
  --t: .18s cubic-bezier(.4, 0, .2, 1);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--c-text); background: var(--c-page);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -.015em; color: var(--c-text); }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
p { margin: 0 0 10px; }
a { color: var(--c-primary-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
code { font-family: var(--font-mono); font-size: .92em; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d3dbe6; border-radius: 8px; border: 2px solid var(--c-page); }
::-webkit-scrollbar-thumb:hover { background: #b8c3d2; }
:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; border-radius: 4px; }

/* ---------- 3. Utilities ---------- */
.row { display: flex; align-items: center; }
.row-t { display: flex; align-items: flex-start; }
.between { display: flex; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.g4 { gap: 4px; } .g6 { gap: 6px; } .g8 { gap: 8px; } .g10 { gap: 10px; }
.g12 { gap: 12px; } .g16 { gap: 16px; } .g20 { gap: 20px; } .g24 { gap: 24px; }
.grow { flex: 1; min-width: 0; }
.mt4{margin-top:4px}.mt8{margin-top:8px}.mt12{margin-top:12px}.mt16{margin-top:16px}
.mt20{margin-top:20px}.mt24{margin-top:24px}.mt32{margin-top:32px}
.mb4{margin-bottom:4px}.mb8{margin-bottom:8px}.mb12{margin-bottom:12px}
.mb16{margin-bottom:16px}.mb20{margin-bottom:20px}.mb24{margin-bottom:24px}
.tar { text-align: right; } .tac { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--font-mono); }
.hide { display: none !important; }

.t-xs { font-size: 11px; } .t-sm { font-size: 12px; } .t-md { font-size: 13px; }
.t-lg { font-size: 16px; } .t-xl { font-size: 20px; } .t-2xl { font-size: 28px; }
.t-3xl { font-size: 34px; }
.w5 { font-weight: 500; } .w6 { font-weight: 600; } .w7 { font-weight: 700; } .w8 { font-weight: 800; }
.muted { color: var(--c-text-2); } .muted2 { color: var(--c-text-3); }
.upper { text-transform: uppercase; letter-spacing: .06em; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--c-text-3); }
.lede { font-size: 14px; color: var(--c-text-2); max-width: 76ch; }

/* ---------- 4. App shell ---------- */
#app { min-height: 100vh; }

.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 60;
  display: flex; align-items: center; gap: 14px; padding: 0 16px 0 14px;
  background: rgba(255, 255, 255, .88); backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--c-border);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--c-primary-grad);
  display: grid; place-items: center; color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .3);
  font-weight: 800; font-size: 14px; letter-spacing: -.03em;
}
.brand-name { font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.brand-name span { color: var(--c-primary-hover); }
.topbar-div { width: 1px; height: 24px; background: var(--c-border); }
.ctx-chip {
  display: flex; align-items: center; gap: 9px; padding: 5px 12px 5px 8px;
  border-radius: var(--r); transition: background var(--t); cursor: pointer;
}
.ctx-chip:hover { background: var(--c-hover); }
.ctx-chip .lbl { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--c-text-3); text-transform: uppercase; }
.ctx-chip .val { font-size: 13px; font-weight: 700; }

.gsearch {
  display: flex; align-items: center; gap: 9px; width: min(400px, 34vw);
  padding: 7px 12px; border: 1px solid var(--c-border); border-radius: var(--r-pill);
  background: var(--c-sunken); color: var(--c-text-3); cursor: pointer; transition: all var(--t);
}
.gsearch:hover { background: #fff; border-color: var(--c-border-hover); box-shadow: var(--sh-xs); }
.gsearch .kbd { margin-left: auto; }
.kbd {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: var(--c-text-3);
  border: 1px solid var(--c-border); background: #fff; border-radius: 5px; padding: 2px 6px;
}

.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r); display: grid; place-items: center;
  color: var(--c-text-2); transition: all var(--t); position: relative;
}
.icon-btn:hover { background: var(--c-hover); color: var(--c-text); }
.icon-btn.ai { color: var(--c-purple); }
.icon-btn.ai:hover { background: var(--c-purple-bg); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--c-red); border: 1.5px solid #fff;
}

/* Rail + sidebar */
.rail {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--rail-w); z-index: 55;
  background: #fff; border-right: 1px solid var(--c-border);
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0;
}
.rail-item {
  width: 50px; padding: 7px 0 6px; border-radius: var(--r); display: flex; flex-direction: column;
  align-items: center; gap: 3px; color: var(--c-text-2); transition: all var(--t); position: relative;
}
.rail-item .rl { font-size: 9.5px; font-weight: 600; letter-spacing: .01em; }
.rail-item:hover { background: var(--c-hover); color: var(--c-text); }
.rail-item.on { background: var(--c-primary-light); color: var(--c-primary-hover); }
.rail-item.on::before {
  content: ""; position: absolute; left: -9px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--c-primary);
}
.rail-item .badge-n {
  position: absolute; top: 2px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-pill); background: var(--c-red); color: #fff; font-size: 9.5px;
  font-weight: 700; display: grid; place-items: center; border: 1.5px solid #fff;
}

.side {
  position: fixed; top: var(--topbar-h); bottom: 0; left: var(--rail-w); width: var(--side-w); z-index: 50;
  background: #fff; border-right: 1px solid var(--c-border); display: flex; flex-direction: column;
  overflow: hidden;
}
.side-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--c-border-light); }
.side-body { flex: 1; overflow-y: auto; padding: 10px 10px 24px; }
.side-foot { padding: 10px; border-top: 1px solid var(--c-border-light); }
.nav-group { margin-bottom: 4px; }
.nav-group-t {
  padding: 12px 10px 6px; font-size: 10px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--c-text-3);
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px;
  color: var(--c-text-2); font-size: 13px; font-weight: 500; transition: all var(--t); text-align: left;
}
.nav-item:hover { background: var(--c-hover); color: var(--c-text); text-decoration: none; }
.nav-item.on { background: var(--c-primary-light); color: var(--c-primary-hover); font-weight: 650; }
.nav-item .n { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--c-text-3);
  background: var(--c-sunken); border-radius: var(--r-pill); padding: 1px 7px; }
.nav-item.on .n { background: #fff; color: var(--c-primary-hover); }
.nav-item .n.warn { background: var(--c-red-bg); color: var(--c-red-dk); }

.main {
  margin: var(--topbar-h) 0 0 calc(var(--rail-w) + var(--side-w));
  min-height: calc(100vh - var(--topbar-h)); padding: 0 0 60px;
}
.main.no-side { margin-left: var(--rail-w); }
.page { max-width: var(--maxw); margin: 0 auto; padding: 22px 28px 0; }
.page.wide { max-width: none; }

/* ---------- 5. Page header ---------- */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--c-text-3); margin-bottom: 10px; }
.crumbs a { color: var(--c-text-2); font-weight: 500; }
.crumbs a:hover { color: var(--c-primary-hover); }
.crumbs .sep { color: var(--c-text-3); opacity: .6; }
.crumbs .cur { color: var(--c-text); font-weight: 600; }

.phead { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.phead h1 { font-size: 25px; letter-spacing: -.025em; }
.phead .sub { margin-top: 5px; font-size: 13.5px; color: var(--c-text-2); }
.phead-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ---------- 6. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--c-border);
  background: #fff; color: var(--c-text); font-size: 13px; font-weight: 600;
  transition: all var(--t); white-space: nowrap; box-shadow: var(--sh-xs);
}
.btn:hover { background: var(--c-hover); border-color: var(--c-border-hover); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn.primary {
  background: var(--c-primary-grad); border-color: transparent; color: #fff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, .3), 0 4px 12px rgba(37, 99, 235, .18);
}
.btn.primary:hover { filter: brightness(1.06); background: var(--c-primary-grad); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--c-text-2); }
.btn.ghost:hover { background: var(--c-hover); color: var(--c-text); }
.btn.soft { background: var(--c-primary-light); border-color: transparent; color: var(--c-primary-hover); box-shadow: none; }
.btn.soft:hover { background: var(--c-primary-soft); }
.btn.danger { background: #fff; color: var(--c-red-dk); border-color: #fecaca; }
.btn.danger:hover { background: var(--c-red-bg); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.lg { height: 42px; padding: 0 20px; font-size: 14px; border-radius: var(--r-md); }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }

.seg { display: inline-flex; padding: 3px; background: var(--c-sunken); border: 1px solid var(--c-border); border-radius: var(--r); gap: 2px; }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--c-text-2); transition: all var(--t);
}
.seg button:hover { color: var(--c-text); }
.seg button.on { background: #fff; color: var(--c-primary-hover); box-shadow: var(--sh-xs); }

/* ---------- 7. Cards & surfaces ---------- */
.card {
  background: var(--c-card); border: 1px solid var(--c-border); border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
}
.card.pad { padding: 18px; }
.card.pad-sm { padding: 14px; }
.card.pad-lg { padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--c-border-light); }
.card-head h3 { font-size: 14px; font-weight: 700; }
.card-head .hint { font-size: 12px; color: var(--c-text-3); margin-top: 2px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--c-border-light); background: var(--c-muted); border-radius: 0 0 var(--r-md) var(--r-md); }
.hoverable { transition: all var(--t); cursor: pointer; }
.hoverable:hover { border-color: var(--c-primary-softer); box-shadow: var(--sh-md); transform: translateY(-2px); }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.g-auto-sm { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
/* asymmetric dashboard grids: columns keep their natural height rather than
   stretching the shorter card to match the taller one */
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
.g-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
@media (max-width: 1300px) { .g-5 { grid-template-columns: repeat(3, 1fr); } .g-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1100px) { .g-3, .g-2-1, .g-1-2, .g-3-2 { grid-template-columns: 1fr; } }

/* ---------- 8. Badges, pills, chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
  background: var(--c-slate-bg); color: var(--c-slate-dk);
}
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green  { background: var(--c-green-bg);  color: var(--c-green-dk); }
.badge.amber  { background: var(--c-amber-bg);  color: var(--c-amber-dk); }
.badge.red    { background: var(--c-red-bg);    color: var(--c-red-dk); }
.badge.blue   { background: var(--c-blue-bg);   color: var(--c-blue-dk); }
.badge.purple { background: var(--c-purple-bg); color: var(--c-purple-dk); }
.badge.teal   { background: var(--c-teal-bg);   color: var(--c-teal-dk); }
.badge.pink   { background: var(--c-pink-bg);   color: var(--c-pink-dk); }
.badge.indigo { background: var(--c-indigo-bg); color: var(--c-indigo-dk); }
.badge.slate  { background: var(--c-slate-bg);  color: var(--c-slate-dk); }
.badge.solid-green  { background: var(--c-green);  color: #fff; }
.badge.solid-amber  { background: var(--c-amber);  color: #fff; }
.badge.solid-red    { background: var(--c-red);    color: #fff; }
.badge.solid-blue   { background: var(--c-primary);color: #fff; }
.badge.sm { padding: 2px 8px; font-size: 10px; }
.badge.upper { text-transform: uppercase; letter-spacing: .06em; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border: 1px solid var(--c-border); border-radius: var(--r-pill); background: #fff;
  font-size: 12px; font-weight: 600; color: var(--c-text-2); transition: all var(--t);
}
.chip:hover { border-color: var(--c-border-hover); background: var(--c-hover); }
.chip.on { background: var(--c-primary-light); border-color: var(--c-primary-softer); color: var(--c-primary-hover); }
.chip .x { color: var(--c-text-3); display: grid; place-items: center; }
.chip .x:hover { color: var(--c-red); }
.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--r-sm);
  background: var(--c-sunken); border: 1px solid var(--c-border); font-size: 11px; font-weight: 600; color: var(--c-text-2); }

/* Priority + health dots */
.pri { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; }
.pri i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.pri.critical { color: var(--c-red-dk); } .pri.critical i { background: var(--c-red); }
.pri.high { color: #c2410c; } .pri.high i { background: #f97316; }
.pri.medium { color: var(--c-amber-dk); } .pri.medium i { background: var(--c-amber); }
.pri.low { color: var(--c-slate); } .pri.low i { background: #a3b1c2; }

.health { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.health i { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 3px currentColor; opacity: 1; }
.health.green { color: rgba(16,185,129,.16); } .health.green i { background: var(--c-green); }
.health.green span { color: var(--c-green-dk); }
.health.amber { color: rgba(245,158,11,.16); } .health.amber i { background: var(--c-amber); }
.health.amber span { color: var(--c-amber-dk); }
.health.red { color: rgba(239,68,68,.16); } .health.red i { background: var(--c-red); }
.health.red span { color: var(--c-red-dk); }

/* ---------- 9. Avatars ---------- */
.av {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  font-size: 11px; font-weight: 700; color: #fff; letter-spacing: -.02em; user-select: none;
}
.av.xs { width: 22px; height: 22px; font-size: 9px; }
.av.sm { width: 26px; height: 26px; font-size: 10px; }
.av.lg { width: 40px; height: 40px; font-size: 14px; }
.av.xl { width: 54px; height: 54px; font-size: 18px; }
.av-stack { display: flex; }
.av-stack .av { border: 2px solid #fff; margin-left: -8px; }
.av-stack .av:first-child { margin-left: 0; }
.av-stack .more {
  width: 26px; height: 26px; border-radius: 50%; background: var(--c-sunken); border: 2px solid #fff;
  margin-left: -8px; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--c-text-2);
}
.user-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.user-line .nm { font-size: 13px; font-weight: 600; }
.user-line .rl { font-size: 11.5px; color: var(--c-text-3); }

/* ---------- 10. Progress ---------- */
.bar { height: 6px; border-radius: var(--r-pill); background: var(--c-border-light); overflow: hidden; }
/* a bar sitting in a flex row has no intrinsic width — let it take the slack */
.row > .bar, .between > .bar { flex: 1 1 auto; min-width: 46px; }
.bar > i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--c-primary); transition: width .5s cubic-bezier(.4,0,.2,1); }
.bar.thin { height: 4px; }
.bar.thick { height: 9px; }
.bar > i.green { background: var(--c-green); } .bar > i.amber { background: var(--c-amber); }
.bar > i.red { background: var(--c-red); } .bar > i.purple { background: var(--c-purple); }
.bar.multi { display: flex; }
.bar.multi > i { border-radius: 0; }

/* ---------- 11. Stat tiles ---------- */
.stat { background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 16px 18px; box-shadow: var(--sh-sm); position: relative; overflow: hidden; }
.stat .lbl { font-size: 11.5px; font-weight: 650; color: var(--c-text-2); letter-spacing: .01em; }
.stat .val { font-size: 27px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; line-height: 1.1; }
.stat .val .u { font-size: 14px; font-weight: 700; color: var(--c-text-3); margin-left: 3px; }
.stat .delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; margin-top: 7px; }
.stat .delta.up { color: var(--c-green-dk); } .stat .delta.down { color: var(--c-red-dk); }
.stat .delta.flat { color: var(--c-text-3); }
.stat .ic { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; }
.stat.clickable { cursor: pointer; transition: all var(--t); }
.stat.clickable:hover { border-color: var(--c-primary-softer); box-shadow: var(--sh-md); transform: translateY(-2px); }

/* ---------- 12. Tables ---------- */
.tbl-wrap { overflow-x: auto; border-radius: var(--r-md); }
table.tbl { font-size: 13px; }
table.tbl thead th {
  text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--c-text-3); background: var(--c-muted);
  border-bottom: 1px solid var(--c-border); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.tbl tbody td { padding: 11px 14px; border-bottom: 1px solid var(--c-border-light); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr.clickable { cursor: pointer; transition: background var(--t); }
table.tbl tbody tr.clickable:hover { background: var(--c-primary-light); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tbl .cell-title { font-weight: 650; color: var(--c-text); }
table.tbl .cell-sub { font-size: 11.5px; color: var(--c-text-3); margin-top: 1px; }
table.tbl.compact tbody td { padding: 8px 12px; }

/* Toolbar above lists */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.search-inline {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border: 1px solid var(--c-border); border-radius: var(--r); background: #fff; min-width: 250px;
  transition: all var(--t); box-shadow: var(--sh-xs);
}
.search-inline:focus-within { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-focus-ring); }
.search-inline input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 13px; }
.search-inline input::placeholder { color: var(--c-text-3); }

/* ---------- 13. Forms ---------- */
.field { margin-bottom: 16px; }
.field > label, .lbl-field {
  display: block; font-size: 12.5px; font-weight: 650; color: var(--c-text); margin-bottom: 6px;
}
.field .req { color: var(--c-red); margin-left: 2px; }
.field .help { font-size: 11.5px; color: var(--c-text-3); margin-top: 5px; line-height: 1.45; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--c-border); border-radius: var(--r);
  background: #fff; font-size: 13.5px; transition: all var(--t); outline: 0;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--c-border-hover); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-focus-ring); }
.input::placeholder, .textarea::placeholder { color: var(--c-text-3); }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }

.switch { position: relative; width: 40px; height: 22px; border-radius: var(--r-pill); background: #cbd5e1; transition: background var(--t); flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--sh-sm); transition: transform var(--t); }
.switch.on { background: var(--c-primary); }
.switch.on::after { transform: translateX(18px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--c-border); border-radius: var(--r); background: var(--c-muted); }
.switch-row .t { font-size: 13px; font-weight: 650; }
.switch-row .d { font-size: 12px; color: var(--c-text-3); margin-top: 2px; }

/* Choice cards — the "click, don't type" primitive */
.choices { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.choices.two { grid-template-columns: repeat(2, 1fr); }
.choices.tight { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.choice {
  position: relative; text-align: left; padding: 16px; border: 1.5px solid var(--c-border);
  border-radius: var(--r-md); background: #fff; transition: all var(--t); display: block; width: 100%;
}
.choice:hover { border-color: var(--c-primary-softer); box-shadow: var(--sh-md); transform: translateY(-2px); }
.choice.on { border-color: var(--c-primary); background: var(--c-primary-light); box-shadow: 0 0 0 3px var(--c-focus-ring); }
.choice .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--c-primary-light); color: var(--c-primary-hover); margin-bottom: 11px; }
.choice.on .ic { background: var(--c-primary); color: #fff; }
.choice .t { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.choice .d { font-size: 12.5px; color: var(--c-text-2); margin-top: 4px; line-height: 1.5; }
.choice .flow { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 11px; }
.choice .flow .s { font-size: 10.5px; font-weight: 650; background: var(--c-sunken); border-radius: var(--r-sm); padding: 2px 7px; color: var(--c-text-2); }
.choice .flow .a { color: var(--c-text-3); font-size: 10px; align-self: center; }
.choice .pin { position: absolute; top: 12px; right: 12px; font-size: 9.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--c-primary-hover); background: var(--c-primary-light); border-radius: var(--r-pill); padding: 3px 8px; }
.choice.on .check { position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--c-primary); color: #fff; display: grid; place-items: center; }
.choice.compact { padding: 12px 14px; display: flex; align-items: center; gap: 11px; }
.choice.compact .ic { margin-bottom: 0; width: 32px; height: 32px; border-radius: 9px; }

/* ---------- 14. Stepper / wizard ---------- */
.wizard { background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--sh); overflow: hidden; }
.wiz-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--c-border-light); }
.wiz-head .ic { width: 40px; height: 40px; border-radius: var(--r); background: var(--c-primary-grad); color: #fff; display: grid; place-items: center; box-shadow: 0 3px 10px rgba(37,99,235,.28); }
.wiz-head h2 { font-size: 17px; }
.wiz-head .sub { font-size: 12.5px; color: var(--c-text-2); margin-top: 2px; }

.steps { display: flex; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--c-border-light); background: var(--c-muted); overflow-x: auto; }
.step { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.step .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--c-border-light); color: var(--c-text-3); transition: all var(--t); }
.step .s { font-size: 12.5px; font-weight: 600; color: var(--c-text-3); white-space: nowrap; }
.step.on .n { background: var(--c-primary); color: #fff; box-shadow: 0 0 0 4px var(--c-focus-ring); }
.step.on .s { color: var(--c-text); font-weight: 700; }
.step.done .n { background: var(--c-green-bg); color: var(--c-green-dk); }
.step.done .s { color: var(--c-text-2); }
.step-line { flex: 1; height: 2px; background: var(--c-border); margin: 0 12px; min-width: 20px; border-radius: 2px; }
.step-line.done { background: #a7f3d0; }
.wiz-body { padding: 28px 24px; min-height: 300px; }
.wiz-q { font-size: 21px; font-weight: 750; letter-spacing: -.02em; }
.wiz-hint { font-size: 13.5px; color: var(--c-text-2); margin-top: 6px; margin-bottom: 22px; }
.wiz-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--c-border-light); background: var(--c-muted); }

/* Review summary rows */
.review-row { display: flex; align-items: flex-start; gap: 16px; padding: 11px 0; border-bottom: 1px dashed var(--c-border); }
.review-row:last-child { border-bottom: 0; }
.review-row .k { width: 190px; flex-shrink: 0; font-size: 12.5px; color: var(--c-text-2); font-weight: 600; }
.review-row .v { font-size: 13.5px; font-weight: 600; }

/* ---------- 15. Kanban ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 20px; align-items: flex-start; }
.kcol { flex: 0 0 296px; background: var(--c-sunken); border: 1px solid var(--c-border); border-radius: var(--r-md); display: flex; flex-direction: column; max-height: calc(100vh - 250px); }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--c-border); }
.kcol-head .dt { width: 8px; height: 8px; border-radius: 50%; }
.kcol-head .t { font-size: 12.5px; font-weight: 700; letter-spacing: .01em; }
.kcol-head .n { font-size: 11px; font-weight: 700; color: var(--c-text-3); background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-pill); padding: 1px 7px; }
.kcol-head .wip { margin-left: auto; font-size: 10.5px; font-weight: 700; color: var(--c-text-3); }
.kcol-head .wip.over { color: var(--c-red-dk); }
.kcol-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; flex: 1; }
.kcard { background: #fff; border: 1px solid var(--c-border); border-radius: var(--r); padding: 12px; box-shadow: var(--sh-xs); cursor: pointer; transition: all var(--t); }
.kcard:hover { border-color: var(--c-primary-softer); box-shadow: var(--sh-md); transform: translateY(-1px); }
.kcard .code { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; color: var(--c-text-3); }
.kcard .ttl { font-size: 13px; font-weight: 600; line-height: 1.4; margin: 5px 0 9px; }
.kcard .meta { display: flex; align-items: center; gap: 8px; }
.kcard .sp { font-size: 10.5px; font-weight: 700; background: var(--c-sunken); border-radius: var(--r-sm); padding: 2px 6px; color: var(--c-text-2); }
.kadd { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px; border: 1.5px dashed var(--c-border-hover); border-radius: var(--r); color: var(--c-text-3); font-size: 12.5px; font-weight: 600; transition: all var(--t); width: 100%; }
.kadd:hover { border-color: var(--c-primary); color: var(--c-primary-hover); background: var(--c-primary-light); }

/* ---------- 16. Gantt / timeline ---------- */
.gantt { border: 1px solid var(--c-border); border-radius: var(--r-md); overflow: hidden; background: #fff; }
.gantt-head { display: flex; background: var(--c-muted); border-bottom: 1px solid var(--c-border); }
.gantt-lbl { flex: 0 0 300px; padding: 9px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--c-text-3); border-right: 1px solid var(--c-border); }
.gantt-scale { flex: 1; display: flex; position: relative; }
.gantt-scale .m { flex: 1; text-align: center; padding: 9px 4px; font-size: 11px; font-weight: 700; color: var(--c-text-3); border-right: 1px solid var(--c-border-light); }
.gantt-row { display: flex; border-bottom: 1px solid var(--c-border-light); transition: background var(--t); }
.gantt-row:hover { background: var(--c-primary-light); }
.gantt-row:last-child { border-bottom: 0; }
.gantt-row .gl { flex: 0 0 300px; padding: 10px 14px; border-right: 1px solid var(--c-border); min-width: 0; }
.gantt-row .gl .t { font-size: 12.5px; font-weight: 600; }
.gantt-row .gl .s { font-size: 11px; color: var(--c-text-3); margin-top: 1px; }
.gantt-track { flex: 1; position: relative; padding: 12px 0; }
.gantt-track .grid-l { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--c-border-light); }
.gbar { position: absolute; height: 20px; border-radius: 5px; display: flex; align-items: center; padding: 0 8px; font-size: 10.5px; font-weight: 700; color: #fff; cursor: pointer; transition: all var(--t); overflow: hidden; }
.gbar:hover { filter: brightness(1.08); box-shadow: var(--sh); }
.gbar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.28); }
.gbar span { position: relative; }
.gmile { position: absolute; width: 14px; height: 14px; transform: rotate(45deg); border: 2px solid #fff; box-shadow: var(--sh-sm); cursor: pointer; }
.gtoday { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--c-red); z-index: 3; }
/* only the first row carries the label, otherwise it repeats down the chart */
.gtoday.lbl::before { content: "TODAY"; position: absolute; top: -1px; left: 50%; transform: translateX(-50%); background: var(--c-red); color: #fff; font-size: 8.5px; font-weight: 800; padding: 1px 5px; border-radius: 3px; letter-spacing: .06em; white-space: nowrap; }

/* ---------- 17. Timeline / activity ---------- */
.tl { position: relative; padding-left: 26px; }
.tl::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--c-border); }
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -21px; top: 4px; width: 10px; height: 10px; border-radius: 50%;
  background: #fff; border: 2px solid var(--c-primary); z-index: 1;
}
.tl-item.green::before { border-color: var(--c-green); }
.tl-item.amber::before { border-color: var(--c-amber); }
.tl-item.red::before { border-color: var(--c-red); }
.tl-item.slate::before { border-color: var(--c-text-3); }
.tl-item .w { font-size: 13px; line-height: 1.5; }
.tl-item .tm { font-size: 11.5px; color: var(--c-text-3); margin-top: 2px; }

/* ---------- 18. Modal / drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .38); backdrop-filter: blur(2px); z-index: 200; opacity: 0; transition: opacity .2s; }
.scrim.show { opacity: 1; }
.modal {
  position: fixed; z-index: 210; left: 50%; top: 50%; transform: translate(-50%, -48%) scale(.98);
  width: min(660px, calc(100vw - 40px)); max-height: calc(100vh - 80px); background: #fff;
  border-radius: var(--r-lg); box-shadow: var(--sh-lg); display: flex; flex-direction: column;
  opacity: 0; transition: all .2s cubic-bezier(.4,0,.2,1); overflow: hidden;
}
.modal.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.modal.lg { width: min(880px, calc(100vw - 40px)); }
.modal.xl { width: min(1100px, calc(100vw - 40px)); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--c-border-light); }
.modal-head h2 { font-size: 17px; }
.modal-head .sub { font-size: 12.5px; color: var(--c-text-2); margin-top: 3px; }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--c-border-light); background: var(--c-muted); }

.drawer {
  position: fixed; z-index: 210; top: 0; right: 0; bottom: 0; width: min(900px, 94vw);
  background: #fff; box-shadow: var(--sh-lg); display: flex; flex-direction: column;
  transform: translateX(16px); opacity: 0; transition: all .22s cubic-bezier(.4,0,.2,1);
}
.drawer.show { transform: translateX(0); opacity: 1; }
.drawer-head { padding: 18px 24px; border-bottom: 1px solid var(--c-border-light); }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 24px; background: var(--c-page); }
.drawer-foot { padding: 14px 24px; border-top: 1px solid var(--c-border-light); background: #fff; display: flex; gap: 10px; justify-content: flex-end; }

/* Command palette */
.cmdk { position: fixed; z-index: 210; left: 50%; top: 90px; transform: translateX(-50%) scale(.98); width: min(620px, calc(100vw - 40px));
  background: #fff; border-radius: var(--r-lg); box-shadow: var(--sh-lg); overflow: hidden; opacity: 0; transition: all .18s; }
.cmdk.show { opacity: 1; transform: translateX(-50%) scale(1); }
.cmdk-input { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid var(--c-border-light); }
.cmdk-input input { flex: 1; border: 0; outline: 0; font-size: 15px; }
.cmdk-list { max-height: 400px; overflow-y: auto; padding: 8px; }
.cmdk-sec { padding: 10px 10px 5px; font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--c-text-3); }
.cmdk-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; cursor: pointer; width: 100%; text-align: left; }
.cmdk-item:hover, .cmdk-item.sel { background: var(--c-primary-light); }
.cmdk-item .t { font-size: 13.5px; font-weight: 600; }
.cmdk-item .s { font-size: 11.5px; color: var(--c-text-3); }
.cmdk-item .k { margin-left: auto; }

/* Toast */
.toasts { position: fixed; z-index: 300; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: flex-start; gap: 11px; min-width: 300px; max-width: 400px; padding: 13px 15px;
  background: #0f172a; color: #fff; border-radius: var(--r-md); box-shadow: var(--sh-lg);
  transform: translateY(8px); opacity: 0; transition: all .22s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast .t { font-size: 13px; font-weight: 650; }
.toast .d { font-size: 12px; color: #cbd5e1; margin-top: 2px; }
.toast .ic { color: var(--c-green); flex-shrink: 0; margin-top: 1px; }

/* Tooltip */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; font-size: 11.5px; font-weight: 600; padding: 5px 9px; border-radius: 6px;
  white-space: nowrap; z-index: 100; pointer-events: none; box-shadow: var(--sh-md);
}

/* Popover menu */
.menu { position: absolute; z-index: 220; min-width: 200px; background: #fff; border: 1px solid var(--c-border);
  border-radius: var(--r-md); box-shadow: var(--sh-lg); padding: 6px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px;
  font-size: 13px; font-weight: 550; color: var(--c-text); text-align: left; transition: background var(--t); }
.menu-item:hover { background: var(--c-hover); }
.menu-item.danger { color: var(--c-red-dk); } .menu-item.danger:hover { background: var(--c-red-bg); }
.menu-sep { height: 1px; background: var(--c-border-light); margin: 5px 0; }
.menu-lbl { padding: 8px 10px 5px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-text-3); }

/* ---------- 19. Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--c-border); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--c-text-2); border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all var(--t); white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--c-text); }
.tab.on { color: var(--c-primary-hover); border-bottom-color: var(--c-primary); }
.tab .n { font-size: 10.5px; font-weight: 700; background: var(--c-sunken); border-radius: var(--r-pill); padding: 1px 6px; color: var(--c-text-3); }
.tab.on .n { background: var(--c-primary-light); color: var(--c-primary-hover); }

/* ---------- 20. Empty / callout ---------- */
.empty { text-align: center; padding: 54px 20px; }
.empty .ic { width: 56px; height: 56px; border-radius: var(--r-lg); background: var(--c-sunken); color: var(--c-text-3);
  display: grid; place-items: center; margin: 0 auto 16px; }
.empty h3 { font-size: 15px; } .empty p { font-size: 13px; color: var(--c-text-2); margin: 6px auto 18px; max-width: 46ch; }

.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); background: var(--c-blue-bg);
  border: 1px solid #bfdbfe; font-size: 13px; line-height: 1.55; }
.callout .ic { flex-shrink: 0; color: var(--c-blue-dk); margin-top: 1px; }
.callout.tip { background: var(--c-green-bg); border-color: #a7f3d0; } .callout.tip .ic { color: var(--c-green-dk); }
.callout.warn { background: var(--c-amber-bg); border-color: #fde68a; } .callout.warn .ic { color: var(--c-amber-dk); }
.callout.danger { background: var(--c-red-bg); border-color: #fecaca; } .callout.danger .ic { color: var(--c-red-dk); }
.callout.ai { background: var(--c-purple-bg); border-color: #ddd6fe; } .callout.ai .ic { color: var(--c-purple-dk); }
.callout b { font-weight: 700; }

/* ---------- 21. Project card ---------- */
.pcard { background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-md); overflow: hidden;
  box-shadow: var(--sh-sm); transition: all var(--t); cursor: pointer; display: flex; flex-direction: column; }
.pcard:hover { border-color: var(--c-primary-softer); box-shadow: var(--sh-md); transform: translateY(-3px); }
.pcard .strip { height: 4px; }
.pcard .top { padding: 16px 17px 13px; display: flex; align-items: flex-start; gap: 12px; }
.pcard .em { width: 42px; height: 42px; border-radius: var(--r); display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.pcard .code { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; color: var(--c-text-3); letter-spacing: .02em; }
.pcard h3 { font-size: 14.5px; margin-top: 3px; line-height: 1.35; }
.pcard .cl { font-size: 12px; color: var(--c-text-2); margin-top: 3px; }
.pcard .mid { padding: 0 17px 14px; }
.pcard .kpis { display: flex; gap: 0; border-top: 1px solid var(--c-border-light); }
.pcard .kpi { flex: 1; padding: 11px 8px; text-align: center; border-right: 1px solid var(--c-border-light); }
.pcard .kpi:last-child { border-right: 0; }
.pcard .kpi .v { font-size: 15px; font-weight: 750; letter-spacing: -.02em; }
.pcard .kpi .l { font-size: 10px; font-weight: 600; color: var(--c-text-3); margin-top: 1px; text-transform: uppercase; letter-spacing: .05em; }
.pcard .foot { padding: 11px 17px; border-top: 1px solid var(--c-border-light); background: var(--c-muted); display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- 22. Detail layout ---------- */
.detail-hero { background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 20px 22px; box-shadow: var(--sh-sm); }
.kv { display: flex; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--c-border-light); }
.kv:last-child { border-bottom: 0; }
.kv .k { width: 132px; flex-shrink: 0; font-size: 12px; color: var(--c-text-2); font-weight: 600; }
.kv .v { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; }
.kv.stack { display: block; } .kv.stack .k { width: auto; margin-bottom: 4px; }
/* narrow side columns inside drawers: give the value more room */
.drawer .kv .k { width: 112px; }
.drawer .kv .v { text-align: right; }
.drawer .kv .v .user-line { justify-content: flex-end; }
.drawer .kv .v .user-line .grow { flex: 0 1 auto; }

.comment { display: flex; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--c-border-light); }
.comment:last-child { border-bottom: 0; }
.comment .bd { flex: 1; min-width: 0; }
.comment .hd { display: flex; align-items: baseline; gap: 8px; }
.comment .hd .nm { font-size: 13px; font-weight: 700; }
.comment .hd .tm { font-size: 11.5px; color: var(--c-text-3); }
.comment .tx { font-size: 13px; line-height: 1.6; margin-top: 4px; color: var(--c-text); }
.comment .tx .mention { color: var(--c-primary-hover); font-weight: 650; background: var(--c-primary-light); border-radius: 4px; padding: 0 4px; }

/* ---------- 23. Matrix / heatmap ---------- */
.matrix { display: grid; gap: 4px; }
.mcell { border-radius: var(--r-sm); padding: 10px 6px; text-align: center; font-size: 12px; font-weight: 700; transition: all var(--t); cursor: pointer; }
.mcell:hover { transform: scale(1.05); box-shadow: var(--sh-md); z-index: 2; }
.mcell.l1 { background: #dcfce7; color: #166534; } .mcell.l2 { background: #fef9c3; color: #854d0e; }
.mcell.l3 { background: #fed7aa; color: #9a3412; } .mcell.l4 { background: #fecaca; color: #991b1b; }
.mcell.l5 { background: #fca5a5; color: #7f1d1d; }
.heat-cell { height: 30px; border-radius: 5px; display: grid; place-items: center; font-size: 11px; font-weight: 700; transition: all var(--t); cursor: pointer; }
.heat-cell:hover { transform: scale(1.08); box-shadow: var(--sh); z-index: 2; }

/* ---------- 23b. Stage designer / stage flows ---------- */
.stage-list { display: flex; flex-direction: column; gap: 8px; }
.stage-row {
  display: flex; align-items: flex-start; gap: 11px; padding: 11px 12px;
  border: 1px solid var(--c-border); border-radius: var(--r); background: #fff; transition: all var(--t);
}
.stage-row:hover { border-color: var(--c-border-hover); box-shadow: var(--sh-xs); }
.stage-grip { display: flex; flex-direction: column; gap: 1px; padding-top: 2px; }
.stage-grip .icon-btn { width: 22px; height: 18px; border-radius: 5px; }
.stage-grip .icon-btn[disabled] { opacity: .25; pointer-events: none; }
.stage-swatch {
  width: 26px; height: 26px; border-radius: 8px; border: 2px solid #fff; flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--c-border); margin-top: 3px; transition: transform var(--t);
}
.stage-swatch:hover { transform: scale(1.12); }
.stage-name {
  width: 100%; border: 0; outline: 0; background: transparent; font-size: 13.5px; font-weight: 650;
  padding: 3px 6px; border-radius: 6px; border: 1px solid transparent; transition: all var(--t);
}
.stage-name:hover { border-color: var(--c-border); }
.stage-name:focus { border-color: var(--c-primary); background: #fff; box-shadow: 0 0 0 3px var(--c-focus-ring); }
.stage-type {
  height: 26px; padding: 0 24px 0 8px; border: 1px solid var(--c-border); border-radius: 7px;
  background: var(--c-sunken); font-size: 11.5px; font-weight: 600; color: var(--c-text-2);
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='3' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center;
}
.stage-wip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px;
  border: 1px solid var(--c-border); border-radius: 7px; background: var(--c-sunken);
  font-size: 11px; font-weight: 700; color: var(--c-text-3); text-transform: uppercase; letter-spacing: .05em;
}
.stage-wip input { width: 30px; border: 0; outline: 0; background: transparent; font-size: 12px;
  font-weight: 700; color: var(--c-text); text-align: center; text-transform: none; }
.chip.sm { height: 26px; padding: 0 9px; font-size: 11.5px; }
.stage-add {
  display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; margin-top: 10px;
  padding: 11px; border: 1.5px dashed var(--c-border-hover); border-radius: var(--r);
  color: var(--c-text-2); font-size: 13px; font-weight: 600; transition: all var(--t);
}
.stage-add:hover { border-color: var(--c-primary); color: var(--c-primary-hover); background: var(--c-primary-light); }

.stage-flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stage-flow .sf-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-pill);
  border: 1.5px solid var(--c-border); background: #fff; font-size: 12px; font-weight: 650;
  color: var(--c-text-3); white-space: nowrap; transition: all var(--t);
}
.stage-flow .sf-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.stage-flow .sf-pill.on { box-shadow: var(--sh-sm); }
.stage-flow .sf-pill.past { background: var(--c-muted); }
.stage-flow .sf-arrow { color: var(--c-border-hover); display: inline-flex; }
.stage-flow .sf-arrow.done { color: var(--c-primary-softer); }
.stage-flow.compact .sf-pill { padding: 3px 9px; font-size: 11px; }
.stage-flow [data-stage] { cursor: pointer; }
.stage-flow [data-stage]:hover { border-color: var(--c-primary); color: var(--c-primary-hover); }

.stepper { display: flex; align-items: flex-start; width: 100%; }
.stepper .step-node { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; width: 88px; }
.stepper .sn-dot {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--c-border-hover);
  background: #fff; display: grid; place-items: center; transition: all var(--t);
}
.stepper .step-node.on .sn-dot { box-shadow: 0 0 0 4px var(--c-focus-ring); }
.stepper .sn-label { font-size: 11px; font-weight: 600; color: var(--c-text-3); text-align: center; line-height: 1.3; }
.stepper .step-node.on .sn-label { color: var(--c-text); font-weight: 700; }
.stepper .step-node.done .sn-label { color: var(--c-text-2); }
.stepper .sn-line { flex: 1; height: 2px; background: var(--c-border); margin-top: 9px; border-radius: 2px; min-width: 12px; }
.stepper .sn-line.done { background: var(--c-green); }

/* ---------- 24. Misc ---------- */
.divider { height: 1px; background: var(--c-border-light); margin: 18px 0; }
.dot-sep { color: var(--c-text-3); }
.sk { background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 50%, #eef2f7 75%); background-size: 200% 100%; animation: sh 1.4s infinite; border-radius: var(--r-sm); }
@keyframes sh { to { background-position: -200% 0; } }
.fade-in { animation: fi .28s cubic-bezier(.4,0,.2,1); }
@keyframes fi { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-green); position: relative; }
.pulse-dot::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--c-green); opacity: .5; animation: pl 1.8s infinite; }
@keyframes pl { to { transform: scale(1.7); opacity: 0; } }

.ai-panel { background: linear-gradient(135deg, #faf5ff 0%, #eff6ff 100%); border: 1px solid #e9d5ff; border-radius: var(--r-md); padding: 16px 18px; }
.ai-panel .hd { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.ai-panel .hd .t { font-size: 13px; font-weight: 750; color: var(--c-purple-dk); }
.ai-sug { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; background: rgba(255,255,255,.75); border: 1px solid #ede9fe; border-radius: var(--r); margin-bottom: 8px; font-size: 12.5px; line-height: 1.5; }
.ai-sug:last-child { margin-bottom: 0; }

.print-only { display: none; }
@media print {
  .topbar, .rail, .side, .phead-actions, .toolbar, .no-print { display: none !important; }
  .main { margin: 0 !important; } .page { padding: 0; max-width: none; }
  .card, .stat { box-shadow: none; break-inside: avoid; }
  .print-only { display: block; }
  body { background: #fff; }
}

@media (max-width: 1150px) {
  :root { --side-w: 216px; }
  .gsearch { width: 240px; }
}
@media (max-width: 900px) {
  .side { display: none; }
  .main { margin-left: var(--rail-w); }
  .page { padding: 18px 16px 0; }
  .g-2, .g-4, .g-5, .field-row, .field-row.three { grid-template-columns: 1fr; }
  .gsearch { display: none; }
}
