/* KnowledgeBase — v2 UI (teal terminal / dashboard hybrid).
   Persistent left sidebar, rounded translucent cards, teal→cyan gradient
   accents, monospace terminal cues (> eyebrows, mono metadata, blinking caret).
   Fonts: IBM Plex Sans (UI/prose) + IBM Plex Mono (labels/meta/bodies), vendored.

   Two theme variables: --ac (accent, teal or cyan — set at runtime by
   terminal.js and persisted) and --hi (highlight cyan, constant). Every other
   translucent border/fill is fixed teal, exactly as the design specifies, so
   the tint switch only ever moves the gradient + accent hues. */
/*#00FFFB*/
:root {
  --ac: #0DBEBA;                 /* accent — themeable, written by terminal.js */
  --hi: #00FFFB;                 /* highlight cyan — constant */
  --on-ac: #04191b;             /* text on accent surfaces */
  --violet: #9B7BFF;            /* graph project node */
  --danger: #ff6a4d;

  --bg: #070f11;
  --sans: "IBM Plex Sans", system-ui, -apple-system, Segoe UI, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;

  /* text */
  --t-head: #eafffe;
  --t-body: #cfeceb;
  --t-2: rgba(207, 236, 235, 0.62);
  --t-3: rgba(207, 236, 235, 0.5);
  --t-mute: rgba(198, 235, 234, 0.45);

  /* surfaces */
  --panel: rgba(11, 26, 29, 0.72);
  --panel-2: rgba(11, 26, 29, 0.6);
  --input: rgba(6, 17, 19, 0.9);
  --sidebar: rgba(9, 22, 25, 0.85);
  --modal: #0a1719;

  --grad: linear-gradient(120deg, var(--ac), var(--hi));
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }

body {
  min-height: 100vh;
  background: radial-gradient(120% 80% at 82% -10%, #10262a 0%, #070f11 55%);
  color: var(--t-body);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--hi); text-decoration: none; }
a:hover { color: var(--ac); }
::placeholder { color: rgba(198, 235, 234, 0.32); }
:focus-visible { outline: 2px solid var(--hi); outline-offset: 2px; }
textarea { resize: vertical; }
select { appearance: none; -webkit-appearance: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(13, 190, 186, 0.28); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes kbPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes kbSpin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .caret, .link-ok .dot, .loading-dot, .skeleton span, .spin { animation: none; }
}

/* --- Fixed overlays --- */
.overlay-scan, .overlay-vignette { position: fixed; inset: 0; pointer-events: none; }
.overlay-scan {
  z-index: 60;
  opacity: 0.5;
  display: none;
  background: repeating-linear-gradient(to bottom,
    rgba(0, 0, 0, 0.22) 0, rgba(0, 0, 0, 0.22) 1px, transparent 1px, transparent 4px);
}
.scan-on .overlay-scan { display: block; }
.overlay-vignette {
  z-index: 61;
  background: radial-gradient(95% 80% at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.45) 100%);
}

/* ===================================================================
   Layout shell
   =================================================================== */
.app { display: flex; min-height: 100vh; position: relative; }

.sidebar {
  width: 252px;
  flex: 0 0 252px;
  min-height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
  align-self: flex-start;
  background: var(--sidebar);
  border-right: 1px solid rgba(13, 190, 186, 0.16);
  padding: 26px 18px 32px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.logo-mark {
  width: 30px; height: 30px; flex: none;
  color: var(--hi);
  filter: drop-shadow(0 0 10px rgba(13, 190, 186, 0.55));
}
.brand-text { display: flex; flex-direction: column; gap: 3px; }
.wordmark { font-size: 15px; font-weight: 600; letter-spacing: 0.1em; color: #e8fffe; }
.version { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.2em; color: rgba(13, 190, 186, 0.75); }

/* Nav */
.side-nav { display: flex; flex-direction: column; gap: 8px; }
.nav-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.24em;
  color: rgba(198, 235, 234, 0.38);
  padding: 0 10px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: rgba(207, 236, 235, 0.65);
  padding: 12px 14px;
  border-radius: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: 0.65; stroke: currentColor; fill: none; }
.nav-item:hover { background: rgba(13, 190, 186, 0.08); color: #dff6f5; }
.nav-item.active {
  background: var(--grad);
  color: var(--on-ac);
  font-weight: 600;
  box-shadow: 0 8px 26px rgba(13, 190, 186, 0.32);
}
.nav-item.active svg { opacity: 0.9; }

/* Vault stats */
.vault-stats { display: flex; flex-direction: column; gap: 10px; }
.stat-card {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(13, 190, 186, 0.07);
  border: 1px solid rgba(13, 190, 186, 0.16);
}
.stat-card + .stat-card { background: rgba(13, 190, 186, 0.05); border-color: rgba(13, 190, 186, 0.12); }
.stat-num { font-family: var(--mono); font-size: 26px; font-weight: 600; line-height: 1; }
.stat-num.hi { color: var(--hi); text-shadow: 0 0 18px rgba(0, 255, 251, 0.35); }
.stat-num.ac { color: var(--ac); }
.stat-cap { font-size: 12px; color: rgba(207, 236, 235, 0.55); }

/* Sidebar footer */
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 16px; }
.link-ok {
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  color: rgba(198, 235, 234, 0.45);
}
.link-ok .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--hi);
  box-shadow: 0 0 10px var(--hi);
  animation: kbPulse 1.8s ease-in-out infinite;
}
.tint-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  color: rgba(198, 235, 234, 0.45);
}
.tint-swatches { display: flex; gap: 7px; }
.tint { background: none; border: none; padding: 0; cursor: pointer; line-height: 0; }
.tint > span { display: block; width: 16px; height: 16px; border-radius: 5px; }
.tint[data-ac="#0DBEBA"] > span { background: rgba(13, 190, 186, 0.35); }
.tint[data-ac="#00FFFB"] > span { background: rgba(0, 255, 251, 0.35); }
.tint[data-ac="#0DBEBA"].active > span { background: #0DBEBA; outline: 1px solid #0DBEBA; outline-offset: 2px; box-shadow: 0 0 10px #0DBEBA; }
.tint[data-ac="#00FFFB"].active > span { background: #00FFFB; outline: 1px solid #00FFFB; outline-offset: 2px; box-shadow: 0 0 10px #00FFFB; }

.scan-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  color: rgba(198, 235, 234, 0.45);
  background: none; border: none; cursor: pointer;
}
.scan-toggle .scan-state {
  border-radius: 20px; padding: 3px 10px;
  border: 1px solid rgba(13, 190, 186, 0.35);
  color: rgba(198, 235, 234, 0.5);
}
.scan-toggle.on .scan-state {
  border-color: transparent;
  background: var(--ac);
  color: var(--on-ac);
}
.user-chip {
  display: flex; align-items: center; gap: 11px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(13, 190, 186, 0.06);
}
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 10px;
  background: var(--grad); color: var(--on-ac);
  font-weight: 600; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.user-text { display: flex; flex-direction: column; }
.user-name { font-size: 13px; color: #e2f7f6; }
.user-sub { font-size: 11px; color: rgba(207, 236, 235, 0.45); }

/* Main column */
.main { flex: 1; min-width: 0; padding: 34px 40px 70px; }
.screen { max-width: 1200px; }

/* ===================================================================
   Common content
   =================================================================== */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--ac);
  text-transform: uppercase;
  margin: 0 0 12px;
}
.eyebrow::before { content: "> "; }

