/* ─────────────────────────────────────────────────────────────────────────────
   app.css — the web app's design system.

   Colors are ported from DesignSystem/Theme.swift so the web and the phone look
   like the same product. The iOS app leans on UIKit's semantic system colors for
   dark mode; here that's `prefers-color-scheme` plus a manual override, since a
   browser tab can't ask the OS the way an app can.
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  /* Brand palette — Theme.swift */
  --brand: #0FA968;
  --brand-dark: #0B7A4B;
  --income: #16A34A;
  --expense: #E1483B;
  --warning: #F59E0B;
  --info: #3B82F6;
  --violet: #7C3AED;

  /* Surfaces (light) */
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --card-alt: #FAFAFB;
  --text: #11181C;
  --text-muted: #6B7280;
  --border: #E3E4E8;
  --track: #E9EAEE;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .05);

  --radius: 14px;
  --radius-sm: 9px;
  --nav-width: 236px;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1C1C1E;
    --card-alt: #2C2C2E;
    --text: #F5F5F7;
    --text-muted: #9BA1A6;
    --border: #38383A;
    --track: #38383A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

/* Explicit user choice beats the OS preference, in both directions. */
:root[data-theme="dark"] {
  --bg: #000000; --card: #1C1C1E; --card-alt: #2C2C2E;
  --text: #F5F5F7; --text-muted: #9BA1A6; --border: #38383A; --track: #38383A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
:root[data-theme="light"] {
  --bg: #F2F2F7; --card: #FFFFFF; --card-alt: #FAFAFB;
  --text: #11181C; --text-muted: #6B7280; --border: #E3E4E8; --track: #E9EAEE;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--brand); }

.muted { color: var(--text-muted); font-size: 13px; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ── App shell ───────────────────────────────────────────────────────────── */

.app { display: flex; min-height: 100vh; }

.nav {
  width: var(--nav-width);
  flex: 0 0 var(--nav-width);
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.nav-brand {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 10px 16px;
  font-weight: 700; font-size: 17px; letter-spacing: -0.02em;
}
.nav-brand .dot {
  width: 22px; height: 22px; border-radius: 7px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: grid; place-items: center; color: #fff; font-size: 12px;
}

.nav-section {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 600;
  padding: 14px 10px 5px;
}

.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  transition: background .12s;
}
.nav a:hover { background: var(--card-alt); }
.nav a.on { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); font-weight: 600; }
.nav a .ico { width: 20px; text-align: center; font-size: 15px; }

.nav-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }

.main { flex: 1; min-width: 0; padding: 26px 30px 80px; max-width: 1240px; }

/* Mobile: nav becomes a top bar with a slide-over drawer. */
.nav-toggle { display: none; }
.topbar { display: none; }

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    background: var(--card); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
  }
  .nav {
    position: fixed; z-index: 40; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow);
    height: 100dvh;
  }
  .nav.open { transform: none; }
  .nav-scrim {
    position: fixed; inset: 0; z-index: 35;
    background: rgba(0, 0, 0, .35);
  }
  .main { padding: 16px 14px 90px; }
  h1 { font-size: 22px; }

  /* Two stat tiles per row rather than one tall column per screen. */
  .grid { --min-cap: 148px; gap: 10px; }
  .stat { padding: 11px 12px; }
  .stat-value { font-size: 19px; }
  .search { max-width: none; }
}

/* ── Cards, headers, grids ───────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: -2px 0 12px;
}
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.grid {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  /* --min is set inline per-grid by ui.grid(). The breakpoint below can't lower
     it directly (an inline custom property beats a media query), so it sets
     --min-cap instead and min() takes whichever is smaller. */
  --min: 200px;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--min), var(--min-cap, 100%), 100%), 1fr));
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── Stats ───────────────────────────────────────────────────────────────── */

.stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 3px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 23px; font-weight: 680; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--text-muted); }
.stat-income .stat-value { color: var(--income); }
.stat-expense .stat-value { color: var(--expense); }
.stat-warning .stat-value { color: var(--warning); }

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

