/* ── Tokens ───────────────────────────────────────────────────────────────── */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --text: #18181b;
  --text-2: #71717a;
  --text-3: #a1a1aa;
  --border: #e4e4e7;
  --border-subtle: #f0f0ee;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.07);
  --btn-bg: #18181b;
  --btn-text: #ffffff;
  --btn-hover: #27272a;
  --brand: #2f8fc9;
}

[data-theme="dark"] {
  --bg: #111110;
  --surface: #1c1c1a;
  --surface-2: #242422;
  --text: #fafaf9;
  --text-2: #a8a29e;
  --text-3: #78716c;
  --border: #2c2c2a;
  --border-subtle: #242422;
  --shadow-sm:
    0 1px 3px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-md:
    0 4px 20px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --btn-bg: #fafaf9;
  --btn-text: #111110;
  --btn-hover: #e7e5e4;
  --brand: #5bb8e8;
}

/* ── Reset / base ─────────────────────────────────────────────────────────── */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Header ───────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  min-height: 3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
}

.site-header .logo {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 0.5rem;
  transition: opacity 0.15s;
}

.site-header .logo:hover {
  opacity: 0.7;
}

.logo-icon {
  display: block;
  height: 2.1rem;
  width: 2.1rem;
  border-radius: 22%;
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.0625rem;
  line-height: 1.15;
}

.logo-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand);
}

.logo-tagline {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-3);
}

/* ── Household menu ───────────────────────────────────────────────────────── */

.hh-menu {
  position: relative;
}

.hh-menu > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 500;
  user-select: none;
  transition:
    background 0.15s,
    color 0.15s;
}

.hh-menu > summary::-webkit-details-marker {
  display: none;
}

.hh-menu > summary:hover {
  background: var(--border-subtle);
  color: var(--text);
}

.hh-chevron {
  opacity: 0.5;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.hh-menu[open] .hh-chevron {
  transform: rotate(180deg);
}

.hh-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.375rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  min-width: 14rem;
  z-index: 200;
  overflow: hidden;
}

.hh-dropdown-section {
  padding: 0.75rem;
}

.hh-dropdown-label {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.375rem;
}

.hh-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
}

/* Scope all button overrides inside the dropdown to beat global button specificity */
.hh-dropdown .hh-code-copy {
  display: block;
  width: 100%;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 0.375rem 0.625rem;
  cursor: pointer;
  text-align: left;
  min-height: unset;
  box-shadow: none;
  transition: background 0.15s;
}

.hh-dropdown .hh-code-copy:hover {
  background: var(--surface-2);
  box-shadow: none;
}

.hh-dropdown .hh-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 400;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  min-height: unset;
  letter-spacing: 0;
  box-shadow: none;
  transition: background 0.1s;
}

.hh-dropdown .hh-menu-item:hover {
  background: var(--border-subtle);
  box-shadow: none;
}

.hh-dropdown form {
  display: block;
}

.hh-invite-form {
  display: flex;
  gap: 0.375rem;
  align-items: center;
}

.hh-invite-form input[type="email"] {
  flex: 1;
  min-width: 0;
  height: 1.875rem;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.hh-invite-form input[type="email"]:focus {
  border-color: var(--text-3);
}

.hh-dropdown .hh-invite-btn {
  flex-shrink: 0;
  height: 1.875rem;
  padding: 0 0.625rem;
  font-size: 0.8125rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  min-height: unset;
  box-shadow: none;
  white-space: nowrap;
  transition: background 0.15s;
}

.hh-dropdown .hh-invite-btn:hover {
  background: var(--surface-2);
  box-shadow: none;
}

.hh-dropdown .hh-logout {
  color: #e11d48;
}
.hh-dropdown .hh-logout:hover {
  background: #fff1f2;
  box-shadow: none;
}
[data-theme="dark"] .hh-dropdown .hh-logout:hover {
  background: rgba(225, 29, 72, 0.1);
}

/* Header search */
.header-search {
  flex: 1;
  min-width: 0;
  max-width: 22rem;
}

.header-search input[type="search"] {
  width: 100%;
  height: 1.875rem;
  padding: 0 0.625rem;
  font-size: 0.8125rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.header-search input[type="search"]:focus {
  border-color: var(--text-3);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .header-search input[type="search"]:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

/* Header nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  margin-left: auto;
}

.header-nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s;
}

.header-nav-link:hover {
  background: var(--border-subtle);
  color: var(--text);
}

.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  min-height: unset;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--text-3);
  border-radius: 6px;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}

.header-icon-btn:hover {
  background: var(--border-subtle);
  color: var(--text);
  box-shadow: none;
}

.icon-sun {
  display: none;
}
.icon-moon {
  display: block;
}
[data-theme="dark"] .icon-sun {
  display: block;
}
[data-theme="dark"] .icon-moon {
  display: none;
}

@media (max-width: 620px) {
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 0 0.75rem;
    column-gap: 0.25rem;
    row-gap: 0;
  }

  .site-header .logo {
    flex: 1;
    margin-right: 0;
  }

  .logo-icon {
    height: 1.9rem;
    width: 1.9rem;
  }

  .logo-title {
    font-size: 1rem;
  }

  .logo-tagline {
    font-size: 0.625rem;
  }

  .header-nav {
    height: 2.75rem;
    gap: 0.125rem;
  }

  .header-nav-link {
    display: none;
  }

  .header-search {
    order: 3;
    flex-basis: 100%;
    max-width: 100%;
    padding-bottom: 0.625rem;
  }

  .header-search input[type="search"] {
    height: 2.25rem;
    font-size: 1rem; /* prevents iOS zoom on focus */
  }
}

/* ── Layout ───────────────────────────────────────────────────────────────── */

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
}

