:root {
  --ink: #1c1914;
  --paper: #f3ecdc;
  --sheet: #fffaf0;
  --rail: #1b2420;
  --rail-ink: #e7dfcc;
  --copper: #b35c38;
  --moss: #2f6f5e;
  --line: #d8ccb4;
  --warn: #9b2f1a;
  --ok: #2a6b4f;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body.app-body {
  margin: 0;
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans SC", "PingFang SC", sans-serif;
}

h1, h2, .brand-name {
  font-family: "Noto Serif SC", serif;
}

.rail {
  background: var(--rail);
  color: var(--rail-ink);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  color: inherit;
  text-decoration: none;
  display: grid;
  gap: 4px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #c9b48a;
  color: #e8c27a;
  font-family: "Noto Serif SC", serif;
  font-weight: 700;
}

.brand-name { font-size: 22px; letter-spacing: 0.12em; }
.brand-sub { font-size: 12px; opacity: 0.7; }

.rail-nav { display: grid; gap: 6px; }

.rail-link {
  color: inherit;
  text-decoration: none;
  padding: 8px 10px;
  border-left: 2px solid transparent;
  opacity: 0.78;
}

.rail-link.active, .rail-link:hover {
  opacity: 1;
  border-left-color: #e8c27a;
  background: rgba(232, 194, 122, 0.08);
}

.rail-user {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  font-size: 13px;
}

.who { display: grid; }
.who span { opacity: 0.65; font-size: 12px; }

.linkish, .quiet {
  background: none;
  border: 0;
  color: #e8c27a;
  text-decoration: none;
  padding: 0;
  cursor: pointer;
}

.quiet { color: var(--copper); }

.stage { min-width: 0; }
.sheet { padding: 36px 40px 64px; max-width: 1180px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 28px;
}

.page-head h1 { font-size: 34px; margin: 0; }
.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  color: #7a6e5b;
}

.btn-ink, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  padding: 9px 16px;
  min-height: 40px;
  cursor: pointer;
}

.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost.danger { border-color: var(--warn); color: var(--warn); }
.actions { display: flex; gap: 8px; align-items: start; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat, .panel {
  background: var(--sheet);
  border: 1px solid var(--line);
  padding: 18px;
}

.stat span { color: #6f6556; font-size: 13px; }
.stat strong { display: block; font-size: 32px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat.warn strong { color: var(--warn); }

.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; margin-bottom: 20px; }
.panel h2 { font-size: 20px; margin: 0 0 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.panel-head a { color: var(--copper); }
.muted { color: #6f6556; }
.mt { margin-top: 22px; }

.meter {
  height: 8px;
  background: #eadfc8;
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  background: #8a7a5e;
}

.meter.actual i { background: var(--moss); }

.compare, .load-list { display: grid; gap: 14px; }
.compare > div, .load-list li { display: grid; grid-template-columns: 88px 1fr 48px; gap: 10px; align-items: center; }
.load-list { list-style: none; padding: 0; margin: 0; }
.done-split { display: flex; gap: 18px; margin-top: 16px; color: #6f6556; }

.ledger { width: 100%; border-collapse: collapse; }
.ledger th {
  text-align: left;
  font-weight: 500;
  color: #6f6556;
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  font-size: 13px;
}
.ledger td { padding: 14px 8px; border-bottom: 1px solid #eee3cc; vertical-align: top; }
.ledger tr.overdue td { background: #f8ece3; }
.title-link { color: var(--ink); font-weight: 700; text-decoration: none; }
.meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; color: #6f6556; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.lg { width: 12px; height: 12px; }
.twin { display: grid; gap: 4px; min-width: 140px; }
.gap { display: block; margin-top: 6px; color: #6f6556; }
.gap.behind { color: var(--warn); }
.gap.ahead { color: var(--ok); }
.late { color: var(--warn); font-size: 12px; }
.empty { text-align: center; color: #6f6556; padding: 32px !important; }

.stamp {
  display: inline-block;
  border: 1px solid currentColor;
  padding: 1px 7px;
  font-size: 12px;
  letter-spacing: 0.06em;
}
.stamp-todo { color: #6f6556; }
.stamp-doing { color: #9a5b12; }
.stamp-done { color: var(--ok); }
.stamp-cancel { color: #888; }
.prio { font-size: 12px; }
.prio-urgent { color: var(--warn); font-weight: 700; }
.prio-high { color: var(--copper); }
.prio-mid, .prio-low { color: #6f6556; }

.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar input, .filter-bar select, .field {
  border: 1px solid var(--line);
  background: var(--sheet);
  color: var(--ink);
  padding: 8px 10px;
  min-height: 40px;
  width: 100%;
}

.filter-bar input, .filter-bar select { width: auto; min-width: 140px; }

.form-grid { display: grid; gap: 16px; }
.form-wide { grid-column: 1 / -1; }
.form-narrow { max-width: 520px; display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: grid; gap: 6px; font-size: 13px; color: #4d463b; }
.form-actions { display: flex; gap: 8px; }
.field-error, .form-error { color: var(--warn); font-size: 13px; }

.facts { display: grid; gap: 10px; margin: 0 0 14px; }
.facts div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.facts dt { color: #6f6556; }
.facts dd { margin: 0; font-weight: 700; }
.note { white-space: pre-wrap; }

.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: start;
}

.board-col { background: #efe6d2; border: 1px solid var(--line); padding: 12px; min-height: 280px; }
.board-col header { display: flex; justify-content: space-between; margin-bottom: 12px; }
.board-col h2 { font-size: 16px; margin: 0; }
.ticket {
  display: grid;
  gap: 8px;
  background: var(--sheet);
  border: 1px solid var(--line);
  padding: 12px;
  margin-bottom: 10px;
  color: inherit;
  text-decoration: none;
}
.ticket strong { font-size: 15px; }

.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.project-card header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.project-card h2 { margin: 0; font-size: 20px; }

.toast-bar {
  background: #2f6f5e;
  color: #f3ecdc;
  padding: 10px 40px;
}

.login-body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background: #1b2420;
  color: var(--paper);
  font-family: "Noto Sans SC", sans-serif;
}

.login-card {
  width: min(420px, 92vw);
  background: var(--paper);
  color: var(--ink);
  padding: 36px;
  border: 1px solid #c9b48a;
}

.login-head h1 { margin: 0 0 8px; font-size: 36px; }
.login-form { display: grid; gap: 14px; margin-top: 24px; }
.remember { display: flex; align-items: center; gap: 8px; }
.hint { color: #6f6556; font-size: 12px; margin: 0; }

@media (max-width: 1100px) {
  body.app-body { grid-template-columns: 1fr; }
  .rail { height: auto; position: relative; }
  .stat-grid, .split, .board, .project-grid { grid-template-columns: 1fr; }
  .sheet { padding: 24px; }
}
