/* ShortHome brand (brand/README.md). Self-hosted DM Sans: the CSP serves
   nothing from anywhere else. Licence: /static/fonts/DMSans-OFL.txt */
@font-face {
  font-family: "DM Sans";
  src: url("/static/fonts/DMSans-latin.woff2") format("woff2");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

/* Every text/background pair below passes WCAG AA (4.5:1; 3:1 for field
   borders and the focus ring). Coral #E4572E is 3.6:1 on paper: brand mark
   and small non-text highlights only, never text. */
:root {
  --bg: #F7F4EC;
  --card: #FFFDF8;
  --ink: #22223B;
  --muted: #5C5C70;
  --line: #DAD6CC;           /* card edges, rules (decorative) */
  --line-strong: #8B8899;    /* field and quiet-button borders, 3.4:1 */
  --accent: #22223B;         /* primary buttons, links */
  --accent-ink: #FFFDF8;
  --error-bg: #FBE9E6;
  --error-ink: #8A2A1C;
  --notice-bg: #E3F1EE;
  --notice-ink: #1D5A52;
  --focus: #F2B134;
  --coral: #E4572E;
  --pane-1: #3E7CB1;         /* ShortHome Travel */
  --pane-2: #F2B134;         /* Home Inventory */
  --pane-3: #2A9D8F;         /* ShortHome Photos */
  --pane-4: #8E6CCF;
  color-scheme: light dark;
}
/* Dark: follows the system. data-theme="dark" forces it (previews, tests). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17172A;
    --card: #22223B;
    --ink: #FFFDF8;
    --muted: #B4B3C6;
    --line: #3A3A57;
    --line-strong: #7E7D98;
    --accent: #EAE5D9;
    --accent-ink: #22223B;
    --error-bg: #46222A;
    --error-ink: #FFB8AA;
    --notice-bg: #173B3A;
    --notice-ink: #A8E0D6;
  }
}
:root[data-theme="dark"] {
  --bg: #17172A;
  --card: #22223B;
  --ink: #FFFDF8;
  --muted: #B4B3C6;
  --line: #3A3A57;
  --line-strong: #7E7D98;
  --accent: #EAE5D9;
  --accent-ink: #22223B;
  --error-bg: #46222A;
  --error-ink: #FFB8AA;
  --notice-bg: #173B3A;
  --notice-ink: #A8E0D6;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-optical-sizing: auto;
}
.shell { max-width: 28rem; margin: 0 auto; padding: 2.5rem 16px 3rem; }
.brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.5rem; color: var(--ink); }
.brand .mark { width: 2rem; height: 2rem; flex: none; display: block; }
.brand .name { font-weight: 700; font-size: 1.25rem; letter-spacing: -.02em; }
.brand .sub { font-weight: 400; color: var(--muted); letter-spacing: 0; }
h1, h2, h3 { font-weight: 700; letter-spacing: -.01em; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.75rem 1.5rem;
}
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .5rem; }
.lede { color: var(--muted); margin: 0 0 1.25rem; }
.fine { color: var(--muted); font-size: .9rem; margin: 1.25rem 0 0; }
a { color: var(--accent); }
.stack { display: grid; gap: 1rem; }
label { display: grid; gap: .35rem; font-weight: 500; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
input[type=text], input:not([type]), input[type=password], input[type=email] {
  font: inherit;
  padding: .7rem .8rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  width: 100%;
}
input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
button {
  font: inherit;
  font-weight: 600;
  padding: .75rem 1rem;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}
button.quiet { background: transparent; color: var(--accent); border: 1px solid var(--line-strong); padding: .45rem .8rem; }
/* An ink ring for contrast inside a brand-yellow halo (yellow alone is
   1.9:1 on paper). */
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--focus); }
.error, .notice { padding: .7rem .85rem; border-radius: 10px; margin: 0 0 1rem; }
.error { background: var(--error-bg); color: var(--error-ink); }
.notice { background: var(--notice-bg); color: var(--notice-ink); }
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1rem; }
.row .actions { flex-wrap: nowrap; }
.row h1 { margin: 0; }
.card + .card { margin-top: 1rem; }
.card h2 { font-size: 1.15rem; margin: 0 0 1rem; }
.apps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: .75rem; }
/* Each app tile carries its pane colour (brand/README.md): a marker on the
   left and the icon's ground. No pane set: ink. */
