/* kit.css: the Deep Ink component kit. Every screen, modal and admin tool is built
   from these classes. Scales and colours come from tokens.css; themes change colour only.
   States: :hover · :active · :focus-visible · [aria-pressed|selected|checked] · :disabled · .is-loading */

/* ---------- type ---------- */
.sv-title-1 { font-family: var(--sv-font-display); font-weight: 600; font-size: var(--sv-fs-46); line-height: 1.08; letter-spacing: var(--sv-ls-title);
  background: var(--sv-text-headline); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 0 rgba(0,0,0,.9)); margin: 0; }
.sv-title-2 { font-family: var(--sv-font-display); font-weight: 600; font-size: var(--sv-fs-24); line-height: 1.2; letter-spacing: var(--sv-ls-title); color: var(--sv-text); margin: 0; }
.sv-title-3 { font-family: var(--sv-font-display); font-weight: 600; font-size: var(--sv-fs-19); line-height: 1.2; letter-spacing: var(--sv-ls-title); color: var(--sv-text); margin: 0; }
.sv-eyebrow, .sv-label { font-family: var(--sv-font-display); font-weight: 600; font-size: var(--sv-fs-12); letter-spacing: var(--sv-ls-label); line-height: 1.3; }
.sv-eyebrow { color: var(--sv-violet); }
.sv-label { color: var(--sv-text-dim); display: block; }
.sv-text { font-family: var(--sv-font-body); font-size: var(--sv-fs-17); line-height: 1.45; color: var(--sv-text-soft); }
.sv-text--muted { color: var(--sv-text-muted); }
.sv-text--italic { font-style: italic; }
.sv-data { font-family: var(--sv-font-mono); font-size: var(--sv-fs-12); letter-spacing: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .sv-title-1 { font-size: var(--sv-fs-34); } }

/* ---------- icons ---------- */
.sv-icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: square; stroke-linejoin: miter; vertical-align: middle; }
.sv-icon--20 { width: 20px; height: 20px; }
.sv-icon--fill { fill: currentColor; stroke: none; }

/* ---------- buttons ---------- */
.sv-btn { position: relative; box-sizing: border-box; height: var(--sv-h-md); padding: 0 var(--sv-space-4); display: inline-flex; align-items: center; justify-content: center; gap: var(--sv-space-2);
  white-space: nowrap; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  font-family: var(--sv-font-display); font-weight: 600; font-size: var(--sv-fs-14); letter-spacing: var(--sv-ls-control); line-height: 1; text-transform: none;
  color: var(--sv-text-soft); background: var(--sv-surface-control); border: 1px solid var(--sv-line-strong); border-radius: var(--sv-r); box-shadow: var(--sv-e-button);
  transition: color var(--sv-t1) var(--sv-ease), border-color var(--sv-t1) var(--sv-ease), background-color var(--sv-t1) var(--sv-ease); }
.sv-btn:hover { color: var(--sv-text); border-color: var(--sv-rim); }
.sv-btn:active { transform: translateY(1px); box-shadow: var(--sv-e-pressed); }
.sv-btn:focus-visible { outline: var(--sv-focus); outline-offset: 2px; }
.sv-btn[aria-pressed="true"], .sv-btn.is-selected { color: var(--sv-text); border-color: var(--sv-rim); background-color: rgba(var(--sv-glow-rgb),.08); }
.sv-btn:disabled, .sv-btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; transform: none; }
.sv-btn.is-loading { color: transparent !important; text-shadow: none !important; pointer-events: none; }
.sv-btn.is-loading::after { content: ""; position: absolute; width: 14px; height: 14px; border: 1.25px solid rgba(var(--sv-glow-rgb),.25); border-top-color: var(--sv-violet-bright); border-radius: 50%; animation: sv-spin .9s linear infinite; }
.sv-btn--primary { color: var(--sv-on-primary); background: var(--sv-surface-primary); border-color: var(--sv-rim); box-shadow: var(--sv-e-primary); text-shadow: 0 1px 0 rgba(0,0,0,.8); }
.sv-btn--primary:hover { color: var(--sv-on-primary); border-color: var(--sv-violet-bright); }
.sv-btn--quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--sv-text-muted); }
.sv-btn--quiet:hover { border-color: var(--sv-line-2); color: var(--sv-text); }
.sv-btn--danger { color: var(--sv-danger); border-color: rgba(220,90,78,.45); }
.sv-btn--danger:hover { color: var(--sv-danger); border-color: var(--sv-danger); background-color: rgba(220,90,78,.08); }
.sv-btn--lg { height: var(--sv-h-lg); padding: 0 var(--sv-space-5); }
.sv-btn--sm { height: var(--sv-h-sm); padding: 0 var(--sv-space-3); gap: 6px; font-size: var(--sv-fs-12); }
.sv-btn--icon { width: var(--sv-h-md); padding: 0; }
.sv-btn--icon.sv-btn--sm { width: var(--sv-h-sm); }
.sv-btn--icon.sv-btn--lg { width: var(--sv-h-lg); }
.sv-btn--block { width: 100%; }

