/* Jalten design system: shared components. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--harbour-strong); text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-xs); }
::selection { background: var(--harbour-soft); }

.vh {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.eyebrow { display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: 0; color: var(--brand); }
.icon { width: 1em; height: 1em; max-width: none; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Concept notice: a quiet strip on every page */
.concept-bar {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: 6px 16px; background: var(--night); color: #c3cddd;
  font-size: 12.5px; line-height: 1.4; text-align: center;
}
.concept-bar strong { color: #fff; font-weight: 600; }
.concept-bar a { color: #fff; }
.concept-bar .sep { opacity: 0.35; }
.concept-bar .ctx { display: inline-flex; align-items: center; gap: 8px; }
.concept-bar .ctx a { color: #fff; }
.concept-bar .role-chip { padding: 1px 8px; border-radius: 5px; background: rgba(255, 255, 255, 0.12); color: #fff; font-weight: 600; }
.concept-bar .assumed { color: #a9b7cf; }
@media (max-width: 1280px) { .concept-bar .why { display: none; } }
@media (max-width: 760px) { .concept-bar .assumed { display: none; } }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.logo svg { width: 26px; height: 26px; }
.logo span { font-size: 18.5px; font-weight: 650; letter-spacing: -0.03em; }
.logo-lockup { display: block; width: 84px; height: auto; }
.logo:has(.logo-lockup) { min-height: 28px; } /* the old word line was 28px tall; keep every layout where it was */

/* Buttons: squared, not pills */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 0 14px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 550; text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--surface-2); border-color: #b7c0c9; }
.btn:active { background: var(--canvas-2); }
.btn .icon { font-size: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--white); box-shadow: 0 1px 2px rgba(29, 79, 191, 0.25); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:active { background: var(--brand-deep); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--white); }
.btn-dark:hover { background: #262c32; border-color: #262c32; }
.btn-quiet { background: transparent; border-color: transparent; box-shadow: none; }
.btn-quiet:hover { background: var(--canvas-2); border-color: transparent; }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red-line); background: var(--red-bg); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn-lg { min-height: 44px; padding: 0 20px; font-size: 15px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r);
  border: 1px solid transparent; background: transparent; color: var(--ink-3);
}
.icon-btn:hover { background: var(--canvas-2); color: var(--ink); }
.icon-btn .icon { font-size: 18px; }

/* Badges (statuses and tags: the only full pills) */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 12px; font-weight: 550; white-space: nowrap;
  background: var(--canvas-2); color: var(--ink-2); border: 1px solid transparent;
}
.badge .icon { font-size: 13px; }
.badge-protect { background: var(--safe); color: var(--brand-deep); }
.badge-harbour { background: var(--harbour-soft); color: var(--harbour-strong); }
.badge-warn { background: var(--amber-bg); color: var(--amber); }
.badge-danger { background: var(--red-bg); color: var(--red); }
.badge-outline { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.badge-concept { background: transparent; border: 1px dashed var(--line-strong); color: var(--ink-3); }
.badge-dark { background: var(--ink); color: var(--white); }

/* Filter chips */
.chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 550; color: var(--ink-2); white-space: nowrap;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip[aria-pressed="true"], .chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--white); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }

/* Segmented control */
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--canvas-2); border: 1px solid var(--line); border-radius: var(--r); }
.seg button {
  border: 0; background: transparent; min-height: 28px; padding: 0 12px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 550; color: var(--ink-3);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), var(--shadow-1); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  position: relative; border: 0; background: none; padding: 10px 12px 12px; font-size: 14px; font-weight: 550;
  color: var(--ink-3); white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--brand); }
.tabs .count { margin-left: 6px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; letter-spacing: -0.01em; }
.card-head .sub { font-size: 13px; color: var(--ink-3); }

