/* Backoffice styling. Loaded only on the backoffice host, never by a
   storefront. A dark navigation rail, a light work surface, dense tables and
   coloured status pills: the working language of a rental planning tool. */

:root {
  --nav: #121a24;
  --nav-hover: #1a2533;
  --nav-active: #213047;
  --nav-ink: #9fadbf;
  --nav-ink-strong: #ffffff;
  --nav-rule: #223042;

  --bg: #f1f4f8;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --line: #e1e6ee;
  --line-strong: #c8d1dd;
  --ink: #16202c;
  --ink-2: #3a4859;
  --muted: #6b7a8f;

  --accent: #2468e0;
  --accent-strong: #1a52b8;
  --accent-soft: #e8f0fd;

  --green: #13804f;
  --green-soft: #e1f3ea;
  --amber: #a86400;
  --amber-soft: #fcefd9;
  --red: #c4362b;
  --red-soft: #fbe7e5;
  --violet: #6247d1;
  --violet-soft: #eeeafc;
  --grey: #56657a;
  --grey-soft: #eceff4;

  --font: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius: 7px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(18, 26, 36, 0.06), 0 1px 1px rgba(18, 26, 36, 0.03);
  --shadow-lift: 0 8px 24px rgba(18, 26, 36, 0.12);
  --rail: 232px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 10px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; }
img { max-width: 100%; display: block; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  display: inline-block;
  vertical-align: -4px;
}
.icon--sm { width: 15px; height: 15px; vertical-align: -3px; }

/* ------------------------------------------------------------------ frame */

.frame {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100vh;
  /* Keeps the rail column dark below the sticky rail on long pages. */
  background: linear-gradient(to right, var(--nav) var(--rail), transparent var(--rail));
}

.rail {
  background: var(--nav);
  color: var(--nav-ink);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.rail__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  color: var(--nav-ink-strong);
  border-bottom: 1px solid var(--nav-rule);
  min-height: 60px;
}
.rail__brand:hover { color: var(--nav-ink-strong); text-decoration: none; }
.rail__mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.04em;
}
.rail__name { font-weight: 700; font-size: 15px; line-height: 1.1; }
.rail__name small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: var(--nav-ink);
  letter-spacing: 0.02em;
}