h1 {
  font-size: 40px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--t-head);
  margin: 0 0 14px;
}
.caret {
  font-family: var(--mono); color: var(--hi);
  margin-left: 8px;
  animation: blink 1.1s steps(1, end) infinite;
}
.lede {
  font-size: 15px; line-height: 1.7;
  color: var(--t-2);
  max-width: 64ch;
  margin: 0 0 30px;
}

/* Panels / cards */
.card {
  border: 1px solid rgba(13, 190, 186, 0.16);
  background: var(--panel);
  border-radius: 20px;
  padding: 30px 30px 34px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  margin-bottom: 20px;
}

/* Forms */
label, .field-label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(198, 235, 234, 0.5);
  margin-bottom: 9px;
}
label .optional { color: rgba(198, 235, 234, 0.32); text-transform: none; letter-spacing: 0.06em; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px 28px; }
.form-row { margin-top: 26px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 15px;
  color: #dff6f5;
  background: var(--input);
  border: 1px solid rgba(13, 190, 186, 0.22);
  border-radius: 12px;
  padding: 13px 15px;
  transition: border-color 0.12s ease;
}
select option { background: #061113; color: #dff6f5; }
textarea {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.75;
  border-radius: 14px;
  padding: 16px;
  min-height: 150px;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, input[type="search"]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--hi);
}

.select-wrap { position: relative; }
.chevron { display: none; }

/* File dropzone */
.dropzone {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  border: 1px dashed rgba(13, 190, 186, 0.3);
  border-radius: 16px;
  background: rgba(13, 190, 186, 0.04);
  padding: 22px;
  cursor: pointer;
  margin-bottom: 0;
  text-transform: none; letter-spacing: normal;
}
.dropzone .file-btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--sans); font-size: 14px;
  color: var(--hi);
  background: rgba(0, 255, 251, 0.07);
  border: 1px solid rgba(0, 255, 251, 0.35);
  border-radius: 12px;
  padding: 11px 20px;
  white-space: nowrap;
  transition: background 0.12s ease;
}
.dropzone .file-btn svg { stroke: var(--hi); }
.dropzone:hover .file-btn { background: rgba(0, 255, 251, 0.15); }
.dropzone .drop-hint { font-size: 13px; color: rgba(207, 236, 235, 0.5); }

/* Buttons */
button { font-family: var(--sans); cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600;
  color: var(--on-ac);
  background: var(--grad);
  border: none;
  border-radius: 12px;
  padding: 14px 26px;
  box-shadow: 0 12px 32px rgba(13, 190, 186, 0.3);
  transition: box-shadow 0.12s ease;
}
.btn svg { stroke: var(--on-ac); fill: none; }
.btn:hover { box-shadow: 0 14px 40px rgba(0, 255, 251, 0.42); }
.btn:disabled { opacity: 0.6; cursor: wait; box-shadow: none; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--hi);
  background: rgba(0, 255, 251, 0.08);
  border: 1px solid rgba(0, 255, 251, 0.35);
  border-radius: 12px;
  padding: 11px 22px;
  transition: background 0.12s ease;
}
.btn-outline svg { stroke: currentColor; fill: none; }
.btn-outline:hover { background: rgba(0, 255, 251, 0.18); }
.btn-outline:disabled { opacity: 0.5; cursor: wait; }

