/* ============================================================================
 * Reseller storefront — client area design system.
 *
 * Served through the /reseller-assets/ passthrough prefix, so it resolves both
 * on a reseller's own domain and under the /p/<slug> preview path.
 *
 * Brand-neutral by construction: every colour is a CSS custom property that
 * reseller/views/storefront.html sets at runtime from the panel's branding, so
 * this one file renders every store.
 *
 * Layout model
 * ------------
 * Signed-in customers get an application shell: a fixed sidebar, a topbar with
 * breadcrumbs and a scrolling content column. Guests (the marketing pages and
 * the auth forms) get a centred single-column site instead, because a sidebar
 * of links they cannot use yet is just noise. `body.is-app` switches between
 * the two.
 * ========================================================================== */

:root {
  --primary: #4f8cff;
  --accent: #7c5cff;
  --bg: #0b0f1a;
  --surface: #131a2b;
  --surface-2: #1a2338;
  --text: #e8ecf6;
  --muted: #96a0b8;
  --border: rgba(255, 255, 255, .09);
  --ok: #35c68a;
  --warn: #f0b23c;
  --danger: #f4665f;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);

  /* Derived tokens. Kept here so the whole sheet has one place to tune. */
  --radius-sm: 10px;
  --radius-lg: 18px;
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --ring: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
  --hairline: 1px solid var(--border);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; font-weight: 650; letter-spacing: -.015em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 1rem; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.grow { margin-left: auto; }

/* Utility for the scrollbars inside panels, so they stop looking like an
   operating-system afterthought on top of a dark surface. */
.thin-scroll { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.thin-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.thin-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 999px; }
.thin-scroll::-webkit-scrollbar-track { background: transparent; }

/* ========================================================================== */
/* app shell                                                                  */
/* ========================================================================== */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* Guest pages collapse the shell to a single centred column. */
body:not(.is-app) .app { grid-template-columns: minmax(0, 1fr); }
body:not(.is-app) .sidebar { display: none; }

/* ------------------------------------------------------------------ sidebar */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 14px;
  background: color-mix(in srgb, var(--surface) 72%, #000);
  border-right: var(--hairline);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 18px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -.02em;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand img { height: 34px; width: auto; max-width: 160px; display: block; }
.sidebar-brand .sub {
  display: block;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand-mark {
  width: 34px; height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 700;
  font-size: .92rem;
  letter-spacing: 0;
}

.side-label {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 10px 6px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: .92rem;
  font-weight: 550;
  border: 1px solid transparent;
  position: relative;
}
.side-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-link svg { flex: 0 0 17px; width: 17px; height: 17px; opacity: .85; }

.side-link.active {
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  border-color: color-mix(in srgb, var(--primary) 32%, transparent);
}
.side-link.active svg { opacity: 1; color: var(--primary); }

/* Count bubble for unpaid invoices / open tickets. */
.side-link .pill {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
  background: var(--danger);
  color: #fff;
}

.side-help {
  margin-top: auto;
  background: var(--surface-2);
  border: var(--hairline);
  border-radius: var(--radius);
  padding: 15px;
  font-size: .85rem;
  color: var(--muted);
}
.side-help strong { color: var(--text); display: block; margin-bottom: 4px; font-size: .9rem; }

/* ------------------------------------------------------------------- column */

.main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }

/* ------------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--topbar-h);
  padding: 10px 26px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: var(--hairline);
}

/* Guest pages have no sidebar, so the topbar carries the brand and nav. */
body:not(.is-app) .topbar { padding: 10px 26px; }

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: .9rem;
  color: var(--muted);
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs .sep { opacity: .5; }
.crumbs .here {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topbar-nav a {
  color: var(--muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: .92rem;
  font-weight: 550;
}
.topbar-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.topbar-nav a.active { color: var(--text); background: var(--surface-2); }

/* Round icon button used for the sidebar toggle and the avatar. */
.icon-btn {
  width: 36px; height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: var(--hairline);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 17px; height: 17px; }

.avatar {
  width: 34px; height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .82rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  cursor: pointer;
}

/* The sidebar toggle only exists on narrow screens. */
#side-toggle { display: none; }

/* ------------------------------------------------------------------ content */

.content { flex: 1; padding: 26px; min-width: 0; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; }

/* Guest pages keep a narrower measure so marketing copy stays readable. */
body:not(.is-app) .wrap { max-width: 1080px; }

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 { margin: 0; }
.page-head .lead { color: var(--muted); font-size: .92rem; margin: 3px 0 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ========================================================================== */
/* buttons                                                                    */
/* ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
  transition: filter .15s, opacity .15s, background .15s, border-color .15s;
}
.btn:hover { filter: brightness(1.14); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--primary) 70%, transparent);
}
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); filter: none; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); filter: none; }
.btn-danger { background: transparent; border-color: rgba(244, 102, 95, .45); color: var(--danger); }
.btn-danger:hover { background: rgba(244, 102, 95, .12); filter: none; }
.btn-ok { background: transparent; border-color: rgba(53, 198, 138, .45); color: var(--ok); }
.btn-ok:hover { background: rgba(53, 198, 138, .12); filter: none; }
.btn-sm { padding: 6px 12px; font-size: .84rem; border-radius: 8px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-block { width: 100%; }

/* ========================================================================== */
/* surfaces                                                                   */
/* ========================================================================== */

.card {
  background: var(--surface);
  border: var(--hairline);
  border-radius: var(--radius);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.card > h3:first-child { margin-top: 0; }

/* Card with its own titled header rail, used by the panel sections. */
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: -20px -20px 18px;
  padding: 14px 20px;
  border-bottom: var(--hairline);
}
.card-head h3 { margin: 0; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-tight { padding: 0; }
.card-tight .card-head { margin: 0 0 0; }

.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Asymmetric split: main work area plus a narrower rail of context. */
.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 336px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* ========================================================================== */
/* stat cards                                                                 */
/* ========================================================================== */

.stat {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: var(--hairline);
  border-radius: var(--radius);
  padding: 17px 18px;
}
.stat .ico {
  width: 42px; height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  color: var(--primary);
}
.stat .ico svg { width: 20px; height: 20px; }
.stat .ico.ok { background: rgba(53, 198, 138, .14); color: var(--ok); }
.stat .ico.warn { background: rgba(240, 178, 60, .14); color: var(--warn); }
.stat .ico.danger { background: rgba(244, 102, 95, .14); color: var(--danger); }
.stat .body { min-width: 0; }
.stat .v { font-size: 1.5rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; }
.stat .k { font-size: .88rem; font-weight: 600; color: var(--text); }
.stat .sub { color: var(--muted); font-size: .78rem; }

/* ========================================================================== */
/* service cards (the "my services" list)                                     */
/* ========================================================================== */

.srv-list { display: grid; gap: 12px; }

.srv {
  display: grid;
  grid-template-columns: 92px minmax(180px, 1.6fr) minmax(0, 2fr) auto;
  gap: 18px;
  align-items: center;
  background: var(--surface);
  border: var(--hairline);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color .15s, background .15s;
}
.srv:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, transparent);
  background: color-mix(in srgb, var(--surface-2) 60%, var(--surface));
}

/* Game artwork. Falls back to a gradient monogram when the game has no image. */
.srv-art {
  width: 92px; height: 62px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(135deg, var(--surface-2), var(--bg));
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--muted);
  letter-spacing: .04em;
  border: var(--hairline);
}
.srv-art img { width: 100%; height: 100%; object-fit: cover; display: block; }

.srv-id { min-width: 0; }
.srv-id .name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  font-size: 1rem;
  color: var(--text);
}
.srv-id .name a { color: inherit; }
.srv-id .name a:hover { color: var(--primary); text-decoration: none; }
.srv-id .meta { color: var(--muted); font-size: .82rem; }
.srv-id .addr {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem;
  color: var(--muted);
}

/* The live metrics block: a label, a value and a thin usage bar. */
.srv-metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  min-width: 0;
}
.srv-metric .k {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}
.srv-metric .v { font-size: .88rem; font-weight: 600; }

.srv-side {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}
.srv-side .when { color: var(--muted); font-size: .78rem; text-align: right; }

@media (max-width: 900px) {
  .srv { grid-template-columns: 62px minmax(0, 1fr); }
  .srv-art { width: 62px; height: 62px; }
  .srv-metrics { grid-column: 1 / -1; }
  .srv-side { grid-column: 1 / -1; justify-content: flex-start; }
}

/* --------------------------------------------------------------- usage bars */

.bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .09);
  margin-top: 6px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .4s ease;
}
.bar.ok > span { background: var(--ok); }
.bar.warn > span { background: var(--warn); }
.bar.danger > span { background: var(--danger); }