/* Forms */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; min-height: 38px; padding: 8px 12px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--white); color: var(--ink); font-size: 14.5px;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--harbour); box-shadow: var(--focus); }
.input::placeholder, .textarea::placeholder { color: #808a94; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%233d454d' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.help { font-size: 12.5px; color: var(--ink-3); }

/* Toggle */
.toggle { position: relative; display: inline-flex; width: 38px; height: 22px; flex: none; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: var(--canvas-3); transition: background 0.15s; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 2px rgba(0,0,0,.22); transition: transform 0.15s; }
.toggle input:checked + span { background: var(--brand); }
.toggle input:checked + span::after { transform: translateX(16px); }
.toggle input:focus-visible + span { box-shadow: var(--focus); }
.toggle input:disabled { cursor: not-allowed; }
.toggle input:disabled + span { opacity: 0.55; }

/* Checkbox */
.check { display: inline-flex; align-items: flex-start; gap: 9px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }

/* Avatar */
.avatar {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--canvas-2); color: var(--ink-2); font-size: 12px; font-weight: 650; flex: none; letter-spacing: 0;
}
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }

/* Provider marks: small and subordinate to Jalten */
.pmark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--r-sm); background: var(--white); border: 1px solid var(--line); flex: none; }
.pmark img { width: 13px; height: 13px; }
.pmark-lg { width: 30px; height: 30px; border-radius: var(--r); }
.pmark-lg img { width: 17px; height: 17px; }
.mdot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; flex: none; }

/* Tables */
.table-wrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .r { text-align: right; }
.cell-person { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.cell-person b { font-weight: 550; display: block; }
.cell-person small { color: var(--ink-3); font-size: 12.5px; }

/* Meter */
.meter { height: 6px; border-radius: 999px; background: var(--canvas-2); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.meter.warn > i { background: #c27c12; }
.meter.over > i { background: var(--red); }

/* Notices */
.notice {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 13.5px;
}
.notice .icon { font-size: 17px; margin-top: 1px; color: var(--brand); }
.notice-harbour { background: var(--harbour-soft); border-color: var(--harbour-line); color: #1b3f86; }
.notice-harbour .icon { color: var(--harbour-strong); }
.notice-warn { background: var(--amber-bg); border-color: var(--amber-line); color: #5c3606; }
.notice-warn .icon { color: var(--amber); }

/* Overlays */
.scrim { position: fixed; inset: 0; background: rgba(16, 27, 50, 0.42); z-index: 80; animation: fade 0.15s ease-out; }
.dialog {
  position: fixed; z-index: 90; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-3); border: 1px solid var(--line);
  animation: pop 0.16s ease-out;
}
.dialog-lg { width: min(760px, calc(100vw - 32px)); }
.dialog-head { display: flex; gap: 12px; align-items: flex-start; padding: 18px 22px 14px; border-bottom: 1px solid var(--line-soft); }
.dialog-head .dicon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r); background: var(--safe); color: var(--brand); flex: none; }
.dialog-head .dicon .icon { font-size: 18px; }
.dialog-head h2 { font-size: 18px; }
.dialog-head p { color: var(--ink-3); font-size: 14px; margin-top: 3px; }
.dialog-head .icon-btn { margin-left: auto; margin-top: -4px; }
.dialog-body { padding: 16px 22px 18px; overflow-y: auto; }
.dialog-foot { display: flex; align-items: center; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); flex-wrap: wrap; }
.dialog-foot .note { margin-right: auto; font-size: 13px; color: var(--ink-3); }

.drawer {
  position: fixed; z-index: 90; top: 0; right: 0; bottom: 0; width: min(460px, 100vw);
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-3);
  display: flex; flex-direction: column; animation: slide 0.2s ease-out;
}
.drawer .dialog-foot { border-radius: 0; margin-top: auto; }

.popover {
  position: absolute; z-index: 70; min-width: 240px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: 6px; animation: popover 0.12s ease-out;
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none;
  border-radius: var(--r-sm); text-align: left; font-size: 14px; color: var(--ink); text-decoration: none;
}
.menu-item:hover, .menu-item.is-active { background: var(--canvas-2); }
.menu-item[aria-disabled="true"] { color: var(--ink-3); cursor: not-allowed; }
.menu-label { padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line-soft); }

.toast-host { position: fixed; z-index: 120; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r);
  background: var(--ink); color: var(--white); font-size: 14px; box-shadow: var(--shadow-3); animation: rise 0.18s ease-out; max-width: calc(100vw - 32px);
}
.toast .icon { color: var(--brand-on-night); font-size: 17px; }