.btn-danger {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--danger);
  background: transparent;
  border: 1px solid rgba(255, 106, 77, 0.4);
  border-radius: 12px;
  padding: 11px 20px;
  transition: background 0.12s ease;
}
.btn-danger svg { stroke: var(--danger); fill: none; }
.btn-danger:hover { background: rgba(255, 106, 77, 0.14); }
.btn-danger:disabled { opacity: 0.5; cursor: wait; }

.action-row { margin-top: 30px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.helper { font-size: 13px; color: rgba(207, 236, 235, 0.5); }
.kbd-hint { font-family: var(--mono); font-size: 12.5px; color: rgba(207, 236, 235, 0.45); }

/* ===================================================================
   Notes: filter bar + rows
   =================================================================== */
.filterbar {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid rgba(13, 190, 186, 0.2);
  background: var(--panel);
  border-radius: 16px;
  padding: 15px 20px;
}
.filterbar svg { display: none; }
.filterbar::before { content: "/"; font-family: var(--mono); font-size: 15px; color: var(--ac); }
.filterbar input {
  flex: 1;
  border: none; outline: none; padding: 0;
  font-size: 15px; color: #dff6f5; background: transparent;
}
.filterbar input:focus { border: none; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0 0; }
.filters .by {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(198, 235, 234, 0.45);
}
.filter-pill { position: relative; }
.filter-pill select {
  width: auto;
  font-size: 13px;
  color: #cfeceb;
  background: rgba(13, 190, 186, 0.07);
  border: 1px solid rgba(13, 190, 186, 0.2);
  border-radius: 20px;
  padding: 9px 16px;
  cursor: pointer;
}
.filter-pill select:hover { border-color: rgba(0, 255, 251, 0.4); }
.filter-pill.active select { border-color: var(--hi); background: rgba(13, 190, 186, 0.14); }
.clear-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; letter-spacing: 0.06em;
  color: var(--danger);
  background: transparent;
  border: 1px solid rgba(255, 106, 77, 0.4);
  border-radius: 20px;
  padding: 8px 14px;
  transition: background 0.12s ease;
}
.clear-btn:hover { background: rgba(255, 106, 77, 0.14); }
.clear-btn svg { stroke: var(--danger); fill: none; }

.count { font-size: 13px; color: rgba(207, 236, 235, 0.5); margin: 18px 0 0; text-align: right; }

.notes-list { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; counter-reset: note; }
.note-item {
  position: relative;
  counter-increment: note;
  border: 1px solid rgba(13, 190, 186, 0.14);
  background: var(--panel-2);
  border-radius: 18px;
  overflow: hidden;
  padding: 20px 24px 22px 68px;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.note-item:hover { border-color: rgba(0, 255, 251, 0.38); background: rgba(13, 190, 186, 0.08); }
.note-item::before {
  content: counter(note, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 44px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(13, 190, 186, 0.07);
  font-family: var(--mono); font-size: 12px; color: rgba(13, 190, 186, 0.8);
}
.note-item h2 {
  font-size: 19px; font-weight: 600; color: var(--t-head);
  margin: 0 0 8px;
}
.meta {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(198, 235, 234, 0.42);
  margin: 0 0 14px;
}
.note-body {
  border-left: 2px solid var(--ac);
  padding: 2px 0 2px 16px;
  font-family: var(--mono);
  font-size: 12.5px; line-height: 1.8;
  color: rgba(207, 236, 235, 0.6);
  white-space: pre-wrap; word-break: break-word;
  max-height: 220px; overflow: hidden;
  margin: 0 0 18px;
}
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.tag {
  font-family: var(--mono);
  font-size: 11.5px; color: rgba(207, 236, 235, 0.62);
  background: rgba(13, 190, 186, 0.08);
  border: 1px solid rgba(13, 190, 186, 0.2);
  border-radius: 8px;
  padding: 4px 10px;
}
.note-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.empty {
  text-align: center; padding: 56px 24px;
  color: rgba(207, 236, 235, 0.5); font-size: 14px;
}
.empty.card { padding: 48px 24px; }
.empty strong { color: var(--t-head); }

/* ===================================================================
   Search
   =================================================================== */
.query-box {
  display: flex; gap: 12px;
  border: 1px solid rgba(13, 190, 186, 0.28);
  border-radius: 14px;
  background: var(--input);
  padding: 16px 18px;
  transition: border-color 0.12s ease;
}
.query-box:focus-within { border-color: var(--hi); }
.query-box::before { content: ">"; font-family: var(--mono); font-size: 16px; color: var(--hi); line-height: 1.65; }
.search-textarea {
  flex: 1;
  font-family: var(--mono);
  min-height: 66px; font-size: 15px; line-height: 1.65;
  border: none; background: transparent; padding: 0; border-radius: 0;
}
.search-textarea:focus { border: none; }
.chips { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.chips .try {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(198, 235, 234, 0.45);
}
.chip {
  font-size: 13px; color: #cfeceb;
  background: rgba(13, 190, 186, 0.07);
  border: 1px solid rgba(13, 190, 186, 0.2);
  border-radius: 20px;
  padding: 10px 18px;
  transition: background 0.12s ease;
}
.chip:hover { background: rgba(13, 190, 186, 0.16); }

.answer { font-size: 14.5px; line-height: 1.9; color: rgba(219, 244, 243, 0.86); white-space: pre-wrap; }
.answer code {
  font-family: var(--mono); font-size: 12.5px;
  color: var(--hi);
  background: rgba(0, 255, 251, 0.08);
  border: 1px solid rgba(0, 255, 251, 0.3);
  border-radius: 8px;
  padding: 2px 7px;
}
.sources { margin-top: 26px; padding-top: 20px; border-top: 1px solid rgba(13, 190, 186, 0.16); }
.sources .label {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(198, 235, 234, 0.5);
  margin-bottom: 14px;
}
.sources ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.source-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; text-align: left;
  font-family: var(--mono); font-size: 12.5px;
  color: #e2f7f6;
  background: rgba(13, 190, 186, 0.1);
  border: 1px solid rgba(13, 190, 186, 0.3);
  border-radius: 14px;
  padding: 14px 18px;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.source-item svg { flex: none; stroke: var(--hi); fill: none; }
.source-item:hover { background: rgba(0, 255, 251, 0.16); border-color: rgba(0, 255, 251, 0.45); }

/* Loading state */
.loading-card { margin-top: 24px; }
.loading-status {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--mono);
  font-size: 13.5px; color: var(--t-2);
  margin: 0 0 22px;
}
.loading-status::before { content: ">"; color: var(--ac); }
.loading-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--hi); animation: kbPulse 1.1s ease-in-out infinite; }
.skeleton { display: flex; flex-direction: column; gap: 13px; }
.skeleton span { height: 12px; border-radius: 6px; background: rgba(13, 190, 186, 0.1); animation: kbPulse 1.4s ease-in-out infinite; }
.skeleton span:nth-child(1) { width: 92%; }
.skeleton span:nth-child(2) { width: 78%; }
.skeleton span:nth-child(3) { width: 85%; }
.skeleton span:nth-child(4) { width: 45%; }
.spin { animation: kbSpin 0.9s linear infinite; }

