/* Fonts are served by the app (wwwroot/fonts, SIL OFL 1.1, see OFL.txt there), not by Google. */
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap; src: url("../fonts/dm-sans-latin-wght.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/fraunces-latin-opsz-wght.woff2") format("woff2"); }
/* Closet Ledger: palette, type and shapes taken from the Lovable prototype (2026-10-11). */
:root {
  --bg: oklch(0.975 0.012 80);
  --fg: oklch(0.22 0.02 50);
  --card: oklch(0.995 0.005 80);
  --primary: oklch(0.26 0.03 50);
  --primary-fg: oklch(0.975 0.012 80);
  --muted: oklch(0.94 0.014 75);
  --muted-fg: oklch(0.5 0.02 55);
  --border: oklch(0.89 0.018 75);
  --input: oklch(0.86 0.02 75);
  --ring: oklch(0.6 0.12 45);
  --danger: oklch(0.55 0.2 27);
  --keep: oklch(0.5 0.09 150);    --keep-soft: oklch(0.93 0.04 150);
  --ret: oklch(0.58 0.15 40);     --ret-soft: oklch(0.93 0.045 45);
  --ship: oklch(0.5 0.1 240);     --ship-soft: oklch(0.93 0.03 240);
  --refund: oklch(0.5 0.1 290);   --refund-soft: oklch(0.93 0.03 290);
  --warn: oklch(0.55 0.15 70);    --warn-soft: oklch(0.94 0.07 85);
  --radius: 14px;
  --sans: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 16px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
body.with-tabbar { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
a { color: var(--fg); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; font-weight: 600; color: var(--fg); }
h2 { font-size: 20px; }
h3 { font-size: 18px; margin: 0; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.muted { color: var(--muted-fg); font-size: 14px; }
.small { font-size: 12px; }
.text-danger { color: var(--danger) !important; }

/* ---- shell ---- */
.shell { max-width: 36rem; margin: 0 auto; padding: 0 16px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 24px 0 12px; }
.page-title { font-size: 28px; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-nav { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.account-link { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; color: var(--muted-fg); text-decoration: none; cursor: pointer; }
.account-link:hover { background: var(--muted); color: var(--fg); }
.account-link svg { width: 16px; height: 16px; }
.logout-form { margin: 0; }
main { padding-bottom: 24px; }
main > * + * { margin-top: 20px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; border-top: 1px solid var(--border); background: color-mix(in oklch, var(--card) 95%, transparent); backdrop-filter: blur(8px); padding-bottom: env(safe-area-inset-bottom); }
.tabbar-inner { max-width: 36rem; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0; font-size: 12px; color: var(--muted-fg); text-decoration: none; }
.tabbar a svg { width: 20px; height: 20px; }
.tabbar a.active { color: var(--fg); font-weight: 600; }

/* ---- cards and forms ---- */
.card, .panel { display: block; background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) + 8px); padding: 16px; margin-bottom: 0; }
.panel + .panel { margin-top: 20px; }
label { display: block; font-size: 12px; font-weight: 500; color: var(--muted-fg); margin-bottom: 12px; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea { display: block; width: 100%; margin-top: 4px; border: 1px solid var(--input); border-radius: 12px; background: var(--card); color: var(--fg); padding: 9px 12px; font: inherit; font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 25%, transparent); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fg); font-weight: 400; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.hint { display: block; margin-top: 4px; font-size: 12px; color: var(--warn); font-weight: 400; }
.btn { border-radius: 12px; padding: 10px 16px; font-weight: 500; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn-primary:hover, .btn-primary:focus { background: oklch(0.32 0.03 50); border-color: oklch(0.32 0.03 50); color: var(--primary-fg); }
.btn-outline-dark { border-color: var(--border); background: var(--card); color: var(--fg); }
.btn-outline-dark:hover { background: var(--muted); color: var(--fg); border-color: var(--border); }
.btn-outline-danger { color: var(--danger); border-color: var(--border); background: var(--card); }
.btn-block { display: block; width: 100%; height: 48px; }
.notice { background: var(--muted); border-radius: var(--radius); padding: 14px 16px; font-size: 14px; }
.preview-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: var(--bg); }
.button-pair { display: flex; gap: 8px; }
.button-pair .btn { flex: 1; }

/* ---- items page ---- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) + 8px); padding: 12px; }
.stat strong { display: block; font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1.2; }
.stat span { display: block; font-size: 12px; color: var(--muted-fg); }
.deadlines { background: var(--warn-soft); border: 1px solid var(--border); border-radius: calc(var(--radius) + 8px); padding: 16px; }
.deadlines h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; margin: 0 0 8px; }
.deadlines h2 svg { color: var(--warn); width: 16px; height: 16px; }
.deadlines ul { list-style: none; margin: 0; padding: 0; }
.deadlines li + li { margin-top: 6px; }
.deadlines a { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; text-decoration: none; }
.deadline-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deadline-name b { font-weight: 500; }
.deadline-tag { flex-shrink: 0; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 500; background: var(--card); }
.deadline-tag.unknown { background: transparent; border: 1px dashed var(--warn); color: var(--warn); font-weight: 400; }
.deadline-tag.urgent { background: var(--ret); color: var(--primary-fg); }
.deadline-tag.soon { background: var(--warn); color: var(--primary-fg); }
.search { position: relative; margin-bottom: 0; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted-fg); }
.search input { padding-left: 36px !important; margin-top: 0 !important; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin-left: -16px; margin-right: -16px; padding: 0 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
main > .chips { margin-top: 12px; }
.chip { flex-shrink: 0; border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 14px; text-decoration: none; white-space: nowrap; }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.order-card { text-decoration: none; color: var(--fg); }
.order-card + .order-card { margin-top: 12px; }
.order-card:active { background: var(--muted); }
.order-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.order-head .small { text-align: right; }
.item-list { list-style: none; margin: 8px 0 0; padding: 0; }
.item-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.item-list li + li { border-top: 1px solid var(--border); }
.item-text { flex: 1; min-width: 0; }
.item-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { font-size: 12px; color: var(--muted-fg); }
.item-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--muted); }
.item-thumb-empty { display: none; }
.badge-status { flex-shrink: 0; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 500; text-align: center; max-width: 9rem; }
.badge-status.muted { background: var(--muted); color: var(--muted-fg); }
.badge-status.keep { background: var(--keep-soft); color: var(--keep); }
.badge-status.ret { background: var(--ret-soft); color: var(--ret); }
.badge-status.ship { background: var(--ship-soft); color: var(--ship); }
.badge-status.refund { background: var(--refund-soft); color: var(--refund); }
.totals { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 14px; }
main > .totals { border-top: 0; padding-top: 0; }
.total { flex: 1; border-radius: 10px; padding: 6px 10px; text-align: center; }
.total.keep { background: var(--keep-soft); }
.total.ret { background: var(--ret-soft); }
.total.refund { background: var(--refund-soft); }
.totals-note { margin: 6px 0 0; }
.export-button, .dashed-button { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px; border: 1px solid var(--border); background: var(--card); border-radius: var(--radius); font-size: 14px; color: var(--fg); text-decoration: none; }
.dashed-button { border-style: dashed; background: transparent; }
.export-button svg, .dashed-button svg { width: 16px; height: 16px; }
.empty-note { text-align: center; color: var(--muted-fg); padding: 32px 0; }
.onboarding ol { padding-left: 20px; font-size: 14px; }
.onboarding li + li { margin-top: 6px; }

/* ---- order page ---- */
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted-fg); text-decoration: none; }
.back-link svg { width: 16px; height: 16px; }
.section-title { font-size: 20px; margin-bottom: 0; }
main > .item-card { margin-top: 12px; }
.item-card-head { display: flex; align-items: flex-start; gap: 10px; }
.item-card .item-name { font-weight: 600; white-space: normal; }
.item-deadline { margin-top: 8px; }
.item-deadline .deadline-tag { display: inline-block; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.quick-btn { min-height: 48px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--fg); padding: 4px 8px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.quick-btn.keep.on { background: var(--keep); border-color: var(--keep); color: var(--primary-fg); }
.quick-btn.ret.on { background: var(--ret); border-color: var(--ret); color: var(--primary-fg); }
.quick-btn.ship.on { background: var(--ship); border-color: var(--ship); color: var(--primary-fg); }
.quick-btn.refund.on { background: var(--refund); border-color: var(--refund); color: var(--primary-fg); }
.mini-selects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.mini-selects label { margin: 0; font-weight: 400; }
.mini-selects select { font-size: 12px; padding: 6px; margin-top: 2px; }
.edit-link { display: inline-block; margin-top: 12px; font-size: 14px; }
main > .dashed-button { margin-top: 12px; }
.delete-order { text-align: center; }
.delete-order .check { justify-content: center; font-size: 13px; color: var(--muted-fg); }
.danger-link { display: inline-flex; align-items: center; gap: 8px; color: var(--danger); background: none; border: 0; }
.danger-link svg { width: 16px; height: 16px; }

/* ---- item edit page: photos ---- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.gallery-item { margin: 0; }
.gallery-item img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--muted); }
.gallery-item figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--muted-fg); }
.gallery-item form { margin: 0; }
.photo-forms { display: grid; grid-template-columns: 1fr; gap: 12px; }
.photo-forms form { display: flex; flex-direction: column; gap: 8px; }
.photo-forms label { margin-bottom: 0; }
.saved-link { background: var(--muted); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; font-size: 14px; }
.saved-link p { margin-bottom: 10px; }
.image-message { color: var(--keep); font-size: 14px; }

@media (max-width: 340px) {
  .field-grid { grid-template-columns: 1fr; }
  .mini-selects { grid-template-columns: 1fr; }
}
.validation-summary-valid { display: none; }
.text-danger ul { margin: 0 0 12px; padding-left: 18px; }
/* The page title lives in the top bar; Identity UI pages print a second one inside <main>. */
main > h1:first-child, main > div > h1:first-child { display: none; }
/* The Identity UI login page links to registration and password reset, which Program.cs
   removes (they answer 404), and offers external sign-in, which is not configured. Those
   parts live in the Identity UI's own page, so they are hidden here. Delete these rules if
   either feature returns. */
a[href*="/Identity/Account/Register"], a[href*="/Identity/Account/ForgotPassword"],
a[href*="/Identity/Account/ResendEmailConfirmation"] { display: none; }
main .row > div:has(> section > h3) { display: none; }
main .form-floating { position: relative; margin-bottom: 12px; }
/* Grid columns must be allowed to shrink below an input's intrinsic width (date inputs especially). */
.field-grid > *, .mini-selects > * { min-width: 0; }
input, select, textarea { min-width: 0; max-width: 100%; }
@media (max-width: 480px) { .account-label { display: none; } .account-link { padding: 6px 8px; } .page-title { font-size: 26px; } }
/* Order page: every non-zero amount, two per row so each stays on one line at phone width. */
.totals.full { display: grid; grid-template-columns: 1fr 1fr; }
.totals.full .total:only-child { grid-column: 1 / -1; }
.total.undecided { background: var(--muted); }
.total { white-space: nowrap; }

/* Email import: drafts from forwarded email, and the receiving address */
.drafts li{align-items:center}
.drafts form{margin-left:auto}
.drafts a.item-text{color:inherit;text-decoration:none;flex:1;min-width:0}
.inbound-address{color:var(--fg);display:inline-block;word-break:break-all;font-size:1rem;padding:.4rem .6rem;background:var(--muted);border-radius:8px}
.draft-picture{display:flex;align-items:center;gap:.75rem;margin-bottom:.5rem}
