:root {
  --bg: #fbf6ee;
  --surface: #ffffff;
  --ink: #2b2118;
  --muted: #7a6a5c;
  --line: #eadfce;
  --sun: #e9a23b;
  --sun-deep: #c97f1a;
  --terra: #b5532f;
  --good: #3f7d4e;
  --bad: #b23a2b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .06);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
.brand { font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif; font-weight: 600; letter-spacing: .01em; }
.muted { color: var(--muted); }
.tabular { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px max(24px, env(safe-area-inset-right)) 14px max(24px, env(safe-area-inset-left));
  padding-top: max(14px, env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
header.top .logo { display: flex; align-items: center; gap: 10px; font-size: 20px; white-space: nowrap; }
header.top button { white-space: nowrap; }
.logo svg { width: 30px; height: 30px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }

button, .btn {
  font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 10px 16px; cursor: pointer; font-weight: 550;
}
button:active { transform: translateY(1px); }
.btn-primary { background: var(--sun); border-color: var(--sun-deep); color: #2b1a05; }
.btn-primary:disabled { opacity: .5; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
input, textarea, select {
  font: inherit; color: inherit; width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: #fffdf9;
}
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 3px solid rgba(233, 162, 59, .45); outline-offset: 1px; }
label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 6px; font-weight: 550; }

.banner { background: #fff3d6; border-bottom: 1px solid #f0d9a4; color: #6b4a10; padding: 8px 24px; font-size: 14px; }
.error { color: var(--bad); font-size: 15px; min-height: 1.3em; margin-top: 10px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #f4ecdf; color: var(--muted); }
.pill.open { background: #e6f1e8; color: var(--good); }
.pill.mid { background: #fdf0d8; color: var(--sun-deep); }
.pill.close { background: #f7e4dc; color: var(--terra); }
.pill.note { background: #ece8f5; color: #5a4a8a; }

/* Login screens */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: min(420px, 100%); text-align: center; }
.login .logo-big svg { width: 64px; height: 64px; }
.login h1 { font-size: 28px; margin: 8px 0 4px; }
.login form { text-align: left; margin-top: 22px; display: grid; gap: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 14px 22px; border-radius: 12px; font-weight: 550;
  transition: .25s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Phone overrides — keep last so they win over the base rules above */
@media (max-width: 520px) {
  header.top { padding: max(10px, env(safe-area-inset-top)) 14px 10px; }
  header.top .logo { font-size: 18px; }
  .banner { padding: 8px 14px; font-size: 13px; }
}
