/* Packing App — Tricount-inspired, mobile-first. No inline styles anywhere (strict CSP). */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e8ebf0;
  --border: #e6e9ee;
  --text: #101828;
  --muted: #667085;
  --faint: #98a2b3;
  --accent: #1f6fe5;
  --accent-text: #ffffff;
  --accent-weak: #e8f0fd;
  --accent-ink: #0b3f8f;
  --ok: #16a34a;
  --ok-weak: #e6f6ec;
  --ok-ink: #0f5a2b;
  --warn: #a15c07;
  --warn-weak: #fdf1dc;
  --danger: #d92d20;
  --danger-weak: #fde8e7;
  --none: #c3c8d0;
  --radius: 14px;
  --tap: 44px;
  --nav-h: 62px;
  --shadow-fab: 0 6px 18px rgba(31, 111, 229, 0.35);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #0e1116;
    --surface-2: #1a1f27;
    --surface-3: #252b35;
    --border: #232933;
    --text: #eef1f5;
    --muted: #9aa3b2;
    --faint: #6b7584;
    --accent: #5b9bff;
    --accent-text: #08142b;
    --accent-weak: #16243d;
    --accent-ink: #b9d3ff;
    --ok: #4ade80;
    --ok-weak: #123222;
    --ok-ink: #b7f0cb;
    --warn: #f5b450;
    --warn-weak: #3a2a10;
    --danger: #ff7b7b;
    --danger-weak: #3d1a1c;
    --none: #3a414d;
    --shadow-fab: 0 6px 18px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

