/* Cannalitix: the one stylesheet. No third-party fonts or frameworks. Phones first; wider screens get more room. */
:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --text: #1b2420;
  --muted: #5b6661;
  --line: #d8ddd9;
  --accent: #1d6b47;
  --accent-hover: #175a3b;
  --accent-text: #ffffff;
  --accent-soft: #e2f0e7;
  --warn-bg: #fff5d9;
  --warn-line: #e3b947;
  --error-bg: #fde8e8;
  --error-line: #d98c8c;
  --error-text: #9b1c1c;
  --done-bg: #e2f0e7;
  --done-line: #86bf9d;
  --banner-bg: #c2410c;
  --banner-text: #ffffff;
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111613;
    --surface: #1a201d;
    --text: #e4eae6;
    --muted: #9ba6a0;
    --line: #2e3833;
    --accent: #52b987;
    --accent-hover: #6cc89b;
    --accent-text: #0c120f;
    --accent-soft: #1d3127;
    --warn-bg: #362d14;
    --warn-line: #86691d;
    --error-bg: #3a1d1d;
    --error-line: #8a3b3b;
    --error-text: #f2b8b8;
    --done-bg: #1d3127;
    --done-line: #3b7754;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0.5rem 0 0.75rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
p { margin: 0 0 0.75rem; }
code { font: 0.85em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code.wrap { display: block; white-space: pre-wrap; word-break: break-word; margin-top: 0.4rem; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 10; background: var(--surface); padding: 8px 12px; }
.hidden-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The bright strip outside production */
.env-banner {
  background: var(--banner-bg); color: var(--banner-text); text-align: center;
  font-weight: 700; letter-spacing: 0.08em; padding: 6px 16px;
}

/* Top bar: brand, who is signed in, sign out */
.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; margin-right: auto;
}
.who { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.who-name { font-weight: 600; }
.who-where { color: var(--muted); font-size: 0.85rem; }
.sign-out { margin: 0; }

/* Main menu: scrolls sideways on a phone instead of wrapping */
.menu {
  display: flex; gap: 4px; overflow-x: auto; padding: 0 12px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.menu a {
  padding: 10px 12px; white-space: nowrap; color: var(--muted); text-decoration: none;
  border-bottom: 3px solid transparent;
}
.menu a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* While the page asks the server whether the session still holds, its data is hidden */
body.checking main { visibility: hidden; }

/* Floats over the page: it must never move the page (a page that moves scrolls itself) */
.idle-warning {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; padding: 12px 16px;
  background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.foot { max-width: 1100px; margin: 0 auto; padding: 8px 16px 32px; color: var(--muted); font-size: 0.85rem; }

/* Blocks */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 0 0 16px;
}
.card.danger { border-color: var(--error-line); }
.lede { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.source { color: var(--muted); font-size: 0.85rem; margin: 0.75rem 0 0; }
.crumbs { margin: 0; font-size: 0.9rem; }
.nowrap { white-space: nowrap; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
ul.plain { margin: 0; padding-left: 1.2rem; }

/* Messages */
.notice { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 16px; }
.notice p:last-child { margin-bottom: 0; }
.notice.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.notice.error { background: var(--error-bg); border-color: var(--error-line); }
.notice.done { background: var(--done-bg); border-color: var(--done-line); }

/* Buttons: at least 44px tall, for fingers */
.button, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.button:hover, button:hover { background: var(--accent-hover); color: var(--accent-text); }
.button.quiet, button.quiet { background: transparent; color: var(--accent); }
.button.quiet:hover, button.quiet:hover { background: var(--accent-soft); color: var(--accent); }
.button.danger, button.danger { background: var(--error-text); border-color: var(--error-text); color: #fff; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.confirm { margin: 12px 0 0; }
.actions form { margin: 0; }

/* Forms */
form.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
label .muted, label .small { font-weight: 400; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; min-height: 44px; }
label.box { display: inline-flex; min-height: 44px; min-width: 44px; align-items: center; justify-content: center; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="search"], select,
textarea {
  font: inherit; width: 100%; max-width: 32rem; min-height: 44px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text);
}
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 0; min-width: 0; }
fieldset[disabled] { opacity: 0.45; }
legend { font-weight: 600; padding: 0 6px; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 0 0 16px; }
.filters label { flex-direction: row; align-items: center; gap: 8px; }
.filters select { width: auto; }

/* Tables scroll sideways inside their box on a phone, never the whole page */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.places td, table.places th { padding: 2px 10px; vertical-align: middle; }
table.audit details summary { cursor: pointer; color: var(--muted); }

/* Facts (label: value) */
dl.facts { display: grid; grid-template-columns: 1fr; gap: 2px 16px; margin: 0; }
dl.facts dt { color: var(--muted); font-size: 0.85rem; margin-top: 8px; }
dl.facts dd { margin: 0; }

.tag {
  display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.tag.on { border-color: var(--done-line); background: var(--done-bg); color: var(--text); }
.tag.off { border-color: var(--error-line); background: var(--error-bg); color: var(--error-text); }

/* Reports */
.filters input[type="date"], .filters input[type="search"] { width: auto; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 10px; margin: 0 0 16px; }
.figure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.figure .label { color: var(--muted); font-size: 0.8rem; }
.figure .value { font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 600; border-top: 2px solid var(--line); }
td.check { font-size: 0.85rem; }
.ok { color: var(--accent); }
.attention { color: var(--error-text); }
ul.reports { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
ul.reports a { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
               background: var(--surface); text-decoration: none; }
ul.reports a span { display: block; color: var(--muted); font-size: 0.85rem; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 12px; }
.tabs a { padding: 6px 12px; border-radius: 999px; text-decoration: none; border: 1px solid var(--line); }
.tabs a[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* Sign-in */
.sign-in { max-width: 32rem; margin: 8vh auto 0; }
.sign-in h2 { margin-top: 1.5rem; }
.choices-list { display: flex; flex-direction: column; gap: 6px; }
.stack-indent { margin-left: 30px; }
svg.qr { display: block; max-width: 100%; height: auto; border-radius: 8px; margin: 4px 0; }
code.secret { word-break: break-all; font-size: 0.95rem; }
.link-box { border-color: var(--done-line); background: var(--done-bg); }
.link-box input { font-family: ui-monospace, Menlo, Consolas, monospace; max-width: 100%; }
.sign-in .ask { margin-top: 1.25rem; }
.choices { display: flex; flex-direction: column; gap: 10px; margin: 0 0 16px; }
.button.choice { flex-direction: column; align-items: flex-start; padding: 12px 16px; text-align: left; }
.button.choice span { font-weight: 400; font-size: 0.85rem; opacity: 0.9; }

/* Wider screens */
@media (min-width: 720px) {
  main { padding: 24px; }
  h1 { font-size: 1.75rem; }
  dl.facts { grid-template-columns: 12rem 1fr; }
  dl.facts dt { margin-top: 0; padding: 6px 0; }
  dl.facts dd { padding: 6px 0; }
}
