/* =========================================================
   VMCC / Comeketo — Fusion Components
   Dark system widget vocabulary, recolored for paper.
   ========================================================= */

/* =====================================================
   PANEL — the foundational data plate
   ===================================================== */
.panel {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: 20px 22px;
  position: relative;
}
.panel.deep { background: var(--card-2); }
.panel.well {                     /* recessed — for data dense plates */
  background: var(--well);
  border-color: var(--rule-2);
  box-shadow: inset 0 1px 0 rgba(20,20,15,0.04);
}
.panel.float {                    /* floats above paper, for important review/judgment surfaces */
  background: var(--card);
  border-color: var(--rule);
  box-shadow: var(--shadow-md);
}
.panel.glow {                     /* live / sweeping state */
  border-color: var(--cy-edge);
  box-shadow: 0 0 0 1px var(--cy-edge), 0 0 32px -10px rgba(27,158,146,0.25);
}
.panel.ink {                      /* inverted for headers / emphasis blocks */
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink-2);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.panel-head .title {
  font-size: var(--t-md);
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.005em;
}
.panel-head .right { margin-left: auto; display:flex; align-items:center; gap:8px; }
.panel-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--fg-mute);
}

/* key-value mono table for metadata */
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 14px;
  row-gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
}
.kv .k { color: var(--fg-faint); }
.kv .v { color: var(--fg-mute); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* =====================================================
   PILL — universal status / tag / count
   ===================================================== */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
  background: var(--card);
  border: 1px solid var(--rule);
  color: var(--fg);
  white-space: nowrap;
}
.pill .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: inline-block;
}
.pill .dot.ok    { background: var(--ok);    box-shadow: 0 0 0 3px rgba(77,122,71,0.16); }
.pill .dot.warn  { background: var(--warn);  box-shadow: 0 0 0 3px rgba(142,119,36,0.16); }
.pill .dot.danger{ background: var(--danger);box-shadow: 0 0 0 3px rgba(163,63,63,0.18); }
.pill .dot.attn  { background: var(--attn);  box-shadow: 0 0 0 3px rgba(176,113,46,0.18); }
.pill .dot.link  { background: var(--link);  box-shadow: 0 0 0 3px rgba(63,90,142,0.18); }
.pill .dot.ai    { background: var(--ai);    box-shadow: 0 0 0 3px rgba(111,91,176,0.18); }
.pill .dot.cy    { background: var(--cy-bright); box-shadow: 0 0 0 3px var(--cy-halo); animation: pulse-ring 1.8s ease-out infinite; }
.pill .dot.idle  { background: var(--fg-faint); }

