/* web/ additions on top of Julian's tokens.css + ui.css (both copied verbatim from mocks/). Only what the live app
   needs that the static mocks did with inline style="" (blocked by the CSP) or did not have. */

/* CSP is default-src 'self': the data: URI textures in tokens.css are blocked, so serve them as files. */
:root {
  --tex-noise: url("../img/noise.svg");
  --tex-vein: url("../img/vein.svg");
  --t-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --t-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
.meter b, .nav .count, [data-count], .col-head .n, .tabs .n, .stat b { font-family: var(--t-mono); }
/* Matching fallback behind the WebP/SVG textures so the page color is already there while they load. */

/* The floor is body::before (ui.css). Only html may carry a colour; an opaque body would hide it. */
html { background-color: var(--c-bg); }
body { background: transparent; }

/* chrome */
/* Chromeless routes (sign-in, onboarding): the view owns the whole page. */
.bare .main { display: block; }
.bare .content { padding: 0; max-width: none; margin: 0; gap: 0; display: block; }
.brand-name { font: 600 var(--t-lg) var(--t-display); }
.auth-h { font-size: 28px; }
.auth-meta a, .auth-link { color: var(--c-accent); } .auth-link { font-weight: 600; }
.steps a { display: flex; align-items: center; min-height: 32px; color: inherit; text-decoration: none; }
.onb-card > section.slab { padding: 0; background: none; box-shadow: none; border-radius: 0; }
.onb-card > section.slab::before, .onb-card > section.slab::after { display: none; }
.net { margin: 0; padding: 6px var(--s-4); text-align: center; font-size: var(--t-sm); background: var(--c-warn-soft); color: var(--c-warn); border-bottom: 1px solid var(--c-border); }
.bare .rail, .bare .bottomnav, .bare .guest-bar, .bare .topbar { display: none; }
.bare .app { grid-template-columns: 1fr; display: block; }
.who-name { font-weight: 600; }
.content:focus { outline: none; }
.minw0 { min-width: 0; } .center { text-align: center; } .pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.hi { color: var(--c-text); }
.link { color: var(--c-accent); }
.crumbs { gap: 6px; } .crumbs a { text-decoration: none; }

/* search on the page (mobile + in-page) */
.page-search { display: flex; max-width: 520px; }
.page-search input { width: 100%; }
@media (min-width: 768px) { .page-search { display: none; } }

/* jobs list (mock used inline styles for these) */
.table-wrap { display: block; overflow-x: auto; }

.cm { display: flex; flex-direction: column; min-width: 0; }
.cm .t { font-weight: 600; font-size: var(--t-md); }
.jrow { display: flex; gap: 12px; text-decoration: none; align-items: flex-start; }
.jcol { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.jcol .t { font-weight: 600; line-height: 1.3; }
.jmeta { gap: 8px; margin-top: 8px; }
.jcard .jtop { gap: 10px; }

.col.over { box-shadow: inset 0 0 0 2px var(--c-accent), inset 0 2px 6px var(--c-ext-036); }
.crow { gap: 12px; text-decoration: none; color: inherit; }
.crow-meta { gap: 8px; margin-top: 6px; }
.actions-cell { width: 56px; }

/* job record */
.jh { gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.jh-main { min-width: 220px; }
.jh-chips { gap: 8px; margin-bottom: 8px; }
.jt { font-size: 30px; }
.jh-facts { gap: 24px; }
.status-select { width: auto; min-width: 150px; min-height: var(--hit); font-weight: 600; }

.mrow { gap: 20px; }
 

.composer { padding: var(--s-3); border-radius: var(--r-md); background: var(--c-ext-113); border: 1px solid var(--c-border); }
.composer .hstack > * { flex: 1; }
.timeline li.done b { text-decoration: line-through; opacity: .6; }
.timeline .check.sm { margin-left: auto; }
.dnc { color: var(--c-warn); display: flex; gap: 6px; align-items: center; }

/* forms */
.form .grid-2, .grid-4 { gap: var(--s-3); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 767px) { .form .grid-2, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fs { border: 1px solid var(--c-border); border-radius: var(--r-md); padding: var(--s-3); margin: 0; }
.fs legend { font-weight: 600; color: var(--c-text-2); padding: 0 4px; }

.field-err { color: var(--c-danger); }
.sticky-actions { position: sticky; bottom: var(--s-3); padding: var(--s-2); border-radius: var(--r-md); background: var(--c-ext-114); backdrop-filter: blur(8px); }
@media (max-width: 767px) { .sticky-actions { bottom: calc(var(--bottomnav-h) + 8px); } }
.merge-row { gap: 8px; } .tpl-foot { justify-content: space-between; gap: 12px; }
.tname { display: block; }

/* settings */

.stat { display: flex; flex-direction: column; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--c-surface-2); box-shadow: var(--e-1); min-width: 110px; }
.stat b { font-weight: 600; font-size: var(--t-xl); line-height: 1.1; font-family: var(--t-mono); }

/* auth */

.otp-input { font: 600 var(--t-2xl)/1 var(--t-mono); letter-spacing: .4em; text-align: center; }

/* toasts */
.toast[data-kind="danger"] span { color: var(--c-danger); } .toast[data-kind="warn"] span { color: var(--c-warn); }

/* ---------- CSS-only 3D: empty state (three floating basalt slabs) ---------- */
.empty-state { align-items: center; text-align: center; padding: var(--s-10) var(--s-6); }
.empty-state p { max-width: 46ch; }
.slabs3d { position: relative; width: 150px; height: 110px; perspective: 600px; transform-style: preserve-3d; }
.slabs3d i { position: absolute; left: 25px; width: 100px; height: 64px; border-radius: 14px; background: var(--c-surface-2); box-shadow: var(--e-2);
  transform: rotateX(58deg) rotateZ(-32deg) translateZ(calc(var(--k) * 18px)); animation: jm-float var(--m-ambient) ease-in-out infinite alternate; }
.slabs3d i:nth-child(1) { --k: 0; top: 46px; } .slabs3d i:nth-child(2) { --k: 1; top: 28px; animation-delay: -3s; }
.slabs3d i:nth-child(3) { --k: 2; top: 10px; background: var(--c-accent); animation-delay: -6s; }
@keyframes jm-float { to { transform: rotateX(58deg) rotateZ(-24deg) translateZ(calc(var(--k) * 18px + 10px)); } }
.gate .icon { color: var(--c-warn); }

/* ---------- View Transitions: direction-aware page slide (router sets html[data-nav]); fallback = instant swap ---------- */
[data-nav="forward"]::view-transition-new(root) { animation-name: jm-in-r; } [data-nav="forward"]::view-transition-old(root) { animation-name: jm-out-l; }
[data-nav="back"]::view-transition-new(root) { animation-name: jm-in-l; } [data-nav="back"]::view-transition-old(root) { animation-name: jm-out-r; }
@keyframes jm-in-r { from { opacity: 0; transform: perspective(1200px) translateX(6%) rotateY(-3deg); } }
@keyframes jm-out-l { to { opacity: 0; transform: perspective(1200px) translateX(-5%) rotateY(3deg); } }
@keyframes jm-in-l { from { opacity: 0; transform: perspective(1200px) translateX(-6%) rotateY(3deg); } }
@keyframes jm-out-r { to { opacity: 0; transform: perspective(1200px) translateX(5%) rotateY(-3deg); } }
.rail { view-transition-name: rail; } .bottomnav { view-transition-name: bottomnav; } .topbar { view-transition-name: topbar; }
::view-transition-group(job-title), ::view-transition-group(contact-title) { animation-duration: var(--m-slow); animation-timing-function: var(--ease-out); }

/* ---------- reduced motion: every animation above has a still variant ---------- */
@media (prefers-reduced-motion: reduce) {
  .slabs3d i { animation: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .slab.interactive:active, .btn:hover, .btn:active { transform: none; }
}
[hidden]{display:none !important}
.seg label:has(input:disabled) { opacity: .55; cursor: not-allowed; }

.danger-zone h2, .danger-title { color: var(--c-danger); }






/* Advisory recommended_level tag — suggestion only, never a preselection. */



/* AI providers, consent, claims diff, identities */
.ident-row, .ai-row { gap: var(--s-2); }
.ok-note { padding: var(--s-3); border-radius: var(--r-md); background: var(--c-ok-soft, var(--c-ext-117)); color: var(--c-accent); }


.claims q { display: block; font: 500 var(--t-md)/1.4 var(--t-body); color: var(--c-text); quotes: none; }
.claims .reason { margin-top: 4px; }
#ollama-note, #local-cors-note { padding: var(--s-3); border-radius: var(--r-md); background: var(--c-surface-2); }
#ai-key { font-family: var(--t-mono); }

/* Structural r1 (layout/behavior). Theme tokens stay in tokens.css; palette pending Julian's theme B tokens. */
/* 2×2 in the 340–380px match panel (and any panel under 640px). 4-up only when the panel itself is ≥640px. */
#match, .dialog.apply-preview { container-type: inline-size; container-name: match-panel; }


@container match-panel (min-width: 640px) {
  .seg { grid-template-columns: repeat(4, 1fr); }
}




pre.resume-preview {
  max-height: 46dvh; overflow: auto; padding: var(--s-4); border-radius: var(--r-md);
  background: var(--c-bg); color: var(--c-text); font-family: var(--t-mono); font-size: var(--t-sm);
}
button[aria-disabled="true"], a[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.score, .guest-counts b, .n, .otp-input, #ai-key, pre.resume-preview { font-family: var(--t-mono); }

/* Settings: one section per route. Phone: top tabs. Desktop: side tabs. */
.settings-layout { display: flex; flex-direction: column; gap: var(--s-5); }
.settings-tabs { display: flex; flex-wrap: nowrap; gap: var(--s-2); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.settings-tabs a { flex: none; display: inline-flex; align-items: center; min-height: var(--hit); padding: 0 14px; border-radius: var(--r-sm); color: var(--c-text-2); text-decoration: none; font: 600 var(--t-sm)/1 var(--t-body); white-space: nowrap; }
.settings-tabs a[aria-current="page"] { color: var(--c-text); background: var(--c-surface-2); }
@media (min-width: 768px) {
  .settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; gap: var(--s-8); }
  .settings-nav-col { position: sticky; top: calc(var(--topbar-h) + var(--s-4)); }
  .settings-tabs { flex-direction: column; overflow: visible; }
  .settings-tabs a { width: 100%; }
}

/* Phone bottom nav is pinned to the viewport; page padding matches its occupied height. */
@media (max-width: 767px) {
  .bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    box-sizing: content-box;
    height: var(--bottomnav-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  html:not(.bare) {
    scroll-padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
  }
  html:not(.bare) #main.content {
    padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px) + 80px);
  }
  #match, #wh-launch, #job-fit, #match .match-actions {
    scroll-margin-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px) + 24px);
  }
}

