/* SPDX-License-Identifier: MIT */
:root {
  color-scheme: light;
  --canvas: #f1f4f4;
  --surface: #fff;
  --panel: #f8fafa;
  --ink: #162327;
  --muted: #4d5f65;
  --line: #d8e1e1;
  --control: #85989b;
  --accent: #126055;
  --accent-strong: #0b493f;
  --accent-soft: #e7f3ef;
  --warn: #7b4816;
  --warn-soft: #faf0df;
  --error: #8a342c;
  --error-soft: #fbeeea;
  --mono: "Geist Mono", ui-monospace, Consolas, monospace;
  --gutter: clamp(.875rem, 3.5vw, 2rem);
  font-family: Geist, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.5;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1, h2 { font-weight: 650; letter-spacing: -.045em; line-height: 1.12; }
h3 { font-size: .98rem; line-height: 1.35; font-weight: 650; }
a { color: var(--accent-strong); text-underline-offset: .19em; }
button, select, textarea { font: inherit; color: inherit; }
button, select {
  min-height: 44px;
  padding: .5rem .8rem;
  font-size: .875rem;
  font-weight: 600;
}
button, select, textarea {
  border: 1px solid var(--control);
  background: var(--surface);
  border-radius: .5rem;
}
button { cursor: pointer; transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease; }
button:hover:not(:disabled, [aria-disabled="true"]) { border-color: var(--accent); background: var(--accent-soft); }
button:disabled, button[aria-disabled="true"] { cursor: default; opacity: .55; }
button[aria-busy="true"] { cursor: progress; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
label { font-size: .875rem; font-weight: 600; }
textarea {
  display: block;
  width: 100%;
  min-height: 4rem;
  resize: vertical;
  padding: .7rem .8rem;
  margin: .35rem 0 .75rem;
}
.icon { width: 1rem; height: 1rem; flex: none; }
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner, .workspace { width: min(76rem, 100%); margin-inline: auto; padding-inline: var(--gutter); }
.top-inner, .brand, .top-links { display: flex; align-items: center; }
.top-inner { min-height: 4.15rem; padding-block: .5rem; justify-content: space-between; gap: .5rem; }
.brand { gap: .65rem; font-size: .9rem; font-weight: 700; line-height: 1.22; }
.brand small { color: var(--muted); display: block; margin-top: .12rem; font-size: .75rem; font-weight: 500; }
.brand-mark { display: grid; place-items: center; background: var(--ink); color: white; width: 2.25rem; aspect-ratio: 1; border-radius: .5rem; flex: none; }
.brand-mark svg { width: 1.25rem; height: 1.25rem; }
.top-links { gap: .35rem; }
.top-links a { display: inline-flex; gap: .35rem; min-height: 44px; align-items: center; padding: .35rem .4rem; border-radius: .4rem; font-size: .83rem; font-weight: 600; text-decoration: none; }
.top-links a:hover { text-decoration: underline; }
#language { font: 500 .78rem var(--mono); padding-inline: .45rem; }
.workspace { padding-bottom: 4rem; }
.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .85rem 1.25rem;
  padding: clamp(1.4rem, 3vw, 2.4rem) 0 clamp(1.3rem, 2.5vw, 2rem);
}
.eyebrow, .mono, .count, #case-revision, .case-list small, .context { font-family: var(--mono); }
.eyebrow { font-weight: 550; font-size: .71rem; letter-spacing: .095em; color: var(--accent-strong); }
h1 { font-size: clamp(2.25rem, 4.6vw, 3.65rem); margin: .27rem 0 .46rem; }
.lede { max-width: 38rem; color: var(--muted); font-size: .96rem; }
.mode, .pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  width: fit-content;
  border: 1px solid transparent;
  padding: .25rem .55rem;
  border-radius: .3rem;
  font-size: .78rem;
  font-weight: 650;
}
.mode { color: var(--muted); border-color: var(--line); background: var(--surface); }
.mode::before, .pill::before, .case-list-status::before {
  content: "";
  flex: none;
  width: .42rem;
  height: .42rem;
  background: currentColor;
  border-radius: 50%;
}
.mode[data-mode="protected_demo"], .mode[data-mode="portfolio"] { color: var(--accent-strong); background: var(--accent-soft); }
.mode[data-mode="unavailable"] { color: var(--error); background: var(--error-soft); }
.switcher { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: .9rem; }
.switcher button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  min-width: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: .4rem .4rem 0 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: .5rem .65rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.switcher button[aria-pressed="true"] { color: var(--accent-strong); border-bottom-color: var(--accent); }
.count { color: var(--accent-strong); background: var(--accent-soft); border-radius: .25rem; padding: .16rem .34rem; font-size: .72rem; font-weight: 550; flex: none; }
.desk { display: grid; gap: 1rem; align-items: start; }
.inbox, .case-detail, .conversation {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--surface);
}
.inbox { padding: .45rem .55rem .55rem; }
.inbox-head, .chat-head, .section-head, .mobile-case-nav { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .2rem .6rem; }
.inbox-head { padding: 0 .3rem .3rem .5rem; }
.inbox-head h2 { font-size: 1rem; letter-spacing: -.02em; }
.text-button { display: inline-flex; align-items: center; gap: .35rem; color: var(--accent-strong); border-color: transparent; background: transparent; padding-inline: .48rem; }
.case-list, .messages { list-style: none; margin: 0; padding: 0; }
.case-list li + li { margin-top: .25rem; }
.case-list button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .2rem .45rem;
  width: 100%;
  min-height: 4.9rem;
  padding: .63rem .65rem;
  text-align: left;
  overflow-wrap: anywhere;
  border: 1px solid transparent;
  background: var(--panel);
}
.case-list button::after {
  content: "";
  grid-area: 1 / 2 / 4 / 3;
  width: .43rem;
  height: .43rem;
  margin-right: .2rem;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
  color: var(--muted);
}
.case-list button[aria-current="true"] { border-color: #a9c8c0; box-shadow: inset 3px 0 var(--accent); background: var(--accent-soft); }
.case-list small { font-weight: 500; font-size: .68rem; color: var(--muted); }
.case-list-title { font-weight: 650; line-height: 1.27; }
.case-list-status { display: flex; align-items: center; gap: .35rem; font-size: .73rem; line-height: 1.32; font-weight: 500; color: var(--muted); }
.case-list-status::before { width: .35rem; height: .35rem; }
.case-list-status[data-status="waiting_review"], .case-list-status[data-status="applying"] { color: var(--warn); }
.case-list-status[data-status="executed"], .case-list-status[data-status="decided"] { color: var(--accent-strong); }
.case-detail, .conversation { padding: clamp(.95rem, 2.6vw, 2.1rem); }
.case-head { max-width: 54rem; }
.case-head .eyebrow { letter-spacing: .055em; }
.case-detail h2, .conversation h2 { font-size: clamp(1.55rem, 3.1vw, 2.3rem); margin: .25rem 0 .6rem; }
.case-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; margin-bottom: .8rem; font-size: .76rem; color: var(--muted); }
.pill { color: var(--muted); background: var(--canvas); }
.pill[data-status="waiting_review"], .pill[data-status="applying"] { color: var(--warn); background: var(--warn-soft); }
.pill[data-status="executed"], .pill[data-status="decided"] { color: var(--accent-strong); background: var(--accent-soft); }
#case-reason { color: var(--muted); }
.mobile-case-nav { display: none; }
.detail-section { border-top: 1px solid var(--line); margin-top: 1.15rem; padding-top: 1.05rem; }
.detail-section > h3 { margin-bottom: .55rem; }
.fields {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  margin: .55rem 0 0;
  border: 1px solid var(--line);
  border-radius: .5rem;
  font-size: .85rem;
  overflow-wrap: anywhere;
}
.fields:empty { display: none; }
.fields dt, .fields dd { margin: 0; padding: .45rem .65rem; }
.fields dt:not(:first-of-type), .fields dd:not(:first-of-type) { border-top: 1px solid var(--line); }
.fields dt { color: var(--muted); background: var(--panel); }
#action-type { color: var(--accent-strong); font-size: .81rem; }
.evidence-list { padding-left: 1.1rem; margin: .5rem 0 0; overflow-wrap: anywhere; font-size: .9rem; }
.evidence-list li + li { margin-top: .4rem; }
.evidence-list li::marker { color: var(--accent); }
.receipt { display: flex; align-items: start; gap: .75rem; color: var(--accent-strong); background: var(--accent-soft); border: 1px solid #a9c8c0; border-radius: .55rem; padding: .75rem; margin-top: 1.1rem; }
.receipt .icon { width: 1.25rem; height: 1.25rem; }
.receipt h3 { margin-bottom: .22rem; }
.receipt .mono { font-size: .86rem; }
.receipt .muted { font-size: .8rem; }
#case-decision-time { margin-top: .45rem; font-size: .82rem; }
.section-head { margin-top: -.4rem; }
#history-panel { padding: .65rem .75rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--panel); font-size: .88rem; }
#history-panel :empty { margin: 0; }
#history-feedback { margin-top: .45rem; }
.buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.buttons button { max-width: 100%; overflow-wrap: anywhere; }
.primary { color: white; background: var(--accent); border-color: var(--accent); }
.primary:hover:not(:disabled, [aria-disabled="true"]) { color: white; background: var(--accent-strong); border-color: var(--accent-strong); }
#decision-form [value="reject"]:hover:not(:disabled) { color: var(--error); border-color: var(--error); background: var(--error-soft); }
#approval-expiry { margin: .15rem 0 .65rem; font-size: .84rem; }
#approval-expiry[data-expired="true"] { color: var(--error); }
.muted { color: var(--muted); }
#decision-readonly { margin-top: .75rem; font-size: .88rem; }
.empty-state { padding: .9rem; background: var(--panel); border: 1px dashed var(--control); border-radius: .5rem; font-size: .9rem; }
.conversation { max-width: 60rem; }
.chat-head { gap: .65rem 1.15rem; }
.chat-head h2 { margin-bottom: 0; }
.chat-head label { display: block; margin-bottom: .2rem; }
.chat-context { padding: .72rem .85rem; margin: 1rem 0; background: var(--panel); border: 1px solid var(--line); border-radius: .5rem; font-size: .88rem; }
.context { font-weight: 550; color: var(--accent-strong); margin-bottom: .2rem; font-size: .77rem; }
.messages { display: grid; gap: .7rem; }
.messages li { width: fit-content; max-width: min(100%, 43rem); padding: .65rem .85rem; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--control); border-radius: .12rem .65rem .65rem .65rem; }
.messages li[data-author="user"] { justify-self: end; background: var(--accent-soft); border-left: 1px solid var(--line); border-right: 3px solid var(--accent); border-radius: .65rem .12rem .65rem .65rem; }
.messages strong { display: block; color: var(--accent-strong); font-size: .78rem; margin-bottom: .2rem; }
.messages p { white-space: pre-wrap; }
.escalation { margin-top: .75rem; color: var(--warn); background: var(--warn-soft); border-color: #ba9b74; }
#chat-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.privacy { font-size: .8rem; margin-bottom: .75rem; }
.notice:not(:empty) { color: var(--accent-strong); background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 0 .35rem .35rem 0; padding: .55rem .7rem; margin-top: .65rem; font-size: .875rem; }
.notice[data-error="true"]:not(:empty) { color: var(--error); background: var(--error-soft); border-color: var(--error); }
#inbox-notice:not(:empty) { margin: 0 0 .55rem; }
#workspace-notice:not(:empty) { margin: 0 0 .9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (min-width: 44rem) {
  .desk { grid-template-columns: minmax(13rem, 29%) minmax(0, 1fr); }
}
@media (max-width: 43.999rem) {
  .desk[data-screen="inbox"] .case-detail, .desk[data-screen="detail"] .inbox { display: none; }
  .mobile-case-nav { display: flex; border-bottom: 1px solid var(--line); margin: -.45rem 0 .9rem; padding-bottom: .27rem; }
  .case-list button { padding: .7rem .75rem; }
}
@media (max-width: 25rem) {
  .switcher button { padding-inline: .42rem; font-size: .8rem; }
  .switcher .icon { display: none; }
  .case-detail .buttons button { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