/* ---------- tabs ---------- */
.sv-tabs { display: flex; gap: var(--sv-space-5); border-bottom: 1px solid var(--sv-line); overflow-x: auto; scrollbar-width: none; }
.sv-tabs::-webkit-scrollbar { display: none; }
.sv-tab { height: var(--sv-h-md); padding: 0; display: inline-flex; align-items: center; gap: var(--sv-space-2); flex: none; cursor: pointer; background: none; border: 0; border-radius: 0;
  font-family: var(--sv-font-display); font-weight: 600; font-size: var(--sv-fs-14); letter-spacing: var(--sv-ls-control); color: var(--sv-text-muted);
  box-shadow: none; transition: color var(--sv-t1) var(--sv-ease); }
.sv-tab:hover { color: var(--sv-text); }
.sv-tab[aria-selected="true"], .sv-tab.is-selected { color: var(--sv-violet-bright); box-shadow: var(--sv-e-underline); }
.sv-tab:focus-visible { outline: var(--sv-focus); outline-offset: 2px; }
.sv-tab:disabled { opacity: .4; cursor: not-allowed; }
.sv-tab__count { font-family: var(--sv-font-mono); font-size: var(--sv-fs-11); color: var(--sv-text-dim); }

/* ---------- fields ---------- */
.sv-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sv-input, .sv-select, .sv-textarea { box-sizing: border-box; width: 100%; min-width: 0; height: var(--sv-h-md); padding: 0 var(--sv-space-3);
  font-family: var(--sv-font-body); font-size: var(--sv-fs-17); color: var(--sv-text); background: var(--sv-surface-field);
  border: 1px solid var(--sv-line-2); border-radius: var(--sv-r); outline: none; transition: border-color var(--sv-t1) var(--sv-ease); }
.sv-textarea { height: auto; min-height: 96px; padding: var(--sv-space-2) var(--sv-space-3); line-height: 1.45; resize: vertical; font-family: var(--read-font, var(--sv-font-read)); }
.sv-input::placeholder, .sv-textarea::placeholder { color: var(--sv-placeholder); font-style: italic; }
.sv-input:hover, .sv-select:hover, .sv-textarea:hover { border-color: var(--sv-line-strong); }
.sv-input:focus, .sv-select:focus, .sv-textarea:focus { border-color: var(--sv-rim); }
.sv-input:focus-visible, .sv-select:focus-visible, .sv-textarea:focus-visible { outline: var(--sv-focus); outline-offset: 2px; }
.sv-input:disabled, .sv-select:disabled, .sv-textarea:disabled { opacity: .4; cursor: not-allowed; }
.sv-input[aria-invalid="true"], .sv-textarea[aria-invalid="true"] { border-color: var(--sv-danger); }
.sv-select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--sv-violet) 50%), linear-gradient(135deg, var(--sv-violet) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.sv-hint { font-family: var(--sv-font-body); font-style: italic; font-size: var(--sv-fs-14); color: var(--sv-text-dim); }
.sv-hint--error { font-style: normal; color: var(--sv-danger); }

/* ---------- choices ---------- */
.sv-toggle { position: relative; flex: none; width: 40px; height: 22px; padding: 0; cursor: pointer; border: 1px solid var(--sv-line-strong); border-radius: var(--sv-r); background: var(--sv-surface-field); transition: background-color var(--sv-t2) var(--sv-ease), border-color var(--sv-t2) var(--sv-ease); }
.sv-toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: var(--sv-r-badge); background: var(--sv-text-muted); transition: left var(--sv-t2) var(--sv-ease), background-color var(--sv-t2) var(--sv-ease); }
.sv-toggle[aria-checked="true"] { border-color: var(--sv-rim); background: var(--sv-surface-primary); }
.sv-toggle[aria-checked="true"]::after { left: 21px; background: var(--sv-violet-bright); }
.sv-toggle:disabled { opacity: .4; cursor: not-allowed; }
.sv-toggle:focus-visible { outline: var(--sv-focus); outline-offset: 2px; }
.sv-seg { display: inline-flex; border: 1px solid var(--sv-line-2); border-radius: var(--sv-r); }
.sv-seg__btn { height: var(--sv-h-sm); padding: 0 var(--sv-space-3); cursor: pointer; background: none; border: 0; border-radius: 0; color: var(--sv-text-muted);
  font-family: var(--sv-font-display); font-weight: 600; font-size: var(--sv-fs-12); letter-spacing: var(--sv-ls-control); transition: color var(--sv-t1) var(--sv-ease); }
