:root {
  --bg: #f1f2f7;
  --glow: rgb(99 102 241 / 16%);
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --surface-3: #eaecf3;
  --text: #0f1222;
  --muted: #5a6175;
  --faint: #8b91a3;
  --border: #e3e5ee;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-soft: #eef0ff;
  --accent-ink: #ffffff;
  --ok: #13843f;
  --ok-bg: #e5f5ea;
  --warn: #a95a08;
  --warn-bg: #fdf0dc;
  --danger: #c4291e;
  --danger-bg: #fdeceb;
  --shadow: 0 1px 2px rgb(16 24 40 / 5%), 0 10px 28px -12px rgb(16 24 40 / 16%);
  --shadow-card: 0 22px 40px -20px rgb(15 18 34 / 60%), 0 6px 14px -6px rgb(15 18 34 / 30%);
  --radius: 20px;
  --tabbar-h: 66px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0c12;
    --glow: rgb(124 58 237 / 20%);
    --surface: #13161f;
    --surface-2: #191d29;
    --surface-3: #242938;
    --text: #eceef5;
    --muted: #a3a9ba;
    --faint: #6f768a;
    --border: #252a38;
    --accent: #8f93fb;
    --accent-2: #b98cff;
    --accent-soft: #1c1e3a;
    --accent-ink: #0a0c12;
    --ok: #4ade80;
    --ok-bg: #102619;
    --warn: #fbbf24;
    --warn-bg: #2b2210;
    --danger: #f87171;
    --danger-bg: #321617;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 12px 30px -14px rgb(0 0 0 / 60%);
    --shadow-card: 0 24px 44px -20px rgb(0 0 0 / 85%), 0 6px 14px -6px rgb(0 0 0 / 50%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(1100px 520px at 50% -240px, var(--glow), transparent 70%) no-repeat, var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 700; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* ---------- Top bar & tabs ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 16px; letter-spacing: -0.01em; }
.brand img { width: 30px; height: 30px; border-radius: 9px; box-shadow: 0 4px 10px -4px rgb(79 70 229 / 60%); }
.topbar .today { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.tabs a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); text-decoration: none; font-size: 11.5px; font-weight: 600;
}
.tabs a svg { width: 23px; height: 23px; }
.tabs a.active { color: var(--accent); }
.tabs a.active::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

@media (min-width: 820px) {
  body { padding-bottom: 40px; }
  .tabs {
    position: sticky; top: 0; bottom: auto; height: auto; padding: 0; z-index: 11;
    display: flex; gap: 4px; justify-content: center;
    background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
    margin: 14px auto 0; width: max-content;
    padding: 5px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .tabs a { flex-direction: row; gap: 8px; padding: 8px 16px; border-radius: 999px; font-size: 14px; color: var(--muted); }
  .tabs a svg { width: 18px; height: 18px; }
  .tabs a.active { color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
  .tabs a.active::before { display: none; }
}

main { max-width: 1040px; margin: 0 auto; padding: 18px 16px; }
section { margin-top: 28px; }
section:first-child { margin-top: 4px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel.pad { padding: 18px; }
.loading, .empty { padding: 36px 16px; text-align: center; color: var(--muted); }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 650; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: var(--accent-ink); box-shadow: 0 8px 18px -10px var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
  color: var(--text); font-weight: 500;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); outline: none; }
textarea { min-height: 88px; resize: vertical; }
.btn:focus-visible, .tabs a:focus-visible, [role=button]:focus-visible, .cal button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=color] { width: 52px; height: 42px; padding: 3px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--text); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 520px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.form { display: grid; gap: 14px; }

/* ---------- Card visual ---------- */
.cardface {
  --c: #4f46e5;
  position: relative; aspect-ratio: 1.586; width: 100%;
  border-radius: 5% / 7.93%; overflow: hidden; isolation: isolate;
  container-type: inline-size;
  color: #fff;
  background:
    radial-gradient(120% 95% at 100% 0%, rgb(255 255 255 / 20%), transparent 55%),
    radial-gradient(90% 80% at 0% 100%, rgb(0 0 0 / 25%), transparent 60%),
    linear-gradient(140deg, color-mix(in srgb, var(--c) 85%, #fff) 0%, var(--c) 45%, color-mix(in srgb, var(--c) 55%, #000) 100%);
  box-shadow: var(--shadow-card);
}
.cardface.has-photo { background: var(--photo) center / cover no-repeat, var(--c); }
.cardface::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgb(255 255 255 / 12%) 48%, transparent 62%);
}
.cf-bank { position: absolute; top: 8cqw; left: 7cqw; font-size: 6.4cqw; font-weight: 800; letter-spacing: .06em; }
.cf-wave { position: absolute; top: 7.5cqw; right: 7cqw; width: 7cqw; height: 7cqw; opacity: .9; }
.cf-chip {
  position: absolute; left: 7cqw; top: 37%; width: 13cqw; aspect-ratio: 1.32; border-radius: 1.8cqw;
  background: linear-gradient(135deg, #f8e2a0, #c99b40 60%, #e6c56f);
  box-shadow: inset 0 0 0 0.35cqw rgb(0 0 0 / 18%);
}
.cf-digits { position: absolute; left: 7cqw; bottom: 8cqw; font-size: 6cqw; letter-spacing: .12em; font-weight: 600; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgb(0 0 0 / 35%); }
.cf-net { position: absolute; right: 7cqw; bottom: 7cqw; font-size: 6.4cqw; font-weight: 850; font-style: italic; letter-spacing: -0.01em; text-shadow: 0 1px 3px rgb(0 0 0 / 25%); }
.has-photo .cf-bank, .has-photo .cf-wave, .has-photo .cf-chip, .has-photo .cf-net { display: none; }
.has-photo .cf-digits {
  left: 5cqw; bottom: 5cqw; font-size: 4.6cqw; padding: 1.1cqw 2.8cqw; border-radius: 999px;
  background: rgb(0 0 0 / 42%); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); text-shadow: none;
}
.cardface--mini { width: 56px; flex: none; border-radius: 5px; box-shadow: 0 3px 8px -3px rgb(0 0 0 / 45%); }
.cardface--mini > * { display: none !important; }