.btn {
  font: inherit; font-size: 14px; font-weight: 550;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: filter .12s, background .12s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .55; cursor: default; }

.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-danger { background: var(--expense); border-color: var(--expense); color: #fff; }
.btn-danger-ghost { border-color: transparent; color: var(--expense); background: transparent; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-icon { padding: 5px 8px; font-size: 15px; line-height: 1; }

/* ── Forms ───────────────────────────────────────────────────────────────── */

input, select, textarea {
  font: inherit; font-size: 14px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-alt);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
  outline-offset: -1px;
}
textarea { resize: vertical; min-height: 70px; }
input[type="checkbox"] { width: auto; }
input[type="file"] { background: none; border: none; padding: 6px 0; }

.form { display: flex; flex-direction: column; gap: 13px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 13px; font-weight: 560; color: var(--text-muted); }
.req { color: var(--expense); font-style: normal; margin-left: 2px; }
.readonly { padding: 8px 10px; background: var(--card-alt); border-radius: var(--radius-sm); color: var(--text-muted); }

.form-error {
  background: color-mix(in srgb, var(--expense) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--expense) 40%, transparent);
  color: var(--expense);
  padding: 9px 11px; border-radius: var(--radius-sm); font-size: 13px;
}

.money-input { display: flex; align-items: center; gap: 0; }
.money-input span {
  padding: 8px 10px; background: var(--track); color: var(--text-muted);
  border: 1px solid var(--border); border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.money-input input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.switch { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.emoji-input { max-width: 84px; font-size: 20px; text-align: center; }

.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch {
  width: 26px; height: 26px; border-radius: 8px;
  border: 2px solid transparent; cursor: pointer; padding: 0;
}
.swatch-on { border-color: var(--text); transform: scale(1.12); }

.file-field { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.file-preview img { max-width: 190px; max-height: 190px; border-radius: var(--radius-sm); display: block; }

.search { max-width: 320px; }

.segmented { display: inline-flex; background: var(--track); border-radius: var(--radius-sm); padding: 2px; gap: 2px; }
.seg {
  font: inherit; font-size: 13px; font-weight: 550;
  padding: 5px 12px; border: none; border-radius: 7px;
  background: transparent; color: var(--text-muted); cursor: pointer;
}
.seg-on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* ── Lists & tables ──────────────────────────────────────────────────────── */

.list { list-style: none; margin: 0; padding: 0; }
.list > li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
}
.list > li:last-child { border-bottom: none; }
.list > li.clickable { cursor: pointer; border-radius: var(--radius-sm); }
.list > li.clickable:hover { background: var(--card-alt); }

.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 560; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-sub { font-size: 12.5px; color: var(--text-muted); display: block; }
.list-amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.list-amount.income { color: var(--income); }
.list-amount.expense { color: var(--text); }

.avatar {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; font-size: 17px; flex: 0 0 36px;
  background: var(--track);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }

.day-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 4px 5px; font-size: 12.5px; font-weight: 620;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
.day-total { font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0; }

.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--card-alt); }

.badge {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--track); color: var(--text-muted);
  border: 1px solid transparent;
}
.badge-income { background: color-mix(in srgb, var(--income) 15%, transparent); color: var(--income); }
.badge-expense { background: color-mix(in srgb, var(--expense) 15%, transparent); color: var(--expense); }
.badge-warning { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }
.badge-muted { background: var(--track); color: var(--text-muted); }

.tags { display: flex; gap: 5px; flex-wrap: wrap; }

/* ── Progress ────────────────────────────────────────────────────────────── */

.bar { height: 7px; background: var(--track); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .25s ease; }