/* Category / trip colors — keep in sync with Catalog::COLORS (app/src/Catalog.php). */
.bg-blue { background: #2f7ed8; }
.bg-green { background: #4f8a1b; }
.bg-red { background: #d9423f; }
.bg-pink { background: #cc4a78; }
.bg-berry { background: #993556; }
.bg-purple { background: #7067d3; }
.bg-indigo { background: #534ab7; }
.bg-teal { background: #178f6b; }
.bg-forest { background: #0f6e56; }
.bg-amber { background: #b06e12; }
.bg-orange { background: #d9700f; }
.bg-coral { background: #d2552b; }
.bg-gray { background: #75746d; }
.bg-slate { background: #55544f; }
.bg-none { background: var(--none); }

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 96px);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

h1 {
  font-size: 1.9rem;
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -0.02em;
  margin: 0;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}

p {
  margin: 0.4rem 0;
}

code {
  background: var(--surface-2);
  border-radius: 5px;
  padding: 0.05em 0.35em;
  font-size: 0.9em;
}

.muted {
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.4rem 0 0.8rem;
}

[hidden] {
  display: none !important;
}

/* Icons from the SVG sprite */
.ic {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.25em;
}

/* Round colored category / trip badges with a white icon */
.badge-ic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex: none;
}

.badge-ic .ic {
  width: 21px;
  height: 21px;
  vertical-align: 0;
}

.badge-sq {
  border-radius: 13px;
}

.badge-lg {
  width: 52px;
  height: 52px;
}

.badge-lg .ic {
  width: 27px;
  height: 27px;
}

.badge-lg.badge-sq {
  border-radius: 16px;
}

.badge-sm {
  width: 30px;
  height: 30px;
}

.badge-sm .ic {
  width: 17px;
  height: 17px;
}

.badge-xs {
  width: 22px;
  height: 22px;
}

.badge-xs .ic {
  width: 13px;
  height: 13px;
}

/* ------------------------------------------------------------ top / nav */

/* Phones: no top bar (pages have big titles); the nav inside it becomes the bottom tab bar. */
.topbar {
  display: contents;
}

.brand {
  display: none;
}

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--nav-h);
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.nav a .ic {
  width: 25px;
  height: 25px;
  vertical-align: 0;
}

.nav a.is-active {
  color: var(--accent);
}

@media (min-width: 760px) {
  body {
    padding-bottom: 120px;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 860px;
    margin: 0 auto;
    padding: 14px 20px;
    background: var(--bg);
  }
  .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 750;
    font-size: 1.1rem;
    color: var(--text);
  }
  .nav {
    position: static;
    border: 0;
    background: none;
    padding: 0;
    gap: 4px;
  }
  .nav a {
    flex-direction: row;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    font-size: 0.95rem;
    gap: 8px;
    color: var(--muted);
  }
  .nav a .ic {
    width: 20px;
    height: 20px;
  }
  .nav a.is-active {
    background: var(--accent-weak);
    color: var(--accent);
  }
}

.banner {
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--warn-weak);
  color: var(--warn);
  font-weight: 600;
  font-size: 0.88rem;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
  text-align: center;
}

/* ------------------------------------------------------------------ page */

.view {
  max-width: 820px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 18px 18px;
  outline: none;
}

@media (min-width: 760px) {
  .view {
    padding-top: 8px;
  }
}

.loading {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
}

.page-head {
  margin: 0 0 18px;
}

.subtitle {
  color: var(--muted);
  margin: 4px 0 0;
  font-size: 0.98rem;
}

.head-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  margin: -6px -8px 6px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 600;
  padding: 8px 8px 8px 2px;
  font-size: 1rem;
}

.back .ic {
  width: 24px;
  height: 24px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.title-row h1 {
  font-size: 1.7rem;
}

.trip-note {
  white-space: pre-line;
  color: var(--muted);
  margin-top: 10px;
}

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--accent-weak);
  color: var(--accent-ink);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 0.95rem;
}

.notice > span {
  flex: 1;
}

.notice .ic {
  width: 22px;
  height: 22px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 1rem;
}

.empty h2 {
  color: var(--text);
  font-size: 1.15rem;
  margin: 0.6rem 0 0.2rem;
}

.empty .btn {
  margin-top: 14px;
}

.empty-ic {
  width: 44px;
  height: 44px;
  color: var(--faint);
  stroke-width: 1.6;
}

.empty-ic.ok {
  color: var(--ok);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h2 .link-btn {
  margin-left: auto;
  font-size: 0.9rem;
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: 12px;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  background: var(--surface-3);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 88%, #000);
}

.btn-ghost {
  background: transparent;
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-danger-text {
  color: var(--danger);
}

.btn-small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover {
  background: var(--surface-2);
}

.icon-btn:disabled {
  opacity: 0.3;
}

.icon-btn .ic {
  width: 22px;
  height: 22px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  padding: 6px 0;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fab {
  position: fixed;
  right: max(18px, calc((100vw - 820px) / 2 + 18px));
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px);
  z-index: 25;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow-fab);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.fab .ic {
  width: 30px;
  height: 30px;
  stroke-width: 2.4;
}

.fab:active {
  transform: scale(0.96);
}

.fab:disabled {
  opacity: 0.5;
}

@media (min-width: 760px) {
  .fab {
    bottom: 28px;
  }
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ chips */

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -18px 16px;
  padding: 0 18px;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.chip .ic {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.chip:disabled {
  opacity: 0.45;
}

.chip-count {
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 0.75rem;
  line-height: 1.5;
}

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
  vertical-align: 1px;
}

.tag-ok {
  background: var(--ok-weak);
  color: var(--ok-ink);
}

.tag-warn {
  background: var(--warn-weak);
  color: var(--warn);
}

.tag-accent {
  background: var(--accent-weak);
  color: var(--accent-ink);
}

.tag-error {
  background: var(--danger-weak);
  color: var(--danger);
}

/* ------------------------------------------------------------------ forms */

input,
select,
textarea {
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: 12px;
  min-height: var(--tap);
  padding: 9px 13px;
  width: 100%;
}

textarea {
  resize: vertical;
  min-height: 70px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  outline: none;
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.6;
}

input[type='file'] {
  padding: 9px;
}

.field {
  display: block;
  margin: 0 0 14px;
  border: 0;
  padding: 0;
}

.field > span,
.field > legend {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field small {
  font-weight: 400;
  color: var(--faint);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.radio-row label,
.check-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  font-size: 0.95rem;
}

.radio-row input,
.check-inline input {
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
}

.form-error {
  color: var(--danger);
  background: var(--danger-weak);
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 600;
  font-size: 0.9rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.search {
  position: relative;
  margin: 0 0 16px;
}

.search > .ic {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  width: 19px;
  height: 19px;
}

.search input {
  padding-left: 40px;
  border-radius: 999px;
}

.suggest-hint,
.added-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--accent-ink);
  background: var(--accent-weak);
  border-radius: 10px;
  padding: 7px 10px;
  margin: -6px 0 14px;
}

.added-msg {
  color: var(--ok-ink);
  background: var(--ok-weak);
  margin: 10px 0 0;
}

/* Icon and color pickers (radio buttons styled as tiles) */
.picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pick input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
}

.pick span:not(.swatch) {
  background: var(--surface-2);
}

.pick span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
  border: 2px solid transparent;
}

.pick .ic {
  width: 22px;
  height: 22px;
  vertical-align: 0;
}

.pick input:checked + span:not(.swatch) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-weak);
}

.pick input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
}

.color-picker .pick span.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px transparent;
}

.color-picker .pick input:checked + span.swatch {
  box-shadow: 0 0 0 2px var(--text);
}

.cat-preview,
.item-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.item-head .hint {
  margin: 0;
}

/* --------------------------------------------------------------- progress */

progress {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--ok) 18%, transparent);
  display: block;
}

progress::-webkit-progress-bar {
  background: color-mix(in srgb, var(--ok) 18%, transparent);
  border-radius: 999px;
}

progress::-webkit-progress-value {
  background: var(--ok);
  border-radius: 999px;
}

progress::-moz-progress-bar {
  background: var(--ok);
  border-radius: 999px;
}

progress.mini {
  width: 52px;
  height: 5px;
  margin-top: 5px;
  background: var(--surface-3);
}

progress.mini::-webkit-progress-bar {
  background: var(--surface-3);
}

progress.mini::-webkit-progress-value {
  background: var(--accent);
}

progress.mini::-moz-progress-bar {
  background: var(--accent);
}

/* ---------------------------------------------------------------- summary */

.summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.sum {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border: 0;
  border-radius: var(--radius);
  padding: 12px 14px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sum-accent {
  background: var(--accent-weak);
  color: var(--accent-ink);
}

.sum-ok {
  background: var(--ok-weak);
  color: var(--ok-ink);
}

.sum-label {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.85;
}

.sum-num {
  font-size: 1.75rem;
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.sum-num small {
  font-size: 0.95rem;
  font-weight: 600;
}

.sum progress {
  margin-top: 6px;
}

/* ------------------------------------------------------------- segmented */

.segmented {
  display: flex;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 3px;
  margin-bottom: 14px;
}

.seg {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}

.seg.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}

/* ------------------------------------------------------------------ lists */

.group {
  margin-bottom: 20px;
}

.group-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 2px;
}

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

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  position: relative;
}

/* hairline between rows, inset like iOS / Tricount */
.row + .row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 52px;
  right: 0;
  border-top: 1px solid var(--border);
}

