/* Sermi styles. Colours are tokens on :root, redefined for the dark theme, so
   components only refer to var(--…). */

/* --- Colours and themes --------------------------------------------------------------- */

:root {
  color-scheme: light;
  --text: #18181b;
  --muted: #71717a;
  --line: #e4e4e7;
  --soft: #f4f4f5;
  --bg: #fafafa;
  --surface: #fff;
  --surface-2: #fcfcfc;
  --row-hover: #fafafa;
  --strong: #3f3f46;
  --input-line: #d4d4d8;
  --underline: #a1a1aa;
  --on-text: #fff;
  --accent: #2f5bd3;
  --focus-ring: #2f5bd326;
  --danger: #c2410c;
  --shadow: rgb(0 0 0 / .08);
  --avatar-bg: #e0e7ff; --avatar-fg: #3730a3;
  --blue-bg: #e0ecff; --blue-fg: #1e429f;
  --amber-bg: #fef3c7; --amber-fg: #92400e;
  --violet-bg: #ede9fe; --violet-fg: #5b21b6;
  --green-bg: #dcfce7; --green-fg: #166534; --green-line: #bbf7d0; --green-soft: #f0fdf4; --green-text: #15803d;
  --red-bg: #fee2e2; --red-fg: #991b1b; --red-line: #fecaca; --red-soft: #fef2f2;
  --radius: 10px;
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Dark theme: automatic from the device setting unless the user chose light or dark
   (data-theme on <html>, set by theme.js). The two blocks hold the same values. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --text: #e4e4e7;
    --muted: #a1a1aa;
    --line: #2e2e33;
    --soft: #26262b;
    --bg: #111113;
    --surface: #18181b;
    --surface-2: #1c1c20;
    --row-hover: #1f1f24;
    --strong: #d4d4d8;
    --input-line: #3f3f46;
    --underline: #71717a;
    --on-text: #18181b;
    --accent: #7ea2ff;
    --focus-ring: #7ea2ff40;
    --danger: #fb923c;
    --shadow: rgb(0 0 0 / .5);
    --avatar-bg: #312e81; --avatar-fg: #c7d2fe;
    --blue-bg: #1e2a4a; --blue-fg: #a5c4ff;
    --amber-bg: #3d2e0f; --amber-fg: #fcd34d;
    --violet-bg: #2e2350; --violet-fg: #c4b5fd;
    --green-bg: #12321f; --green-fg: #86efac; --green-line: #1f5133; --green-soft: #0f2418; --green-text: #4ade80;
    --red-bg: #3b1515; --red-fg: #fca5a5; --red-line: #5c2020; --red-soft: #2a1111;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --text: #e4e4e7;
  --muted: #a1a1aa;
  --line: #2e2e33;
  --soft: #26262b;
  --bg: #111113;
  --surface: #18181b;
  --surface-2: #1c1c20;
  --row-hover: #1f1f24;
  --strong: #d4d4d8;
  --input-line: #3f3f46;
  --underline: #71717a;
  --on-text: #18181b;
  --accent: #7ea2ff;
  --focus-ring: #7ea2ff40;
  --danger: #fb923c;
  --shadow: rgb(0 0 0 / .5);
  --avatar-bg: #312e81; --avatar-fg: #c7d2fe;
  --blue-bg: #1e2a4a; --blue-fg: #a5c4ff;
  --amber-bg: #3d2e0f; --amber-fg: #fcd34d;
  --violet-bg: #2e2350; --violet-fg: #c4b5fd;
  --green-bg: #12321f; --green-fg: #86efac; --green-line: #1f5133; --green-soft: #0f2418; --green-text: #4ade80;
  --red-bg: #3b1515; --red-fg: #fca5a5; --red-line: #5c2020; --red-soft: #2a1111;
}


