/* Admin interface styles.
   One stylesheet, no framework, no build step. Readable by anyone who has
   written CSS before, which is the same standard the Python is held to. */

:root {
  --ground: #f5f7f8;
  --surface: #ffffff;
  --surface-alt: #eef2f4;
  --ink: #10171c;
  --ink-soft: #3f4b54;
  --muted: #6a7883;
  --rule: #dde4e8;
  --accent: #0b6b63;
  --accent-soft: #e2efed;
  --warn: #96461c;
  --warn-soft: #fbeee5;
  --bad: #a3232e;
  --bad-soft: #fbe9ea;
  --radius: 6px;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0f1417;
    --surface: #171d21;
    --surface-alt: #1e262b;
    --ink: #e6ebef;
    --ink-soft: #c3ccd3;
    --muted: #8f9ba5;
    --rule: #2a333a;
    --accent: #43b3a6;
    --accent-soft: #11312f;
    --warn: #e0a072;
    --warn-soft: #2d1f14;
    --bad: #e8848c;
    --bad-soft: #2e1719;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- chrome ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.brand { font-weight: 650; text-decoration: none; color: var(--ink); }
.topbar nav { display: flex; gap: 1rem; flex-wrap: wrap; flex: 1; }
.topbar nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.topbar nav a:hover { color: var(--ink); }
.topbar nav a.on { color: var(--ink); border-bottom-color: var(--accent); }
.who { display: flex; gap: 0.9rem; align-items: center; font-size: 0.82rem; color: var(--muted); }

main { max-width: 68rem; margin: 0 auto; padding: 2rem 1.5rem 5rem; }
main.narrow { max-width: 30rem; padding-top: 5rem; }

h1 { font-size: 1.5rem; letter-spacing: -0.02em; margin: 0 0 0.3rem; }
h2 { font-size: 1.05rem; margin: 2rem 0 0.8rem; }
h2:first-child { margin-top: 0; }
.lede { color: var(--muted); margin: 0 0 1.75rem; max-width: 46rem; }

/* ---------- banners ---------- */

.banner {
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  border-left: 3px solid;
}
.banner.ok { background: var(--accent-soft); border-color: var(--accent); }
.banner.bad { background: var(--bad-soft); border-color: var(--bad); }
.banner.warn { background: var(--warn-soft); border-color: var(--warn); }

/* ---------- cards and grids ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.5rem;
}
.card h2 { margin-top: 0; }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }

.stat {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.stat .n { font-size: 1.7rem; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 0.82rem; }

.two-col { display: grid; gap: 1.5rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 52rem) { .two-col { grid-template-columns: 1fr; } }

/* ---------- tables ---------- */

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th {
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.8rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  font-weight: 650;
}
td {
  padding: 0.65rem 0.8rem 0.65rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
  color: var(--ink-soft);
}
td:first-child { color: var(--ink); }
th:last-child, td:last-child { padding-right: 0; text-align: right; }
tr:last-child td { border-bottom: none; }
.empty { color: var(--muted); padding: 1.5rem 0; }

/* ---------- forms ---------- */

label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.25rem; }
.hint { color: var(--muted); font-size: 0.78rem; font-weight: 400; margin: 0.2rem 0 0; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], select, textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
}
textarea { min-height: 8rem; font-family: var(--mono); font-size: 0.85rem; line-height: 1.6; }
textarea.tall { min-height: 24rem; }

.field { margin-bottom: 1.1rem; }
.row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }

.checks { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; }
.check { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; font-weight: 400; }
.check input { width: auto; }

button, .button {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover { filter: brightness(1.08); }
button.ghost, .button.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
button.danger { background: transparent; color: var(--bad); border-color: var(--rule); }
button.small, .button.small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

form.inline { display: inline; }
.actions { display: flex; gap: 0.6rem; align-items: center; margin-top: 1.25rem; flex-wrap: wrap; }

/* ---------- misc ---------- */

.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--muted);
}
.pill.on { background: var(--accent-soft); color: var(--accent); }
.pill.off { background: var(--surface-alt); color: var(--muted); }
.pill.alert { background: var(--warn-soft); color: var(--warn); }

code, .mono { font-family: var(--mono); font-size: 0.85em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.hours-grid { display: grid; gap: 0.6rem; grid-template-columns: 7rem 1fr; align-items: center; }
.hours-grid label { margin: 0; }

.transcript { display: flex; flex-direction: column; gap: 0.8rem; }
.bubble { padding: 0.65rem 0.9rem; border-radius: var(--radius); max-width: 46rem; }
.bubble.user { background: var(--surface-alt); }
.bubble.assistant { background: var(--accent-soft); }
.bubble.tool { background: var(--surface); border: 1px dashed var(--rule); font-family: var(--mono); font-size: 0.78rem; overflow-x: auto; }
.bubble.note { background: var(--warn-soft); border-left: 3px solid var(--warn); font-size: 0.85rem; white-space: pre-wrap; }
.bubble .who { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.25rem; }