.pill.cy     { background: var(--cy-bg); color: var(--cy-shade); border-color: var(--cy-edge); }
.pill.solid-cy { background: var(--cy); color: #062825; border-color: var(--cy); font-weight: 500; }
.pill.ink    { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pill.ghost  { background: transparent; }
.pill.warn   { color: #5A4A12; background: rgba(176,113,46,0.10); border-color: rgba(176,113,46,0.32); }
.pill.danger { color: #6E2828; background: rgba(163,63,63,0.08); border-color: rgba(163,63,63,0.32); }
.pill.ok     { color: var(--ok); background: rgba(77,122,71,0.08); border-color: rgba(77,122,71,0.32); }
.pill.mono   { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.02em; }
.pill.tiny   { padding: 2px 8px; font-size: 10.5px; gap: 5px; }
.pill.big    { padding: 6px 14px; font-size: 13px; }

/* status chip vocabulary — for module headers */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 8px;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: var(--r-pill);
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; }
.chip-ready   { background: var(--st-ready-bg);   color: var(--st-ready-ink); }
.chip-ready .dot { background: var(--st-ready-dot); }
.chip-pending { background: var(--st-pending-bg); color: var(--st-pending-ink); }
.chip-pending .dot { background: var(--st-pending-dot); }
.chip-locked  { background: var(--st-locked-bg);  color: var(--st-locked-ink); }
.chip-locked .dot { background: var(--st-locked-dot); }
.chip-exp     { background: var(--st-exp-bg);     color: var(--st-exp-ink); }
.chip-exp .dot { background: var(--st-exp-dot); }
.chip-needs   { background: var(--st-needs-bg);   color: var(--st-needs-ink); }
.chip-needs .dot { background: var(--st-needs-dot); }
.chip-blocked { background: var(--st-blocked-bg); color: var(--st-blocked-ink); }
.chip-blocked .dot { background: var(--st-blocked-dot); }
.chip-live    { background: var(--st-live-bg);    color: var(--st-live-ink); border: 1px solid var(--cy-edge); }
.chip-live .dot { background: var(--cy-bright); box-shadow: 0 0 0 3px var(--cy-halo); animation: pulse-ring 1.8s ease-out infinite; }

/* badge — small numeric counter */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--ink); color: var(--paper);
  border-radius: 999px;
  font: 600 10.5px var(--sans);
  font-feature-settings: "tnum";
}
.badge.cy { background: var(--cy); color: #062825; }
.badge.warn { background: var(--attn); color: #fff; }
.badge.danger { background: var(--danger); color: #fff; }
.badge.outline { background: transparent; color: var(--fg-dim); border: 1px solid var(--rule); }

/* =====================================================
   BUTTON
   ===================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  font: 500 13px/1 var(--sans);
  letter-spacing: 0.005em;
  background: var(--card);
  border: 1px solid var(--rule);
  color: var(--fg);
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
}
.btn:hover { background: var(--card-2); border-color: var(--rule-2); }
.btn:active { transform: translateY(0.5px); }
.btn.ink     { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.ink:hover { background: var(--ink-2); }
.btn.cy      { background: var(--cy); color: #062825; border-color: var(--cy); font-weight: 500; }
.btn.cy:hover { background: var(--cy-shade); color: #fff; border-color: var(--cy-shade); }
.btn.ghost   { background: transparent; }
.btn.ghost:hover { background: rgba(22,22,26,0.04); }
.btn.danger  { color: #6E2828; border-color: rgba(163,63,63,0.32); background: rgba(163,63,63,0.06); }
.btn.danger:hover { background: rgba(163,63,63,0.12); }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.lg { padding: 12px 18px; font-size: 14px; border-radius: 12px; }
.btn .kbd-i {
  font-family: var(--mono); font-size: 10.5px; color: var(--fg-mute);
  padding: 2px 5px;
  background: rgba(22,22,26,0.04);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.btn.cy .kbd-i { background: rgba(0,0,0,0.10); border-color: rgba(0,0,0,0.18); color: #062825; }
.btn:disabled, .btn.locked {
  background: var(--card);
  border-color: var(--rule);
  color: var(--fg-faint);
  cursor: not-allowed;
  position: relative;
}
.btn.locked::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, transparent 0 4px, rgba(22,22,26,0.025) 4px 5px);
  border-radius: inherit;
  pointer-events: none;
}

.iconbtn {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--fg-dim);
  cursor: pointer;
  flex: 0 0 auto;
}
.iconbtn:hover { background: var(--card-2); color: var(--fg); }
.iconbtn.lg { width: 40px; height: 40px; }
.iconbtn.circle { border-radius: 999px; }
.iconbtn.ghost { background: transparent; border-color: transparent; }
.iconbtn.ghost:hover { background: rgba(22,22,26,0.05); }

/* segmented */
.seg {
  display: inline-flex;
  padding: 3px;
  background: var(--well);
  border: 1px solid var(--rule);
  border-radius: 10px;
  gap: 2px;
}
.seg .opt {
  padding: 6px 12px;
  font-size: 12px;
  color: var(--fg-mute);
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 500;
}
.seg .opt.on { background: var(--ink); color: var(--paper); }
.seg .opt:hover:not(.on) { color: var(--fg); }

/* =====================================================
   KEYBOARD
   ===================================================== */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 6px;
  font: 500 11px/1 var(--mono);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--fg-dim);
  min-width: 18px;
}

/* =====================================================
   INPUTS
   ===================================================== */
.input {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  color: var(--fg);
  font-size: 13px;
  font-family: var(--sans);
}
.input .ph { color: var(--fg-mute); }
.input:focus-within { border-color: var(--cy-edge); box-shadow: 0 0 0 3px var(--cy-bg); }

/* =====================================================
   LIVE / HEARTBEAT
   ===================================================== */
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 var(--cy-halo); opacity: 1; }
  60%  { box-shadow: 0 0 0 8px transparent; opacity: 0.5; }
  100% { box-shadow: 0 0 0 10px transparent; opacity: 1; }
}
@keyframes pulse-fade {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes ekg {
  to { stroke-dashoffset: -2000; }
}
@keyframes pulse-ring-warn {
  0%   { box-shadow: 0 0 0 0 rgba(176,113,46,0.5); opacity: 1; }
  60%  { box-shadow: 0 0 0 8px transparent; opacity: 0.5; }
  100% { box-shadow: 0 0 0 10px transparent; opacity: 1; }
}

.heartbeat-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--cy-bright);
  display: inline-block;
  position: relative;
}
.heartbeat-dot::after {
  content: "";
  position: absolute; inset: -4px;
  border-radius: 999px;
  border: 1.5px solid var(--cy);
  opacity: 0;
  animation: ring 1.8s ease-out infinite;
}
@keyframes ring {
  0%   { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.4); opacity: 0; }
}

.ekg-strip {
  height: 22px;
  width: 100%;
  overflow: visible;
}
.ekg-strip path {
  stroke: var(--cy);
  stroke-width: 1.4;
  fill: none;
  stroke-dasharray: 2400;
  animation: ekg 14s linear infinite;
}

/* =====================================================
   MODULE CARD (the building block of role pages)
   ===================================================== */
