/* =========================================================
   Сундук — учёт вещей и хранилищ
   Светлая и тёмная темы, мобильный-first.
   ========================================================= */

:root {
  --bg: #FCF6EA;
  --bg-soft: #F7EDDA;
  --surface: #FFFDF8;
  --surface-2: #F8F0E0;
  --ink: #2B2017;
  --ink-soft: #57452F;
  --muted: #89775F;
  --line: #E7D8C0;
  --line-strong: #D8C3A3;
  --accent: #B4461F;
  --accent-2: #CD5C33;
  --accent-ink: #FFF9F2;
  --gold: #C89A54;
  --green: #6F8260;
  --danger: #A62F22;
  --shadow: 0 14px 34px rgba(74, 48, 25, .09);
  --shadow-sm: 0 4px 14px rgba(74, 48, 25, .07);
  --radius: 18px;
  --radius-sm: 12px;
  --font-sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", "PT Serif", serif;
  --maxw: 1240px;
}

:root[data-theme="dark"] {
  --bg: #17120E;
  --bg-soft: #1E1711;
  --surface: #241C15;
  --surface-2: #2C231A;
  --ink: #F4E9D8;
  --ink-soft: #D8C6AE;
  --muted: #A7937A;
  --line: #3A2E22;
  --line-strong: #4C3B2B;
  --accent: #CF5A2E;
  --accent-2: #E0703F;
  --accent-ink: #1B120B;
  --gold: #D8AB63;
  --green: #8FA37C;
  --danger: #D4553F;
  --shadow: 0 18px 40px rgba(0, 0, 0, .38);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, .3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17120E;
    --bg-soft: #1E1711;
    --surface: #241C15;
    --surface-2: #2C231A;
    --ink: #F4E9D8;
    --ink-soft: #D8C6AE;
    --muted: #A7937A;
    --line: #3A2E22;
    --line-strong: #4C3B2B;
    --accent: #CF5A2E;
    --accent-2: #E0703F;
    --accent-ink: #1B120B;
    --gold: #D8AB63;
    --green: #8FA37C;
    --danger: #D4553F;
    --shadow: 0 18px 40px rgba(0, 0, 0, .38);
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
h1, h2, h3 { font-family: var(--font-serif); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 3.4vw, 40px); }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sprite { display: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.pre { white-space: pre-line; }
.ic { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: -4px; }
.ic.big { width: 44px; height: 44px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; line-height: 1.2; text-align: center;
  transition: background .18s, color .18s, border-color .18s, transform .12s, box-shadow .18s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 18px rgba(180, 70, 31, .2); }
.btn-primary:hover { background: var(--accent-2); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-soft { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn-soft:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--line-strong); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.btn-sm { padding: 8px 13px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { padding: 14px 24px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn .ic { width: 18px; height: 18px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft); transition: background .18s, color .18s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.link { display: inline-flex; align-items: center; gap: 3px; font-size: 14px; font-weight: 600; color: var(--accent); }
.link .ic { width: 15px; height: 15px; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.field > span b { color: var(--accent); font-weight: 700; }
.field input, .field select, .field textarea,
.filters input, .filters select, .search-hero input {
  width: 100%; padding: 12px 14px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); transition: border-color .16s, box-shadow .16s, background .16s;
}
.field input::placeholder, .field textarea::placeholder, .filters input::placeholder { color: var(--muted); opacity: .8; }
.field input:focus, .field select:focus, .field textarea:focus,
.filters input:focus, .filters select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.field input:disabled { background: var(--surface-2); color: var(--muted); }
.field textarea { resize: vertical; min-height: 64px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row { display: flex; align-items: center; gap: 10px; }
.form-row.end { justify-content: flex-end; margin-top: -6px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-soft); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.dashed-line { position: relative; text-align: center; margin: 6px 0; color: var(--muted); font-size: 13px; }
.dashed-line::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed var(--line-strong); }
.dashed-line span { position: relative; background: var(--surface); padding: 0 12px; }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark { width: 34px; height: 34px; color: var(--accent); flex: none; }
.brand-mark.lg { width: 66px; height: 66px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-family: var(--font-serif); font-size: 21px; letter-spacing: .01em; }
.brand-text small { color: var(--muted); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; margin-top: 3px; }

/* ---------- public header / footer ---------- */
.is-public {
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--gold) 16%, transparent), transparent 60%),
    repeating-linear-gradient(to bottom, transparent 0 39px, color-mix(in srgb, var(--line) 45%, transparent) 39px 40px);
  background-attachment: fixed;
}
.pub-head {
  max-width: var(--maxw); margin: 0 auto; padding: 22px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.pub-nav { display: flex; align-items: center; gap: 22px; font-size: 14.5px; font-weight: 500; }
.pub-nav > a:not(.btn) { color: var(--ink-soft); }
.pub-nav > a:not(.btn):hover { color: var(--accent); }
.pub-nav .btn { margin-left: 2px; }
.pub-main { max-width: var(--maxw); margin: 0 auto; padding: 10px 28px 60px; }
.pub-foot { border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 65%, transparent); }
.foot-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 30px 28px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px;
}
.foot-brand { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.foot-brand small { color: var(--muted); }
.foot-links { display: flex; gap: 20px; font-size: 14px; }
.foot-copy { width: 100%; color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 46px;
  align-items: center; padding: 34px 0 70px;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-soft);
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 20px;
}
.eyebrow .ic { width: 15px; height: 15px; color: var(--gold); }
.hero h1 { font-size: clamp(38px, 5.4vw, 66px); margin-bottom: 20px; }
.hero h1 em { color: var(--accent); font-style: italic; }
.lede { font-size: 18px; line-height: 1.6; color: var(--ink-soft); max-width: 540px; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.hero-notes { display: flex; flex-wrap: wrap; gap: 18px; list-style: none; font-size: 13.5px; color: var(--muted); }
.hero-notes li { display: inline-flex; align-items: center; gap: 6px; }
.hero-notes .ic { width: 15px; height: 15px; color: var(--green); }
.hero-art { position: relative; }
.hero-art::before {
  content: ""; position: absolute; inset: 12px -10px -14px 14px;
  border: 1px dashed var(--line-strong); border-radius: 42px; z-index: 0;
}
.hero-art svg { position: relative; width: 100%; height: auto; border-radius: 34px; box-shadow: var(--shadow); z-index: 1; }

/* ---------- sections ---------- */
.section { padding: 56px 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 38px; }
.section-head .eyebrow { margin-bottom: 14px; }
.section-head h2 { font-size: clamp(28px, 3.6vw, 42px); margin-bottom: 12px; }
.section-head p { color: var(--muted); font-size: 16.5px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
}
.feature-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 13px; margin-bottom: 14px;
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  color: var(--accent);
}
.feature h3 { margin-bottom: 7px; }
.feature p { color: var(--muted); font-size: 14.5px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; list-style: none; counter-reset: step; }
.steps li {
  position: relative; padding: 26px 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; margin-bottom: 14px;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-serif); font-size: 20px; font-weight: 700;
}
.steps h3 { margin-bottom: 7px; }
.steps p { color: var(--muted); font-size: 14.5px; }
.cta-band {
  margin: 40px 0 20px; padding: 38px 40px; border-radius: 26px;
  background: linear-gradient(120deg, #7C3A1E, #B4461F 55%, #CF6A3D);
  color: #FFF6EA; display: flex; align-items: center; justify-content: space-between; gap: 28px;
  box-shadow: var(--shadow);
}
.cta-band h2 { font-size: clamp(24px, 3vw, 34px); margin-bottom: 6px; color: #FFF6EA; }
.cta-band p { color: rgba(255, 246, 234, .8); margin: 0; }
.cta-band .btn-primary { background: #FFF6EA; color: #8E3A1C; box-shadow: none; }
.cta-band .btn-primary:hover { background: #fff; color: #6E2C14; }

/* ---------- auth ---------- */
.auth-wrap { display: flex; justify-content: center; padding: 30px 16px 60px; }
.auth-card {
  width: 100%; max-width: 460px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 24px; padding: 42px 38px 34px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.perf {
  position: absolute; top: 0; left: 0; right: 0; height: 12px;
  background:
    radial-gradient(circle at 6px 0, transparent 5px, var(--bg) 5.5px) 0 0 / 14px 12px repeat-x;
  border-bottom: 1px solid var(--line);
  background-color: color-mix(in srgb, var(--accent) 22%, var(--surface));
}
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-brand .brand-mark { margin: 0 auto 12px; color: var(--accent); }
.auth-brand h1 { font-size: 30px; margin-bottom: 6px; }
.auth-brand p { color: var(--muted); font-size: 14px; margin: 0; }
.auth-alt { text-align: center; font-size: 14px; color: var(--muted); margin-top: 20px; }
.auth-card .form { gap: 14px; }
.public-flashes { max-width: 460px; margin: 0 auto 6px; }

/* ---------- app shell ---------- */
.is-app { background-image: radial-gradient(900px 500px at 85% 0%, color-mix(in srgb, var(--gold) 9%, transparent), transparent 60%); }
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 256px; z-index: 30;
  display: flex; flex-direction: column; gap: 22px; padding: 26px 20px;
  background: color-mix(in srgb, var(--surface) 72%, var(--bg));
  border-right: 1px solid var(--line);
}
.sidebar-add { width: 100%; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px;
  border-radius: 11px; color: var(--ink-soft); font-size: 14.5px; font-weight: 600;
  transition: background .16s, color .16s;
}
.side-nav a .ic { color: var(--muted); width: 19px; height: 19px; }
.side-nav a:hover { background: var(--surface-2); color: var(--ink); }
.side-nav a.active { background: color-mix(in srgb, var(--accent) 11%, var(--surface)); color: var(--accent); }
.side-nav a.active .ic { color: var(--accent); }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 16px; }
.side-user { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: var(--ink); }
.side-user-text { display: flex; flex-direction: column; min-width: 0; }
.side-user-text strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: linear-gradient(145deg, var(--accent), #8E3A1C); color: #FFF6EA;
  font-family: var(--font-serif); font-size: 18px; font-weight: 700;
}
.avatar.xl { width: 64px; height: 64px; border-radius: 18px; font-size: 28px; }
.theme-sun { display: none; }
[data-theme="dark"] .theme-sun { display: inline-block; }
[data-theme="dark"] .theme-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-sun { display: inline-block; }
  :root:not([data-theme="light"]) .theme-moon { display: none; }
}
.main { flex: 1; margin-left: 256px; min-width: 0; }
.content { max-width: 1180px; margin: 0 auto; padding: 36px 34px 60px; }
.mobile-head { display: none; }
.tabbar { display: none; }
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px; border-radius: 11px; font-size: 14px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm);
}
.flash.ok { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); background: color-mix(in srgb, var(--green) 12%, var(--surface)); }
.flash.err { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.flash-close { border: 0; background: transparent; color: var(--muted); padding: 2px; display: inline-flex; }
.flash-close .ic { width: 16px; height: 16px; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-head h1 { margin-bottom: 6px; }
.page-head p { margin: 0; font-size: 15px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.center-actions { justify-content: center; }

/* ---------- dashboard ---------- */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px; }
.stat {
  display: flex; align-items: center; gap: 13px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .16s, border-color .16s;
}
.stat:hover { transform: translateY(-2px); border-color: var(--line-strong); color: var(--ink); }
.stat-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 13px; flex: none;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent);
}
.stat b { display: block; font-family: var(--font-serif); font-size: 25px; line-height: 1.05; }
.stat small { color: var(--muted); font-size: 12px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .9fr); gap: 20px; align-items: start; }
.dash-side { display: flex; flex-direction: column; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.panel-head h2 { font-size: 20px; }
.panel > h2 { margin-bottom: 12px; }
.panel.tips { background: linear-gradient(150deg, color-mix(in srgb, var(--gold) 14%, var(--surface)), var(--surface)); }
.panel.tips p { color: var(--ink-soft); font-size: 14px; }
.place-list { display: flex; flex-direction: column; gap: 4px; }
.place-row { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 11px; color: var(--ink); }
.place-row:hover { background: var(--surface-2); color: var(--ink); }
.place-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; borderRadius: 10px; border-radius: 10px; background: var(--surface-2); color: var(--accent); flex: none; }
.place-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.place-info strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-info small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-count { font-size: 13px; color: var(--muted); }
.place-count small { font-size: 11px; }