/* --- Base ----------------------------------------------------------------------------- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; text-decoration-color: var(--underline); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1 { font-size: 1.5rem; line-height: 1.25; font-weight: 650; letter-spacing: -.02em; margin: 0 0 1rem; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 .75rem; }
h3 { font-size: .9rem; font-weight: 600; }
p { margin: .25rem 0 .5rem; }
details { margin-bottom: 1rem; }
summary { cursor: pointer; margin-bottom: 1rem; font-weight: 500; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--muted); }
.danger { color: var(--danger); }
.strong { font-weight: 600; text-decoration: none; }
.nowrap { white-space: nowrap; }
.preline { white-space: pre-line; overflow-wrap: anywhere; }
.empty { color: var(--muted); margin: .5rem 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip { position: absolute; left: .5rem; top: -100px; z-index: 10; background: var(--surface); padding: .5rem; }
.skip:focus { top: .5rem; }


/* --- App shell: sidebar on wide screens, top bar on narrow ones ------------------------ */

.sidebar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .75rem 1rem .5rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--text); }
.brand svg { display: block; flex: none; }
.brand span { font-size: 1.3rem; font-weight: 700; letter-spacing: -.015em; line-height: 1; }
main { max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; }
.public .sidebar { justify-content: center; border: 0; background: transparent; padding-top: 3rem; }

/* Menu. Narrow screens: one horizontally scrolling row under the logo. */
.menu { order: 3; display: flex; gap: .25rem; width: calc(100% + 2rem); margin: 0 -1rem; padding: 0 .75rem; overflow-x: auto; scrollbar-width: none; }
.sidebar nav { display: flex; gap: .25rem; }
.sidebar nav a { padding: .4rem .65rem; border-radius: 8px; text-decoration: none; color: var(--strong); font-weight: 500; white-space: nowrap; }
.sidebar nav a:hover { background: var(--soft); color: var(--text); }
.sidebar nav a[aria-current] { background: var(--soft); color: var(--text); font-weight: 600; }
/* Due and overdue own tasks next to the menu item. */
.nav-count { display: inline-block; min-width: 1.25rem; margin-left: .4rem; padding: 0 .35rem; border-radius: 999px; background: var(--danger); color: var(--surface); font-size: .7rem; font-weight: 600; line-height: 1.25rem; text-align: center; }
/* Groups: a divider in the narrow top bar, a small heading in the wide sidebar. */
.nav-group { display: flex; gap: .25rem; padding-left: .25rem; margin-left: .25rem; border-left: 1px solid var(--line); }
.nav-label { display: none; }
.nav-help { margin-left: .5rem; }

/* "Hae…" opens the quick search dialog. */
.search-open, .search-open:hover {
  display: flex; align-items: center; gap: .5rem; padding: .4rem .65rem; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--muted); font-weight: 400; font-size: .875rem;
}
.search-open:hover { border-color: var(--underline); color: var(--text); }
.search-open kbd { margin-left: auto; padding: 0 .3rem; border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: .7rem; }

/* User menu: own page, own details, theme and sign-out. */
.account { position: relative; margin-left: auto; font-size: .875rem; }
.account summary {
  display: flex; align-items: center; gap: .5rem; padding: .3rem .5rem; border-radius: 8px;
  list-style: none; cursor: pointer; font-weight: 500;
}
.account summary::-webkit-details-marker { display: none; }
.account summary:hover, .account[open] summary { background: var(--soft); }
.account summary::after {
  content: ""; width: .35rem; height: .35rem; margin-left: auto; border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted); transform: rotate(45deg) translateY(-2px);
}
.account-menu {
  position: absolute; right: 0; top: calc(100% + .35rem); z-index: 20; width: 15rem; padding: .5rem;
  display: grid; gap: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px var(--shadow);
}
.account-menu > a { padding: .35rem .5rem; border-radius: 6px; text-decoration: none; }
.account-menu > a:hover { background: var(--soft); }
.account-menu form button { width: 100%; }
.me-name { display: none; }
.avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--avatar-bg); color: var(--avatar-fg); font-size: .75rem; font-weight: 700; }
.theme-choice { display: grid; gap: .3rem; padding: .35rem .5rem; }
.theme-choice > span { color: var(--muted); font-size: .75rem; }
.theme-switch { display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--soft); }
.theme-switch button, .theme-switch button:hover {
  flex: 1; padding: .2rem .5rem; border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  font-size: .75rem; font-weight: 500;
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px var(--shadow); }

