:root {
  --accent: #1E4D3F;
  --hero-ink: #F6F3EC;
  --hero-muted: rgba(246, 243, 236, 0.74);
  --bg: #F4F1EA; --surface: #FFFFFF; --track: #EEEAE0; --border: #E8E3D8;
  --ink: #1A1A17; --muted: #5E5B53; --on-strong: #FFFFFF;
  --ok-soft: #DCE9E2; --ok: #1E4D3F;
  --issue: #B4470F; --issue-soft: #FBE4D5; --issue-ink: #8E3709;
  --re-soft: #E1E8F2; --re: #2F4C70;
  --warn: #C9A24A; --warn-soft: #F6EDD3; --warn-ink: #6E5513;
  --note: #FFF6D9;
  --nav-bg: rgba(26, 26, 23, 0.94); --nav-border: rgba(26, 26, 23, 0.94);
  --nav-ink: #F4F1EA; --nav-muted: #A9A597;
  --photo-a: #EADFD3; --photo-b: #F3EAE0;
  --hero-shadow: 0 18px 40px -18px rgba(26, 26, 23, 0.35);
  --radius: 22px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0D0E0D; --surface: #171917; --track: #262926; --border: #2A2D2A;
  --ink: #F2EFE8; --muted: #A3A097; --on-strong: #0D0E0D;
  --ok-soft: #16302A; --ok: #8FD1B0;
  --issue: #E58A55; --issue-soft: #3A2216; --issue-ink: #F2AE85;
  --re-soft: #1A2535; --re: #A3BEE3;
  --warn: #D9B866; --warn-soft: #2C2715; --warn-ink: #E5CC85;
  --note: #22201A;
  --nav-bg: rgba(32, 35, 32, 0.92); --nav-border: #363A36;
  --nav-ink: #F4F1EA; --nav-muted: #8E8B83;
  --photo-a: #2A2C2A; --photo-b: #202220;
  --hero-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.45; font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { display: block; max-width: 100%; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; }
.screen { padding: 20px 20px 120px; display: flex; flex-direction: column; gap: 18px; }
.screen.no-nav { padding-bottom: 110px; }

h1, h2, h3, p { margin: 0; }
.h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.h2 { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.label-caps { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.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: 8px; }

/* Header */
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar .title { flex: 1; min-width: 0; }
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 22px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.icon-btn.solid { background: var(--accent); border-color: var(--accent); color: var(--hero-ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card.pad { padding: 16px; }
.list { padding: 2px 16px; }
.list > * + * { border-top: 1px solid var(--track); }

/* Hero */
.hero {
  background: var(--accent); color: var(--hero-ink); border-radius: 30px; padding: 22px;
  display: flex; flex-direction: column; gap: 18px; box-shadow: var(--hero-shadow);
}
.hero .chip { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,0.12); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero .big { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -0.035em; }
.hero .sub { font-size: 13px; color: var(--hero-muted); }
.hero hr { border: 0; height: 1px; background: rgba(255,255,255,0.14); margin: 0; }
.ring { width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ring > div { width: 68px; height: 68px; border-radius: 50%; background: var(--accent); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring b { font-size: 19px; font-weight: 800; }
.ring span { font-size: 10px; color: var(--hero-muted); }
.hero-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 18px; border-radius: 22px;
  background: var(--hero-ink); color: var(--accent); font-size: 14px; font-weight: 700; text-decoration: none; border: 0; white-space: nowrap;
}

/* Stats */
.stat { border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; }
.stat b { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.stat span { font-size: 13px; }
.stat.ok { background: var(--ok-soft); border-color: var(--ok-soft); color: var(--ok); }
.stat.issue { background: var(--issue-soft); border-color: var(--issue-soft); color: var(--issue-ink); }
.stat.re { background: var(--re-soft); border-color: var(--re-soft); color: var(--re); }
.stat.plain span { color: var(--muted); }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--track); color: var(--ink); white-space: nowrap; }
.pill.issue { background: var(--issue); color: var(--on-strong); }
.pill.issue-soft { background: var(--issue-soft); color: var(--issue-ink); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.re { background: var(--re-soft); color: var(--re); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.sm { font-size: 11px; padding: 3px 8px; border-radius: 8px; }

/* Progress */
.bar { height: 5px; border-radius: 3px; background: var(--track); overflow: hidden; }
.bar > div { height: 100%; border-radius: 3px; background: var(--warn); }
.bar > div.full { background: var(--ok); }
.segs { display: flex; gap: 3px; height: 8px; }
.segs > i { flex: 1; border-radius: 2px; background: var(--track); }
.segs > i.ok { background: var(--ok); } .segs > i.issue { background: var(--issue); } .segs > i.recheck { background: var(--re); }

/* Room rows */
.room-row { display: flex; flex-direction: column; gap: 9px; padding: 14px 0; text-decoration: none; color: inherit; }
.room-row .name { font-size: 15px; font-weight: 600; }

/* Buttons */
.btn {
  height: 52px; border-radius: 26px; border: 1px solid transparent; padding: 0 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 700; text-decoration: none; width: 100%;
}
.btn svg { width: 18px; height: 18px; }
.btn.dark { background: var(--ink); color: var(--bg); }
.btn.accent { background: var(--accent); color: var(--hero-ink); }
.btn.line { background: var(--surface); border-color: var(--border); color: var(--ink); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn.danger { background: transparent; border-color: var(--issue); color: var(--issue-ink); }
.btn.sm { height: 44px; font-size: 14px; border-radius: 22px; }
.btn[disabled] { opacity: 0.5; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-btn { height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; }
.chip-btn.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.seg3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.seg-btn { height: 44px; border-radius: 14px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; }
.seg-btn.on-ok { background: var(--ok); border-color: var(--ok); color: var(--on-strong); }
.seg-btn.on-issue { background: var(--issue); border-color: var(--issue); color: var(--on-strong); }
.seg-btn.on-recheck { background: var(--re); border-color: var(--re); color: var(--on-strong); }
.seg-btn.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* Item */
.item { padding: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.item .label { font-size: 15px; font-weight: 600; }
.item .hint { font-size: 13px; color: var(--muted); }
.detail { background: var(--issue-soft); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.detail.re { background: var(--re-soft); }
.detail .lbl { font-size: 12px; font-weight: 700; color: var(--issue-ink); }
.detail.re .lbl { color: var(--re); }
.field { width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 12px 14px; font-size: 15px; outline-color: var(--accent); }
textarea.field { min-height: 72px; resize: vertical; }
.field-label { font-size: 13px; font-weight: 700; display: block; margin-bottom: 6px; }

.photos { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.thumb { width: 64px; height: 64px; flex-shrink: 0; border-radius: 12px; overflow: hidden; border: 0; padding: 0; background: repeating-linear-gradient(135deg, var(--photo-a) 0 8px, var(--photo-b) 8px 16px); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.add-photo { width: 64px; height: 64px; flex-shrink: 0; border-radius: 12px; border: 1.5px dashed var(--issue-ink); background: transparent; color: var(--issue-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; font-weight: 700; position: relative; overflow: hidden; }
.add-photo input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.add-photo svg { width: 18px; height: 18px; }

/* Issue cards */
.issue-card { display: flex; gap: 14px; padding: 14px; text-decoration: none; color: inherit; }
.stack-photo { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.stack-photo .back { position: absolute; inset: 0; transform: rotate(6deg) translate(4px, -2px); border-radius: 14px; background: var(--photo-b); border: 1px solid var(--border); }
.stack-photo .front { position: absolute; inset: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: repeating-linear-gradient(135deg, var(--photo-a) 0 8px, var(--photo-b) 8px 16px); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); }
.stack-photo .front img { width: 100%; height: 100%; object-fit: cover; }
.stack-photo .count { position: absolute; left: 6px; bottom: 6px; display: flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 999px; background: rgba(13,14,13,0.75); color: #F6F3EC; font-size: 11px; font-weight: 700; }
.stack-photo .count svg { width: 12px; height: 12px; }

/* Deadline */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; padding: 12px 10px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; border-radius: 14px; }
.day small { font-size: 10px; font-weight: 600; opacity: 0.8; }
.day b { font-size: 15px; font-weight: 800; }
.day .dots { display: flex; gap: 2px; height: 5px; }
.day .dots i { width: 5px; height: 5px; border-radius: 50%; }
.day.today { background: var(--ink); color: var(--bg); }
.day.bast { background: var(--accent); color: var(--hero-ink); }
.dl-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.check-btn { width: 44px; height: 44px; flex-shrink: 0; border-radius: 22px; border: 1.5px solid var(--border); background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.check-btn.on { background: var(--ok); border-color: var(--ok); color: var(--on-strong); }
.check-btn svg { width: 18px; height: 18px; }
.done-text { opacity: 0.6; text-decoration: line-through; }

/* Notes */
.note-card { background: var(--note); border-radius: 24px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.q-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.q-row input[type="checkbox"] { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ok); flex-shrink: 0; }
.q-row .x { margin-left: auto; border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 16px; flex-shrink: 0; }

/* Settings rows */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 60px; padding: 10px 0; border: 0; background: transparent; text-align: left; color: inherit; text-decoration: none; }
.switch { width: 46px; height: 28px; flex-shrink: 0; border-radius: 14px; padding: 3px; display: flex; background: var(--track); transition: background .2s; }
.switch i { width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.switch.on { background: var(--ok); }
.switch.on i { transform: translateX(18px); }
.swatches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 8px; padding: 16px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: transparent; font-size: 12px; font-weight: 600; padding: 0; }
.swatch .ringw { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid transparent; }
.swatch.on .ringw { border-color: var(--ink); }
.swatch .ringw span { width: 36px; height: 36px; border-radius: 50%; display: block; }
.segbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 5px; border-radius: 18px; background: var(--track); }
.segbar button { height: 44px; border-radius: 14px; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; }
.segbar button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Bottom nav & action bar */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom));
  width: calc(100% - 32px); max-width: 448px; height: 68px; background: var(--nav-bg); border: 1px solid var(--nav-border);
  border-radius: 34px; display: flex; align-items: center; justify-content: space-around; padding: 0 8px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); z-index: 20;
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; padding: 6px 0; color: var(--nav-muted); font-size: 11px; font-weight: 600; text-decoration: none; }
.nav a.on { color: var(--nav-ink); font-weight: 700; }
.nav svg { width: 22px; height: 22px; }
.actionbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); width: calc(100% - 32px); max-width: 448px; display: flex; gap: 10px; z-index: 20; }
.actionbar .btn { height: 56px; border-radius: 28px; }

/* Sheet / modal */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 480px; border-radius: 28px 28px 0 0; padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; max-height: 90vh; overflow-y: auto; }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 60; display: flex; flex-direction: column; }
.viewer img { flex: 1; object-fit: contain; width: 100%; min-height: 0; }
.viewer .bar2 { display: flex; gap: 10px; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 16px; font-size: 14px; font-weight: 600; z-index: 70; max-width: calc(100% - 40px); text-align: center; }

.info { border-radius: 18px; padding: 12px 14px; font-size: 13px; line-height: 1.45; background: var(--re-soft); color: var(--re); }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* Print report */
#print { display: none; }
@media print {
  @page { size: A4; margin: 14mm; }
  html, body { background: #fff !important; color: #1A1A17 !important; }
  .app, .nav, .actionbar, .toast, .overlay, .viewer { display: none !important; }
  #print { display: block; font-size: 11pt; line-height: 1.4; }
  #print h1 { font-size: 20pt; margin: 0 0 4pt; letter-spacing: -0.02em; }
  #print h2 { font-size: 13pt; margin: 18pt 0 6pt; border-bottom: 1px solid #ccc; padding-bottom: 4pt; }
  #print h3 { font-size: 11pt; margin: 10pt 0 4pt; }
  #print .meta { color: #555; font-size: 10pt; }
  #print .sum { display: flex; gap: 8pt; margin: 10pt 0; }
  #print .sum div { flex: 1; border: 1px solid #ddd; border-radius: 6pt; padding: 6pt 8pt; font-size: 9pt; }
  #print .sum b { display: block; font-size: 16pt; }
  #print .pi { border: 1px solid #ddd; border-radius: 6pt; padding: 8pt; margin: 6pt 0; break-inside: avoid; }
  #print .pi .t { font-weight: 700; }
  #print .pi .m { font-size: 9pt; color: #555; }
  #print .pph { display: flex; flex-wrap: wrap; gap: 4pt; margin-top: 6pt; }
  #print .pph img { width: 38mm; height: 38mm; object-fit: cover; border-radius: 3pt; }
  #print table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  #print td, #print th { border-bottom: 1px solid #eee; padding: 4pt 2pt; text-align: left; vertical-align: top; }
  #print .sign { display: flex; gap: 20mm; margin-top: 24pt; break-inside: avoid; }
  #print .sign div { flex: 1; border-top: 1px solid #333; padding-top: 4pt; font-size: 9.5pt; margin-top: 22mm; }
  #print .foot { margin-top: 16pt; font-size: 8.5pt; color: #777; }
}