.row-tap,
.row-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.row-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.row-sub {
  color: var(--muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.85rem;
  flex: none;
}

.pct {
  font-weight: 700;
  color: var(--text);
}

.done-ic {
  color: var(--ok);
}

.done-ic .ic {
  width: 26px;
  height: 26px;
}

.row-actions {
  display: flex;
  gap: 2px;
  flex: none;
}

.row.is-packed .row-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--muted) 70%, transparent);
}

.row.is-muted {
  opacity: 0.6;
}

.qty {
  color: var(--accent);
  font-weight: 700;
}

/* −/+ number on counted items (socks, underwear …) */
.qty-step {
  flex: none;
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: 999px;
  height: 34px;
}

.qty-step button {
  width: 32px;
  height: 34px;
  border: 0;
  background: none;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.qty-step button:disabled {
  color: var(--faint);
  cursor: default;
}

.qty-step .ic {
  width: 16px;
  height: 16px;
  stroke-width: 2.6;
  vertical-align: 0;
}

.qty-num {
  min-width: 18px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.row.is-packed .qty-step {
  opacity: 0.6;
}

/* On/off switch row (item dialog) */
.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  cursor: pointer;
}

.switch-row > span {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-size: 0.95rem;
}

.switch-row small {
  color: var(--muted);
  font-size: 0.82rem;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 50px;
  height: 30px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--surface-3);
  position: relative;
  cursor: pointer;
  transition: background-color 0.15s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}

.switch:checked {
  background: var(--accent);
}

.switch:checked::after {
  transform: translateX(20px);
}

.switch:focus {
  background: var(--surface-3);
}

.switch:checked:focus {
  background: var(--accent);
}

/* Row controls: "Take" (blue, Choose tab) and "Packed" (green, other tabs) */
.tgl {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-right: -6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tgl input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
}

.tgl span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--none);
  color: var(--faint);
  transition: background-color 0.12s, border-color 0.12s;
}

.tgl .ic {
  width: 18px;
  height: 18px;
  stroke-width: 2.6;
  vertical-align: 0;
}

.tgl-pack .ic {
  opacity: 0;
}

.tgl-take input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.tgl-pack input:checked + span {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

.tgl-pack input:checked + span .ic {
  opacity: 1;
}

.tgl input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

.tgl input:disabled + span {
  opacity: 0.45;
}

.row:not(.is-taken) .tgl-take span {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--none));
  color: var(--accent);
}