@media (min-width: 1000px) {
  .app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
  .app .sidebar {
    position: sticky; top: 0; height: 100vh; flex-direction: column; flex-wrap: nowrap; align-items: stretch;
    gap: 1.5rem; padding: 1.25rem .75rem .75rem; border: 0; border-right: 1px solid var(--line);
  }
  .app .brand { padding: 0 .5rem; }
  .app .menu { order: 0; flex-direction: column; gap: 1.5rem; width: auto; margin: 0; padding: 0; overflow: visible; }
  .app .sidebar nav { flex-direction: column; }
  .app .nav-group { flex-direction: column; padding: 0; margin: 1.1rem 0 0; border: 0; }
  .app .nav-help { margin: 1.1rem 0 0; }
  .app .nav-label {
    display: block; padding: 0 .65rem .3rem; color: var(--muted);
    font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  }
  .app .me-name { display: inline; }
  .app .account { margin: auto 0 0; }
  /* At the bottom of the sidebar the menu opens upwards, and its arrow points up. */
  .app .account-menu { top: auto; bottom: calc(100% + .2rem); left: 0; right: 0; width: auto; }
  .app .account[open] summary::after { transform: rotate(-135deg) translate(-2px, -1px); }
  .app main { width: 100%; padding: 2rem 2.5rem 3rem; }
}
@media (max-width: 999px) {
  .search-open kbd { display: none; }
}


/* --- Buttons and inputs --------------------------------------------------------------- */

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-size: .875rem; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none;
  padding: .55rem .95rem; border: 1px solid var(--text); border-radius: 8px; background: var(--text); color: var(--on-text);
}
button:hover, .button:hover { background: var(--strong); border-color: var(--strong); color: var(--on-text); }
.quiet, .quiet:hover { background: var(--surface); color: var(--text); border-color: var(--line); font-weight: 500; }
.quiet:hover { background: var(--soft); }
button.link, button.link:hover {
  background: none; border: 0; padding: 0; font: inherit; color: var(--muted);
  text-decoration: underline; text-decoration-color: var(--underline); text-underline-offset: 3px;
}
button.link:hover { color: var(--accent); }
/* Buttons that create something start with a plus. */
.button.add { gap: .5rem; }
.button.add::before {
  content: ""; width: .7rem; height: .7rem; flex-shrink: 0;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
}