/* Webhook (any agent) — §2.11 / contract §4.4c */
.wh-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border-radius: var(--r-pill); font: 600 var(--t-xs)/1 var(--t-body); letter-spacing: .04em; text-transform: uppercase; background: var(--c-surface-3); color: var(--c-text-2); }
.wh-chip.ok { background: var(--c-ok-soft); color: var(--c-ok); }
.wh-chip.warn { background: var(--c-warn-soft); color: var(--c-warn); }
.wh-chip.danger { background: var(--c-danger-soft); color: var(--c-danger); }
.wh-chip.info { background: var(--c-info-soft); color: var(--c-info); }
.wh-secret { display: flex; align-items: stretch; gap: var(--s-2); }
.wh-secret pre { flex: 1; margin: 0; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--c-inset); box-shadow: var(--e-carve), inset 0 0 0 1px var(--c-border-strong); font: 500 var(--t-sm)/1.4 var(--t-mono); color: var(--c-text); overflow-wrap: anywhere; white-space: pre-wrap; }
.wh-instructions { position: relative; margin: 0; padding: var(--s-4); border-radius: var(--r-md); background: var(--c-inset); box-shadow: var(--e-carve), inset 0 0 0 1px var(--c-border); font: 400 var(--t-xs)/1.5 var(--t-mono); color: var(--c-text-2); overflow: auto; max-height: 40dvh; white-space: pre-wrap; }
.wh-draft { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: var(--r-pill); font: 700 var(--t-xs)/1 var(--t-body); letter-spacing: .08em; text-transform: uppercase; background: var(--c-warn-soft); color: var(--c-warn); }


