/* Karwan AI access. Tokens follow the published Karwan team guide; see docs/ui-brief.md. */
:root {
  --canvas: #eef2f7;
  --paper: #ffffff;
  --ink: #16202a;
  --muted: #5c646c;
  --line: #d5dce4;
  --lime: #afc95b;
  --lime-text: #42560f;
  --lime-wash: #eef4da;
  --warn: #7a4f00;
  --warn-wash: #fbf1dc;
  --err: #9a2414;
  --err-wash: #fbe6e2;
  --code-bg: #16202a;
  --code-fg: #e6ebf0;
  --focus: #42560f;
  --hatch: #9aa3ad;
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #16202a;
    --paper: #1d2732;
    --ink: #eef2f7;
    --muted: #a0a6ad;
    --line: #2e3944;
    --lime-text: #c3d97a;
    --lime-wash: #26301f;
    --warn: #e7b864;
    --warn-wash: #2f2818;
    --err: #ff9c8a;
    --err-wash: #3a1f1b;
    --code-bg: #0f161d;
    --focus: #c3d97a;
    --hatch: #6d7782;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 16px/1.55 var(--font); }
main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 72px; }
h1 { font-size: 1.55rem; line-height: 1.25; margin: 0.2rem 0 0.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0 0 0.6rem; }
h3 { font-size: 1rem; margin: 1.3rem 0 0.4rem; }
p { margin: 0.4rem 0 0.8rem; }
a { color: var(--lime-text); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
code, pre, .mono { font-family: var(--mono); font-size: 0.88em; }
:not(pre) > code { background: var(--paper); border: 1px solid var(--line); border-radius: 5px; padding: 0.05em 0.35em; overflow-wrap: anywhere; }

.eyebrow { text-transform: uppercase; letter-spacing: 0.09em; font-size: 0.72rem; font-weight: 600; color: var(--muted); margin: 0; }
.muted { color: var(--muted); font-size: 0.92rem; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; }
.narrow { max-width: 460px; margin: 8vh auto 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid .card { margin: 0; }
.big { font-size: 1.9rem; font-weight: 650; margin: 0.1rem 0 0.4rem; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* Header and admin nav */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.top p { margin: 0; }
nav.top p:last-child { display: flex; gap: 4px 14px; flex-wrap: wrap; align-items: center; }
nav.top a { text-decoration: none; color: var(--ink); padding: 8px 2px; }
nav.top a:hover { color: var(--lime-text); }

/* The reservation bar: spent | reserved (hatched) | left. Widths come from SVG attributes. */
.bar { display: block; width: 100%; height: 14px; border-radius: 999px; overflow: hidden; background: var(--canvas); border: 1px solid var(--line); margin: 6px 0 8px; }
.bar .spent { fill: var(--ink); }
.bar { color: var(--hatch); }
.bar .left { fill: var(--lime); }
.bar.low .left { fill: #e0b552; }
.bar .draw { transform-origin: left; transform-box: fill-box; animation: draw 420ms ease-out both; }
@keyframes draw { from { transform: scaleX(0); } }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.85rem; color: var(--muted); margin: 0; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .k-spent { background: var(--ink); }
.legend .k-reserved { background: repeating-linear-gradient(45deg, var(--hatch) 0 2px, transparent 2px 4px); border: 1px solid var(--hatch); }
.legend .k-left { background: var(--lime); }

/* Forms and buttons */
label { display: block; font-weight: 600; margin: 12px 0 4px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
label.check input { width: auto; min-height: 0; }
input, textarea { width: 100%; padding: 10px 12px; min-height: 44px; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
textarea { font-family: var(--mono); font-size: 0.85rem; }
button { font: inherit; font-weight: 600; min-height: 44px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); cursor: pointer; margin-top: 12px; }
button:hover { filter: brightness(1.15); }
button:disabled { opacity: 0.55; cursor: progress; }
button.link { background: none; border: none; color: var(--lime-text); padding: 0 2px; min-height: 0; text-decoration: underline; margin: 0; font-weight: 500; }
button.danger { background: transparent; color: var(--err); border-color: var(--err); }
button.copy { background: var(--lime); color: #16202a; border-color: var(--lime); }
form.inline { display: inline; }
form.inline button { margin: 0 6px 0 0; min-height: 36px; padding: 5px 12px; }
.row input { max-width: 440px; }

/* Messages */
.notice, .warning { background: var(--warn-wash); color: var(--ink); border-left: 4px solid var(--warn); padding: 10px 14px; border-radius: 8px; }
.error { background: var(--err-wash); color: var(--err); border-left: 4px solid var(--err); padding: 10px 14px; border-radius: 8px; }
.ok { background: var(--lime-wash); color: var(--lime-text); border-left: 4px solid var(--lime); padding: 10px 14px; border-radius: 8px; }

/* Key and code */
.key { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--code-bg); color: var(--code-fg); padding: 14px; border-radius: 10px; }
.key code { word-break: break-all; font-size: 0.98rem; color: var(--code-fg); background: none; border: 0; padding: 0; flex: 1 1 260px; }
.key button { margin: 0; }
pre { background: var(--code-bg); color: var(--code-fg); border-radius: 10px; padding: 14px; overflow-x: auto; margin: 0 0 6px; font-size: 0.82rem; line-height: 1.5; }
ol.steps { padding-left: 1.2rem; }
ol.steps li { margin: 0 0 0.6rem; }

/* Tables become labelled stacks on small screens (each td carries data-label). */
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
td { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }

@media (max-width: 640px) {
  main { padding: 14px 12px 64px; }
  .card { padding: 16px; }
  h1 { font-size: 1.35rem; }
  .big { font-size: 1.6rem; }
  table, thead, tbody, tr, td { display: block; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  tr:last-child { border-bottom: 0; }
  td { border: 0; padding: 3px 0; display: grid; grid-template-columns: 7.5rem 1fr; gap: 8px; }
  td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 0.82rem; }
  td:not([data-label]) { display: block; }
  nav.top p:last-child { overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; width: 100%; padding-bottom: 4px; }
  form.inline button { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
