:root {
  --paper: #f3efe6;
  --ink: #1c2430;
  --muted: #5c6670;
  --navy: #12343f;
  --card: #fffdf8;
  --line: #e3dccf;
  --red: #9f2d22;
  --red-bg: #fdeceb;
  --yellow: #8a5a00;
  --yellow-bg: #fff6df;
  --green: #1d6b45;
  --green-bg: #e7f6ee;
  --shadow: 0 8px 24px rgba(18, 52, 63, 0.06);
  font-family: "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 96px;
}

#tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(243, 239, 230, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
#tabbar button {
  min-width: 72px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
}
#tabbar button[aria-current="page"] {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}

.brand {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.brand h1 {
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 28px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.03em;
}
.brand p, .quiet { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
.linkish {
  border: 0;
  background: transparent;
  color: var(--navy);
  min-height: 44px;
  padding: 0 4px;
}

.counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.counts button, .chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  min-height: 64px;
  text-align: left;
  padding: 8px 10px;
}
.counts strong { display: block; font-size: 22px; }
.counts button[aria-pressed="true"], .chip[aria-pressed="true"] {
  outline: 2px solid var(--navy);
}
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 6px; }
.dot.red, .rail.red { background: var(--red); }
.dot.yellow, .rail.yellow { background: #e0a106; }
.dot.green, .rail.green { background: var(--green); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters select { flex: 1 1 140px; min-width: 0; }
.filters select, .field input, .field select, .field textarea, textarea {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  padding: 8px 10px;
}

.card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px;
  margin: 0 0 12px;
}
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card h3 { margin: 16px 0 8px; font-size: 15px; }
.row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.phase {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 10px;
  background: #e7eef1;
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}
.row h1, .row h2 { min-width: 0; overflow-wrap: anywhere; }
.checkpoint {
  display: grid;
  grid-template-columns: 6px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.checkpoint .body { min-width: 0; }
.checkpoint .actions { grid-column: 1 / -1; }
.checkpoint .title { font-weight: 600; }
.checkpoint .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.rail { border-radius: 99px; }
.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.yellow { background: var(--yellow-bg); color: var(--yellow); }
.tag.green { background: var(--green-bg); color: var(--green); }

.cargo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.cargo div { background: #f6f3ec; border-radius: 12px; padding: 8px; }
.cargo span { display: block; color: var(--muted); font-size: 11px; letter-spacing: 0.06em; }
.cargo strong { font-size: 16px; }

.steps { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.step {
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  min-height: 44px;
  background: white;
  font-size: 13px;
}
.step.done { color: var(--green); }
.step.current { background: var(--navy); color: white; border-color: var(--navy); }

.login {
  margin-top: 12vh;
}
.login h1 { font-family: Georgia, serif; font-size: 36px; margin-bottom: 4px; }
.field { margin: 12px 0; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.primary, .ghost, .danger {
  min-height: 44px;
  border-radius: 12px;
  padding: 8px 12px;
  border: 1px solid transparent;
}
.primary { background: var(--navy); color: white; width: 100%; }
.ghost { background: white; border-color: var(--line); }
.danger { background: var(--red-bg); color: var(--red); border-color: transparent; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.actions input, .actions select { flex: 1 1 140px; min-width: 0; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: white; padding: 8px 10px; }
.actions .primary, .actions .ghost, .actions .danger { width: auto; }
.error {
  background: var(--red-bg);
  color: var(--red);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0;
}
.shift {
  background: #fff8ea;
  border: 1px solid #efd7a4;
  border-radius: 16px;
  padding: 12px;
  margin: 8px 0;
}
.money { font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 12px 0; }
.notice {
  background: var(--green-bg);
  color: var(--green);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 12px;
}
label.quiet { display: flex; align-items: center; gap: 8px; min-height: 44px; }
@media (min-width: 900px) {
  #app { max-width: 720px; }
}
.help { background: #e7eef1; border-radius: 14px; padding: 8px 12px; margin: 8px 0 12px; }
.help summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.menu-link { display: flex; align-items: center; min-height: 48px; border-bottom: 1px solid var(--line); }
.back { margin-bottom: 8px; }
textarea { min-height: 88px; }