.sv-seg__btn + .sv-seg__btn { border-left: 1px solid var(--sv-line-2); }
.sv-seg__btn:hover { color: var(--sv-text); }
.sv-seg__btn[aria-pressed="true"] { color: var(--sv-violet-bright); background: rgba(var(--sv-glow-rgb),.06); box-shadow: var(--sv-e-underline); }
.sv-seg__btn:focus-visible { outline: var(--sv-focus); outline-offset: -2px; }
.sv-chip { height: 28px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; background: none;
  font-family: var(--sv-font-display); font-weight: 600; font-size: var(--sv-fs-12); letter-spacing: var(--sv-ls-control); color: var(--sv-text-soft);
  border: 1px solid var(--sv-line-2); border-radius: var(--sv-r); transition: border-color var(--sv-t1) var(--sv-ease), color var(--sv-t1) var(--sv-ease); }
.sv-chip:hover { border-color: var(--sv-rim); }
.sv-chip[aria-pressed="true"], .sv-chip.is-selected { border-color: var(--sv-rim); color: var(--sv-violet-bright); background: rgba(var(--sv-glow-rgb),.06); }
.sv-chip:disabled { opacity: .4; cursor: not-allowed; }
.sv-chip:focus-visible { outline: var(--sv-focus); outline-offset: 2px; }
.sv-badge { height: 20px; padding: 0 6px; display: inline-flex; align-items: center; white-space: nowrap; font-family: var(--sv-font-display); font-weight: 700; font-size: var(--sv-fs-11);
  letter-spacing: var(--sv-ls-control); color: var(--sv-bg); background: var(--sv-grad-badge); border-radius: var(--sv-r-badge); }
.sv-badge--line { background: none; color: var(--sv-text-muted); border: 1px solid var(--sv-line-2); font-weight: 600; }
.sv-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--sv-bg); }
.sv-dot--online { background: var(--sv-success); } .sv-dot--away { background: var(--sv-warning); }
.sv-dot--dnd { background: var(--sv-danger); } .sv-dot--off { background: var(--sv-tint-slate); }

/* ---------- surfaces ---------- */
.sv-card, .sv-panel { position: relative; box-sizing: border-box; background: var(--sv-surface-card); border: 1px solid var(--sv-line); border-radius: var(--sv-r); box-shadow: var(--sv-e-raised); }
.sv-card { padding: var(--sv-space-4) var(--sv-space-4); transition: border-color var(--sv-t1) var(--sv-ease); }
.sv-card--hover { cursor: pointer; }
.sv-card--hover:hover { border-color: var(--sv-line-strong); }
.sv-card.is-selected { border-color: var(--sv-rim); box-shadow: var(--sv-e-raised), var(--sv-e-selected); }
.sv-card:focus-visible { outline: var(--sv-focus); outline-offset: 2px; }
.sv-card--new { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sv-space-3); background: none; box-shadow: none;
  border: 1px dashed var(--sv-line-strong); color: var(--sv-text-muted); font-family: var(--sv-font-display); font-weight: 600; font-size: var(--sv-fs-14); letter-spacing: var(--sv-ls-control); cursor: pointer; }
.sv-card--new:hover { border-color: var(--sv-rim); color: var(--sv-text); }
.sv-card--new .sv-card__mark { width: var(--sv-h-md); height: var(--sv-h-md); display: grid; place-items: center; border: 1px solid var(--sv-line-strong); color: var(--sv-violet-bright); }
.sv-section-head { display: flex; align-items: center; gap: var(--sv-space-4); margin: var(--sv-space-6) 0 var(--sv-space-4); }
.sv-section-head__rule, .sv-rule { flex: 1; height: 1px; background: var(--sv-line); border: 0; margin: 0; }
.sv-section-head__link { display: inline-flex; align-items: center; gap: 6px; font-family: var(--sv-font-display); font-weight: 600; font-size: var(--sv-fs-12); letter-spacing: var(--sv-ls-control); color: var(--sv-violet); background: none; border: 0; cursor: pointer; padding: 0; }
.sv-section-head__link:hover { color: var(--sv-violet-bright); }

