@font-face {
  font-family: 'Rubik';
  src: url('../fonts/rubik.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --bg: #f6f1e7;
  --card: #fffdf8;
  --ink: #23201c;
  --muted: #6e665c;
  --line: #e3dacb;
  --red: #c8322b;
  --red-ink: #ffffff;
  --yellow: #f2bf1d;
  --blue: #1f5ba6;
  --green: #2f8a4e;
  --soft: #efe7d8;
  --shadow: 0 1px 0 rgba(60, 40, 10, .06), 0 6px 18px -10px rgba(60, 40, 10, .25);
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #181614; --card: #221f1c; --ink: #f2ece2; --muted: #a79d90; --line: #3a352f;
    --red: #e04a40; --yellow: #f2c53a; --blue: #6a9be0; --green: #5cbf7c; --soft: #2c2824;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 20px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #181614; --card: #221f1c; --ink: #f2ece2; --muted: #a79d90; --line: #3a352f;
  --red: #e04a40; --yellow: #f2c53a; --blue: #6a9be0; --green: #5cbf7c; --soft: #2c2824;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 20px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.45 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
[hidden] { display: none !important; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 10px) 0 10px; border-bottom: 1px solid transparent;
}
.bar.scrolled { border-bottom-color: var(--line); }
.bar .wrap { display: flex; align-items: center; gap: 10px; }
.bar h1 { font-size: 22px; font-weight: 700; margin: 0; flex: 1; min-width: 0; letter-spacing: -.01em; }
.back { width: 40px; height: 40px; margin-left: -8px; border: 0; background: none; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.back:hover, .back:focus-visible { background: var(--soft); }

/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: 11px; padding: 10px 16px; font-weight: 600; cursor: pointer;
  background: var(--red); color: var(--red-ink); display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18);
}
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn.quiet { background: var(--soft); color: var(--ink); box-shadow: none; }
.btn.sm { padding: 7px 12px; font-size: 14px; }
.btn.wide { width: 100%; justify-content: center; }
.btn.danger { background: none; color: var(--red); box-shadow: none; padding-left: 0; }
.icon-btn { width: 42px; height: 42px; border-radius: 11px; border: 0; background: var(--soft); cursor: pointer; display: grid; place-items: center; }

/* ---------- home ---------- */
.hero { padding: 6px 0 4px; }
.hero p { color: var(--muted); margin: 4px 0 18px; }
.rooms { display: grid; gap: 14px; padding-bottom: 20px; }
.room {
  display: grid; grid-template-columns: 88px 1fr; gap: 14px; align-items: center; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow);
  color: inherit; text-decoration: none; cursor: pointer; width: 100%;
}
.room:hover, .room:focus-visible { border-color: var(--muted); }
.room h2 { margin: 0 0 2px; font-size: 19px; }
.room p { margin: 0; color: var(--muted); font-size: 15px; }
.room .stat { margin-top: 6px; font-weight: 600; color: var(--ink); font-size: 14px; }
.room.soon { cursor: default; box-shadow: none; background: transparent; border-style: dashed; }
.room.soon:hover { border-color: var(--line); }
.room.soon .art { opacity: .55; }
.tag-soon { display: inline-block; margin-bottom: 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; }
.art { width: 88px; height: 72px; display: block; }

