:root {
  --red: #be1e2d; --red-dark: #8f1520; --red-soft: #fdeeee;
  --ink: #111111; --ink2: #3f3f46; --muted: #5c5c5c; --line: #e7e7ea; --line2: #f0f0f1;
  --bg: #f7f7f8; --card: #ffffff; --green: #1d6b3a; --green-soft: #e3f4e9;
  --amber: #8a5300; --amber-soft: #fff4cc; --yellow: #fde68a; --grey-soft: #f1f1f3;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--red); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px; text-align: center; color: var(--muted); }

.top { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line); padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.top img { height: 30px; width: auto; display: block; }
.top .who { font-size: 12px; color: var(--muted); text-align: right; }
.main { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: #fff; border-top: 1px solid var(--line); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 4px 0; min-height: 44px; justify-content: center; }
.nav a.on { color: var(--red); }
.nav svg { width: 22px; height: 22px; }

h1 { font-size: 22px; margin: 4px 0 0; }
h2 { font-size: 16px; margin: 0; }
.sub { font-size: 13px; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.card.tap { cursor: pointer; text-decoration: none; color: inherit; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.list > * + * { border-top: 1px solid var(--line2); }
.item { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }

.btn { height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid #d4d4d8; background: #fff; font-weight: 600; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.warn { color: #9b1515; border-color: #e7b8b8; }
.btn.sm { height: 34px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.seg { display: flex; gap: 4px; background: var(--grey-soft); padding: 4px; border-radius: 10px; }
.seg button { flex: 1; height: 36px; border: 0; border-radius: 8px; background: transparent; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.in, select.in, textarea.in { height: 44px; padding: 0 12px; border: 1px solid #d4d4d8; border-radius: 10px; background: #fff; font-size: 16px; color: var(--ink); font-weight: 400; width: 100%; }
textarea.in { height: auto; min-height: 80px; padding: 10px 12px; }
.in:focus, .btn:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) { .grid3:not(.fixed3) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fixed3 .stat { padding: 10px 8px; text-align: center; }
.fixed3 .stat b { font-size: 19px; }

.badge { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.b-tl { background: var(--red); color: #fff; }
.b-sd { background: var(--yellow); color: #713f12; }
.b-res { background: #e4e4e7; color: var(--ink2); }
.b-draft { background: var(--grey-soft); color: var(--ink2); }
.b-ok { background: var(--green-soft); color: var(--green); }
.b-warn { background: var(--amber-soft); color: var(--amber); }
.b-bad { background: var(--red-soft); color: #9b1515; }
.dot { width: 10px; height: 10px; border-radius: 5px; flex: none; }

.notice { border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.notice.ok { background: var(--green-soft); color: var(--green); }
.notice.warn { background: var(--amber-soft); color: var(--amber); border-left: 5px solid #e0a800; }
.notice.bad { background: var(--red-soft); color: #9b1515; }
.notice.info { background: var(--grey-soft); color: var(--ink2); }

.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 22px; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 6px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.scroll { overflow-x: auto; }

.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.35); border: 0; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: #fff; border-radius: 18px 18px 0 0; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.sheet .act { height: 50px; border-radius: 12px; border: 1px solid #e4e4e7; background: #fff; font-weight: 600; font-size: 15px; text-align: left; padding: 0 16px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.sheet .act.primary { background: var(--red); border-color: var(--red); color: #fff; }
.sheet .act.warn { color: #9b1515; }
a.act { text-decoration: none; color: var(--ink); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 60; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: 90%; }

.sugg { border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.1); display: flex; flex-direction: column; padding: 4px; margin-top: 4px; }
.sugg button { height: 40px; border: 0; background: transparent; text-align: left; padding: 0 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.sugg button:hover { background: var(--grey-soft); }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 3px 4px 3px 6px; font-size: 13px; }
.chip button { width: 26px; height: 26px; border: 0; background: transparent; font-size: 16px; color: var(--muted); cursor: pointer; }
.latz { width: 58px; height: 36px; text-align: center; padding: 0 4px; font-size: 15px; border-radius: 8px; }
.call { width: 44px; height: 44px; border-radius: 22px; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.offline { background: var(--amber-soft); color: var(--amber); font-size: 13px; font-weight: 600; text-align: center; padding: 6px; }

@media print {
  .top, .nav, .noprint { display: none !important; }
  .main { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}