input, select, textarea {
  display: block; width: 100%; font: inherit; color: inherit; background: var(--surface);
  padding: .5rem .65rem; margin-top: .3rem; border: 1px solid var(--input-line); border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
input[type=checkbox] { display: inline-block; width: auto; margin: 0 .5rem 0 0; accent-color: var(--text); }
/* Grows with its content up to about 12 lines (app.js). */
textarea { resize: vertical; min-height: 5.5rem; max-height: 18rem; overflow-y: auto; }
label { font-size: .875rem; font-weight: 500; }
label:has(input[type=checkbox]) { display: block; font-weight: 400; }
/* A radio group (contact method) is a row of chips; the input stays focusable. */
div:has(> div > label > input[type=radio]) { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
label:has(input[type=radio]) { display: inline-flex; padding: .3rem .75rem; border: 1px solid var(--input-line); border-radius: 999px; font-weight: 400; cursor: pointer; position: relative; }
label:has(input[type=radio]:checked) { background: var(--text); border-color: var(--text); color: var(--surface); font-weight: 500; }
label:has(input[type=radio]:focus-visible) { box-shadow: 0 0 0 3px var(--focus-ring); }
input[type=radio] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }


/* --- Layout --------------------------------------------------------------------------- */

.heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.heading h1, .heading h2 { margin: 0; }
.heading p { margin: 0; }
.panel .heading { margin-bottom: .75rem; }
/* Action links (Lisää …, Muokkaa) share one size wherever they sit. */
.panel .heading a, .row > .actions a, .row > a.nowrap, .row > a[aria-label^="Muokkaa"] { font-size: .875rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.actions form { margin: 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; min-width: 0; }
/* Outer margins of the first and last element would add to the panel padding; so would a
   last row's own padding or a last paragraph's margin further in. */
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }
.panel :is(p, dl, ul, ol, .empty):last-child { margin-bottom: 0; }
/* A flush panel lets a table reach its edges. */
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { padding: 1rem 1.25rem 0; }
.panel.flush .empty, .panel.flush .pagination { padding: 0 1.25rem 1rem; }
.panel.flush > .empty:first-child { padding-top: 1rem; }

.grid-2, .grid-3 { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tabs { display: inline-flex; gap: .25rem; padding: .25rem; margin-bottom: 1.25rem; background: var(--soft); border-radius: 9px; }
.tabs a { padding: .3rem .8rem; border-radius: 7px; text-decoration: none; font-size: .875rem; color: var(--muted); }
.tabs a[aria-current] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px var(--shadow); }


/* --- Lists and tables ----------------------------------------------------------------- */

.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: .75rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.row:first-of-type { border-top: 0; }
.row > div { min-width: 0; }
.row .aside { text-align: right; }
.row > .actions, .row > a { flex-shrink: 0; overflow-wrap: normal; }
.grid-3 .row { flex-direction: column; gap: .25rem; }
.event { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.event:first-of-type { border-top: 0; }
.event p { margin: 0; }
.row:last-child, .event:last-child { padding-bottom: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .75rem; font-weight: 500; color: var(--muted); padding: .6rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
td { padding: .7rem 1.25rem; border-bottom: 1px solid var(--line); vertical-align: top; }
/* The panel edge already closes a table. */
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--row-hover); }
.panel:not(.flush) th, .panel:not(.flush) td { padding-left: 0; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 2rem; margin: 0 0 .75rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.pagination { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; font-size: .875rem; }

.status { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 500; white-space: nowrap; background: var(--soft); color: var(--strong); }
.status-contacted, .status-sent { background: var(--blue-bg); color: var(--blue-fg); }
.status-negotiating { background: var(--amber-bg); color: var(--amber-fg); }
.status-waiting { background: var(--violet-bg); color: var(--violet-fg); }
.status-won { background: var(--green-bg); color: var(--green-fg); }
.status-lost { background: var(--red-bg); color: var(--red-fg); }
.tag { padding: .05rem .5rem; border-radius: 999px; background: var(--soft); font-size: .75rem; text-decoration: none; color: var(--strong); }
.tag:hover { background: var(--line); }


/* --- Forms ---------------------------------------------------------------------------- */

.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin-bottom: 1rem; }
.filters > div { flex: 1; min-width: 10rem; }
.filters label { white-space: nowrap; }
.filters .search { flex: 2; }
.filters .actions { flex: 0; padding-bottom: .1rem; }
.filters .check { padding-bottom: .55rem; }

.form { max-width: 40rem; }
.form h2 { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.form-layout { display: grid; grid-template-columns: minmax(0, 40rem) minmax(16rem, 1fr); gap: 1.25rem; align-items: start; }
.field { margin-bottom: 1rem; }
.field > .muted { margin-top: .3rem; font-size: .85rem; }
.field ul { list-style: none; padding: 0; margin: .3rem 0 0; }
/* An address entered as its name part, with the fixed @domain after it. */
.input-suffix { display: flex; align-items: center; gap: .4rem; }
.input-suffix span { margin-top: .3rem; color: var(--muted); white-space: nowrap; }

/* Quick picks under a field: task titles and due dates. */
.shortcuts { gap: .4rem; margin-top: .5rem; }
.shortcuts .quiet { padding: .3rem .7rem; }
.shortcut-group { display: inline-flex; flex-wrap: wrap; gap: .4rem; }
.shortcut-group + .shortcut-group { padding-left: .6rem; border-left: 1px solid var(--line); }
.month-shortcut[aria-pressed="true"], .month-shortcut[aria-pressed="true"]:hover { background: var(--text); border-color: var(--text); color: var(--on-text); }
.due-preview { align-self: center; font-size: .85rem; }

.note-form { margin-bottom: 1rem; }
.note-form textarea { margin-bottom: .5rem; }
.note-form select { width: auto; margin: 0; }
.note-form .combo-select { display: inline-block; min-width: 14rem; vertical-align: middle; }
.note-form .combo-select input { margin: 0; }

.login-page .sidebar { display: none; }
.login-page main { min-height: 100dvh; padding-block: 1.5rem; display: grid; place-content: center; justify-items: center; gap: 1.5rem; }
.login { width: min(24rem, 100vw - 3rem); margin: 0; padding: 1.75rem; }
.login > div { margin-bottom: 1rem; }
.login button { width: 100%; margin-top: .5rem; }


/* --- Messages ------------------------------------------------------------------------- */

.message { padding: .65rem .9rem; margin: 0 0 1rem; border: 1px solid var(--green-line); border-radius: 8px; background: var(--green-soft); color: var(--green-fg); font-size: .9rem; }
.message.error, .error-summary { border: 1px solid var(--red-line); background: var(--red-soft); color: var(--red-fg); }
.error-summary { padding: 1rem; margin-bottom: 1rem; border-radius: 8px; }
.errorlist { color: var(--red-fg); padding-left: 1.25rem; margin: .25rem 0; font-size: .875rem; }


/* --- Notes ---------------------------------------------------------------------------- */

.note { padding: .9rem 1rem; margin-top: .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.note header { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; margin-bottom: .4rem; font-size: .875rem; }
.note p { margin: 0; }
.note-meta { font-size: .8rem; color: var(--muted); margin-bottom: .35rem !important; }
.note-edit { margin-left: auto; display: flex; gap: .75rem; font-size: .8rem; }
.note-edit a, .note-edit button { color: var(--muted); }
.note-edit form { display: contents; }


/* --- Searchable fields (app.js): text comboboxes, selects and multi-selects ----------- */

.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: .25rem; list-style: none; max-height: 18rem; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px var(--shadow);
}
.combo-list li { padding: .45rem .6rem; border-radius: 6px; cursor: pointer; }
.combo-list li:hover, .combo-list li[aria-selected="true"] { background: var(--soft); }
.combo-list li.new { color: var(--accent); font-weight: 600; }
.combo-list li.blank-option { color: var(--muted); }
.combo-list li.empty-option { color: var(--muted); cursor: default; }
.combo-list li.empty-option:hover { background: none; }
.combo-status { min-height: 1.3rem; margin: .3rem 0 0; font-size: .85rem; }
.combo-status.existing { color: var(--green-text); }
.combo-status.new { color: var(--accent); }
.combo-status.ambiguous { color: var(--danger); }

/* A select shown as a searchable field, with a dropdown arrow. */
.combo-select input { padding-right: 2rem; cursor: pointer; }
.combo-select input:focus { cursor: text; }
.combo-select::after {
  content: ""; position: absolute; right: .85rem; top: calc(50% + .15rem); width: .4rem; height: .4rem;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: translateY(-75%) rotate(45deg); pointer-events: none;
}

/* Multi-select: the chosen items as removable chips above the field. */
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .3rem; }
.chips:empty { display: none; }
.chip, .chip:hover {
  display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .45rem .2rem .65rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--soft); color: var(--text);
  font-size: .85rem; font-weight: 500;
}
.chip span { color: var(--muted); font-size: 1rem; line-height: 1; }
.chip:hover span, .chip:focus-visible span { color: var(--danger); }