/* ---------- onboarding ---------- */
.onboard {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 26px; align-items: center;
  padding: 34px; border-radius: 24px;
  background: linear-gradient(140deg, color-mix(in srgb, var(--gold) 16%, var(--surface)), var(--surface) 65%);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.onboard h2 { font-size: clamp(26px, 3vw, 34px); margin-bottom: 10px; }
.onboard p { color: var(--ink-soft); font-size: 15px; }
.steps-mini { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.steps-mini span { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.steps-mini b { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; }
.card.onboard-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); }
.onboard-form h3 { margin-bottom: 14px; font-size: 19px; }
.onboard-form .field-row { grid-template-columns: 1fr; }

/* ---------- grids & cards ---------- */
.items-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.items-grid-2 { grid-template-columns: repeat(2, 1fr); }
.item-card {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .16s, border-color .16s;
}
.item-card:hover { transform: translateY(-2px); border-color: var(--line-strong); color: var(--ink); }
.item-thumb { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.item-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.item-card:hover .item-thumb img { transform: scale(1.03); }
.thumb-fallback { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--line-strong); background: repeating-linear-gradient(45deg, var(--surface-2) 0 12px, color-mix(in srgb, var(--surface-2) 70%, var(--line)) 12px 24px); }
.thumb-fallback .ic { width: 34px; height: 34px; }
.qty { position: absolute; right: 8px; bottom: 8px; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 78%, transparent); color: var(--bg); font-size: 11px; font-weight: 700; }
.item-body { display: flex; flex-direction: column; gap: 3px; padding: 12px 13px 13px; }
.item-body strong { font-size: 14.5px; line-height: 1.3; }
.item-body small { font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.chip {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft);
  font-size: 11.5px; font-weight: 600;
}
a.chip:hover { border-color: var(--accent); color: var(--accent); }
.containers-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.container-card {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .16s, border-color .16s;
}
.container-card:hover { transform: translateY(-2px); border-color: var(--line-strong); color: var(--ink); }
.container-cover { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--surface-2); }
.container-cover img { width: 100%; height: 100%; object-fit: cover; }
.container-cover .thumb-fallback .ic { width: 38px; height: 38px; }
.code-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 7px;
  background: color-mix(in srgb, var(--ink) 72%, transparent); color: var(--bg);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11.5px; font-weight: 700;
  letter-spacing: .03em; border: 0;
}
.container-cover .code-chip { position: absolute; left: 9px; top: 9px; }
.code-chip.copy { cursor: pointer; }
.code-chip .ic { width: 12px; height: 12px; }
.container-body { display: flex; flex-direction: column; gap: 3px; padding: 12px 13px 13px; }
.container-body strong { font-size: 14.5px; }
.container-body small { font-size: 12px; }
.add-card { align-items: center; justify-content: center; gap: 10px; min-height: 190px; border-style: dashed; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; }
.add-card:hover { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.add-card-icon { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%; background: var(--surface-2); color: var(--accent); }
.places-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.place-card {
  display: flex; align-items: center; gap: 15px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .16s, border-color .16s;
}
.place-card:hover { transform: translateY(-2px); border-color: var(--line-strong); color: var(--ink); }
.place-card-icon { display: inline-flex; align-items: center; justify-content: center; width: 50px; height: 50px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent); flex: none; }
.place-card-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.place-card-body strong { font-family: var(--font-serif); font-size: 18px; }
.place-card-body small { font-size: 12.5px; }
.place-card-stats { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kind-chip { align-self: flex-start; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.chev { color: var(--line-strong); }

/* ---------- detail pages ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 16px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs .ic { width: 13px; height: 13px; color: var(--line-strong); }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.detail-head.tight { margin-bottom: 18px; }
.detail-title { display: flex; align-items: center; gap: 16px; min-width: 0; }
.detail-title h1 { margin: 2px 0 4px; }
.icon-badge { display: inline-flex; align-items: center; justify-content: center; width: 62px; height: 62px; border-radius: 18px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent); flex: none; }
.icon-badge .ic { width: 30px; height: 30px; }
.title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.title-row h1 { margin: 0; }
.container-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, .8fr); gap: 20px; align-items: start; }
.box-aside { display: flex; flex-direction: column; gap: 18px; }
.qr-img { width: min(100%, 220px); margin: 4px auto 10px; border-radius: 14px; border: 1px solid var(--line); padding: 8px; background: #fff; }
.qr-panel h2 { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack form { margin: 0; }
.note-strip { display: flex; align-items: flex-start; gap: 9px; padding: 12px 15px; margin: 0 0 22px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); font-size: 14px; }
.note-strip .ic { color: var(--gold); margin-top: 1px; }
.danger-zone { margin-top: 30px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 18px; background: color-mix(in srgb, var(--danger) 3%, var(--surface)); }
.danger-zone summary { cursor: pointer; padding: 14px 0; font-size: 13.5px; font-weight: 600; color: var(--danger); }
.danger-zone div { padding: 0 0 16px; }
.danger-zone p { color: var(--muted); font-size: 13px; }

/* ---------- item detail ---------- */
.item-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 26px; align-items: start; }
.item-photo { border-radius: 22px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); box-shadow: var(--shadow-sm); position: sticky; top: 24px; }
.item-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--surface-2); }
.photo-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; aspect-ratio: 4 / 3; color: var(--line-strong); background: repeating-linear-gradient(45deg, var(--surface-2) 0 14px, color-mix(in srgb, var(--surface-2) 70%, var(--line)) 14px 28px); font-size: 13px; }
.item-info h1 { font-size: clamp(28px, 3.4vw, 40px); }
.facts { display: flex; flex-direction: column; gap: 0; margin: 20px 0; border-top: 1px solid var(--line); }
.facts > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-size: 14px; font-weight: 600; text-align: right; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tag-block { margin-top: 18px; }
.tag-block h2 { font-size: 16px; margin-bottom: 8px; }
.tag-block p { color: var(--ink-soft); font-size: 14.5px; }