.archived {
  margin-top: 24px;
}

/* -------------------------------------------------------------- starter */

.starter-cat {
  margin-bottom: 12px;
}

.starter-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  margin: 8px 0 2px;
}

.row-check {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  padding-left: 6px;
  cursor: pointer;
}

.row-check input {
  width: 22px;
  height: 22px;
  min-height: 0;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
}

.row-check .row-title {
  flex: 1;
  font-weight: 500;
}

.starter-cat .row {
  min-height: 50px;
}

.starter-cat .row + .row::before {
  left: 42px;
}

.bottom-bar {
  position: sticky;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px);
  padding: 10px 0 0;
  background: linear-gradient(to bottom, transparent, var(--bg) 30%);
}

@media (min-width: 760px) {
  .bottom-bar {
    bottom: 16px;
  }
}

/* ----------------------------------------------------- import / dialogs */

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  background: var(--surface-2);
  max-height: 55vh;
  overflow: auto;
}

.check-list li + li {
  border-top: 1px solid var(--border);
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: var(--tap);
  cursor: pointer;
  flex-wrap: wrap;
}

.check-list input[type='checkbox'] {
  width: 21px;
  height: 21px;
  min-height: 0;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
}

.check-list small {
  flex-basis: 100%;
  padding-left: 31px;
}

.ac-name,
.import-main {
  flex: 1;
  min-width: 0;
}

.ac-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

.import-main {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  align-items: baseline;
}

.import-main small {
  flex-basis: 100%;
  padding-left: 0;
}

.row-note {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.85rem;
}

.chips.chips-wrap,
p.chips {
  flex-wrap: wrap;
  margin: 0 0 10px;
  padding: 0;
}

.help {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.help summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  min-height: 32px;
}

.copy-tools {
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 0;
  font-size: 0.92rem;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ login */

.login {
  max-width: 360px;
  margin: 10vh auto 0;
  text-align: center;
}

.login .field {
  text-align: left;
  margin-top: 26px;
}

.login .check-inline {
  justify-content: flex-start;
}

.login .btn-block {
  margin-top: 14px;
}

.login-logo {
  border-radius: 16px;
}

/* --------------------------------------------------------------- dialogs */

.modal {
  border: 0;
  padding: 0;
  border-radius: 20px;
  width: min(460px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-wide {
  width: min(600px, calc(100vw - 24px));
}

.modal:focus {
  outline: none;
}

.modal::backdrop {
  background: rgba(10, 14, 22, 0.45);
}

.modal-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 24px);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 10px 4px 20px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-body {
  padding: 8px 20px 6px;
  overflow: auto;
}

.modal-body > p:first-child {
  margin-top: 0;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 18px;
}

.dialog-extra {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 4px;
}

.dialog-extra .btn {
  padding: 0 8px;
}

.stepper {
  display: flex;
  gap: 8px;
  max-width: 210px;
}

.stepper input {
  text-align: center;
}

.stepper .btn {
  min-width: var(--tap);
  padding: 0;
  font-size: 1.3rem;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 10px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.menu-item .ic {
  width: 22px;
  height: 22px;
  color: var(--muted);
}

.menu-item:hover {
  background: var(--surface-2);
}

.menu-item:disabled {
  opacity: 0.45;
}

.menu-danger,
.menu-danger .ic {
  color: var(--danger);
}

@media (max-width: 560px) {
  .modal,
  .modal-wide {
    width: 100vw;
    max-width: 100vw;
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
    max-height: 94dvh;
  }
  .modal-form {
    max-height: 94dvh;
  }
  .modal-head::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 7px;
    width: 38px;
    height: 4px;
    margin-left: -19px;
    border-radius: 4px;
    background: var(--surface-3);
  }
  .modal-head {
    padding-top: 18px;
  }
  .modal-foot {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .modal-foot .btn {
    flex: 1;
  }
}

/* ----------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 90px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(440px, calc(100vw - 24px));
  pointer-events: none;
}

@media (min-width: 760px) {
  .toasts {
    bottom: 100px;
  }
}

.toast {
  background: #1d2433;
  color: #fff;
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  font-size: 0.95rem;
  transition: opacity 0.4s, transform 0.4s;
}

.toast-success {
  background: #166534;
}

.toast-warn {
  background: #8a4b05;
}

.toast-error {
  background: #a51d24;
}

.toast-hide {
  opacity: 0;
  transform: translateY(8px);
}

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