/* Layout: one narrow column, entry form first (thumb-reachable), then the week ledger. */
:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --fg: #16201e;
  --muted: #5d6b68;
  --line: #dde3e1;
  --accent: #1d5c55;
  --accent-fg: #ffffff;
  --accent-soft: #e2eeec;
  --danger: #b4372f;
  --c-admin: #6a7a86;
  --c-client: #2f7d5b;
  --c-mentor: #3f63b0;
  --c-james: #a2622a;
  --c-session: #8a4fa8;
  --c-company: #b8475f;
  --f-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --f-body: "Figtree", -apple-system, "Segoe UI", system-ui, sans-serif;
  --f-num: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1514; --surface: #182120; --fg: #e6ecea; --muted: #93a29f; --line: #2a3533;
    --accent: #5fb3a8; --accent-fg: #0b1211; --accent-soft: #1e3431; --danger: #ef7d73;
    --c-admin: #9aa9b4; --c-client: #5fbf92; --c-mentor: #7d9df0; --c-james: #e09a5c; --c-session: #c08ae0; --c-company: #ec8199;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 15px; line-height: 1.45; }
.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 48px; display: flex; flex-direction: column; gap: 20px; }
header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
header form { display: contents; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-top: -8px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.92rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.form-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.link { background: none; border: 0; padding: 0; color: var(--muted); font-size: 0.8rem; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
h1 { font-family: var(--f-display); font-weight: 700; font-size: 1.5rem; margin: 0; letter-spacing: -0.01em; }
h1 span { color: var(--accent); }
.status { font-size: 0.8rem; color: var(--muted); }
h2 { font-family: var(--f-display); font-weight: 600; font-size: 1.05rem; margin: 0; }
.label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
form { display: flex; flex-direction: column; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
input, textarea, button { font: inherit; color: inherit; }
input[type=date], input[type=text], input[type=password], textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; font-size: 16px;
}
textarea { resize: vertical; min-height: 64px; }
input:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hours { display: flex; align-items: stretch; gap: 6px; }
.hours input { text-align: center; font-family: var(--f-num); font-size: 1.1rem; min-width: 0; }
.step { width: 44px; flex: none; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; cursor: pointer; font-size: 1.2rem; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 10px; font-family: var(--f-num); font-size: 0.8rem; cursor: pointer; color: var(--muted); }
.quick button:hover { color: var(--fg); border-color: var(--muted); }

.cats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cat { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px; cursor: pointer; text-align: left; font-size: 0.88rem; font-weight: 500; min-height: 44px; }
.cat .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--c); }
.cat[aria-pressed="true"] { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); background: var(--surface); }
@media (max-width: 420px) { .cats { grid-template-columns: repeat(2, 1fr); } }

.actions { display: flex; gap: 10px; align-items: center; }
.primary { flex: 1; background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 10px; padding: 12px; font-weight: 600; cursor: pointer; min-height: 46px; }
.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; cursor: pointer; color: var(--muted); }
.msg { font-size: 0.85rem; color: var(--muted); min-height: 1.2em; }
.msg.err { color: var(--danger); }

.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.weeknav button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; font-size: 1rem; }
.weeknav .mid { text-align: center; flex: 1; min-width: 0; }
.weeknav .range { font-weight: 600; }

.summary { display: flex; flex-direction: column; gap: 12px; }
.total { display: flex; align-items: baseline; gap: 8px; }
.total .num { font-family: var(--f-num); font-size: 2rem; font-weight: 500; letter-spacing: -0.02em; }
.bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line); }
.bar span { background: var(--c); }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 0.85rem; }
.legend div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.legend .n { margin-left: auto; font-family: var(--f-num); font-variant-numeric: tabular-nums; color: var(--muted); }
.legend .zero { opacity: 0.45; }

.days { display: flex; flex-direction: column; gap: 16px; }
.day h3 { display: flex; justify-content: space-between; margin: 0 0 6px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.day h3 .n { font-family: var(--f-num); }
.entry { display: grid; grid-template-columns: 4px 1fr auto; gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.entry:first-of-type { border-top: 0; }
.entry .stripe { align-self: stretch; border-radius: 2px; background: var(--c); }
.entry .body { min-width: 0; }
.entry .cname { font-weight: 600; font-size: 0.92rem; }
.entry .notes { color: var(--muted); font-size: 0.88rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry .right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.entry .h { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.entry .tools { display: flex; gap: 4px; }
.entry .tools button { background: none; border: 0; color: var(--muted); font-size: 0.78rem; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.entry .tools button:hover { color: var(--fg); }
.entry .tools button.confirm { color: var(--danger); font-weight: 600; }
.entry.editing { background: var(--accent-soft); border-radius: 8px; padding-inline: 8px; margin-inline: -8px; }
.empty { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 20px 8px; }
.foot { display: flex; justify-content: flex-end; }
.login { max-width: 360px; padding-top: 15vh; }
@media (prefers-reduced-motion: no-preference) { .bar span { transition: flex-grow 0.3s ease; } }