/* ── Typography ───────────────────────────────────────────────────────────── */

h1 {
  margin-top: 0;
  letter-spacing: -0.03em;
  font-weight: 700;
  color: var(--text);
}

h2 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 1rem;
  margin-top: 0;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text);
}

/* ── Panels ───────────────────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border-radius: 14px;
  padding: 1.375rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

/* ── Toolbar ──────────────────────────────────────────────────────────────── */

.toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

form.inline {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  flex: 1 1 0;
  min-width: 0;
}

form.inline input[type="text"],
form.inline input[type="number"],
form.inline input[type="search"],
form.inline input[type="email"] {
  flex: 1 1 0;
  min-width: 0;
}

form.inline input[name="code"] {
  text-transform: uppercase;
}

/* ── Form controls ────────────────────────────────────────────────────────── */

input[type="text"],
input[type="number"],
input[type="search"],
input[type="email"],
textarea,
select {
  font-size: 0.9375rem;
  font-family: inherit;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  min-height: 2.375rem;
  background: var(--surface);
  color: var(--text);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.08);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
  box-shadow: 0 0 0 3px rgba(250, 250, 249, 0.1);
}

textarea {
  min-height: 0;
}

.field input,
.field textarea,
.field select {
  width: 100%;
}

label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field {
  margin-bottom: 0.875rem;
}

.field-error {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.8125rem;
  color: var(--danger, #c0392b);
}

.field-hint {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-3);
  line-height: 1.4;
}

.field-label-optional {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-3);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

button,
.btn {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  min-height: 2.375rem;
  border-radius: 8px;
  border: 1.5px solid transparent;
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  letter-spacing: -0.01em;
  transition:
    background 0.15s,
    opacity 0.15s,
    box-shadow 0.15s;
}

