:root {
  --navy: #0f2a43; --teal: #0b6f6a; --teal-d: #095a56; --ink: #1c2733; --muted: #4a5a6a;
  --bg: #f3f6f9; --card: #ffffff; --line: #d5dde5;
  --amber-bg: #fff4d6; --amber: #6b4600; --green: #1b6e35; --green-bg: #e3f4e8; --red: #b3261e; --red-bg: #fdeceb;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.top { background: var(--navy); color: #fff; padding: 20px 0 16px; }
.top h1 { margin: 0 0 6px; font-size: 1.5rem; }
.lede { margin: 0 0 10px; max-width: 760px; color: #e6eef6; }
.note { margin: 0; display: inline-block; background: var(--amber-bg); color: var(--amber); padding: 6px 12px; border-radius: 8px; font-size: .92rem; }
h2 { font-size: 1.1rem; margin: 0 0 10px; color: var(--navy); }
.grid { display: grid; gap: 16px; padding-top: 16px; padding-bottom: 16px; grid-template-columns: 1fr;
  grid-template-areas: "hero" "chat" "approval" "debts" "audit" "evals"; }
@media (min-width: 900px) {
  .grid { grid-template-columns: 1.1fr 1fr; align-items: start;
    grid-template-areas: "hero chat" "debts chat" "debts approval" "audit evals"; }
}
.hero { grid-area: hero; } .chat { grid-area: chat; } .approval { grid-area: approval; }
.debts { grid-area: debts; } .audit { grid-area: audit; } .evals { grid-area: evals; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.date { font-size: 2.1rem; font-weight: 700; margin: 4px 0; color: var(--navy); font-variant-numeric: tabular-nums; }
.meta { margin: 0 0 8px; color: var(--muted); }
.badge { display: inline-block; font-size: .8rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: #e8eef4; color: var(--navy); }
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.adopted { background: var(--green-bg); color: var(--green); }
.hint { margin: 0 0 8px; color: var(--muted); font-size: .92rem; }
.empty { color: var(--muted); margin: 6px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { font: inherit; font-size: .9rem; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--teal); background: #fff; color: var(--teal-d); cursor: pointer; }
.chip:hover { background: #e6f4f3; }
.log { height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #fbfcfd; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 8px 12px; border-radius: 12px; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--teal); color: #fff; }
.msg.agent { align-self: flex-start; background: #e9eff5; color: var(--ink); }
.msg.system { align-self: center; background: var(--green-bg); color: var(--green); font-size: .92rem; }
.tool { display: inline-block; margin: 6px 6px 0 0; font: .8rem ui-monospace, Consolas, monospace; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; color: var(--navy); overflow-wrap: anywhere; }
form label { display: block; font-weight: 600; margin: 12px 0 4px; }
.row { display: flex; gap: 8px; }
input[type=text] { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border: 1px solid #8696a6; border-radius: 8px; }
.btn { font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--navy); cursor: pointer; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-d); }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
.error { color: var(--red); margin: 6px 0 0; font-weight: 600; }
.pending { background: var(--amber-bg); border: 1px solid #e8c978; border-radius: 10px; padding: 12px; margin-bottom: 10px; color: var(--amber); }
.pending p { margin: 0 0 8px; }
.pending .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.done { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: .92rem; color: var(--muted); }
.done .st { font-weight: 700; } .done .st.executed { color: var(--green); } .done .st.rejected { color: var(--red); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--navy); font-weight: 700; background: #f3f6f9; }
.num { text-align: right; }
.scroll { overflow-x: auto; max-width: 100%; }
.scroll.tall { max-height: 320px; overflow-y: auto; }
details { margin-top: 12px; } summary { cursor: pointer; font-weight: 600; color: var(--teal-d); }
#amort-more { margin-top: 8px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; overflow-wrap: anywhere; }
.evals-list { list-style: none; padding: 0; margin: 8px 0 0; }
.evals-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.pass { color: var(--green); font-weight: 700; } .fail { color: var(--red); font-weight: 700; }
.foot { padding-bottom: 24px; color: var(--muted); font-size: .9rem; }
.linklike { font: inherit; background: none; border: 0; color: var(--teal-d); text-decoration: underline; cursor: pointer; padding: 0; }

@media (max-width: 640px) {
  .date { font-size: 1.7rem; }
  .log { height: 260px; }
  #debts-table thead { position: absolute; left: -9999px; }
  #debts-table, #debts-table tbody, #debts-table tr, #debts-table td { display: block; width: 100%; }
  #debts-table tr { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; padding: 6px 4px; }
  #debts-table td { border: 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  #debts-table td::before { content: attr(data-label); font-weight: 600; color: var(--navy); text-align: left; }
  #audit-table td:nth-child(4) { min-width: 150px; }
}