/* --- Quick search dialog -------------------------------------------------------------- */

.search-dialog {
  width: min(36rem, calc(100vw - 2rem)); margin: 12vh auto auto; padding: 0; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 16px 48px var(--shadow);
}
.search-dialog::backdrop { background: rgb(0 0 0 / .35); }
.search-dialog input { margin: 0; padding: .9rem 1rem; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font-size: 1rem; }
.search-dialog input:focus { box-shadow: none; }
.search-results { max-height: 55vh; overflow-y: auto; padding: .25rem .5rem; }
.search-results:empty { display: none; }
.search-group { margin: .6rem .5rem .2rem; color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.search-results a { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem; border-radius: 6px; text-decoration: none; }
.search-results a span { font-size: .85rem; text-align: right; }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--soft); }
.search-results .empty { padding: .5rem; }
.search-help { margin: 0; padding: .5rem 1rem; border-top: 1px solid var(--line); font-size: .75rem; }


/* --- Pages ---------------------------------------------------------------------------- */

/* Seller summary */
.numbers td, .numbers th { white-space: nowrap; padding-left: .8rem; padding-right: .8rem; }
.numbers tfoot th { color: var(--text); font-size: .85rem; font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }

/* Tools */
.tool-list { display: grid; gap: .75rem; max-width: 40rem; }
.tool { display: block; padding: 1rem 1.25rem; text-decoration: none; }
.tool:hover { border-color: var(--underline); color: inherit; }
.tool p { margin: .2rem 0 0; }