.apps a:not([class*="pane-"]) { --pane: var(--ink); --pane-ink: var(--card); }
.apps a {
  display: grid; justify-items: center; gap: .5rem; text-align: center;
  padding: 1rem .5rem; border: 1px solid var(--line); border-left: 5px solid var(--pane);
  border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 500;
}
.apps a:hover { border-color: var(--line-strong); border-left-color: var(--pane); }
.pane-1 { --pane: var(--pane-1); --pane-ink: #FFFDF8; }
.pane-2 { --pane: var(--pane-2); --pane-ink: #22223B; }
.pane-3 { --pane: var(--pane-3); --pane-ink: #FFFDF8; }
.pane-4 { --pane: var(--pane-4); --pane-ink: #FFFDF8; }
/* Pane 0: an app for every app (Feedback). All four colours down the marker,
   and the full mark as its icon. */
.pane-0 { --pane: var(--ink); --pane-ink: var(--card); }
.apps a.pane-0, .apps a.pane-0:hover { border-left-color: transparent;
  background: linear-gradient(var(--pane-1) 0 25%, var(--pane-2) 25% 50%, var(--pane-3) 50% 75%, var(--pane-4) 75%)
    left / 5px 100% no-repeat; background-origin: border-box; }
.apps a.pane-0 .icon { background: transparent; }
.apps .icon img { width: 100%; height: 100%; display: block; }
.apps .icon {
  width: 2.75rem; height: 2.75rem; border-radius: 10px; display: grid; place-items: center;
  background: var(--pane); color: var(--pane-ink); font-weight: 700; font-size: 1.2rem;
}

/* ── shared form bits ─────────────────────────────────────────── */
select, textarea, input[type=date] {
  font: inherit; padding: .55rem .7rem; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg); color: var(--ink); max-width: 100%;
}
textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }
.hint { color: var(--muted); font-weight: 400; font-size: .85rem; }
.muted { color: var(--muted); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }
a.button, button.small { display: inline-block; }
a.button {
  font-weight: 600; padding: .6rem .9rem; border-radius: 10px; background: var(--accent);
  color: var(--accent-ink); text-decoration: none;
}
a.button.quiet { background: transparent; color: var(--accent); border: 1px solid var(--line-strong); }
button.small { padding: .3rem .6rem; font-size: .85rem; }
button.danger { background: var(--error-ink); color: var(--card); }
ul.plain { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .4rem; }

/* ── admin layout ─────────────────────────────────────────────── */
body.admin { font-size: 16px; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); box-shadow: inset 0 3px 0 var(--coral); }
.topbar-inner {
  max-width: 76rem; margin: 0 auto; padding: .6rem 16px; display: flex; flex-wrap: wrap;
  align-items: center; gap: .5rem 1.25rem;
}
.topbar .brand { margin: 0; text-decoration: none; color: var(--ink); gap: .5rem; }
.topbar .brand .mark { width: 1.75rem; height: 1.75rem; }
.topbar .brand .name { font-size: 1.1rem; }
.topbar nav { display: flex; gap: .25rem; overflow-x: auto; flex: 1 1 auto; min-width: 0; }
.topbar nav a {
  padding: .4rem .65rem; border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap;
}
.topbar nav a:hover { color: var(--ink); }
/* Current section: ink, bold, and a coral underline (a non-text mark, 3.6:1). */
.topbar nav a[aria-current=page] { color: var(--ink); font-weight: 700; box-shadow: inset 0 -3px 0 var(--coral); border-radius: 8px 8px 0 0; }
.topbar .who { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9rem; }
.wide-shell { max-width: 76rem; margin: 0 auto; padding: 1.5rem 16px 4rem; }
.wide-shell h1 { font-size: 1.6rem; margin: 0 0 1rem; }
.wide-shell h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 1.25rem; margin: 0 0 1.25rem; min-width: 0;
}
.crumbs { margin: 0 0 .25rem; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1.25rem; }
.grid-2 > .panel { margin: 0; }
.grid-2 + .panel { margin-top: 1.25rem; }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.inline, form.inline { display: inline; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.tile {
  display: grid; gap: .15rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--muted); text-decoration: none;
}
.tile .num { font-size: 1.8rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.tile.warn .num { color: var(--error-ink); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chips a { padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--muted); }
.chips a[aria-current=page] { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 1.25rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.badge {
  display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px;
  background: var(--notice-bg); color: var(--notice-ink); vertical-align: middle;
}
.badge.disabled, .badge.expired, .badge.deleted, .badge.revoked { background: var(--error-bg); color: var(--error-ink); }
.badge.used, .badge.retired { background: var(--line); color: var(--ink); }
/* Small: an ink letter in a ring of the app's pane colour (white letters on
   the panes don't reach 4.5:1 at this size; the launcher's larger icons do). */
.icon-sm { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 6px; background: var(--card); border: 2px solid var(--pane, var(--ink)); color: var(--ink); font-weight: 700; font-size: .85rem; }
.copyable {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .8rem;
  white-space: pre-wrap; word-break: break-all; margin: 0 0 1rem;
}
details.danger-zone { margin-top: 1rem; }
details.danger-zone summary { cursor: pointer; color: var(--error-ink); }
details pre { white-space: pre-wrap; margin: .3rem 0 0; font-size: .8rem; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: .75rem 1rem 1rem; margin: 0; }
legend { padding: 0 .3rem; font-weight: 600; }
.app-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .75rem; }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin-bottom: 1rem; }
.filters label { font-size: .9rem; }
.pager { display: flex; gap: 1rem; margin-top: 1rem; }
label.warn { color: var(--error-ink); font-weight: 600; }
.sessions li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }

/* ── tables ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-bottom: 1.25rem; }
.panel .table-wrap { border: 0; margin: 0; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:last-child > * { border-bottom: 0; }
.nowrap { white-space: nowrap; }
table.grid th[scope=row] { white-space: nowrap; font-weight: 500; }
table.grid tr.disabled, table.grid tr.expired { opacity: .6; }
.cell { display: flex; align-items: center; gap: .35rem; }
.cell select { padding: .3rem .4rem; font-size: .9rem; }
.cell-status { font-size: .8rem; color: var(--notice-ink); min-width: 1rem; }
.cell-status.bad { color: var(--error-ink); }
.js .nojs { display: none; }

/* ── two-step sign-in ─────────────────────────────────────────── */
ol.steps { padding-left: 1.2rem; margin: 0 0 1.25rem; display: grid; gap: .75rem; }
.qr { margin: .6rem 0; }
.qr svg { display: block; width: 100%; max-width: 15rem; height: auto; aspect-ratio: 1; border-radius: 8px; }
code.secret { font-size: 1rem; letter-spacing: .05em; overflow-wrap: anywhere; }
pre.codes { font-size: 1.05rem; line-height: 1.7; text-align: center; letter-spacing: .04em; }

/* ── passkeys ─────────────────────────────────────────────────── */
ul.passkeys li { display: grid; gap: .3rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
ul.passkeys li:last-child { border-bottom: 0; }
ul.passkeys .inline-form input { flex: 1 1 10rem; min-width: 0; }
.passkey-add { margin-top: .5rem; }
.or { display: flex; align-items: center; gap: .75rem; color: var(--muted); margin: 1.1rem 0; font-size: .9rem; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
button.wide-button { width: 100%; }
.sub-h { font-size: 1rem; margin: 1.25rem 0 .5rem; }
.email-form { margin-top: 1rem; }