/* Search history panel */
.history-wrap { position: relative; }
.history-btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 13px; color: #cfeceb;
  background: rgba(13, 190, 186, 0.07);
  border: 1px solid rgba(13, 190, 186, 0.22);
  border-radius: 20px;
  padding: 9px 18px;
  transition: background 0.12s ease;
}
.history-btn svg { stroke: currentColor; fill: none; }
.history-btn:hover, .history-btn.open { background: rgba(13, 190, 186, 0.16); }
.history-panel {
  position: absolute; right: 0; top: calc(100% + 12px);
  width: min(560px, 92vw); max-height: 64vh; overflow: auto;
  background: var(--modal);
  border: 1px solid rgba(13, 190, 186, 0.35);
  border-radius: 18px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6);
  padding: 20px 18px;
  z-index: 40;
}
.history-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 14px; }
.history-head .title {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(198, 235, 234, 0.5);
}
.history-head .clear {
  background: none; border: none; padding: 4px 6px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--hi);
}
.history-head .clear:hover { color: var(--danger); }
.history-item {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; text-align: left;
  background: none; border: 1px solid transparent; border-radius: 12px;
  padding: 12px 10px;
  transition: background 0.12s ease;
}
.history-item:hover { background: rgba(13, 190, 186, 0.08); }
.history-item .q-icon { flex: none; margin-top: 3px; color: rgba(198, 235, 234, 0.42); stroke: currentColor; fill: none; }
.history-item .q-text { flex: 1; font-size: 14px; color: #dff6f5; line-height: 1.4; }
.history-item .q-when { display: block; font-family: var(--mono); font-size: 11px; color: rgba(198, 235, 234, 0.42); margin-top: 5px; }
.history-item .go { flex: none; margin-top: 4px; color: rgba(198, 235, 234, 0.42); stroke: currentColor; fill: none; }
.history-item:hover .go { color: var(--hi); }
.history-empty { font-size: 13px; color: rgba(207, 236, 235, 0.5); text-align: center; padding: 24px 10px; }

/* Read-only modal body */
.note-modal-body {
  border: 1px solid rgba(13, 190, 186, 0.16);
  border-radius: 16px;
  background: rgba(6, 17, 19, 0.7);
  padding: 22px;
  font-family: var(--mono);
  font-size: 12.5px; line-height: 1.85;
  color: rgba(207, 236, 235, 0.72);
  white-space: pre-wrap; word-break: break-word;
  max-height: 55vh; overflow: auto;
  margin: 22px 0 0;
}

/* Attachment hint on a note card */
.attach-hint {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 10px 0 0;
  font-family: var(--mono); font-size: 11.5px;
  color: rgba(13, 190, 186, 0.85);
}
.attach-hint svg { flex: none; stroke: currentColor; }

/* Attachments block in the read-only note modal */
.attachments { margin: 20px 0 0; }
.attach-label {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(198, 235, 234, 0.5); margin: 0 0 12px;
}
.attach-img {
  display: block; max-width: 100%; max-height: 60vh; height: auto;
  border: 1px solid rgba(13, 190, 186, 0.16); border-radius: 12px;
  margin: 0 0 12px; background: rgba(6, 17, 19, 0.7);
}
.attach-pdf {
  display: block; width: 100%; height: 60vh;
  border: 1px solid rgba(13, 190, 186, 0.16); border-radius: 12px;
  margin: 0 0 12px; background: rgba(6, 17, 19, 0.7);
}
.attach-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; margin: 0 0 10px;
  border: 1px solid rgba(13, 190, 186, 0.18); border-radius: 12px;
  background: rgba(6, 17, 19, 0.7);
}
.attach-chip svg { flex: none; stroke: rgba(13, 190, 186, 0.85); }
.attach-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: 12.5px; color: rgba(207, 236, 235, 0.82);
}
.attach-open {
  flex: none; font-family: var(--mono); font-size: 12px; text-decoration: none;
  color: var(--hi); border: 1px solid rgba(13, 190, 186, 0.35); border-radius: 8px;
  padding: 5px 12px;
}
.attach-open:hover { background: rgba(13, 190, 186, 0.12); }