.rail__nav { padding: 10px 10px 16px; flex: 1; }
.rail__section {
  margin: 16px 10px 6px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6c7b8f;
}
.rail__link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--nav-ink);
  font-weight: 500;
  position: relative;
}
.rail__link:hover { background: var(--nav-hover); color: var(--nav-ink-strong); text-decoration: none; }
.rail__link[aria-current="page"] { background: var(--nav-active); color: var(--nav-ink-strong); }
.rail__link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #4f8df5;
}
.rail__count {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  text-align: center;
  background: #2b3a50;
  color: #dbe4ef;
}
.rail__count--amber { background: #f2a93b; color: #2a1a00; }
.rail__count--red { background: #e5534b; color: #fff; }

.rail__foot {
  border-top: 1px solid var(--nav-rule);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #2b3a50;
  color: #e6edf5;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
  text-transform: uppercase;
}
.rail__user { min-width: 0; flex: 1; line-height: 1.25; }
.rail__user strong {
  display: block;
  color: var(--nav-ink-strong);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail__user span { font-size: 11.5px; }
.rail__logout {
  background: none;
  border: 0;
  color: var(--nav-ink);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}
.rail__logout:hover { background: var(--nav-hover); color: var(--nav-ink-strong); }

.workspace { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs__sep { color: var(--line-strong); }
.crumbs__here { color: var(--ink); font-weight: 600; }

.topsearch {
  margin-left: auto;
  position: relative;
  width: min(340px, 40vw);
}
.topsearch .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.topsearch input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 0 12px 0 36px;
  font: inherit;
  color: inherit;
}
.topsearch input:focus { background: var(--surface); border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.content { padding: 24px 28px 48px; max-width: 1480px; width: 100%; }

/* ------------------------------------------------------------ page header */

.pagehead {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.pagehead__main { flex: 1; min-width: 240px; }
.pagehead__eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.pagehead__title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pagehead__meta { color: var(--muted); margin-top: 6px; font-size: 13px; }
.pagehead__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pagehead__thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  object-fit: contain;
  padding: 4px;
  flex: none;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); color: var(--ink); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn--success { background: var(--green); border-color: var(--green); color: #fff; }
.btn--success:hover { background: #0e6b41; border-color: #0e6b41; color: #fff; }
.btn--danger { color: var(--red); border-color: #efc2bd; }
.btn--danger:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--grey-soft); border-color: transparent; }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ------------------------------------------------------------------ pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--grey-soft);
  color: var(--grey);
  line-height: 1.5;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill--green { background: var(--green-soft); color: var(--green); }
.pill--amber { background: var(--amber-soft); color: var(--amber); }
.pill--red { background: var(--red-soft); color: var(--red); }
.pill--violet { background: var(--violet-soft); color: var(--violet); }
.pill--blue { background: var(--accent-soft); color: var(--accent-strong); }
.pill--plain::before { display: none; }

.tag {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--grey-soft);
  color: var(--ink-2);
  line-height: 18px;
  vertical-align: 1px;
}
.tag--accent { background: var(--accent-soft); color: var(--accent-strong); }
.tag--amber { background: var(--amber-soft); color: var(--amber); }

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--swatch, var(--muted));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  vertical-align: 0;
  flex: none;
}
.brandlist { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.brandlist span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.brandlist--suggested { color: var(--muted); font-style: italic; }
.brandlist--suggested .swatch { opacity: 0.55; }

/* ----------------------------------------------------------------- panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  min-width: 0;
}
.panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  min-height: 50px;
}
.panel__head h2 { flex: 1; }
.panel__head a { font-size: 13px; font-weight: 500; }
.panel__body { padding: 16px 18px; }
.panel__body > :last-child { margin-bottom: 0; }
.panel__foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.panel__foot .spacer { flex: 1; }
details.panel > summary { cursor: pointer; list-style: none; border-bottom-color: transparent; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  margin: -4px 4px 0 6px;
  transition: transform 0.15s ease;
}
details.panel[open] > summary { border-bottom-color: var(--line); }
details.panel[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }
.panel--attention { border-color: #e9c98f; box-shadow: 0 0 0 3px var(--amber-soft); }
.panel--change { border-color: #cbc0f3; box-shadow: 0 0 0 3px var(--violet-soft); }
.panel--danger { border-color: #efc2bd; }

.cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}
.cols--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ------------------------------------------------------------------- kpis */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
/* Six cards (the dashboard) split three and three, or sit in one row on a
   wide screen, rather than five and one left over; five (without the
   statistics) split three and two. */
.kpis:has(> .kpi:nth-child(6):last-child),
.kpis:has(> .kpi:nth-child(5):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1400px) {
  .kpis:has(> .kpi:nth-child(6):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpis:has(> .kpi:nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .kpis:has(> .kpi:nth-child(6):last-child),
  .kpis:has(> .kpi:nth-child(5):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.kpi {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 16px 14px;
  color: var(--ink);
  position: relative;
  overflow: hidden;
}
a.kpi:hover { border-color: var(--line-strong); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-lift); }
.kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--kpi-tone, var(--line-strong));
}
.kpi__label { color: var(--muted); font-size: 12.5px; font-weight: 550; display: flex; align-items: center; gap: 7px; }
.kpi__value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.kpi__note { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi--amber { --kpi-tone: #f2a93b; }
.kpi--violet { --kpi-tone: #8b72ea; }
.kpi--green { --kpi-tone: #2fae73; }
.kpi--blue { --kpi-tone: #4f8df5; }
.kpi--red { --kpi-tone: #e5534b; }

/* ----------------------------------------------------------------- tables */

.tablewrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
}
.table th:first-child, .table td:first-child { padding-left: 18px; }
.table th:last-child, .table td:last-child { padding-right: 18px; }
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #f6f9fe; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .check { width: 36px; padding-right: 0; }
.table .nowrap { white-space: nowrap; }
.table .muted { color: var(--muted); }
.table tfoot td { background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }
.table--compact td { padding-top: 8px; padding-bottom: 8px; }
/* A table in a narrow column: tighter cells and plain headers, so every
   column fits without scrolling. */
.table--narrow th { text-transform: none; letter-spacing: 0; font-size: 12px; }
.table--narrow th, .table--narrow td { padding-left: 8px; padding-right: 8px; }
.table--narrow th:first-child, .table--narrow td:first-child { padding-left: 16px; }
.table--narrow th:last-child, .table--narrow td:last-child { padding-right: 16px; }

/* A tree in a table cell or a filter list: indented by --depth. */
.table td.tree { padding-left: calc(12px + var(--depth, 0) * 22px); }
.tree__branch { color: var(--muted); margin-right: 4px; }
.filters__option.tree { padding-left: calc(8px + var(--depth, 0) * 14px); }
.filters__sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 2px;
  padding-left: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.cell-main { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.cell-main__title { font-weight: 600; color: var(--ink); }
a.cell-main__title:hover { color: var(--accent); }
.cell-main__sub { color: var(--muted); font-size: 12.5px; }
.cell-main__sub .mono { font-size: 11.5px; }

.thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  object-fit: contain;
  padding: 2px;
  flex: none;
}
.thumb--empty { display: grid; place-items: center; color: var(--line-strong); }

.suggest { color: var(--muted); font-size: 12px; font-style: italic; }

/* ------------------------------------------------------ list with filters */

.listing {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px 0 10px;
  position: sticky;
  top: 76px;
}
.filters__group { padding: 10px 14px 4px; }
.filters__group + .filters__group { border-top: 1px solid var(--line); }
.filters__title {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}
.filters__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  margin: 0 -8px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
}
.filters__option:hover { background: var(--grey-soft); color: var(--ink); text-decoration: none; }
.filters__option[aria-current="true"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.filters__count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tabs a {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px 10px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count {
  font-size: 11.5px;
  background: var(--grey-soft);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 0 7px;
  font-weight: 650;
  line-height: 18px;
}
.tabs a[aria-current="page"] .count { background: var(--accent-soft); color: var(--accent-strong); }

/* A page's blocks as tabs (partials/tabbar.html). Without JavaScript the
   panels stack under the bar and each tab jumps to its panel; backoffice.js
   shows one panel at a time and marks the chosen tab with aria-selected. */
.tabs--set { margin-bottom: 14px; }
.tabs a[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a[aria-selected="true"] .count { background: var(--accent-soft); color: var(--accent-strong); }
.tabs a[data-invalid] { color: var(--red); }
.tabs a[data-invalid][aria-selected="true"] { border-bottom-color: var(--red); }
.tabs .count--danger,
.tabs a[aria-selected="true"] .count--danger { background: var(--red-soft); color: var(--red); }
.tabpanel[hidden] { display: none; }
.tabpanel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* As a tab, a panel's own title repeats the tab's name. */
.tabset--on .tabpanel__head { display: none; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.toolbar__search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.toolbar__search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar__search input { padding-left: 34px !important; }
.toolbar__spacer { flex: 1; }
.toolbar__note { color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------------ forms */

.input,
select,
.form input[type="text"],
.form input[type="email"],
.form input[type="url"],
.form input[type="number"],
.form input[type="password"],
.form input[type="search"],
.form textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}
.form textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.form textarea.mono { font-family: var(--font-mono); font-size: 13px; }
/* Dropdowns look like every other field: no native chrome, our own chevron. */
select,
select.input {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7a8f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 14px 14px;
  cursor: pointer;
  text-overflow: ellipsis;
}
select:disabled { background-color: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.input:focus,
select:focus,
.form input:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form input[type="color"] {
  width: 56px;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}
.form input[type="checkbox"], .check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

.fieldset { border: 0; padding: 0; margin: 0; }
.fieldset + .fieldset { margin-top: 6px; }
.fieldset__legend {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0;
  margin-bottom: 12px;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}
.field { min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--ink);
}
.field__label .optional { font-weight: 400; color: var(--muted); }
.field__help { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.field__error { color: var(--red); font-size: 12.5px; margin-top: 5px; font-weight: 500; }
.field--invalid input,
.field--invalid select,
.field--invalid textarea { border-color: var(--red); }
.field--toggle { display: flex; align-items: flex-start; gap: 10px; }
.field--toggle .field__label { margin: 0; font-weight: 500; }
.field--toggle input { margin-top: 2px !important; }

.errorbox {
  background: var(--red-soft);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-weight: 500;
}

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  min-width: 0;
}
.choice:hover { border-color: var(--muted); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice__text { min-width: 0; flex: 1; line-height: 1.3; }
.choice__text strong { display: block; font-weight: 600; }
.choice__text small { color: var(--muted); font-size: 12px; }

.kindpick { margin-bottom: 16px; }
.kindpick .choices { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.choice input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

.placements { display: grid; gap: 8px; }
.placement {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 280px);
  gap: 8px 16px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.placement:has(input[type="checkbox"]:checked) { border-color: var(--accent); background: var(--accent-soft); }
.placement__shop { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 0; min-height: 36px; }
.placement__category .field__help { margin-top: 4px; }

.placelist { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.placelist li { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.placelist__cat { color: var(--muted); }
.placelist__cat::before { content: "›"; margin: 0 5px 0 1px; color: var(--line-strong); }
.placelist--suggested { color: var(--muted); font-style: italic; }
.placelist--suggested .swatch { opacity: 0.55; }

.checklist {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 6px 0;
}
.checklist label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 12px;
  cursor: pointer;
}
.checklist label:hover { background: var(--surface-2); }

/* -------------------------------------------------------------- key/value */

.props { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; }
.props dt { color: var(--muted); font-size: 13px; }
.props dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.props--stacked { grid-template-columns: 1fr; gap: 2px; }
.props--stacked dd { margin-bottom: 10px; }

/* ------------------------------------------------------------------- diff */

.diff { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.diff th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.diff td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.diff tr:last-child td { border-bottom: 0; }
.diff__field { font-weight: 600; width: 22%; }
.diff__old, .diff__new {
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 220px;
  overflow-y: auto;
  font-size: 13px;
}
.diff__old { background: var(--red-soft); color: #7a241d; text-decoration: line-through; text-decoration-color: rgba(122, 36, 29, 0.35); }
.diff__new { background: var(--green-soft); color: #0c5234; }
.diff__none { color: var(--muted); font-style: italic; }

/* --------------------------------------------------------------- timeline */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 14px;
  position: relative;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 26px;
  bottom: 2px;
  width: 1px;
  background: var(--line);
}
.timeline li:last-child::before { display: none; }
.timeline__dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--grey-soft);
  color: var(--grey);
}
.timeline__dot .icon { width: 14px; height: 14px; }
.timeline__dot--green { background: var(--green-soft); color: var(--green); }
.timeline__dot--amber { background: var(--amber-soft); color: var(--amber); }
.timeline__dot--red { background: var(--red-soft); color: var(--red); }
.timeline__dot--violet { background: var(--violet-soft); color: var(--violet); }
.timeline__dot--blue { background: var(--accent-soft); color: var(--accent); }
.timeline__what { font-weight: 600; }
.timeline__who { color: var(--muted); font-size: 12.5px; }
.timeline__note { color: var(--ink-2); font-size: 13px; margin-top: 2px; }

/* --------------------------------------------------------------- previews */

.preview {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
}
.preview__image {
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12.5px;
  overflow: hidden;
}
.preview__image img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.preview__lead { font-size: 15px; color: var(--ink-2); }
.preview__price { font-weight: 700; font-size: 17px; }
.preview__price small { font-weight: 500; color: var(--muted); font-size: 13px; }

/* A storefront's logo as its header shows it: 30px high, on the storefront's
   light and dark header colours (house.css and house-dark.css). */
.logopreview { display: grid; gap: 6px; }
.logopreview__header {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}
.logopreview__header--dark { background: #1a1d20; border-color: #1a1d20; }
.logopreview__header img { height: 30px; width: auto; max-width: 100%; object-fit: contain; }

/* A storefront's favicon as a browser tab shows it: 16px, beside the name. */
.tabpreview {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: #ffffff;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
}
.tabpreview img { width: 16px; height: 16px; flex: none; object-fit: contain; }

/* A storefront's extra domains, one row each, divided like a list. */
.aliasrow + .aliasrow { border-top: 1px solid var(--line); padding-top: 14px; }
.prose { color: var(--ink-2); max-width: 70ch; }
.prose p { margin-bottom: 8px; }
.prose ul, .prose ol { padding-left: 20px; margin: 0 0 8px; }

.linelist { list-style: none; margin: 0; padding: 0; }
.linelist li {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.linelist li:last-child { border-bottom: 0; }
.linelist .qty { font-family: var(--font-mono); color: var(--muted); min-width: 34px; }
.linelist--nested {
  margin: 6px 0 2px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}
.linelist--nested li { padding: 4px 0; border-bottom: 0; font-size: 13px; }
/* A line with a checkbox: unticked, it reads as hidden before it is saved. */
.linelist--toggles input[type="checkbox"] { flex: none; margin-top: 2px; }
.linelist--toggles label { cursor: pointer; }
.linelist--toggles li:has(> input[type="checkbox"]:not(:checked)) > div {
  color: var(--muted);
}
.linelist--toggles li:has(> input[type="checkbox"]:not(:checked)) > div > label {
  text-decoration: line-through;
}

/* ---------------------------------------------------------------- notices */

.flashes { display: grid; gap: 8px; margin-bottom: 18px; }
.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid #c9dafb;
  font-weight: 500;
  margin: 0;
}
.flash--success { background: var(--green-soft); color: #0c5234; border-color: #b6e0c9; }
.flash--error { background: var(--red-soft); color: #8a2119; border-color: #efc2bd; }
.flash--warning { background: var(--amber-soft); color: #6e4200; border-color: #efd3a3; }

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.notice .icon { margin-top: 1px; color: var(--muted); }
.notice--amber { background: var(--amber-soft); border-color: #efd3a3; color: #6e4200; }
.notice--amber .icon { color: var(--amber); }
.notice--red { background: var(--red-soft); border-color: #efc2bd; color: #8a2119; }
.notice--red .icon { color: var(--red); }
.notice p:last-child { margin-bottom: 0; }

/* What a storefront still misses: a count that unfolds into links. */
.gaps summary { cursor: pointer; list-style: none; width: fit-content; }
.gaps summary::-webkit-details-marker { display: none; }
.gaps__list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.gaps__list li + li { margin-top: 2px; }
.gaps .gaps__list { min-width: 220px; }

.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted);
}
.empty .icon { width: 34px; height: 34px; color: var(--line-strong); margin: 0 auto 10px; display: block; }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

.syncproblem { margin-top: 12px; }
.syncproblem p { margin: 0 0 6px; }
.syncproblem summary { cursor: pointer; }
.syncproblem .errorlog { margin-top: 6px; }
.syncproblem__text { margin-top: 6px; color: var(--ink-2); }
.errorlog {
  font-family: var(--font-mono);
  font-size: 12px;
  background: #1a2230;
  color: #f0c9c5;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 8px 0 0;
}

/* -------------------------------------------------------------- pagination */

.pager {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.pager__spacer { flex: 1; }

/* ------------------------------------------------------------------ chart */

.bars {
  display: grid;
  grid-template-columns: repeat(var(--bars, 8), minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  height: 150px;
  padding-top: 8px;
}
.bars__col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars__bar {
  width: 100%;
  max-width: 38px;
  min-height: 2px;
  height: var(--h, 0%);
  background: linear-gradient(180deg, #5b95f7, var(--accent));
  border-radius: 4px 4px 2px 2px;
}
.bars__value { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bars__label { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* A line chart drawn by static/js/charts.js from the table inside it. Without
   JavaScript the table shows instead. */
.chart__frame { position: relative; height: 280px; }

/* A share as a bar in a table cell: style="--w: 40%". */
.meter-cell { width: 34%; }
.meter {
  display: block;
  height: 7px;
  min-width: 60px;
  background: var(--grey-soft);
  border-radius: 4px;
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  width: var(--w, 0%);
  background: var(--accent);
  border-radius: 4px;
}

/* The heading of a statistics tab, for when the tabs stack without JavaScript. */
.stathead { margin: 22px 0 12px; font-size: 17px; }

/* ------------------------------------------------------------------ login */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(59, 130, 246, 0.25), transparent 60%),
    radial-gradient(800px 400px at -10% 110%, rgba(98, 71, 209, 0.18), transparent 60%),
    var(--nav);
}
.login__card {
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  padding: 30px 30px 26px;
}
.login__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login__brand .rail__name { color: var(--ink); }
.login__brand .rail__name small { color: var(--muted); }
.login h1 { margin-bottom: 4px; }
.login .field { margin-bottom: 14px; }
.login .btn { width: 100%; height: 40px; margin-top: 6px; }
.login__foot { margin-top: 18px; text-align: center; color: #8492a6; font-size: 12.5px; }

/* ---------------------------------------------------------------- helpers */

.stack > * + * { margin-top: 10px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.right { margin-left: auto; }
.inline-form { display: inline; margin: 0; }

/* ------------------------------------------------------------- responsive */


/* --------------------------------------------------------------- variants */
/* The products of a variant group, each with its label and place. */
.variants-table td { vertical-align: top; }
.form .variants-table input[type="text"] { min-width: 8rem; }
.form .variants-table input[type="number"] { width: 5.5rem; text-align: right; }
.variants-table .check { width: 64px; text-align: center; }
.addvariants { display: grid; gap: 10px; border-top: 1px solid var(--line); }
.addvariants .field__label { margin: 0; }
.addvariants__search { display: flex; gap: 8px; align-items: center; max-width: 480px; }
.variantlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.variantlist li { display: flex; gap: 8px; align-items: baseline; }
.variantlist li[aria-current="true"] { font-weight: 600; }

@media (max-width: 1180px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 960px) {
  .frame { grid-template-columns: minmax(0, 1fr); background: none; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .rail__brand { border-bottom: 0; padding: 10px 14px; min-height: 0; }
  .rail__name { display: none; }
  .rail__nav { display: flex; align-items: center; gap: 2px; padding: 6px; flex: 1; }
  .rail__section { display: none; }
  .rail__link { padding: 8px 10px; white-space: nowrap; }
  .rail__link[aria-current="page"]::before { display: none; }
  .rail__foot { border-top: 0; padding: 6px 10px; }
  .rail__user { display: none; }
  .topbar { position: static; padding: 0 16px; }
  .content { padding: 18px 16px 40px; }
  .listing { grid-template-columns: minmax(0, 1fr); }
  .filters { position: static; display: flex; flex-wrap: wrap; }
  .filters__group { flex: 1 1 200px; }
  .filters__group + .filters__group { border-top: 0; }
  .cols--even { grid-template-columns: minmax(0, 1fr); }
  .preview { grid-template-columns: minmax(0, 1fr); }
  .preview__image { max-width: 260px; }
}

@media (max-width: 640px) {
  .fields { grid-template-columns: minmax(0, 1fr); }
  .placement { grid-template-columns: minmax(0, 1fr); }
  .rail__link span { display: none; }
  .topsearch { width: auto; flex: 1; }
  .crumbs { display: none; }
  .props { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .props dd { margin-bottom: 8px; }
  .diff td { padding: 8px 6px; }
  .diff__field { width: 26%; font-size: 12.5px; }
}
