:root {
  --navy: #0b1f3a;
  --navy-2: #122a4a;
  --navy-3: #1a3a5c;
  --ink: #0e1a2b;
  --gold: #c5a572;
  --gold-2: #e0c48a;
  --cream: #f4f1ea;
  --paper: #fbf8f2;
  --line: rgba(197, 165, 114, 0.28);
  --muted: #6d7a8b;
  --ok: #2e7d4f;
  --warn: #b45309;
  --bad: #8b1e2d;
  --shadow: 0 18px 40px rgba(11, 31, 58, 0.18);
  --r: 16px;
  --font: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --display: "Cormorant Garamond", "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--cream); color: var(--ink); font-family: var(--font); min-height: 100%; }
body { padding-bottom: 88px; }
button, input, select, textarea { font-family: inherit; }
a { color: inherit; }

.app-header {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, #0b1f3a 0%, #102844 100%);
  color: var(--cream);
  border-bottom: 3px solid var(--gold);
  padding: 12px 16px 10px;
}
.brand-row { display: flex; align-items: center; gap: 12px; }
.crest {
  width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid var(--gold);
  display: grid; place-items: center;
  background: #0b1f3a;
  flex: 0 0 auto;
}
.crest svg { width: 24px; height: 24px; }
.brand h1 {
  font-family: var(--display);
  font-size: 22px; line-height: 1; margin: 0; font-weight: 600; letter-spacing: 0.02em;
}
.brand p { margin: 2px 0 0; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-2); }
.header-meta { margin-left: auto; text-align: right; font-size: 12px; color: #d7c7a6; }
.header-meta strong { display: block; color: #fff; font-size: 14px; }

.wrap { max-width: 980px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2, .card h3 {
  font-family: var(--display);
  margin: 0 0 10px;
}
.card h2 { font-size: 26px; }
.card h3 { font-size: 20px; color: var(--navy); }
.kicker {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold);
  font-weight: 700; margin-bottom: 4px;
}
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.stat {
  background: var(--navy);
  color: var(--cream);
  border-radius: 14px;
  padding: 12px;
  min-width: 0;
}
.stat .lbl { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-2); }
.stat .val { font-family: var(--display); font-size: 26px; line-height: 1.1; margin-top: 4px; }
.stat .sub { font-size: 12px; color: #c9d4e3; margin-top: 2px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600;
  background: rgba(197,165,114,0.16); color: var(--navy);
}
.pill.ok { background: rgba(46,125,79,0.15); color: var(--ok); }
.pill.warn { background: rgba(180,83,9,0.14); color: var(--warn); }
.pill.bad { background: rgba(139,30,45,0.12); color: var(--bad); }
.pill.gold { background: var(--navy); color: var(--gold-2); }

.btn {
  appearance: none; border: 0; cursor: pointer;
  background: var(--navy); color: var(--cream);
  border-radius: 999px; padding: 10px 16px; font-weight: 650;
  letter-spacing: 0.02em;
}
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn.ok { background: var(--ok); }
.btn.bad { background: var(--bad); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.sm { padding: 7px 12px; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.field input, .field select, .field textarea {
  border: 1px solid #ddd4c4; background: #fff; border-radius: 10px;
  padding: 9px 10px; font-size: 15px; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--gold); border-color: var(--gold);
}
.yellow input, input.yellow { background: #fff6bf; }

.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.check-list li:last-child { border-bottom: 0; }
.check-list input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--navy); flex: 0 0 auto; }
.check-list span { line-height: 1.4; }
.check-list li.done span { text-decoration: line-through; color: var(--muted); }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: #0b1f3a; color: #d7c7a6;
  display: grid; grid-template-columns: repeat(6, 1fr);
  border-top: 2px solid var(--gold);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
}
.nav button {
  background: none; border: 0; color: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 700;
  padding: 6px 2px;
}
.nav button.active { color: var(--gold-2); }
.nav svg { width: 20px; height: 20px; }

.week-head {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  cursor: pointer; user-select: none;
}
.day-row {
  display: grid; grid-template-columns: 72px 1fr auto;
  gap: 8px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.day-row:hover { background: rgba(197,165,114,0.08); }
.day-row .when { font-size: 12px; color: var(--muted); }
.day-row .when b { display: block; color: var(--navy); font-size: 14px; }
.day-row.today { background: rgba(197,165,114,0.16); border-radius: 10px; padding: 10px 8px; }
.day-row.done .when b { color: var(--ok); }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line);
}
table.data td { padding: 6px; border-bottom: 1px solid #eee6d8; vertical-align: middle; }
table.data input { width: 100%; min-width: 58px; border: 1px solid #eee; border-radius: 8px; padding: 6px; background: #fff6bf; }

.progress-bar { height: 8px; background: #e8dfcf; border-radius: 99px; overflow: hidden; }
.progress-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 13px; z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

.hidden { display: none !important; }
.page { animation: in .25s ease; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.chart { width: 100%; height: 180px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.note { font-size: 13px; line-height: 1.5; color: #334155; }
.score { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; }
.score input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--navy); }

.install-banner {
  display: none; align-items: center; justify-content: space-between; gap: 10px;
  background: #132844; color: var(--cream); padding: 10px 16px;
}
.install-banner.show { display: flex; }

@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .header-meta { display: none; }
  table.data { font-size: 12px; }
}
@media (max-width: 520px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
.offline { font-size: 11px; color: var(--gold-2); }
.nav-ico { display: grid; place-items: center; height: 20px; }
.nav-ico svg { width: 20px; height: 20px; }
.span-2 { grid-column: 1 / -1; }
.timer-box {
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.timer-box strong {
  font-family: var(--display); font-size: 28px; min-width: 78px;
}
.week-head + div { display: block; }