/* Note-generation overlay (canvas animation) */
.gen-overlay {
  position: fixed; inset: 0; z-index: 120;
  display: none; align-items: center; justify-content: center;
  background: rgba(3, 9, 10, 0.82);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.gen-overlay.show { display: flex; animation: genFade 0.25s ease; }
@keyframes genFade { from { opacity: 0; } to { opacity: 1; } }
.gen-panel {
  position: relative; width: min(560px, 92vw);
  border: 1px solid rgba(13, 190, 186, 0.28); border-radius: 18px;
  background: rgba(6, 17, 19, 0.92);
  box-shadow: 0 0 0 1px rgba(0, 255, 251, 0.05), 0 30px 80px rgba(0, 0, 0, 0.6),
              inset 0 0 60px rgba(13, 190, 186, 0.05);
  padding: 20px 20px 18px; overflow: hidden;
}
.gen-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.gen-eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em; color: var(--ac); }
.gen-elapsed { font-family: var(--mono); font-size: 11px; color: rgba(198, 235, 234, 0.45); }
.gen-canvas { display: block; width: 100%; height: 240px; border-radius: 10px; }
.gen-status { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-family: var(--mono); font-size: 13px; color: rgba(207, 236, 235, 0.82); }
.gen-caret { color: var(--ac); animation: genBlink 1s steps(1) infinite; }
@keyframes genBlink { 50% { opacity: 0; } }
/* Reduced motion: no canvas churn — a calm pulsing bar stands in. */
.gen-overlay.reduced .gen-canvas { display: none; }
.gen-overlay.reduced .gen-panel { animation: genPulse 1.6s ease-in-out infinite; }
@keyframes genPulse { 0%, 100% { box-shadow: 0 0 0 1px rgba(0,255,251,0.05), 0 30px 80px rgba(0,0,0,0.6); } 50% { box-shadow: 0 0 0 1px rgba(0,255,251,0.18), 0 30px 80px rgba(0,0,0,0.6); } }
@media (prefers-reduced-motion: reduce) {
  .gen-overlay.show { animation: none; }
  .gen-caret { animation: none; }
}

/* Messages */
.msg {
  margin-top: 22px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  display: none;
}
.msg.error { display: block; background: rgba(255, 106, 77, 0.14); color: var(--danger); border: 1px solid rgba(255, 106, 77, 0.4); }
.msg.success { display: block; background: rgba(13, 190, 186, 0.1); color: #cfeceb; border: 1px solid rgba(13, 190, 186, 0.3); }
.msg.info { display: block; background: rgba(11, 26, 29, 0.6); color: var(--t-2); border: 1px solid rgba(13, 190, 186, 0.2); }
.msg.info::before, .msg.success::before { content: "> "; font-family: var(--mono); color: var(--ac); }

/* Generated note preview (Add) */
pre.note-preview {
  border: 1px solid rgba(13, 190, 186, 0.16);
  border-radius: 16px;
  background: rgba(6, 17, 19, 0.7);
  padding: 22px;
  white-space: pre-wrap; word-break: break-word;
  font-family: var(--mono);
  font-size: 12.5px; line-height: 1.85;
  color: rgba(207, 236, 235, 0.72);
  max-height: 420px; overflow: auto;
  margin: 0;
}
#preview-card h2 { font-size: 24px; font-weight: 600; color: var(--t-head); margin: 0 0 8px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(3, 10, 11, 0.78);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.modal {
  width: min(920px, 100%); max-height: 86vh; overflow: auto;
  background: var(--modal);
  border: 1px solid rgba(13, 190, 186, 0.35);
  border-radius: 22px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6), 0 0 60px rgba(13, 190, 186, 0.12);
  padding: 30px 34px 34px;
}
.modal .eyebrow { margin-bottom: 0; }
.modal h2 { font-size: 24px; font-weight: 600; color: var(--t-head); margin: 10px 0 10px; }
.modal .meta { margin: 10px 0 0; }

