/* Tensor Legal — shared tokens and components (site + app).
   Dark is the default theme; [data-theme="light"] on <html> switches to light. */
:root {
  --fs-xs: 11.5px;
  --fs-sm: 13px;
  --fs-base: 14.5px;
  --fs-md: 16px;
  --fs-lg: 19px;
  --fs-xl: 24px;
  --fs-2xl: 32px;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #0a0b0e;
  --bg-2: #0f1115;
  --panel: #14161b;
  --panel-2: #1a1d23;
  --panel-3: #22262e;
  --line: rgba(255,255,255,.07);
  --line-2: rgba(255,255,255,.13);
  --text: #ecebe6;
  --muted: #a1a3ab;
  --faint: #6c6f79;
  --accent: #d6c29a;        /* champagne */
  --accent-2: #b89f6c;
  --accent-ink: #18130a;
  --accent-soft: rgba(214,194,154,.12);
  --logo-ink: #f4f2ec;
  --blue: #86a8ff;   --blue-soft: rgba(134,168,255,.13);
  --green: #63d39c;  --green-soft: rgba(99,211,156,.13);
  --amber: #f1b65c;  --amber-soft: rgba(241,182,92,.14);
  --red: #ff7d7d;    --red-soft: rgba(255,125,125,.13);
  --violet: #b8a2ff; --violet-soft: rgba(184,162,255,.13);
  --ins: rgba(99,211,156,.18);
  --del: rgba(255,125,125,.16);
  --shadow: 0 20px 60px rgba(0,0,0,.45);
  --radius: 14px;
  --radius-sm: 9px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f3ee;
  --bg-2: #efece5;
  --panel: #ffffff;
  --panel-2: #f8f6f1;
  --panel-3: #efebe3;
  --line: rgba(20,18,12,.08);
  --line-2: rgba(20,18,12,.15);
  --text: #17150f;
  --muted: #5f5c55;
  --faint: #8f8b82;
  --accent: #8a6d34;
  --accent-2: #6f5626;
  --accent-ink: #fffaf0;
  --accent-soft: rgba(138,109,52,.1);
  --logo-ink: #111111;
  --blue: #2f5fd6;   --blue-soft: rgba(47,95,214,.09);
  --green: #1f8a57;  --green-soft: rgba(31,138,87,.1);
  --amber: #a8650a;  --amber-soft: rgba(168,101,10,.1);
  --red: #c43b3b;    --red-soft: rgba(196,59,59,.09);
  --violet: #6a4fd1; --violet-soft: rgba(106,79,209,.09);
  --ins: rgba(31,138,87,.14);
  --del: rgba(196,59,59,.12);
  --shadow: 0 20px 50px rgba(30,25,10,.14);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: var(--fs-base); line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }
.serif { font-family: var(--font-serif); font-weight: 400; letter-spacing: -.02em; font-optical-sizing: auto; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--font-mono); font-size: .92em; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 9px; font-size: var(--fs-sm); font-weight: 500;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  transition: background .15s, border-color .15s, transform .1s; white-space: nowrap;
}
.btn:hover { background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--text); color: var(--bg); border-color: transparent; }
.btn-primary:hover { background: var(--accent); color: var(--accent-ink); }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-accent:hover { filter: brightness(1.08); background: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-sm { height: 30px; padding: 0 11px; font-size: var(--fs-xs); }
.btn-lg { height: 46px; padding: 0 22px; font-size: var(--fs-base); }
.btn-danger { color: var(--red); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center;
  color: var(--muted); border: 1px solid transparent;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* badges, pills, dots */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 500; background: var(--panel-3); color: var(--muted); white-space: nowrap;
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.gold { background: var(--accent-soft); color: var(--accent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.kbd {
  font-family: var(--font-mono); font-size: 11px; padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--line-2); color: var(--faint); background: var(--panel);
}
.eyebrow { font-size: var(--fs-xs); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); font-weight: 500; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 18px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: var(--fs-base); }

/* inputs */
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--bg-2); outline: none; transition: border-color .15s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: var(--fs-sm); color: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-weight: 500; color: var(--faint); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover { background: var(--panel-2); }

/* tabs */
.tabs { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); width: max-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { height: 30px; padding: 0 14px; border-radius: 999px; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 0 var(--line-2) inset; }
.tab .count { font-size: 11px; color: var(--faint); }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-size: 11px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #5b6476, #2d323c);
}
.avatar.a1 { background: linear-gradient(135deg, #c79a5b, #6f4f25); }
.avatar.a2 { background: linear-gradient(135deg, #6c8dfa, #3349a6); }
.avatar.a3 { background: linear-gradient(135deg, #4fbf8c, #1f6b4c); }
.avatar.a4 { background: linear-gradient(135deg, #b48cff, #5b3aa8); }
.avatar.a5 { background: linear-gradient(135deg, #f07c7c, #9a3434); }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

.logo-mark { width: 22px; height: 22px; flex: none; }
.logo-mark use, .ico.logo use { stroke: none; }
.brand { white-space: nowrap; display: inline-flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: -.01em; }
.brand .serif { font-size: 22px; font-weight: 400; }

/* reference type: Source Serif 4 at display optical size, tight tracking */
h1, h2, h3 { font-optical-sizing: auto; }
.caps { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); font-weight: 500; }

/* Tensor dropdown (assets/select.js): the real <select> is hidden, a themed button and menu stand in */
.tsel { position: relative; display: block; width: 100%; height: 38px; }
.tsel.tsel-auto { display: inline-block; width: auto; }
.tsel[hidden] { display: none !important; }
.tsel-native { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; pointer-events: none; }
.tsel-btn {
  position: relative; display: flex; align-items: center; width: 100%; height: 100%; min-height: 28px;
  padding: 0 36px 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2);
  color: var(--text); font: inherit; font-size: var(--fs-sm, 14px); text-align: left; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.tsel-btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
.tsel-btn:focus-visible, .tsel.is-open .tsel-btn { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tsel-btn:disabled { opacity: .55; cursor: not-allowed; }
.tsel-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsel-chev { position: absolute; right: 12px; top: 50%; width: 14px; height: 14px; margin-top: -7px; color: var(--faint); transition: transform .15s; pointer-events: none; }
.tsel.is-open .tsel-chev { transform: rotate(180deg); color: var(--accent); }
.tsel-bare { height: auto; }
.tsel-bare .tsel-btn { border: 0; background: transparent; padding: 2px 22px 2px 0; height: auto; font-size: inherit; font-weight: 500; box-shadow: none; }
.tsel-bare .tsel-chev { right: 2px; }
.tsel-menu {
  position: fixed; z-index: 200; display: none; padding: 5px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow, 0 12px 40px rgba(0,0,0,.35));
  font-size: var(--fs-sm, 14px);
}
.tsel-menu.open { display: block; animation: tsel-in .12s ease; }
@keyframes tsel-in { from { opacity: 0; transform: translateY(-3px); } }
.tsel-opt { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 6px; border-radius: 8px; cursor: pointer; color: var(--text); white-space: nowrap; }
.tsel-opt.hl { background: var(--panel-3); }
.tsel-opt.on { color: var(--accent); }
.tsel-opt.dis { opacity: .45; cursor: default; }
.tsel-check { width: 16px; height: 16px; flex: none; display: grid; place-items: center; }
.tsel-check svg { width: 14px; height: 14px; }
.tsel-group { padding: 8px 10px 4px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.tsel-bare.is-open .tsel-btn, .tsel-bare .tsel-btn:focus-visible { box-shadow: none; color: var(--accent); }
.tsel-bare .tsel-btn:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