button:hover,
.btn:hover {
  background: var(--btn-hover);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

button:active,
.btn:active {
  opacity: 0.8;
}

button.secondary,
.btn.secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

button.secondary:has(svg:only-child) {
  padding: 0.5rem 0.65rem;
}

button.secondary:hover,
.btn.secondary:hover {
  background: var(--surface-2);
  border-color: var(--text-3);
  box-shadow: none;
}

button.btn-text,
.btn-text {
  background: none;
  border-color: transparent;
  color: var(--text-2);
  font-size: 0.8125rem;
  padding: 0.25rem;
  min-height: unset;
  font-weight: 400;
}

button.btn-text:hover,
.btn-text:hover {
  background: none;
  color: var(--text);
  box-shadow: none;
  text-decoration: underline;
}

button.danger {
  background: var(--surface);
  border-color: #fecdd3;
  color: #e11d48;
}

button.danger:hover {
  background: #fff1f2;
  border-color: #fda4af;
  box-shadow: none;
}

[data-theme="dark"] button.danger {
  border-color: rgba(225, 29, 72, 0.3);
}
[data-theme="dark"] button.danger:hover {
  background: rgba(225, 29, 72, 0.1);
}

/* ── Box table ────────────────────────────────────────────────────────────── */

.table-scroll {
  overflow-x: auto;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.box-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.box-table th,
.box-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.box-table thead th {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}

.box-table .col-items,
.box-table .col-icon {
  width: 1%;
  text-align: center;
}

.room-heading-row th {
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.table-icon {
  display: inline-block;
  font-size: 0.9rem;
  line-height: 1;
}

.fragile-icon {
  color: #e11d48;
}

.full-icon {
  color: #16a34a;
}

.table-name-link {
  color: var(--text);
  text-decoration: none;
}

.table-name-link:hover {
  text-decoration: underline;
}

/* ── Box grid ─────────────────────────────────────────────────────────────── */

.box-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}

.box-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 1.125rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.box-card:hover {
  box-shadow: var(--shadow-md);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-top-badges {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  border-radius: 999px;
  background: var(--border-subtle);
  color: var(--text-2);
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.box-card .room {
  color: var(--text-2);
  font-size: 0.8125rem;
}

/* ── Code tag ─────────────────────────────────────────────────────────────── */

.color-dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.code-tag {
  display: inline-block;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--text);
  color: var(--surface);
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
}

/* ── Banners ──────────────────────────────────────────────────────────────── */

.error-banner {
  background: #fff1f2;
  color: #be123c;
  border: 1.5px solid #fecdd3;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

[data-theme="dark"] .error-banner {
  background: rgba(225, 29, 72, 0.08);
  color: #fb7185;
  border-color: rgba(225, 29, 72, 0.2);
}

.info-banner {
  background: #f0f9ff;
  color: #0369a1;
  border: 1.5px solid #bae6fd;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

[data-theme="dark"] .info-banner {
  background: rgba(56, 189, 248, 0.07);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.15);
}

/* ── Photos ───────────────────────────────────────────────────────────────── */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.photo-thumb {
  position: relative;
}

.photo-remove-form {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 1;
}

.photo-remove-btn {
  min-height: unset;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  backdrop-filter: blur(4px);
}

.photo-remove-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  box-shadow: none;
  opacity: 1;
}

.photo-thumb-btn {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 10px;
}

.photo-thumb-btn img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 10px;
  border: 1.5px solid var(--border-subtle);
  display: block;
  transition: opacity 0.15s;
}

.photo-thumb-btn:hover img {
  opacity: 0.85;
}

/* ── Lightbox ─────────────────────────────────────────────────────────────── */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.88);
  align-items: center;
  justify-content: center;
}

.lightbox.lb-open {
  display: flex;
}

.lb-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.lightbox img {
  max-width: min(90vw, 1200px);
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.lb-counter {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  margin: 0;
}

.lb-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  opacity: 0.8;
  min-height: unset;
}

.lb-close:hover {
  opacity: 1;
  box-shadow: none;
  background: none;
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  font-size: 3rem;
  line-height: 1;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
  border-radius: 6px;
  opacity: 0.7;
  min-height: unset;
  backdrop-filter: blur(4px);
}

.lb-nav:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: none;
}

.lb-prev {
  left: 1.25rem;
}
.lb-next {
  right: 1.25rem;
}

/* ── Items ────────────────────────────────────────────────────────────────── */

.item-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.item-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.9rem;
}

.item-list li:last-child {
  border-bottom: none;
}

.item-qty {
  color: var(--text-3);
  font-size: 0.8rem;
  margin-left: 0.4rem;
}

/* ── Misc ─────────────────────────────────────────────────────────────────── */

.empty-state {
  color: var(--text-3);
  font-size: 0.875rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1rem;
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--text);
}

hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 1.25rem 0;
}

/* ── Label settings ───────────────────────────────────────────────────────── */

.label-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.25rem;
}

.settings-group-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 1rem 0 0.4rem;
}

/* ── Checklist ────────────────────────────────────────────────────────────── */

.box-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.check-item input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--text);
}

.checklist-room {
  color: var(--text-3);
  font-size: 0.85em;
}

@media (max-width: 600px) {
  .container {
    padding: 1.25rem 1rem;
  }

  .toolbar {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.625rem;
  }

  .checklist-room {
    display: none;
  }

  .box-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .box-card {
    padding: 0.875rem;
    gap: 0.25rem;
  }
}

/* ── Badges ───────────────────────────────────────────────────────────────── */

.status-badge {
  display: inline-block;
  font-size: 0.625rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #fef9c3;
  color: #854d0e;
}

[data-theme="dark"] .status-badge {
  background: rgba(234, 179, 8, 0.12);
  color: #fbbf24;
}

.fragile-badge {
  display: inline-block;
  font-size: 0.625rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #fff1f2;
  color: #be123c;
}

[data-theme="dark"] .fragile-badge {
  background: rgba(225, 29, 72, 0.12);
  color: #fb7185;
}

/* ── Card actions ─────────────────────────────────────────────────────────── */

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Danger zone ──────────────────────────────────────────────────────────── */

.danger-zone {
  box-shadow: none;
  border: 1.5px solid #fecdd3;
}

[data-theme="dark"] .danger-zone {
  border-color: rgba(225, 29, 72, 0.25);
}

.danger-zone h2 {
  color: #e11d48;
}