/* EasyMDE editor inside the edit modal, tinted to the v2 palette */
.modal .EasyMDEContainer { margin-top: 16px; }
.modal .EasyMDEContainer .CodeMirror {
  border: 1px solid rgba(13, 190, 186, 0.22);
  border-radius: 0 0 14px 14px;
  background: rgba(6, 17, 19, 0.9);
  font-family: var(--mono);
  font-size: 14px;
  color: #dff6f5;
}
.modal .EasyMDEContainer .CodeMirror-cursor { border-left-color: var(--hi); }
.modal .editor-toolbar {
  border: 1px solid rgba(13, 190, 186, 0.22);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  background: rgba(13, 190, 186, 0.06);
}
.modal .editor-toolbar button { color: #cfeceb !important; }
.modal .editor-toolbar button:hover { background: rgba(13, 190, 186, 0.14); border-color: rgba(13, 190, 186, 0.2); }
.modal .editor-toolbar i.separator { border-color: rgba(13, 190, 186, 0.16); }
.modal .editor-preview { background: var(--modal); color: rgba(219, 244, 243, 0.86); }

/* ===================================================================
   Graph view
   =================================================================== */
.graph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 16px;
  align-items: start;
}
.graph-canvas {
  border: 1px solid rgba(13, 190, 186, 0.18);
  background: var(--panel-2);
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}
.graph-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 16px 12px 20px;
  border-bottom: 1px solid rgba(13, 190, 186, 0.12);
}
.legend { display: flex; gap: 8px 16px; align-items: center; flex-wrap: wrap; }
.legend .lg {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.18em;
  color: rgba(198, 235, 234, 0.42);
}
.legend .lg .sw { border-radius: 50%; }
.legend .lg.client .sw { width: 11px; height: 11px; background: var(--hi); }
.legend .lg.project .sw { width: 9px; height: 9px; background: var(--violet); }
.legend .lg.note .sw { width: 7px; height: 7px; background: rgba(13, 190, 186, 0.45); }
.reset-btn {
  font-size: 12px; color: #cfeceb;
  background: rgba(13, 190, 186, 0.1);
  border: 1px solid rgba(13, 190, 186, 0.24);
  border-radius: 20px;
  padding: 8px 16px;
  transition: background 0.12s ease;
}
.reset-btn:hover { background: rgba(13, 190, 186, 0.2); }
.graph-stage { position: relative; }
.graph-stage svg {
  display: block; width: 100%; height: 560px;
  touch-action: none; cursor: grab;
  background: radial-gradient(70% 60% at 50% 45%, rgba(13, 190, 186, 0.07), transparent 70%);
}
.graph-stage svg.grabbing { cursor: grabbing; }
.graph-labels { position: absolute; inset: 0; pointer-events: none; }
.graph-labels .lbl {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-shadow: 0 1px 6px rgba(3, 12, 13, 0.9);
}
.graph-detail {
  border: 1px solid rgba(13, 190, 186, 0.18);
  background: var(--panel-2);
  border-radius: 20px;
  padding: 22px 22px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.graph-detail .kind { font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em; color: rgba(198, 235, 234, 0.45); }
.graph-detail .g-title { font-size: 19px; font-weight: 600; color: var(--t-head); line-height: 1.35; }
.graph-detail .g-body { font-size: 13.5px; line-height: 1.75; color: var(--t-2); }
.graph-detail .g-stats { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid rgba(13, 190, 186, 0.14); padding-top: 16px; }
.graph-detail .g-stat { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: rgba(198, 235, 234, 0.45); }
.graph-detail .g-stat .v { color: var(--hi); }
.graph-detail .g-open { align-self: flex-start; margin-top: 2px; }

/* ===================================================================
   Knowledge gaps (radar)
   =================================================================== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.stat-tile {
  border: 1px solid rgba(13, 190, 186, 0.16);
  background: var(--panel-2);
  border-radius: 16px;
  padding: 20px 22px;
}
.stat-tile .n { font-family: var(--mono); font-size: 30px; font-weight: 600; line-height: 1; color: var(--t-head); }
.stat-tile.gap .n { color: var(--danger); }
.stat-tile.ok .n { color: var(--hi); }
.stat-tile .k {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(198, 235, 234, 0.45);
  margin-top: 10px;
}

.gap-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.gap-toolbar .by {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(198, 235, 234, 0.45);
}
.seg { display: inline-flex; gap: 8px; }
.seg .chip.active {
  background: var(--grad);
  color: var(--on-ac);
  border-color: transparent;
  font-weight: 600;
}
.gap-toolbar .clear-btn { margin-left: auto; }

.gap-list { display: flex; flex-direction: column; gap: 12px; }
.gap-item {
  border: 1px solid rgba(13, 190, 186, 0.14);
  background: var(--panel-2);
  border-radius: 18px;
  padding: 18px 22px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.gap-item.is-gap { border-left: 3px solid var(--danger); }
.gap-item:hover { border-color: rgba(0, 255, 251, 0.3); background: rgba(13, 190, 186, 0.06); }
.gap-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.gap-q { font-size: 16px; color: var(--t-head); line-height: 1.4; flex: 1; }
.gap-badges { display: flex; align-items: center; gap: 8px; flex: none; }
.pill-tag {
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  border-radius: 20px; padding: 4px 10px;
}
.pill-tag.gap { color: var(--danger); background: rgba(255, 106, 77, 0.12); border: 1px solid rgba(255, 106, 77, 0.4); }
.pill-tag.ok { color: var(--hi); background: rgba(0, 255, 251, 0.08); border: 1px solid rgba(0, 255, 251, 0.3); }
.pill-tag.times { color: #cfeceb; background: rgba(13, 190, 186, 0.1); border: 1px solid rgba(13, 190, 186, 0.24); }
.gap-meta {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.08em;
  color: rgba(198, 235, 234, 0.42);
  margin-top: 10px;
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
}
.gap-meta .link-btn {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  color: var(--hi); background: none; border: none; padding: 0; cursor: pointer;
}
.gap-meta .link-btn:hover { text-decoration: underline; }
.gap-meta .link-btn.danger { color: var(--danger); }
.gap-answer {
  margin-top: 14px;
  border: 1px solid rgba(13, 190, 186, 0.16);
  border-radius: 12px;
  background: rgba(6, 17, 19, 0.7);
  padding: 16px 18px;
  font-family: var(--mono);
  font-size: 12.5px; line-height: 1.8;
  color: rgba(207, 236, 235, 0.72);
  white-space: pre-wrap; word-break: break-word;
}
.gap-sources { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.gap-sources .src {
  font-family: var(--mono); font-size: 11.5px;
  color: rgba(207, 236, 235, 0.62);
  background: rgba(13, 190, 186, 0.08);
  border: 1px solid rgba(13, 190, 186, 0.2);
  border-radius: 8px; padding: 4px 10px;
}

/* ===================================================================
   Accounts: login page, sidebar user/logout, roles, admin panel
   =================================================================== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card {
  width: min(420px, 100%);
  border: 1px solid rgba(13, 190, 186, 0.16);
  background: var(--panel);
  border-radius: 20px;
  padding: 34px 34px 30px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-title { font-size: 28px; margin: 0; }

/* Sidebar user chip → link to account, with role + logout */
.user-chip.link { cursor: pointer; text-decoration: none; }
.user-chip.link:hover { background: rgba(13, 190, 186, 0.1); }
.user-sub { text-transform: capitalize; }
.logout-btn {
  margin-left: auto;
  background: none; border: none; cursor: pointer;
  color: rgba(207, 236, 235, 0.5);
  padding: 6px; border-radius: 8px;
  display: inline-flex; align-items: center;
}
.logout-btn:hover { color: var(--danger); background: rgba(255, 106, 77, 0.12); }
.logout-btn svg { stroke: currentColor; fill: none; }

/* Role gate — hide write controls from viewers (server still enforces) */
[data-role="viewer"] .requires-write { display: none !important; }

/* Admin: users list */
.urow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px 20px;
  align-items: center;
  border: 1px solid rgba(13, 190, 186, 0.14);
  background: var(--panel-2);
  border-radius: 16px;
  padding: 16px 20px;
}
.urow.disabled { opacity: 0.55; }
.urow .who { min-width: 0; }
.urow .uname { font-size: 16px; color: var(--t-head); font-weight: 600; }
.urow .uname .you { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; color: var(--hi); margin-left: 8px; }
.urow .uemail { font-family: var(--mono); font-size: 12px; color: rgba(198, 235, 234, 0.5); margin-top: 4px; }
.urow .uctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.urow .uctl select { width: auto; padding: 8px 14px; border-radius: 20px; font-size: 13px; background: rgba(13, 190, 186, 0.07); }
.urow .link-btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  background: none; border: none; cursor: pointer; padding: 6px 4px;
  color: rgba(207, 236, 235, 0.7);
}
.urow .link-btn:hover { color: var(--hi); }
.urow .link-btn.danger { color: var(--danger); }
.urow .badge-off { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; color: var(--danger); border: 1px solid rgba(255,106,77,.4); border-radius: 20px; padding: 3px 9px; }
.urow .uscope { font-family: var(--mono); font-size: 11.5px; color: rgba(13, 190, 186, 0.8); margin-top: 7px; line-height: 1.5; }
.urow .uscope.warn { color: var(--danger); }