@keyframes pulse-ring { from { transform: scale(.7); opacity: .7; } to { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .pulse::after { display: none; animation: none; }
}
.wh-checks { margin: 0; padding-left: 1.2em; color: var(--c-text-2); }

/* Interests and focus (§2.14), onboarding, password (§2.13), webhook job (§2.12) */
.interests-grid { display: grid; gap: var(--s-5); }
.interest-list { display: flex; flex-direction: column; gap: var(--s-2); }
.interest-pills { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.interest-row { display: flex; align-items: center; gap: var(--s-2); min-height: var(--hit); padding: 0 10px; border-radius: var(--r-sm); background: var(--c-surface-2); }
.interest-row .count { margin-left: auto; color: var(--c-text-3); font: 600 var(--t-xs)/1 var(--t-body); }
/* r5: a long "Agree again…" chip must wrap under the name, never clip it */
.ai-row > .hstack > b {
  flex: 0 0 auto;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
}
.interest-combo { position: relative; }
.interest-listbox { position: absolute; z-index: 4; inset: auto 0 auto 0; top: 100%; margin: 4px 0 0; padding: 4px; max-height: 220px; overflow: auto; border-radius: var(--r-sm); background: var(--c-surface-1); box-shadow: var(--e-2); }
.interest-listbox [role="option"] { display: block; width: 100%; text-align: left; min-height: 36px; padding: 8px 10px; border: 0; border-radius: var(--r-xs); background: transparent; color: var(--c-text); cursor: pointer; }
.interest-listbox [role="option"][aria-selected="true"], .interest-listbox [role="option"]:hover { background: var(--c-surface-2); }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2); min-height: 160px; padding: var(--s-5); border: 2px dashed var(--c-border-strong); border-radius: var(--r-md); background: var(--c-surface-2); color: var(--c-text-2); text-align: center; cursor: pointer; }
.dropzone.is-over { border-color: var(--c-accent); background: var(--c-accent-soft); }
.site-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--s-3); }
.site-tile { display: flex; flex-direction: column; gap: 4px; min-height: var(--hit); padding: 12px; border: 0; border-radius: var(--r-md); background: var(--c-surface-2); color: var(--c-text); text-align: left; cursor: pointer; }
.site-tile[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--c-accent); background: var(--c-accent-soft); }
.pw-wrap { display: flex; align-items: center; gap: 4px; }
.pw-wrap input { flex: 1; }
.pw-toggle { flex: none; min-width: var(--hit); min-height: var(--hit); }
.pw-factor { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.seg-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: var(--hit); padding: 10px 12px; border: 0; border-radius: var(--r-sm); background: var(--c-surface-2); color: var(--c-text); cursor: pointer; text-align: left; font: 600 var(--t-sm)/1.2 var(--t-body); }
.seg-btn small { font: 400 var(--t-xs)/1.3 var(--t-body); color: var(--c-text-3); }
.seg-btn[aria-pressed="true"] { background: var(--c-accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-accent) 40%, transparent); }