/* ---------- filters & search ---------- */
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 22px;
  padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
}
.filters select { width: auto; min-width: 150px; flex: 1 1 150px; }
.filters .btn { flex: none; }
.search-field { position: relative; flex: 1 1 240px; display: flex; align-items: center; }
.search-field .ic { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.search-field input { padding-left: 42px !important; }
.search-hero { display: flex; gap: 10px; margin-bottom: 18px; }
.search-hero .search-field { flex: 1; }
.search-hero .btn { padding: 0 26px; }
.search-field.big input { padding: 16px 16px 16px 48px !important; font-size: 17px; border-radius: 14px; }
.search-field.big .ic { left: 16px; width: 22px; height: 22px; }
.search-summary { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.search-summary b { color: var(--ink); }
.result-block { margin-bottom: 34px; }
.result-block > h2 { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; font-size: 21px; }
.result-block .items-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.result-block .containers-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-family: var(--font-sans); font-size: 12px; font-weight: 700; }
.quick-links { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 14px; }

/* ---------- empty / error ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 40px 22px; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 22px; }
.empty p { max-width: 420px; font-size: 14.5px; }
.empty .ic.big { color: var(--line-strong); }
.empty.big { padding: 54px 22px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.error-page { min-height: 50vh; }
.error-code { font-family: var(--font-serif); font-size: clamp(64px, 12vw, 120px); line-height: 1; color: var(--line-strong); }

/* ---------- profile ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; align-items: start; }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.profile-head h2 { font-size: 26px; }
.profile-head p { margin: 0; font-size: 13.5px; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 14px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); }
.mini-stats div { text-align: center; }
.mini-stats b { display: block; font-family: var(--font-serif); font-size: 22px; }
.mini-stats small { color: var(--muted); font-size: 11px; }

/* ---------- modal ---------- */
.modal { border: 0; padding: 0; background: transparent; max-width: min(580px, calc(100vw - 28px)); width: 100%; max-height: 90vh; }
.modal::backdrop { background: rgba(24, 16, 9, .55); backdrop-filter: blur(3px); }
.modal-card {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
  overflow: hidden; display: flex; flex-direction: column; max-height: 90vh;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 21px; }
.modal-body { padding: 20px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.photo-input { display: flex; gap: 15px; align-items: flex-start; }
.photo-preview {
  position: relative; width: 108px; height: 108px; border-radius: 13px; flex: none;
  border: 1px dashed var(--line-strong); background: var(--surface-2) var(--photo) center / cover no-repeat;
  display: flex; align-items: center; justify-content: center; color: var(--line-strong);
}
.photo-preview.has-img { border-style: solid; }
.photo-preview.has-img > .ic { display: none; }
.photo-preview .ic { width: 30px; height: 30px; }
.photo-clear { position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border-radius: 50%; background: var(--danger); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow-sm); }
.photo-clear .ic { width: 13px; height: 13px; }
.photo-meta { display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.photo-label { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.photo-meta .btn { cursor: pointer; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  padding: 10px 18px; border-radius: 11px; background: var(--ink); color: var(--bg);
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow); z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- label ---------- */
.label-page { background: #fff; color: #2B2017; }
.label-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 26px; border-bottom: 1px solid #E7D8C0; }
.label-page .btn-ghost { border-color: #D8C3A3; color: #2B2017; }
.label-sheet { max-width: 820px; margin: 24px auto; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 0 20px; }
.label { display: flex; align-items: center; gap: 16px; padding: 18px; border: 2px dashed #C9B18C; border-radius: 16px; background: #FFFDF8; break-inside: avoid; }
.label-qr { flex: none; width: 128px; height: 128px; padding: 5px; background: #fff; border-radius: 8px; }
.label-qr img { width: 100%; height: 100%; }
.label-text { min-width: 0; }
.label-brand { font-family: Georgia, serif; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #B4461F; }
.label-name { font-family: Georgia, serif; font-size: 21px; font-weight: 700; line-height: 1.15; margin: 5px 0 4px; overflow-wrap: anywhere; }
.label-place { font-size: 12.5px; color: #7A6A58; }
.label-code { display: inline-block; margin-top: 8px; padding: 2px 7px; border-radius: 5px; background: #2B2017; color: #FCF6EA; font-family: ui-monospace, Consolas, monospace; font-size: 12px; font-weight: 700; }
.label-hint { max-width: 780px; margin: 8px auto 40px; padding: 0 20px; color: #7A6A58; font-size: 12px; text-align: center; overflow-wrap: anywhere; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .items-grid, .containers-grid { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: 78px; }
  .mobile-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 20; padding: 13px 18px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  }
  .mobile-head .brand { gap: 8px; }
  .mobile-head .brand-mark { width: 28px; height: 28px; }
  .content { padding: 22px 18px 40px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    align-items: flex-end; justify-content: space-around; padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; padding: 4px 0; color: var(--muted); font-size: 10.5px; font-weight: 600; }
  .tabbar a.active { color: var(--accent); }
  .tabbar .ic { width: 22px; height: 22px; }
  .tabbar .tab-add {
    flex: none; width: 54px; height: 54px; margin: 0 2px 4px; border-radius: 18px;
    background: var(--accent); color: var(--accent-ink); justify-content: center;
    box-shadow: 0 10px 22px rgba(180, 70, 31, .32);
  }
  .tabbar .tab-add .ic { width: 26px; height: 26px; }
  .hero { grid-template-columns: 1fr; gap: 34px; padding-top: 16px; }
  .hero-art { order: -1; max-width: 560px; margin: 0 auto; width: 100%; }
  .dash-grid, .container-layout, .item-layout, .profile-grid, .onboard { grid-template-columns: 1fr; }
  .item-photo { position: static; }
  .detail-head { flex-wrap: wrap; }
  .page-head { flex-wrap: wrap; align-items: flex-start; }
  .steps { grid-template-columns: 1fr; }
  .places-grid { grid-template-columns: 1fr; }
  .cta-band { flex-direction: column; align-items: flex-start; text-align: left; }
  .pub-nav > a:not(.btn) { display: none; }
}

@media (max-width: 640px) {
  .pub-head, .pub-main, .foot-inner { padding-left: 18px; padding-right: 18px; }
  .pub-nav { gap: 8px; }
  .pub-nav .btn-ghost { display: none; }
  .hero h1 { font-size: 40px; }
  .lede { font-size: 16px; }
  .items-grid, .containers-grid, .feature-grid, .items-grid-2 { grid-template-columns: 1fr; }
  .items-grid .item-card { flex-direction: row; }
  .items-grid .item-thumb { width: 108px; flex: none; aspect-ratio: 1; }
  .items-grid .item-body { justify-content: center; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .stat-icon { width: 38px; height: 38px; border-radius: 11px; }
  .stat b { font-size: 22px; }
  .field-row { grid-template-columns: 1fr; }
  .filters { padding: 11px; }
  .filters .btn { flex: 1; }
  .search-hero { flex-direction: column; }
  .search-hero .btn { padding: 12px; }
  .auth-card { padding: 34px 22px 26px; border-radius: 20px; }
  .modal { max-width: 100%; max-height: 94vh; margin: auto 0 0; }
  .modal-card { border-radius: 20px 20px 0 0; max-height: 94vh; }
  .photo-input { flex-direction: column; gap: 10px; }
  .photo-preview { width: 100%; height: 150px; }
  .detail-title { gap: 12px; }
  .icon-badge { width: 48px; height: 48px; border-radius: 14px; }
  .icon-badge .ic { width: 24px; height: 24px; }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .cta-band { padding: 28px 22px; }
  .label-sheet { grid-template-columns: 1fr; }
}

@media print {
  .label-toolbar, .label-hint { display: none !important; }
  .label-page { background: #fff; }
  .label-sheet { max-width: none; margin: 0; padding: 0; gap: 0; grid-template-columns: 1fr 1fr; }
  .label { border: 1.5px dashed #b9a482; border-radius: 10px; margin: 4mm; padding: 10mm 8mm; height: 60mm; }
  .label-qr { width: 40mm; height: 40mm; }
  .label-name { font-size: 15pt; }
  .label-brand { font-size: 8pt; }
  @page { size: A4; margin: 8mm; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
