:root {
  --brand: #009C39;
  --brand-dark: #007A2D;
  --accent: #FFD100;
  --ink: #1A1A1A;
  --muted: #5B616B;
  --line: #E3E1DE;
  --bg: #F6F5F2;
  --card: #FFFFFF;
  --warn: #B7791F;
  --bad: #C0392B;
  --radius: 14px;
  --link: var(--brand-dark);
  --tint: color-mix(in srgb, var(--brand) 9%, var(--card));
  --input: #FFFFFF;
  color-scheme: light;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}
/* Dark theme: used when the person picks Dark, or picks System and their device is dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ECEEEC; --muted: #A4ABA6; --line: #2C3430; --bg: #0F1412; --card: #171E1B; --input: #1D2521;
    --link: color-mix(in srgb, var(--brand) 60%, #fff); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #ECEEEC; --muted: #A4ABA6; --line: #2C3430; --bg: #0F1412; --card: #171E1B; --input: #1D2521;
  --link: color-mix(in srgb, var(--brand) 60%, #fff); color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
h1, h2, h3 { font-family: "Plus Jakarta Sans", "Inter", sans-serif; margin: 0 0 8px; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
/* Section headings carry a short brand-coloured bar with an accent tip. */
.card h2 { display: flex; align-items: center; gap: 10px; }
.card h2::before { content: ""; width: 6px; height: 20px; border-radius: 3px; background: linear-gradient(var(--brand) 70%, var(--accent) 70%); flex: none; }
a { color: var(--link); }
.wrap { max-width: 980px; margin: 0 auto; padding: 16px; }
.topbar { background: var(--card); border-bottom: 4px solid var(--brand); box-shadow: inset 0 -2px 0 var(--accent); }
.topbar .wrap { display: flex; align-items: center; gap: 14px; padding-top: 12px; padding-bottom: 12px; }
.topbar img { height: 60px; width: auto; max-width: 240px; object-fit: contain; }
.topbar .name { font-weight: 700; font-size: 18px; }
/* Most logos are made for white backgrounds; give them a light plate in dark mode. */
:root[data-theme="dark"] .topbar img { background: #fff; border-radius: 8px; padding: 4px 8px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .topbar img { background: #fff; border-radius: 8px; padding: 4px 8px; } }
.topbar .spacer { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 16px; }
.card.hero { border: 0; color: #fff; background: linear-gradient(120deg, var(--brand), var(--brand-dark)); box-shadow: inset 6px 0 0 var(--accent); }
.card.hero a { color: #fff; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { background: var(--tint); border-radius: 10px; padding: 12px; border-top: 3px solid var(--brand); }
.stat .v { font-size: 22px; font-weight: 700; color: var(--link); }
.stat .l { font-size: 13px; color: var(--muted); }
.theme-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.theme-switch button { background: transparent; color: var(--muted); padding: 6px 10px; border-radius: 0; font-size: 13px; font-weight: 600; }
.theme-switch button.on { background: var(--brand); color: #fff; }
button, .btn {
  font: inherit; border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 600; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { background: var(--brand-dark); }
button.secondary, .btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
button.link { background: none; color: var(--link); padding: 0; font-weight: 600; }
button:disabled { opacity: .55; cursor: default; }
input, select, textarea {
  font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--input); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 4px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; margin: 6px 0; }
.check input { width: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 6px; }
td { padding: 9px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.table-scroll { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg); }
.pill.ok { background: #E3F4E9; color: var(--brand-dark); }
.pill.bad { background: #F8E1DE; color: var(--bad); }
.pill.warn { background: #FFF4CC; color: #7A5A00; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: inset 0 -3px 0 var(--accent); }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; padding: 4px; }
.msg { max-width: 80%; padding: 9px 12px; border-radius: 12px; background: var(--bg); white-space: pre-wrap; word-wrap: break-word; }
.msg.mine { align-self: flex-end; background: color-mix(in srgb, var(--brand) 22%, var(--card)); }
.chat-divider { align-self: center; font-size: 12px; color: var(--muted); padding: 4px 10px; border: 1px dashed var(--line); border-radius: 999px; }
.msg .t { font-size: 11px; color: var(--muted); margin-top: 4px; }
.notice { padding: 10px 12px; border-radius: 10px; background: #FFF4CC; color: #5C4400; font-size: 14px; }
.error { padding: 10px 12px; border-radius: 10px; background: #F8E1DE; color: var(--bad); font-size: 14px; }
.center { max-width: 420px; margin: 10vh auto; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px 40px; }
details summary { cursor: pointer; }
.hidden { display: none !important; }
td.wrap { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .wrap { padding: 12px; }
  .card { padding: 14px; }
  .hide-sm { display: none; }
  /* Phones: show each table row as a small stacked card instead of side-scrolling columns. */
  table.stack thead { display: none; }
  table.stack tr { display: block; padding: 10px 0; border-top: 1px solid var(--line); }
  table.stack td { display: block; border: 0; padding: 2px 0; }
  table.stack td.strong { font-weight: 600; }
  .topbar img { height: 46px; max-width: 170px; }
  .topbar img + .name { display: none; }
}