.danger-zone p {
  font-size: 0.875rem;
  color: var(--text-2);
  margin: 0 0 1rem;
}

/* ── Gate (login page) ────────────────────────────────────────────────────── */

details.gate-secondary > summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-3);
  user-select: none;
}
details.gate-secondary > summary::-webkit-details-marker {
  display: none;
}
details.gate-secondary > summary:hover {
  color: var(--text-2);
}

.gate-wrap {
  max-width: 46rem;
  margin: 3.5rem auto;
  padding: 0 0.5rem;
}

.gate-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.gate-hero h1 {
  color: white;
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.gate-hero p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  max-width: 30rem;
  margin: 0 auto;
}

.gate-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

@media (max-width: 640px) {
  .gate-options {
    grid-template-columns: 1fr;
  }
}

/* ── Gate page (login) ────────────────────────────────────────────────────── */

body.gate-page {
  /* Gate page is pre-login and always renders in its own light look,
     regardless of the app's dark-mode toggle. */
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --text: #18181b;
  --text-2: #71717a;
  --text-3: #a1a1aa;
  --border: #e4e4e7;
  --border-subtle: #f0f0ee;
  --btn-bg: #18181b;
  --btn-text: #ffffff;
  --btn-hover: #27272a;
  --brand: #2f8fc9;
  background: var(--brand);
  min-height: 100vh;
}

body.gate-page .site-header {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

body.gate-page .site-header .logo-title {
  color: white;
}

body.gate-page .site-header .logo-tagline {
  color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .gate-page .info-banner {
  background: #f0f9ff;
  color: #0369a1;
  border-color: #bae6fd;
}

[data-theme="dark"] .gate-page .error-banner {
  background: #fff1f2;
  color: #be123c;
  border-color: #fecdd3;
}

body.gate-page .site-footer {
  border-top-color: rgba(255, 255, 255, 0.2);
}

body.gate-page .footer-tagline,
body.gate-page .footer-meta,
body.gate-page .site-footer a {
  color: rgba(255, 255, 255, 0.95);
}

.site-footer a {
  font-weight: bold;
}

/* ── Section header ──────────────────────────────────────────────────────── */

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-header h2 {
  margin: 0;
}

.btn-sm {
  font-size: 0.8125rem;
  padding: 0.35rem 0.85rem;
  min-height: unset;
}

/* ── Sort tabs ────────────────────────────────────────────────────────────── */

.sort-row {
  margin-top: -0.5rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sort-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

.sort-tabs {
  display: inline-flex;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.sort-tab {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s;
}

.sort-tab + .sort-tab {
  border-left: 1px solid var(--border);
}

.sort-tab:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sort-tab.active {
  background: var(--text);
  color: var(--surface);
}

/* ── Modal ────────────────────────────────────────────────────────────────── */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.5);
  align-items: flex-start;
  justify-content: center;
  padding: 4rem 1rem 2rem;
  overflow-y: auto;
}

.modal.modal-open {
  display: flex;
}

.modal-panel {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.75rem;
  width: 100%;
  max-width: 26rem;
  position: relative;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--text-3);
  cursor: pointer;
  padding: 0.1rem 0.4rem;
  min-height: unset;
  margin: -0.25rem -0.4rem -0.25rem 0;
}

.modal-close:hover {
  color: var(--text);
  background: none;
  box-shadow: none;
}

/* ── Collapsible ──────────────────────────────────────────────────────────── */

details.collapsible > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0;
  user-select: none;
}

details.collapsible > summary::-webkit-details-marker {
  display: none;
}

details.collapsible > summary::after {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  transform: rotate(-45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}

details.collapsible[open] > summary::after {
  transform: rotate(45deg);
}
details.collapsible[open] > summary {
  margin-bottom: 1rem;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

.site-footer {
  margin-top: 1rem;
  padding: 2.5rem 1rem 3rem;
  border-top: 1px solid var(--border-subtle);
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  text-align: center;
}

.footer-tagline {
  font-size: 0.875rem;
  color: var(--text-2);
  margin: 0;
  max-width: 34rem;
  line-height: 1.65;
}

.footer-meta {
  font-size: 0.8rem;
  color: var(--text-3);
  margin: 0;
}

.footer-meta a {
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-meta a:hover {
  color: var(--text);
}

.footer-badges {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.footer-badges img {
  display: block;
  opacity: 0.85;
  transition: opacity 0.15s;
}

.footer-badges a:hover img {
  opacity: 1;
}

/* ── QR / misc legacy ─────────────────────────────────────────────────────── */

.qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qr-panel #box-qr img,
.qr-panel #box-qr canvas {
  display: block;
  border-radius: 6px;
}

.qr-hint {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--text-3);
}
