:root {
  --ink: #1d2421;
  --muted: #5e675f;
  --paper: #f3ecdf;
  --card: #fffaf3;
  --line: #e3d5c3;
  --sumi: #24312e;
  --asagi: #1f6a72;
  --asagi-deep: #154e54;
  --beni: #b42318;
  --gold: #8a5a12;
  --matcha: #246246;
  --hot: #9a3412;
  --shadow: 0 16px 40px rgba(36, 49, 46, 0.08);
  font-family: "Yu Gothic", "Hiragino Sans", "WenQuanYi Micro Hei", "Noto Sans CJK JP", "Droid Sans Fallback", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(31, 106, 114, 0.08), transparent 32%),
    linear-gradient(180deg, #f7f1e6 0%, var(--paper) 28%, #efe6d6 100%);
  min-height: 100vh;
}
a { color: var(--asagi-deep); }
code { font-family: "Iosevka", "Source Code Pro", ui-monospace, monospace; font-size: 0.92em; }
.skip {
  position: absolute; left: 1rem; top: -4rem; background: white; padding: 0.4rem 0.6rem;
}
.skip:focus { top: 0.5rem; }

.top {
  display: flex; gap: 1rem; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.25rem; background: var(--sumi); color: #f6f0e6; flex-wrap: wrap;
}
.brand { display: flex; gap: 0.75rem; align-items: center; }
.seal {
  width: 2.6rem; height: 2.6rem; border: 2px solid #e25b45; color: #ffd7cf; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.72rem; letter-spacing: 0.08em;
}
.eyebrow { margin: 0; font-size: 0.72rem; letter-spacing: 0.08em; color: #d9cbb8; }
.logo { color: white; text-decoration: none; font-size: 1.15rem; font-weight: 700; }
.nav { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.nav a { color: #f6f0e6; text-decoration: none; border-bottom: 1px solid transparent; }
.nav a:hover { border-color: #e7c9a1; }
.actor { display: flex; gap: 0.4rem; align-items: end; }
.actor label, .filters label, .clockbar label, .stack label { display: grid; gap: 0.2rem; font-size: 0.78rem; }
.top select, .top button { background: #314540; color: white; border: 1px solid #6e8178; }

.banner {
  background: #fff1e8; color: #7a2714; border-bottom: 1px solid #f0c2b2;
  padding: 0.7rem 1.25rem; font-size: 0.92rem;
}
.clockbar {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 0.65rem 1.25rem; background: rgba(255, 250, 243, 0.8); border-bottom: 1px solid var(--line);
}
.clockbar form { display: flex; gap: 0.5rem; align-items: end; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 0.82rem; }
main { width: min(1180px, calc(100% - 2rem)); margin: 1.25rem auto 2rem; }
footer { width: min(1180px, calc(100% - 2rem)); margin: 0 auto 2rem; color: var(--muted); font-size: 0.85rem; }

h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.2; margin: 0.15rem 0; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 0.6rem; }
.kicker { margin: 0; color: var(--asagi); font-size: 0.82rem; letter-spacing: 0.04em; }
.lede { color: var(--muted); max-width: 46rem; }
.page-head { display: flex; justify-content: space-between; gap: 1rem; align-items: end; flex-wrap: wrap; }
.muted { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 400; }
.permalink { font-size: 0.85rem; word-break: break-all; }

.filters, .actions { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: end; margin: 0.8rem 0 1rem; }
.actions { align-items: start; }
.stack { display: grid; gap: 0.35rem; }
input, select, button {
  font: inherit; color: var(--ink); background: white; border: 1px solid #cfc1ae; border-radius: 8px; padding: 0.4rem 0.55rem;
}
button { background: var(--asagi); color: white; border-color: var(--asagi-deep); cursor: pointer; }
button:hover { background: var(--asagi-deep); }
button.ghost { background: transparent; color: var(--ink); }
button.danger { background: var(--beni); border-color: #8e1b12; }
input.narrow { width: 5rem; }
.form-actions { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; margin-top: 0.8rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
table.ledger { width: 100%; border-collapse: collapse; min-width: 720px; }
table.days { min-width: 980px; }
th, td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 0.92rem; }
th { font-size: 0.75rem; letter-spacing: 0.04em; color: var(--muted); background: #f7f1e6; }
tr.missing { background: #fff4e8; }
tr.off { color: #5c6560; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hot { color: var(--hot); font-weight: 700; }
.warn { color: var(--gold); display: block; font-size: 0.78rem; }

.pill { display: inline-block; border-radius: 999px; padding: 0.12rem 0.5rem; font-size: 0.75rem; background: #efe6d6; }
.pill-draft { background: #ece7dc; }
.pill-pending_first { background: #d9efe8; color: #135646; }
.pill-pending_second { background: #d7e7f5; color: #163e66; }
.pill-approved { background: #e5efd8; color: #245014; }
.pill-rejected, .pill-returned { background: #fde2dc; color: #8a2418; }

.totals { display: grid; grid-template-columns: repeat(3, minmax(90px, 1fr)); gap: 0.45rem; margin: 0; min-width: min(100%, 420px); }
.totals div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0.45rem 0.6rem; }
.totals dt { color: var(--muted); font-size: 0.72rem; }
.totals dd { margin: 0.1rem 0 0; font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.alert { border-radius: 12px; padding: 0.7rem 0.85rem; }
.alert.bad { background: #fde8e4; color: #7a2714; }
.alert.good { background: #e5f4ea; color: #145232; }
.alert.hot { background: #fff1e4; color: #7c2d12; }
.empty, .lock { background: var(--card); border: 1px dashed #cbbba6; border-radius: 12px; padding: 0.9rem 1rem; }
.blockers { margin: 0; padding-left: 1.1rem; color: #7a2714; }
.confirm-box { margin-top: 1rem; padding: 1rem; background: white; border-left: 4px solid var(--beni); border-radius: 12px; box-shadow: var(--shadow); }
.textlink { margin-left: 0.8rem; }
.plain { padding-left: 1.1rem; }
.steps { line-height: 1.6; }

@media (max-width: 800px) {
  .top, .clockbar { align-items: stretch; }
  .actor, .actor select { width: 100%; }
  main { width: min(100% - 1rem, 1180px); }
  .totals { grid-template-columns: repeat(2, 1fr); }
}