/* Scope editor (users.html: new-user form + edit-access modal) */
.scope-block { margin-top: 20px; }
.scope-editor {
  margin-top: 10px; border: 1px solid rgba(13, 190, 186, 0.16); border-radius: 14px;
  background: rgba(6, 17, 19, 0.6); padding: 6px; max-height: 340px; overflow: auto;
}
.scope-note { font-family: var(--mono); font-size: 12px; color: rgba(198, 235, 234, 0.55); padding: 12px 14px; margin: 0; }
.scope-group { border-radius: 10px; padding: 4px; }
.scope-group + .scope-group { margin-top: 2px; border-top: 1px solid rgba(13, 190, 186, 0.08); }
.scope-client, .scope-project {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: var(--t-body);
}
.scope-client { font-weight: 600; color: var(--t-head); }
.scope-client:hover, .scope-project:hover { background: rgba(13, 190, 186, 0.06); }
.scope-client input, .scope-project input { width: 16px; height: 16px; accent-color: var(--ac); cursor: pointer; margin: 0; }
.scope-projects { padding-left: 22px; display: flex; flex-direction: column; }
.scope-project { font-family: var(--mono); font-size: 12.5px; }

/* ===================================================================
   Responsive — sidebar collapses to a top bar below 900px
   =================================================================== */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; flex-basis: auto; min-height: 0; position: static;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 14px 20px;
    padding: 16px 18px;
    border-right: none; border-bottom: 1px solid rgba(13, 190, 186, 0.16);
  }
  .brand { padding: 0; }
  .side-nav { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .side-nav .nav-label { display: none; }
  .nav-item { padding: 10px 12px; }
  .vault-stats { display: none; }
  .side-foot { margin-top: 0; flex-direction: row; align-items: center; gap: 16px; flex-wrap: wrap; }
  .user-chip { padding: 8px 10px; }
  .main { padding: 26px 20px 60px; }
}
@media (max-width: 720px) {
  h1 { font-size: 32px; }
  .main { padding: 22px 14px 48px; }
  .modal-overlay { padding: 16px; }
  .modal { padding: 22px 20px 24px; }
  .graph-grid { grid-template-columns: 1fr; }
}