/* ------------------------------------------------------------- status light */

.dot {
  width: 8px; height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}
.dot.running { background: var(--ok); box-shadow: 0 0 0 3px rgba(53, 198, 138, .18); }
.dot.starting, .dot.stopping { background: var(--warn); box-shadow: 0 0 0 3px rgba(240, 178, 60, .16); }
.dot.offline { background: var(--danger); box-shadow: 0 0 0 3px rgba(244, 102, 95, .16); }

.live { display: inline-flex; align-items: center; gap: 7px; font-size: .84rem; color: var(--muted); }

/* ========================================================================== */
/* badges                                                                     */
/* ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.ok { background: rgba(53, 198, 138, .14); color: var(--ok); border-color: rgba(53, 198, 138, .28); }
.badge.warn { background: rgba(240, 178, 60, .14); color: var(--warn); border-color: rgba(240, 178, 60, .28); }
.badge.danger { background: rgba(244, 102, 95, .14); color: var(--danger); border-color: rgba(244, 102, 95, .28); }
.badge.info {
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
}

/* ========================================================================== */
/* tables                                                                     */
/* ========================================================================== */

table { width: 100%; border-collapse: collapse; font-size: .91rem; }
th, td { text-align: left; padding: 12px 10px; border-bottom: var(--hairline); }
th {
  color: var(--muted);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
}
tbody tr:hover { background: rgba(255, 255, 255, .022); }
tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }
.table-scroll { scrollbar-width: thin; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Definition list used for read-only detail pairs. */
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px 18px; font-size: .91rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* A row of label/value pairs stacked with separators, for the status rail. */
.rows { display: grid; gap: 0; }
.rows > div {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: var(--hairline);
  font-size: .89rem;
}
.rows > div:last-child { border-bottom: none; }
.rows .k { color: var(--muted); }
.rows .v { margin-left: auto; text-align: right; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* ========================================================================== */
/* forms                                                                      */
/* ========================================================================== */

label { display: block; font-size: .84rem; color: var(--muted); margin-bottom: 6px; font-weight: 550; }
input, select, textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .92rem;
  background: var(--bg);
  border: var(--hairline);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}
input:disabled, textarea:disabled, select:disabled { opacity: .6; cursor: not-allowed; }
textarea { resize: vertical; min-height: 110px; }
select {
  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='%2396a0b8' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 15px;
}
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.form-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* Centred auth/checkout card. */
.form-narrow {
  max-width: 430px;
  margin: 6vh auto;
  box-shadow: var(--shadow);
}
.form-narrow h2 { margin-bottom: 4px; }

/* Search input with a leading icon, used above the service list. */
.search { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.search input { padding-left: 38px; }
.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters select { width: auto; min-width: 160px; }

/* ========================================================================== */
/* notices                                                                    */
/* ========================================================================== */

.notice {
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  font-size: .89rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.notice:last-child { margin-bottom: 0; }
.notice.err { background: rgba(244, 102, 95, .1); border-color: rgba(244, 102, 95, .34); color: #ffb4b0; }
.notice.ok { background: rgba(53, 198, 138, .1); border-color: rgba(53, 198, 138, .34); color: #93e7c3; }
.notice.warn { background: rgba(240, 178, 60, .1); border-color: rgba(240, 178, 60, .34); color: #f6d597; }
.notice.info { background: rgba(255, 255, 255, .04); border-color: var(--border); color: var(--muted); }

/* Empty and loading states. */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty h3 { color: var(--text); }
.spinner {
  width: 32px; height: 32px;
  margin: 56px auto;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton shimmer, shown while the first paint of a list is in flight. */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: var(--radius);
  height: 92px;
}
.skeleton + .skeleton { margin-top: 12px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Preview banner: only the reseller sees it, and only before approval. */
.preview-bar {
  background: linear-gradient(135deg, var(--warn), #e08a1e);
  color: #241a05;
  text-align: center;
  padding: 8px 16px;
  font-size: .86rem;
  font-weight: 650;
}

/* ========================================================================== */
/* toasts                                                                     */
/* ========================================================================== */

/*
 * Feedback used to be an inline #notice block, which meant a message about an
 * action taken at the bottom of a long page could paint far off-screen. Toasts
 * are always visible, so the outcome of a click is never missed.
 */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: var(--hairline);
  box-shadow: var(--shadow);
  font-size: .89rem;
  pointer-events: auto;
  animation: toast-in .18s ease;
}
.toast .close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}
.toast.ok { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--danger); }
.toast.warn { border-left: 3px solid var(--warn); }
.toast.info { border-left: 3px solid var(--primary); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ========================================================================== */
/* storefront (guest) pages                                                   */
/* ========================================================================== */

.hero { padding: 62px 0 40px; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); }
.hero .tagline {
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 620px;
  margin: 0 auto 26px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.cat-title { display: flex; align-items: baseline; gap: 12px; margin: 34px 0 14px; }
.cat-title h2 { margin: 0; }
.cat-title .kind {
  color: var(--muted);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .11em;
  font-weight: 700;
}

.plan {
  background: var(--surface);
  border: var(--hairline);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.plan:hover { border-color: color-mix(in srgb, var(--primary) 50%, transparent); }
.plan h3 { margin: 0; }
.plan .price { font-size: 1.8rem; font-weight: 700; letter-spacing: -.03em; }
.plan .price small { font-size: .78rem; color: var(--muted); font-weight: 550; }
.specs { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: .88rem; color: var(--muted); }
.specs li { display: flex; align-items: center; gap: 8px; }
.specs li::before { content: "›"; color: var(--primary); font-weight: 700; }
.plan .btn { margin-top: auto; }

/* ------------------------------------------------------------ support thread */

.msg { background: var(--surface-2); border-radius: 12px; padding: 13px 15px; margin-bottom: 12px; }
.msg:last-child { margin-bottom: 0; }
.msg.you { background: color-mix(in srgb, var(--primary) 12%, var(--surface-2)); }
.msg .who {
  font-size: .74rem;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 650;
}
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------- footer */

footer.site { border-top: var(--hairline); padding: 20px 26px; color: var(--muted); font-size: .85rem; }
.footer-inner { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; max-width: 1180px; margin: 0 auto; }
.footer-inner nav { margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; }

/* ========================================================================== */
/* responsive                                                                 */
/* ========================================================================== */

@media (max-width: 980px) {
  /* The sidebar becomes an off-canvas drawer toggled from the topbar. */
  .app { grid-template-columns: minmax(0, 1fr); }
  body.is-app #side-toggle { display: grid; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(84vw, var(--sidebar-w));
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  body.side-open .sidebar { transform: translateX(0); }

  /* Scrim behind the open drawer, so a tap outside closes it. */
  body.side-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, .5);
  }

  .content { padding: 18px; }
  .topbar { padding: 10px 18px; }
  footer.site { padding: 18px; }
}

@media (max-width: 620px) {
  body { font-size: 14.5px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .search { max-width: none; }
  .toasts { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}

/* Respect a reduced-motion preference: keep the affordances, drop the movement. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ========================================================================== */
/* icon sizing safety net                                                     */
/* ========================================================================== */

/*
 * Icons are injected as bare inline <svg> with no width/height attributes. A
 * bare SVG with only a viewBox falls back to the CSS default of 300x150, which
 * blows up any container it lands in. Every component above sets its own size,
 * but this base rule means a new icon in a new place can never explode the
 * layout — it just inherits the local text size.
 */
svg { width: 1em; height: 1em; flex-shrink: 0; }

/* Containers that size the icon through a wrapper span. */
.stat .ico svg,
.srv-art svg { width: 20px; height: 20px; }

/*
 * A table sitting flush inside .card-tight would have its first and last columns
 * touching the card border. Pull them back in line with the card's own padding
 * so the header rail and the table read as one block.
 */
.card-tight .table-scroll th:first-child,
.card-tight .table-scroll td:first-child { padding-left: 20px; }
.card-tight .table-scroll th:last-child,
.card-tight .table-scroll td:last-child { padding-right: 20px; }

/* The last row of a flush table should not leave a hairline against the edge. */
.card-tight .table-scroll table { margin-bottom: 0; }
