:root {
  --bg: #f7f5f0;
  --panel: #ffffff;
  --ink: #1a1a1a;
  --muted: #6d6a63;
  --line: #e3dfd6;
  --accent: #1f4d3f;
  --accent-ink: #ffffff;
  --warn: #b4541a;
  --bad: #9b2c2c;
  --focus-bg: #0f0f0e;
  --focus-ink: #f2efe9;
  --focus-muted: #8c887f;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
body[data-view="focus"] { background: var(--focus-bg); color: var(--focus-ink); }

h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 14px; }
h3 { font-size: 13px; font-weight: 600; margin: 18px 0 6px; }
p { margin: 6px 0 0; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

input, select, textarea {
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }

.btn {
  font: inherit;
  font-weight: 550;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: #173b30; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.icon {
  border: 0; background: transparent; color: var(--muted);
  font-size: 18px; line-height: 1; padding: 4px 8px; cursor: pointer; border-radius: 6px;
}
.icon:hover:not(:disabled) { color: var(--ink); background: var(--bg); }
.icon:disabled { opacity: 0.25; cursor: default; }
.link { border: 0; background: none; color: inherit; opacity: 0.6; cursor: pointer; font: inherit; }
.link:hover { opacity: 1; }

.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.error { color: var(--bad); font-size: 14px; min-height: 1.5em; }

/* login */
.login { width: min(320px, 100%); display: grid; gap: 12px; text-align: center; }
.login h1 { font-size: 24px; margin-bottom: 8px; }
.mark { width: 36px; height: 36px; margin: 0 auto; border: 4px solid var(--ink); border-radius: 50%; position: relative; }
.mark::after { content: ""; position: absolute; inset: 9px; background: var(--ink); border-radius: 50%; }

/* layout */
.page { max-width: 1180px; margin: 0 auto; padding: 40px 24px 80px; }
.narrow-page { max-width: 760px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.eyebrow { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.empty { color: var(--muted); padding: 12px 0; margin: 0; }

.plan-clock { text-align: right; font-size: 13px; color: var(--muted); }
.plan-clock span { display: block; font: 600 28px/1 var(--mono); color: var(--ink); margin-bottom: 4px; }
.plan-clock.over span, .plan-clock.over { color: var(--warn); }

/* backlog */
.add { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
.add select { width: auto; }
.items { list-style: none; margin: 0; padding: 0; }
.items li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.items li:last-child { border-bottom: 0; }
.items li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* today */
.count { font-family: var(--mono); color: var(--muted); margin-left: 6px; }
.count.ok { color: var(--accent); }
.block-edit { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; display: grid; gap: 10px; }
.be-head { display: flex; align-items: center; gap: 10px; }
.be-head strong { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.be-tools { display: flex; align-items: center; gap: 2px; }
.num {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font: 600 13px var(--mono);
  background: var(--bg); border: 1px solid var(--line);
}
.field { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field select { font-size: 15px; font-weight: 400; color: var(--ink); }
.be-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.be-row .field { flex: 1 1 140px; }
.be-row .field.narrow { flex: 0 0 120px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; padding-bottom: 9px; white-space: nowrap; }
.check input { width: auto; }
.sacred { margin: 0; font-size: 13px; color: var(--accent); }
.lock-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-top: 8px; }
.errors { margin: 0; padding-left: 18px; color: var(--bad); font-size: 14px; }

/* day run list */
.run { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 10px; }
.run-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
}
.run-row.next { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.run-row.done, .run-row.abandoned { opacity: 0.6; }
.run-row.done .num { background: var(--accent); color: #fff; border-color: var(--accent); }
.run-main { flex: 1; min-width: 0; }
.run-title { font-weight: 600; overflow-wrap: anywhere; }
.cat { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 6px; }
.run-deliv { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.run-note { font-size: 13px; color: var(--bad); margin-top: 4px; }
.run-right { display: flex; align-items: center; gap: 10px; flex: none; }
.live { font: 500 14px var(--mono); color: var(--accent); }
.tag { font-size: 13px; }
.tag.abandoned { color: var(--bad); }
.summary { display: flex; gap: 40px; margin-bottom: 20px; }
.stat { font-size: 13px; color: var(--muted); }
.stat span { display: block; font: 600 26px/1.1 var(--mono); color: var(--ink); }
.capture .add { margin-top: 12px; }

/* focus */
.focus { min-height: 100vh; display: flex; flex-direction: column; padding: 28px 36px; }
.f-top { display: flex; justify-content: space-between; color: var(--focus-muted); font-size: 14px; }
.f-main { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 10px; padding-bottom: 6vh; }
.f-title { font-size: clamp(28px, 4vw, 48px); max-width: 22ch; overflow-wrap: anywhere; }
.f-deliv { color: var(--focus-muted); font-size: clamp(16px, 1.6vw, 20px); max-width: 48ch; margin: 0; }
.f-clock { font: 600 clamp(88px, 18vw, 220px)/1 var(--mono); letter-spacing: -0.04em; margin: 4vh 0 2vh; font-variant-numeric: tabular-nums; }
.f-clock.over { color: #e0703a; }
.f-bar { width: min(520px, 80vw); height: 4px; background: #2a2926; border-radius: 2px; overflow: hidden; }
.f-bar div { height: 100%; width: 0; background: var(--focus-ink); transition: width 1s linear; }
.f-ctrls { display: flex; gap: 12px; margin-top: 5vh; }
.f-btn { min-width: 130px; padding: 14px 22px; font-size: 17px; background: transparent; color: var(--focus-ink); border-color: #3a3935; }
.f-btn:hover:not(:disabled) { border-color: var(--focus-ink); }
.f-btn.primary { background: var(--focus-ink); color: var(--focus-bg); border-color: var(--focus-ink); }
.f-btn.primary:hover:not(:disabled) { background: #fff; }

body.alerting .focus { animation: flash 1s ease-in-out infinite alternate; }
@keyframes flash { from { background: var(--focus-bg); } to { background: #3b1a10; } }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(10, 10, 9, 0.6); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal-card { background: var(--panel); color: var(--ink); border-radius: 14px; padding: 28px; width: min(440px, 100%); display: grid; gap: 12px; }
.modal-card h2 { font-size: 24px; text-transform: none; letter-spacing: -0.01em; color: var(--ink); margin: 0; }
.modal-card form { display: grid; gap: 12px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 20;
}

@media (max-width: 860px) {
  .cols { grid-template-columns: 1fr; }
  .page { padding: 24px 16px 60px; }
  .head { flex-direction: column; align-items: flex-start; }
  .plan-clock { text-align: left; }
  .add { grid-template-columns: 1fr; }
  .add select { width: 100%; }
  .run-row { flex-wrap: wrap; }
  .focus { padding: 20px 16px; }
}