/* ===================================================================
   transitions.dev — 12 error-state-shake (login sign-in failure)
   Namespaced t-* classes; the .auth-card carries both is-error roles
   (message + border) and is the shaking element. Message reveal is
   scoped to .auth-card so the shared .msg on other pages is untouched.
   =================================================================== */
:root {
  --shake-distance: 6px;
  --shake-overshoot: 4px;
  --shake-dur-a: 80ms;
  --shake-dur-b: 60ms;
  --shake-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --revert-hold: 3000ms;
  --revert-dur: 280ms;
}

/* Border-color tween — the card owns the visible border; this rule
   only owns the interpolation. */
.t-input {
  transition: border-color 150ms ease-out;
  will-change: transform;
}
.auth-card.t-input.is-error {
  border-color: var(--danger);
  transition: border-color var(--revert-dur, 280ms) ease-out;
}

/* Error message reveal, scoped to the login card. Collapses height +
   padding + margin at idle so an empty #msg reserves no space under
   the button (DOM-fit adaptation over the snippet's opacity-only
   reveal). The .msg.error box styling still supplies bg/border/color. */
.auth-card .t-error-msg {
  display: block;
  opacity: 0;
  visibility: hidden;
  max-height: 0;
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  transition:
    opacity     var(--revert-dur, 280ms) ease-out,
    max-height  var(--revert-dur, 280ms) ease-out,
    margin-top  var(--revert-dur, 280ms) ease-out,
    padding-top var(--revert-dur, 280ms) ease-out,
    padding-bottom var(--revert-dur, 280ms) ease-out,
    visibility  0s linear var(--revert-dur, 280ms);
}
.auth-card.is-error .t-error-msg {
  opacity: 1;
  visibility: visible;
  max-height: 6em;
  margin-top: 22px;
  padding-top: 12px;
  padding-bottom: 12px;
  transition:
    opacity     var(--revert-dur, 280ms) ease-out,
    max-height  var(--revert-dur, 280ms) ease-out,
    margin-top  var(--revert-dur, 280ms) ease-out,
    padding-top var(--revert-dur, 280ms) ease-out,
    padding-bottom var(--revert-dur, 280ms) ease-out,
    visibility  0s linear 0s;
}

/* Multi-segment keyframe with per-stop easing so each leg of the
   shake follows its own cubic-bezier independently. %-stops are
   cumulative durations as a fraction of the total (80, 60, 80, 60
   = 280ms): 28.57%, 57.14%, 78.57%, 100%. */
.t-input.is-shaking {
  animation: t-input-shake calc(
      var(--shake-dur-a) * 2 + var(--shake-dur-b) * 2
    ) linear;
}
@keyframes t-input-shake {
  0%      { transform: translateX(0);                                animation-timing-function: var(--shake-ease); }
  28.57%  { transform: translateX(var(--shake-distance));            animation-timing-function: var(--shake-ease); }
  57.14%  { transform: translateX(calc(var(--shake-distance) * -1)); animation-timing-function: var(--shake-ease); }
  78.57%  { transform: translateX(var(--shake-overshoot));           animation-timing-function: var(--shake-ease); }
  100%    { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .t-input { animation: none !important; transform: none !important; }
}

/* ===================================================================
   transitions.dev — 06 modal open / close (all .modal-overlay dialogs)
   The open/close state lives on .modal-overlay (it owns display +
   backdrop), so the dialog's scale is keyed off the overlay's class
   rather than the snippet's .t-modal.is-open directly — DOM-fit
   adaptation. Scale / opacity / easing / durations are verbatim.
   Driven by openModal()/closeModal() in /assets/modal.js.
   =================================================================== */
:root {
  --modal-open-dur: 250ms;
  --modal-close-dur: 150ms;
  --modal-scale: 0.96;
  --modal-scale-close: 0.96;
  --modal-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Backdrop fade. Base opacity:0 covers the one-frame gap between
   display:flex and the .is-open class the orchestration adds next
   frame, so the scale-up actually animates. */
.modal-overlay {
  opacity: 0;
  transition: opacity var(--modal-open-dur) var(--modal-ease);
}
.modal-overlay.is-open { opacity: 1; }
.modal-overlay.is-closing {
  opacity: 0;
  transition: opacity var(--modal-close-dur) var(--modal-ease);
}

/* Dialog surface scales up from --modal-scale to 1. */
.t-modal {
  transform-origin: center;
  transform: scale(var(--modal-scale));
  opacity: 0;
  transition:
    transform var(--modal-open-dur) var(--modal-ease),
    opacity   var(--modal-open-dur) var(--modal-ease);
  will-change: transform, opacity;
}
.modal-overlay.is-open .t-modal {
  transform: scale(1);
  opacity: 1;
}
.modal-overlay.is-closing .t-modal {
  transform: scale(var(--modal-scale-close));
  opacity: 0;
  transition:
    transform var(--modal-close-dur) var(--modal-ease),
    opacity   var(--modal-close-dur) var(--modal-ease);
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay, .t-modal { transition: none !important; }
}