/* ---------- Today: hero ---------- */
.hero-grid { display: grid; gap: 16px; }
@media (min-width: 820px) { .hero-grid { grid-template-columns: 1fr 1fr; } }
.hero { padding: 18px; display: grid; gap: 16px; align-content: start; }
.hero-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.hero-card { display: flex; justify-content: center; padding: 6px 4px 4px; perspective: 900px; }
.hero-card .cardface { width: min(100%, 390px); transition: transform .4s ease; }
@media (hover: hover) { .hero:hover .hero-card .cardface { transform: rotateX(4deg) rotateY(-6deg) translateY(-2px); } }
.hero-stats { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.gauge-wrap { position: relative; width: 96px; height: 96px; }
.gauge { width: 100%; height: 100%; display: block; }
.gauge .track { fill: none; stroke: var(--surface-3); stroke-width: 8; }
.gauge .fill { fill: none; stroke: var(--g, var(--accent)); stroke-width: 8; stroke-linecap: round; }
.gauge-num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.gauge-num b { font-size: 32px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.gauge-num small { font-size: 11px; color: var(--muted); font-weight: 650; margin-top: 2px; }
.hero-name { font-size: 18px; font-weight: 750; letter-spacing: -0.01em; }
.hero-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.hero-due { margin-top: 8px; font-size: 14px; display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.hero-due b { font-weight: 750; }
.hero-next { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 12px; }
.hero-next b { color: var(--text); font-weight: 650; }
.status { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 13px; font-size: 14px; flex-wrap: wrap; }
.status.warn { background: var(--warn-bg); color: var(--warn); }
.status.info { background: var(--surface-2); color: var(--muted); }
.status .grow { min-width: 170px; }
.status select { min-height: 36px; padding: 4px 10px; width: auto; max-width: 100%; }

/* ---------- Ranking ---------- */
.rank { list-style: none; margin: 0; padding: 6px 0; }
.rank li { display: grid; grid-template-columns: 20px auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 18px; }
.rank li + li { border-top: 1px solid var(--border); }
.rank .pos { color: var(--faint); font-weight: 700; font-size: 13px; text-align: right; }
.rank .name { display: flex; align-items: center; gap: 8px; font-weight: 650; min-width: 0; }
.rank .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-3); margin-top: 7px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 70%, var(--surface)), var(--c)); }
.rank li:first-child .bar i { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.rank .days { text-align: right; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.rank .days small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.tag.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.tag.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.tag.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.hint { font-size: 13px; color: var(--muted); margin: 10px 4px 0; }

/* ---------- Bills ---------- */
.summary { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; padding: 18px; align-items: center; }
.summary .big { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.summary .label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.summary .next { justify-self: end; text-align: right; display: grid; gap: 4px; }
@media (max-width: 560px) { .summary { grid-template-columns: 1fr; } .summary .next { justify-self: start; text-align: left; } }
.bills { list-style: none; margin: 0; padding: 0; }
.bill {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 14px; padding: 14px 18px; align-items: center;
  grid-template-areas: "thumb title amount" "thumb meta actions";
}
.bill + .bill { border-top: 1px solid var(--border); }
.bill .thumb { grid-area: thumb; }
.bill .title { grid-area: title; font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bill .meta { grid-area: meta; font-size: 13px; color: var(--muted); display: flex; gap: 4px 10px; flex-wrap: wrap; align-items: center; }
.bill .amount { grid-area: amount; font-weight: 800; font-size: 18px; text-align: right; letter-spacing: -0.02em; white-space: nowrap; }
.bill .amount.unknown { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.bill .actions { grid-area: actions; display: flex; gap: 6px; justify-content: flex-end; }
@media (max-width: 560px) {
  .bill { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "thumb title amount" "meta meta meta" "actions actions actions"; padding: 14px 16px; gap: 6px 12px; }
  .bill .cardface--mini { width: 44px; }
  .bill .actions { justify-content: flex-start; margin-top: 2px; }
}
details.panel > summary { cursor: pointer; padding: 15px 18px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: "▾"; color: var(--muted); }
details.panel[open] > summary::after { content: "▴"; }
details.panel[open] > summary { border-bottom: 1px solid var(--border); }

/* ---------- Cards tab ---------- */
.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tile { padding: 14px; display: grid; gap: 14px; cursor: pointer; transition: transform .15s, box-shadow .15s; text-align: left; }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow), 0 16px 30px -18px rgb(16 24 40 / 30%); }
.tile-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 750; font-size: 16px; }
.tile-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tile-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.tile-stats .stat { background: var(--surface-2); border-radius: 10px; padding: 6px 10px; font-size: 12.5px; color: var(--muted); }
.tile-stats .stat b { color: var(--text); font-size: 14px; }
.tile.add { place-content: center; justify-items: center; min-height: 220px; border: 2px dashed var(--border); background: transparent; box-shadow: none; color: var(--muted); font-weight: 650; }
.tile.add .plus { width: 44px; height: 44px; border-radius: 50%; display: grid; place-content: center; font-size: 24px; background: var(--accent-soft); color: var(--accent); }
.badges { display: flex; gap: 4px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .card-grid { grid-template-columns: 1fr; gap: 12px; }
  .tile { grid-template-columns: 124px minmax(0, 1fr); align-items: center; gap: 14px; padding: 12px; }
  .tile .cardface { box-shadow: 0 8px 16px -10px rgb(15 18 34 / 60%); }
  .tile-title { font-size: 15px; flex-wrap: wrap; }
  .tile-stats { margin-top: 8px; gap: 6px; }
  .tile-stats .stat { padding: 4px 8px; font-size: 12px; }
  .tile-stats .stat b { font-size: 13px; }
  .tile.add { min-height: 72px; grid-template-columns: auto auto; place-content: center; gap: 10px; }
}

/* ---------- Plan ---------- */
.periods { list-style: none; margin: 0; padding: 0; }
.periods li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 18px; }
.periods li + li { border-top: 1px solid var(--border); }
.periods .when { font-size: 13px; color: var(--muted); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; padding: 14px; }
.cal .dow { font-size: 11px; font-weight: 700; color: var(--faint); text-align: center; padding-bottom: 2px; text-transform: uppercase; letter-spacing: .04em; }
.cal button {
  position: relative; height: clamp(48px, 12vw, 60px); border: 0; border-radius: 10px; cursor: pointer;
  background: color-mix(in srgb, var(--c) 26%, var(--surface)); color: var(--text);
  font-weight: 700; font-size: 13px; padding: 0 0 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  transition: transform .1s;
}
.cal button:hover { transform: scale(1.04); }
.cal button small { font-size: 10px; font-weight: 750; color: color-mix(in srgb, var(--c) 65%, var(--text)); font-variant-numeric: tabular-nums; }
.cal button::after { content: ""; position: absolute; left: 18%; right: 18%; bottom: 4px; height: 4px; border-radius: 2px; background: var(--g, transparent); }
.cal button.today { box-shadow: 0 0 0 2px var(--accent); }
.cal button.sel { box-shadow: inset 0 0 0 2px var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 0 18px 16px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; display: inline-block; }

/* ---------- Settings ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.log { list-style: none; margin: 0; padding: 0 18px 12px; font-size: 12px; max-height: 320px; overflow: auto; }
.log li { padding: 7px 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: 112px 1fr; gap: 10px; }
.log li.error { color: var(--danger); }
.issues { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.issues li { padding: 8px 0; border-top: 1px solid var(--border); }
code { font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; word-break: break-all; }

/* ---------- Dialog & toast ---------- */
dialog {
  width: min(580px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  border: 1px solid var(--border); border-radius: 22px; padding: 0;
  background: var(--surface); color: var(--text); box-shadow: 0 30px 70px -20px rgb(0 0 0 / 45%);
}
dialog::backdrop { background: rgb(8 10 16 / 55%); backdrop-filter: blur(3px); }
dialog form { padding: 20px; }
dialog h3 { font-size: 19px; margin-bottom: 4px; }
dialog .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
dialog .foot .left { margin-right: auto; }
.photo-edit { display: grid; gap: 10px; justify-items: center; padding: 16px; border-radius: 16px; background: var(--surface-2); }
.photo-edit .cardface { width: min(100%, 320px); }
.photo-edit.busy .cardface { opacity: .5; }
.photo-edit p { margin: 0; text-align: center; }
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-weight: 650; font-size: 14px;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); box-shadow: 0 12px 30px -10px rgb(0 0 0 / 40%);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 820px) { #toast { bottom: 28px; } }

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login .panel { width: min(400px, 100%); padding: 28px; display: grid; gap: 18px; }
.login img { width: 60px; height: 60px; border-radius: 16px; box-shadow: 0 10px 24px -10px rgb(79 70 229 / 70%); }
.error-text { color: var(--danger); font-size: 14px; min-height: 20px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .hero:hover .hero-card .cardface { transform: none !important; } }