.ring { position: relative; display: grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; }
.ring-text { text-align: center; line-height: 1.2; z-index: 1; }
.ring-text strong { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.ring-text span { font-size: 11px; color: var(--text-muted); }

.breakdown { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.breakdown-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 14px; }
.breakdown-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.breakdown-emoji { font-size: 15px; }
.breakdown-value { font-variant-numeric: tabular-nums; font-weight: 560; white-space: nowrap; }

/* ── Charts ──────────────────────────────────────────────────────────────── */

.chart { width: 100%; overflow: hidden; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-label { fill: var(--text-muted); font-size: 11px; }
.chart-dot { cursor: pointer; }
.chart-dot:hover { r: 5.5; }

/* ── Budget rows ─────────────────────────────────────────────────────────── */

.budget-row { display: flex; align-items: center; gap: 13px; padding: 12px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.budget-row:last-child { border-bottom: none; }
.budget-row:hover { background: var(--card-alt); }
.budget-body { flex: 1; min-width: 0; }
.budget-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 14px; }
.budget-figures { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.budget-over { color: var(--expense); font-weight: 600; }

/* ── Modals ──────────────────────────────────────────────────────────────── */

.backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .45);
  display: grid; place-items: center;
  padding: 20px;
  overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--card);
  border-radius: 16px;
  width: min(520px, 100%);
  max-height: min(88vh, 900px);
  display: flex; flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .3);
  animation: pop .16s ease;
}
.modal-wide { width: min(860px, 100%); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }

.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 16px; border-bottom: 1px solid var(--border);
}
.modal-body { padding: 16px; overflow-y: auto; flex: 1; }
.modal-foot {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 16px; border-top: 1px solid var(--border);
}

@media (max-width: 560px) {
  .backdrop { padding: 0; place-items: end stretch; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 16px 16px 0 0; }
}

/* ── Empty / loading ─────────────────────────────────────────────────────── */

.empty { text-align: center; padding: 44px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-glyph { font-size: 38px; opacity: .75; }
.empty h3 { font-size: 16px; }
.empty p { max-width: 46ch; }

.loading { display: flex; align-items: center; gap: 10px; padding: 40px; justify-content: center; color: var(--text-muted); }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--track); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ───────────────────────────────────────────────────────────────── */

.toast-host { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; }
.toast {
  background: var(--text); color: var(--bg);
  padding: 10px 17px; border-radius: 999px; font-size: 14px; font-weight: 550;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .28);
  animation: rise .2s ease;
}
.toast-error { background: var(--expense); color: #fff; }
.toast-success { background: var(--brand); color: #fff; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

/* ── Login ───────────────────────────────────────────────────────────────── */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 30px; width: min(390px, 100%);
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 20px; font-weight: 700; }
.login-brand .dot {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: grid; place-items: center; color: #fff;
}
.login .form { margin-top: 20px; }
.login .btn-primary { width: 100%; padding: 10px; margin-top: 4px; }

/* ── Banner ──────────────────────────────────────────────────────────────── */

.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-radius: var(--radius);
  font-size: 13.5px; margin-bottom: 16px;
  border: 1px solid;
}
.banner-warning {
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  border-color: color-mix(in srgb, var(--warning) 40%, transparent);
}
.banner-error {
  background: color-mix(in srgb, var(--expense) 12%, transparent);
  border-color: color-mix(in srgb, var(--expense) 40%, transparent);
}
.banner strong { display: block; margin-bottom: 2px; }

/* ── Photo grid (bins, assets) ───────────────────────────────────────────── */

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.photo-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--card-alt); cursor: pointer;
}
.photo-card:hover { border-color: var(--brand); }
.photo-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-card .ph {
  width: 100%; aspect-ratio: 1; display: grid; place-items: center;
  font-size: 30px; opacity: .4; background: var(--track);
}
.photo-card figcaption { padding: 8px 10px; font-size: 13px; }
.photo-card figcaption small { color: var(--text-muted); display: block; font-size: 12px; }

@media print {
  .nav, .topbar, .page-actions, .card-actions { display: none !important; }
  .main { padding: 0; max-width: none; }
  .card { break-inside: avoid; box-shadow: none; }
}

/* ── Camera: barcode scanner and photo capture ───────────────────────────── */

.scan-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}

.scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* A window to aim through. Barcodes are much wider than they are tall, so the
   reticle is shaped like one rather than being a square. */
.scan-reticle {
  position: absolute;
  inset: 50% 12% auto 12%;
  transform: translateY(-50%);
  aspect-ratio: 3 / 1;
  border: 2px solid rgba(255, 255, 255, .9);
  border-radius: 8px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35);
  pointer-events: none;
}

.scan-status {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, .75), transparent);
  font-size: 13px;
  text-align: center;
}

.scan-field { gap: 8px; align-items: center; }
.scan-field input { flex: 1 1 auto; min-width: 0; }

.file-actions { gap: 8px; align-items: center; flex-wrap: wrap; }
.file-actions input[type="file"] { flex: 1 1 auto; min-width: 0; }
.file-note { font-size: 12px; margin-top: 6px; }

/* The scanner stacks on top of the item-edit form that launched it, so it needs
   to sit above the ordinary modal layer rather than replacing it. */
.scan-backdrop { z-index: 60; }

/* ── Bulk selection ──────────────────────────────────────────────────────── */

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: var(--surface-2, rgba(127, 127, 127, .1));
  border: 1px solid var(--border, rgba(127, 127, 127, .25));
}

.bulk-check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.bulk-count { font-weight: 600; }

.list li.selected {
  background: color-mix(in srgb, var(--accent, #0FA968) 12%, transparent);
}

.row-check {
  width: 20px; height: 20px;
  margin-right: 2px;
  flex: 0 0 auto;
  accent-color: var(--accent, #0FA968);
}

/* ── Undo toasts (separate host so regular toasts can't clear pending undos) ── */

.undo-host {
  position: fixed; bottom: 64px; left: 50%; transform: translateX(-50%);
  z-index: 210; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.undo-toast { display: flex; align-items: center; gap: 14px; }
.undo-button {
  background: none; border: none; cursor: pointer;
  color: var(--accent, #0FA968); font-weight: 700; font-size: 14px; padding: 2px 4px;
}

/* ── Quantity steppers on consumable rows ────────────────────────────────── */

.qty-stepper { display: inline-flex; align-items: center; gap: 2px; }
.qty-stepper button {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border, rgba(127,127,127,.3));
  background: transparent; font-size: 16px; line-height: 1; cursor: pointer;
  color: inherit;
}
.qty-stepper button:active { background: rgba(127, 127, 127, .15); }
.qty-stepper .qty-value { min-width: 34px; text-align: center; font-weight: 600; }
.qty-stepper .qty-unit { font-size: 11px; }

/* ── Select mode on the bins photo grid ──────────────────────────────────── */

.photo-card { position: relative; }
.photo-card .row-check {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 22px; height: 22px;
}
.photo-card.selected { outline: 3px solid var(--accent, #0FA968); border-radius: 10px; }

/* ── Tag picker ──────────────────────────────────────────────────────────── */

.tag-field { display: flex; flex-direction: column; gap: 8px; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chips:empty { display: none; }

.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 999px; font-size: 13px;
  background: color-mix(in srgb, var(--accent, #0FA968) 15%, transparent);
}
.tag-x {
  background: none; border: none; cursor: pointer; padding: 0 2px;
  font-size: 15px; line-height: 1; color: inherit; opacity: .65;
}
.tag-x:hover { opacity: 1; }

.tag-picks-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.tag-pick {
  padding: 3px 9px; border-radius: 999px; font-size: 13px; cursor: pointer;
  background: transparent; color: inherit;
  border: 1px dashed var(--border, rgba(127, 127, 127, .45));
}
.tag-pick:hover { border-style: solid; background: rgba(127, 127, 127, .1); }

/* ── Menu icon customiser ────────────────────────────────────────────────── */

.icon-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.icon-row { display: flex; align-items: center; gap: 10px; }
.icon-row .emoji-input { width: 52px; text-align: center; flex: 0 0 auto; }
.icon-row-title { flex: 1 1 auto; min-width: 0; }