/* ---------- catalog ---------- */
.tools { display: flex; gap: 8px; margin: 2px 0 10px; }
.search { flex: 1; min-width: 0; position: relative; }
.search input {
  width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); padding: 0 12px 0 38px;
}
.search svg { position: absolute; left: 12px; top: 12px; color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 6px 12px; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .n { opacity: .65; margin-left: 4px; }
.sumline { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin: 2px 0 8px; }
.sumline select { border: 0; background: none; font-weight: 600; color: var(--ink); padding: 4px 0; cursor: pointer; }
.group { margin: 16px 0 6px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); display: flex; justify-content: space-between; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px 8px 8px; cursor: pointer;
}
.item:hover, .item:focus-visible { border-color: var(--muted); }
.pic { width: 64px; height: 52px; border-radius: 8px; background: #fff; display: grid; place-items: center; overflow: hidden; position: relative; }
:root[data-theme="dark"] .pic:not(.none) { background: #f4f1ea; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pic:not(.none) { background: #f4f1ea; } }
.pic img { width: 100%; height: 100%; object-fit: contain; }
.pic.none { background: var(--soft); }
.item .t { font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item .m { color: var(--muted); font-size: 13.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .main { min-width: 0; }
.badge { font-size: 12px; font-weight: 600; border-radius: 6px; padding: 3px 7px; white-space: nowrap; background: var(--soft); color: var(--ink); }
.badge.built { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.badge.partial { background: color-mix(in srgb, var(--yellow) 30%, transparent); color: color-mix(in srgb, var(--ink) 80%, var(--yellow)); }
.badge.apart { background: color-mix(in srgb, var(--blue) 16%, transparent); color: var(--blue); }
.badge.sealed { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.item .m.warn { color: var(--red); font-weight: 600; }
.empty { text-align: center; padding: 34px 10px 10px; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 20px; margin: 10px 0 6px; }
.empty .acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.fab-row { position: sticky; bottom: 0; padding: 12px 0 calc(env(safe-area-inset-bottom) + 12px); background: linear-gradient(transparent, var(--bg) 40%); display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 15, 10, .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--bg); width: 100%; max-width: 620px; max-height: 92vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .25); animation: up .2s ease-out;
}
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 18px; max-height: 86vh; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet:focus { outline: none; }
.sheet .hd { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px; border-bottom: 1px solid var(--line); }
.sheet .hd h2 { margin: 0; font-size: 19px; flex: 1; min-width: 0; }
.sheet .bd { padding: 14px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet .ft { padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px); border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > span, .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea, .bulk input, .bulk select, textarea.paste {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 11px; min-height: 42px;
}
.field textarea, textarea.paste { min-height: 76px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--soft); border-radius: 11px; padding: 4px; }
.seg button { border: 0; background: none; border-radius: 8px; padding: 8px 2px; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.check { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
.flag { background: color-mix(in srgb, var(--yellow) 22%, var(--card)); border: 1px solid color-mix(in srgb, var(--yellow) 60%, transparent); border-radius: 10px; padding: 9px 11px; margin: 0 0 12px; font-size: 14.5px; display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.note { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.lede { margin: 0 0 12px; }
.head-pic { width: 100%; height: 170px; border-radius: 12px; margin-bottom: 14px; }
.head-pic.none { display: none; }
.menu { list-style: none; padding: 0; margin: 0; }
.menu button, .menu a, .menu label { width: 100%; display: flex; gap: 12px; align-items: center; padding: 13px 4px; border: 0; background: none; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; color: var(--ink); text-decoration: none; }
.menu small { display: block; color: var(--muted); font-size: 13.5px; }
.menu li:last-child > * { border-bottom: 0; }
.how { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.how ol { margin: 6px 0 0; padding-left: 20px; }
.how li { margin: 3px 0; }

/* review list */
.rv { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.rv li { display: grid; grid-template-columns: 24px 56px 1fr; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.rv li.off { opacity: .55; }
.rv .pic { width: 56px; height: 46px; }
.rv input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--red); }
.rv .t { font-weight: 600; line-height: 1.25; }
.rv .m { color: var(--muted); font-size: 13.5px; }
.rv .w { color: var(--red); font-size: 13.5px; margin-top: 2px; }
.bulk { background: var(--soft); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; display: grid; gap: 8px; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 84px); transform: translateX(-50%); z-index: 40;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 11px; font-size: 15px; max-width: calc(100vw - 32px); box-shadow: var(--shadow);
}

.jd-foot { text-align: center; font-size: 13px; color: var(--muted); padding: 18px 16px calc(env(safe-area-inset-bottom) + 18px); }
.jd-foot a { color: inherit; text-decoration: none; }
.jd-foot a:hover, .jd-foot a:focus-visible { text-decoration: underline; }
#catalog ~ .jd-foot { padding-bottom: calc(env(safe-area-inset-bottom) + 18px); }
@media print { .jd-foot, .bar, .fab-row { display: none; } }