.module {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: 20px 22px 16px;
  display: flex; flex-direction: column;
  gap: 14px;
  position: relative;
  min-height: 200px;
}
.module.pending {
  background: var(--card-2);
  border-style: dashed;
  border-color: var(--rule-2);
}
.module.pending .module-body { opacity: 0.55; }
.module.live {
  border-color: var(--cy-edge);
  box-shadow: 0 0 0 1px var(--cy-edge), 0 0 24px -10px rgba(27,158,146,0.25);
}
.module-head {
  display: flex; align-items: flex-start; gap: 10px;
}
.module-head .titles { flex: 1; min-width: 0; }
.module-head .title {
  font-family: var(--sans);
  font-size: var(--t-md);
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.005em;
  margin: 0;
}
.module-head .sub {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--fg-mute);
  margin-top: 4px;
}
.module-stat {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 44px;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--fg);
}
.module-stat .delta {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--ok);
  margin-left: 8px;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.module-stat .delta.dn { color: var(--danger); }

/* small inline divider inside modules */
.module hr.div { border:0; height:1px; background: var(--rule); margin: 0; }

/* =====================================================
   ROW (used in lists inside modules: cadence breaks, etc.)
   ===================================================== */
.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--rule);
  align-items: center;
}
.list-row:last-child { border-bottom: 0; }
.list-row .who {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--fg);
  font-weight: 500;
}
.list-row .meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-mute);
  margin-top: 2px;
}
.list-row .right { display: flex; align-items: center; gap: 8px; }

/* =====================================================
   BARS (mini horizontal bars for lost-reason etc.)
   ===================================================== */
.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 44px;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.bar-row .lbl {
  font-size: 12.5px; color: var(--fg-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-row .bar {
  height: 6px;
  background: var(--well);
  border-radius: 3px;
  overflow: hidden;
}
.bar-row .bar > i {
  display: block; height: 100%;
  background: var(--ink);
  border-radius: 3px;
}
.bar-row .bar > i.cy   { background: var(--cy); }
.bar-row .bar > i.warn { background: var(--attn); }
.bar-row .bar > i.peach{ background: var(--peach-dot); }
.bar-row .num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* =====================================================
   TABLE
   ===================================================== */
table.t {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 12.5px;
}
table.t th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-mute);
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule);
}
table.t td {
  padding: 10px;
  border-bottom: 1px dashed var(--rule);
  color: var(--fg-dim);
  vertical-align: middle;
}
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: rgba(22,22,26,0.02); }
table.t .num { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }

/* =====================================================
   LOCK BANNER (global execution lock) — paper version
   ===================================================== */
.lock-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 24px;
  background: var(--peach-bg);
  color: var(--peach-ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(176,113,46,0.32);
  position: relative;
  overflow: hidden;
}
.lock-banner::before {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(176,113,46,0.06) 6px 7px);
  pointer-events: none;
}
.lock-banner > * { position: relative; }
.lock-banner svg { color: var(--peach-ink); }
.lock-banner .lbl-strong {
  font-weight: 600;
  color: var(--peach-ink);
}
.lock-banner .lbl-detail {
  color: var(--peach-ink);
  opacity: 0.78;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--sans);
  font-size: 12px;
}
.lock-banner .right {
  margin-left: auto;
  display: flex; align-items: center; gap: 14px;
  color: var(--peach-ink);
  opacity: 0.65;
}
.lock-banner .right a {
  color: var(--peach-ink);
  opacity: 1;
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px solid rgba(176,113,46,0.4);
}

/* =====================================================
   ICONS
   ===================================================== */
.ic {
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

/* =====================================================
   ARTIFACT PATH PILL — for "source: leads.md" lines
   ===================================================== */
.path-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-dim);
  background: var(--well);
  border: 1px solid var(--rule);
  border-radius: 6px;
  letter-spacing: 0.02em;
}
.path-pill svg { color: var(--fg-mute); }

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty {
  padding: 24px 18px;
  border: 1px dashed var(--rule-2);
  border-radius: var(--r-card);
  background: var(--card-2);
  color: var(--fg-mute);
  font-size: 12.5px;
  display: flex; align-items: center; gap: 14px;
}
.empty .icn {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--well);
  border: 1px solid var(--rule);
  color: var(--fg-faint);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}

/* =====================================================
   AVATAR / INITIAL
   ===================================================== */
.avi {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--card-2);
  border: 1px solid var(--rule);
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 11px/1 var(--sans);
  color: var(--fg-dim);
  flex: 0 0 auto;
}
.avi.peach { background: var(--peach-bg); color: var(--peach-ink); border-color: rgba(176,113,46,0.32); }
.avi.mint  { background: var(--mint-bg);  color: var(--mint-ink); border-color: rgba(77,122,71,0.32); }
.avi.sky   { background: var(--sky-bg);   color: var(--sky-ink); border-color: rgba(63,90,142,0.32); }
.avi.lav   { background: var(--lav-bg);   color: var(--lav-ink); border-color: rgba(111,91,176,0.32); }
.avi.rose  { background: var(--rose-bg);  color: var(--rose-ink); border-color: rgba(163,63,63,0.32); }

/* =====================================================
   SPARKLINE
   ===================================================== */
.sparkline { height: 32px; width: 100%; }
.sparkline path { stroke: var(--cy); stroke-width: 1.5; fill: none; }
.sparkline .area { fill: var(--cy-bg); stroke: none; }
.sparkline.ink path { stroke: var(--ink); }
.sparkline.ink .area { fill: rgba(22,22,26,0.06); }