/* User guide; the step numbers match the badges in its screenshots. */
.guide { max-width: 52rem; }
.guide .lead-text { font-size: 1.05rem; }
.guide-motto { margin: 1.25rem 0; padding: .9rem 1.1rem; border-left: 3px solid #e8590c; border-radius: 0 var(--radius) var(--radius) 0; background: var(--soft); }
.guide-motto strong { display: block; font-size: 1.15rem; }
.guide section {
  margin-top: 1.75rem; padding: 1.5rem 1.5rem 1.25rem; scroll-margin-top: 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.guide section > :last-child { margin-bottom: 0; }
.guide section h2 { margin: 0 0 .5rem; padding-bottom: .75rem; border-bottom: 1px solid var(--line); font-size: 1.35rem; }
.guide h3 { margin: 1.75rem 0 .25rem; font-size: 1.05rem; }
.guide figure { margin: 1rem 0 1.25rem; }
.guide figure img {
  display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 4px 16px var(--shadow);
}
.guide ul li { margin: .4rem 0; }
.guide-toc h2 { margin: 0 0 .4rem; font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.guide-toc ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 2rem; }
.guide-toc li { margin: .15rem 0; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0 0 1rem; }
.steps li { counter-increment: step; position: relative; padding-left: 2.4rem; margin: .65rem 0; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -.05rem; width: 1.6rem; height: 1.6rem;
  border-radius: 50%; background: #e8590c; color: #fff; font-weight: 700; font-size: .85rem;
  line-height: 1.6rem; text-align: center;
}


/* --- Narrow screens ------------------------------------------------------------------- */

@media (max-width: 900px) {
  .grid-2, .grid-3, .form-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .guide-toc ul { columns: 1; }
  .guide section { padding: 1.1rem 1rem 1rem; }
}
@media (max-width: 600px) {
  main { padding: 1.25rem 1rem 2rem; }
  .row { flex-direction: column; gap: .25rem; }
  .row .aside { text-align: left; }
  .event { grid-template-columns: 1fr; gap: 0; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: .5rem; }
  th, td { padding: .6rem .75rem; }
}