.diff ins, .diff del, ins[data-diff], del[data-diff] { text-decoration: none; border-radius: 2px; padding: 0 1px; }
.diff ins, ins[data-diff] { background: var(--c-ok-soft); color: var(--c-ok); }
.diff del, del[data-diff] { background: var(--c-danger-soft); color: var(--c-danger); }
.novel { box-shadow: inset 0 0 0 2px var(--c-warn); border-radius: 3px; padding: 0 2px; }
.novel-badge { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: var(--r-pill); background: var(--c-warn-soft); color: var(--c-warn); font: 700 var(--t-xs)/1.6 var(--t-body); letter-spacing: .04em; text-transform: uppercase; }

.wh-progress-bar { height: 6px; border-radius: var(--r-pill); background: var(--c-surface-3); overflow: hidden; }
.wh-progress-bar i { display: block; height: 100%; width: 0; background: var(--c-accent); }
#wh-claims { margin: 0; padding-left: 1.2em; }
#wh-agent-error { white-space: pre-wrap; word-break: break-word; padding: var(--s-3); border-radius: var(--r-sm); background: var(--c-surface-2); font: var(--t-xs)/1.45 var(--t-mono); max-height: 160px; overflow: auto; }


.int-h .used, .int-h .count { color: var(--c-text-3); font: 600 var(--t-xs)/1.3 var(--t-body); }

@media (min-width: 1024px) {
  .interests-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}
.interest-pills { display: flex; flex-wrap: wrap; gap: 8px; border: 0; margin: 0; padding: 0; }
.interest-pills legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.interest-pills .pill { display: inline-flex; align-items: center; min-height: var(--hit); padding: 0 14px; border-radius: var(--r-pill); background: var(--c-surface-2); cursor: pointer; font: 600 var(--t-sm)/1 var(--t-body); }
.interest-pills .pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.interest-pills .pill.is-on { background: var(--c-accent-soft); box-shadow: inset 0 0 0 2px var(--c-accent); }
.interest-row.is-marked { box-shadow: inset 0 0 0 2px var(--c-danger); }


/* v1.4: fit score, re-consent, guest-import replace compare (tokens only). */


















@media (max-width:640px){ .sent-cols{grid-template-columns:minmax(0,1fr)} }







@media (max-width:640px){ .rp-compare{grid-template-columns:minmax(0,1fr)} }


@media (max-width: 767px) {
  .guest-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; padding: 6px var(--s-4); }
  .guest-bar .grow { flex: 1 1 calc(100% - 32px); line-height: 1.35; }
  .guest-bar .btn.sm { min-height: 36px; padding: 0 12px; }
  .guest-bar .btn.quiet { padding: 0 8px; }
  .guest-bar .btn.primary, .guest-bar .btn.quiet { grid-column: auto; margin-top: 0; }
}