/* ---------- layout utilities ---------- */
.sv-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sv-space-4); padding: var(--sv-space-3) 0; border-bottom: 1px solid var(--sv-line); }
.sv-stack { display: flex; flex-direction: column; gap: var(--sv-space-1); min-width: 0; }
.sv-stack--2 { gap: var(--sv-space-2); } .sv-stack--3 { gap: var(--sv-space-3); } .sv-stack--4 { gap: var(--sv-space-4); } .sv-stack--5 { gap: var(--sv-space-5); }
.sv-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sv-space-2); }
.sv-cluster--3 { gap: var(--sv-space-3); }
.sv-spacer { flex: 1; }
.sv-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.sv-clamp-2, .sv-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.sv-clamp-2 { -webkit-line-clamp: 2; } .sv-clamp-3 { -webkit-line-clamp: 3; }
.sv-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- overlays ---------- */
.sv-modal { position: fixed; inset: 0; z-index: var(--sv-z-modal); display: grid; place-items: center; padding: var(--sv-space-4); background: rgba(var(--sv-ground-rgb),.72); }
.sv-modal[hidden], .sv-modal.hidden { display: none; }
.sv-modal, .modal { z-index: calc(var(--sv-z-modal) + var(--sv-layer, 0) * 2); }
.sv-modal__panel { box-sizing: border-box; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--sv-surface-overlay); border: 1px solid var(--sv-line-2); border-radius: var(--sv-r); box-shadow: var(--sv-e-overlay); }
.sv-modal__panel--wide { width: min(880px, 100%); }
.sv-modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sv-space-3); padding: var(--sv-space-3) var(--sv-space-4); border-bottom: 1px solid var(--sv-line); }
.sv-modal__title { font-family: var(--sv-font-display); font-weight: 600; font-size: var(--sv-fs-19); letter-spacing: var(--sv-ls-title); color: var(--sv-text); margin: 0; }
.sv-modal__body { padding: var(--sv-space-4); overflow-y: auto; font-family: var(--sv-font-body); font-size: var(--sv-fs-17); color: var(--sv-text-soft); }
.sv-modal__foot { display: flex; justify-content: flex-end; gap: var(--sv-space-2); padding: var(--sv-space-3) var(--sv-space-4); border-top: 1px solid var(--sv-line); }
@media (max-width: 720px) {
  .sv-modal { place-items: end stretch; padding: 0; }
  .sv-modal__panel { width: 100%; max-height: 92vh; border-bottom: 0; }
  .sv-modal__foot { flex-wrap: wrap; } .sv-modal__foot .sv-btn { flex: 1; }
}
.sv-menu { position: absolute; z-index: var(--sv-z-menu); min-width: 200px; padding: var(--sv-space-1); background: var(--sv-surface-overlay); border: 1px solid var(--sv-line-2); border-radius: var(--sv-r); box-shadow: var(--sv-e-overlay); }
.sv-menu__item { width: 100%; height: var(--sv-h-md); padding: 0 var(--sv-space-3); display: flex; align-items: center; gap: var(--sv-space-3); cursor: pointer; text-align: left; background: none; border: 0; border-radius: var(--sv-r);
  font-family: var(--sv-font-body); font-size: var(--sv-fs-17); color: var(--sv-text-soft); transition: background-color var(--sv-t1) var(--sv-ease), color var(--sv-t1) var(--sv-ease); }
.sv-menu__item:hover, .sv-menu__item:focus-visible { background: rgba(var(--sv-glow-rgb),.06); color: var(--sv-text); outline: none; }
.sv-menu__item--danger { color: var(--sv-danger); }
.sv-menu__sep { height: 1px; margin: var(--sv-space-1) 0; background: var(--sv-line); }
.sv-toast { position: fixed; left: 50%; bottom: var(--sv-space-6); transform: translateX(-50%); z-index: var(--sv-z-toast); max-width: min(520px, calc(100vw - 32px));
  padding: var(--sv-space-3) var(--sv-space-4); background: var(--sv-surface-overlay); border: 1px solid var(--sv-rim); border-radius: var(--sv-r); box-shadow: var(--sv-e-overlay);
  font-family: var(--sv-font-body); font-size: var(--sv-fs-17); color: var(--sv-text); animation: sv-rise var(--sv-t2) var(--sv-ease) both; }
.sv-toast[hidden], .sv-toast.hidden { display: none; }
.sv-notice { display: flex; align-items: center; gap: var(--sv-space-3); padding: var(--sv-space-3) var(--sv-space-4); border: 1px solid var(--sv-line-2); border-left: 2px solid var(--sv-violet); border-radius: var(--sv-r);
  background: var(--sv-surface-field); font-family: var(--sv-font-body); font-size: var(--sv-fs-17); color: var(--sv-text-soft); }
.sv-notice--error { border-left-color: var(--sv-danger); }
.sv-notice .sv-btn { margin-left: auto; }

@keyframes sv-spin { to { transform: rotate(360deg); } }
@keyframes sv-rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .sv-btn.is-loading::after { animation-duration: 1.6s; } .sv-toast { animation: none; } }

/* Post-merge (2026-10-05): a dialog footer whose every control is hidden is not drawn
   (the Hallucination Check's footer holds only "Fix it", shown when there is a fix). */
.sv-modal__foot:not(:has(> :not(.hidden, [hidden]))) { display: none; }