.tooltip {
  position: fixed; z-index: 130; pointer-events: none; padding: 8px 10px; border-radius: var(--r); background: var(--ink); color: var(--white);
  font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow-2); max-width: 260px;
}
.tooltip b { font-weight: 600; }
.tooltip .row { display: flex; align-items: center; gap: 7px; }
.tooltip .row span:last-child { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }

/* Protected text marks */
.mark-masked { background: #dce9fd; color: var(--brand-deep); box-shadow: inset 0 0 0 1px var(--safe-line); border-radius: 4px; padding: 0 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.mark-token { font-family: var(--mono); font-size: 0.86em; background: var(--canvas-2); color: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-xs); padding: 0 4px; white-space: nowrap; }
.mark-restored { color: inherit; text-decoration: underline dotted var(--brand-mark); text-decoration-thickness: 2px; text-underline-offset: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.mark-noticed { box-shadow: inset 0 -2px 0 #d9a440; }
.mark-asis { background: var(--amber-bg); color: #5c3606; border-radius: 2px; padding: 0 2px; }

/* Empty states */
.empty { display: grid; justify-items: center; gap: 8px; padding: 40px 20px; text-align: center; color: var(--ink-3); }
.empty .icon { font-size: 24px; color: var(--ink-4); }
.empty b { color: var(--ink); font-weight: 600; }

/* Charts */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--mono); font-size: 11px; fill: var(--ink-3); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 3px 10px 3px 8px; font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.legend button:hover { border-color: var(--line-strong); }
.legend button[aria-pressed="false"] { opacity: 0.5; }
.legend button[aria-pressed="false"] .mdot { background: var(--ink-4) !important; }
.hbars { display: grid; gap: 11px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 160px) 1fr auto; gap: 12px; align-items: center; font-size: 13.5px; }
.hbar .lab { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbar .lab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 8px; border-radius: 2px; background: var(--canvas-2); overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 2px; transition: width 0.45s cubic-bezier(.2,.7,.2,1); }
.hbar .val { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); text-align: right; min-width: 64px; }
.hbar.is-hidden .track { background: repeating-linear-gradient(-45deg, var(--canvas-2) 0 5px, var(--surface) 5px 10px); }
.hbar.is-hidden .val { color: var(--ink-3); }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48.5%); } }
@keyframes popover { from { opacity: 0; transform: translateY(-3px); } }
@keyframes slide { from { transform: translateX(20px); opacity: 0; } }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Model speed and cost meta */
.mmeta { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.mmeta .spd { display: inline-flex; gap: 2px; align-items: flex-end; }
.mmeta .spd i { display: block; width: 3px; border-radius: 1px; background: var(--canvas-3); }
.mmeta .spd i:nth-child(1) { height: 6px; } .mmeta .spd i:nth-child(2) { height: 9px; } .mmeta .spd i:nth-child(3) { height: 12px; }
.mmeta .spd i.on { background: var(--brand); }
.mmeta .cst { font-family: var(--mono); font-size: 11.5px; letter-spacing: -0.02em; }
.mmeta .cst b { display: inline; font-size: inherit; font-weight: 500; color: #b8c0c8; }
.mmeta .cst b.on { color: var(--ink-2); }
[data-icon] { flex: none; }

/* No access: a private page the signed-in role can't use (simulated) */
.denied { flex: 1; display: grid; place-items: center; padding: 32px 16px; }
.denied-card { width: min(560px, 100%); padding: clamp(24px, 4vw, 40px); border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); }
.denied-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--safe); color: var(--brand-deep); font-size: 22px; }
.denied h1 { margin-top: 18px; font-size: clamp(22px, 3vw, 28px); letter-spacing: -0.03em; line-height: 1.15; }
.denied-card > p { margin: 10px 0 0; color: var(--ink-3); font-size: 15px; }
.denied-card ul { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; font-size: 14px; color: var(--ink-2); }
.denied-card li { display: flex; gap: 10px; align-items: flex-start; }
.denied-card li .icon { color: var(--brand); margin-top: 3px; flex: none; }
.denied-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.denied-note { display: flex; gap: 8px; align-items: flex-start; margin: 18px 0 0 !important; font-size: 13px !important; }
.denied-note .icon { margin-top: 2px; flex: none; color: var(--brand-mark); }
