/* site.css — shared across facade, editor, and user portal.
   Facade-specific styles use CSS custom properties and are
   scoped via body.facade; editor/portal keep their own classes.
   No client-side JS on facade pages — all filtering is server-side. */

/* ============================================================
   Design tokens (Dawnframes warm paper palette)
   ============================================================ */

:root {
  --bg:      #f6f2ea;
  --bg-2:    #fefcf8;
  --bg-3:    #f1ebe0;
  --ink:     #211e1a;
  --ink-2:   #4a443b;
  --muted:   #837a6c;
  --line:    #e6dfd1;
  --line-2:  #efe9dd;
  --accent:  #be6a4a;
  --radius:  12px;
  --grid-min: 248px;
  --font:    'Hanken Grotesk', system-ui, sans-serif;
  --shadow:    0 1px 2px rgba(40,34,24,.05), 0 8px 24px -12px rgba(40,34,24,.18);
  --shadow-lg: 0 4px 10px rgba(40,34,24,.06), 0 24px 48px -20px rgba(40,34,24,.30);
}

/* ============================================================
   Base reset
   ============================================================ */

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  color: #1f2328;
  background: #ffffff;
}

body.facade {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
  body.facade {
    --bg:     #15130f;
    --bg-2:   #201d17;
    --bg-3:   #2a2620;
    --ink:    #f3eee4;
    --ink-2:  #d4ccbd;
    --muted:  #9b9282;
    --line:   #322d25;
    --line-2: #3b352c;
    --shadow:    0 1px 2px rgba(0,0,0,.12), 0 8px 24px -12px rgba(0,0,0,.38);
    --shadow-lg: 0 4px 10px rgba(0,0,0,.14), 0 24px 48px -20px rgba(0,0,0,.55);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

a { color: #0a5cb8; }

/* ============================================================
   Global main layout (editor/portal)
   ============================================================ */

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ============================================================
   Facade — sticky header
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  height: 61px;
  background: color-mix(in srgb, var(--bg, #f6f2ea) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line, #e6dfd1);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: -.02em;
  color: var(--ink, #211e1a);
  text-decoration: none;
}

.site-brand:hover { text-decoration: none; }

.brand-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent, #be6a4a);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, #be6a4a) 18%, transparent);
  flex-shrink: 0;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: .25rem;
}

.site-header nav > a {
  position: relative;
  margin-left: .5rem;
  font-size: .92rem;
  font-weight: 500;
  color: var(--ink-2, #4a443b);
  text-decoration: none;
  padding: .25rem .1rem;
  transition: color .15s;
}

.site-header nav > a:hover { color: var(--ink, #211e1a); text-decoration: none; }

.site-header nav > a.is-active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0; right: 0;
  height: 2px;
  background: var(--accent, #be6a4a);
  border-radius: 999px;
}

@media (max-width: 619px) {
  .site-header nav > a { display: none; }
}

/* ============================================================
   Facade — main content area
   ============================================================ */

.facade-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4.25rem) clamp(1.25rem, 4vw, 3rem) 4rem;
}

/* ============================================================
   Facade — hero
   ============================================================ */

.hero {
  max-width: 760px;
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.hero-title {
  margin: 0;
  font-size: clamp(2.1rem, 5.2vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.02;
  color: var(--ink);
}

.hero-tag {
  margin: 1rem 0 0;
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.55;
  color: var(--muted);
  max-width: 56ch;
}

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin: 1.4rem 0 0;
  font-size: .85rem;
  font-weight: 500;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .42rem .85rem;
  color: var(--ink-2);
}

.pulse {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #4a9d6a;
  flex-shrink: 0;
  position: relative;
}

.pulse::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(74,157,106,.28);
  animation: pulse-ring 2.4s infinite;
}

@keyframes pulse-ring {
  0%   { transform: scale(1); opacity: 1; }
  70%  { transform: scale(2.4); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

/* ============================================================
   Facade — toolbar (sticky below header)
   ============================================================ */

.toolbar {
  position: sticky;
  top: 61px;
  z-index: 90;
  background: var(--bg);
  padding: 1rem 0 .5rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  margin-bottom: .5rem;
}

.tb-row {
  display: flex;
  gap: .75rem;
  align-items: center;
}

.search-wrap {
  position: relative;
  flex: 1;
}

.search-ico {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-wrap input[type="text"] {
  width: 100%;
  padding: .8rem 1rem .8rem 2.85rem;
  font-family: var(--font);
  font-size: .98rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

.search-wrap input::placeholder { color: var(--muted); }

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.sort-wrap {
  position: relative;
  flex-shrink: 0;
}

.sort-lbl {
  position: absolute;
  left: .85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: .8rem;
  color: var(--muted);
  pointer-events: none;
  white-space: nowrap;
}

.sort-chev {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.sort-wrap select {
  appearance: none;
  font-family: var(--font);
  font-size: .88rem;
  padding: .8rem 2.4rem .8rem 4.5rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  outline: none;
  min-width: 190px;
  transition: border-color .18s, box-shadow .18s;
}

.sort-wrap select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.cats {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--font);
  font-size: .88rem;
  font-weight: 500;
  padding: .46rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink-2);
  text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}

.chip:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--ink);
  text-decoration: none;
}

.chip:active { transform: translateY(1px); }

.chip.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.chip-n {
  font-size: .74rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.chip.is-on .chip-n {
  color: color-mix(in srgb, var(--bg) 65%, var(--ink));
}

/* ============================================================
   Facade — results bar
   ============================================================ */

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: .25rem 0 1.25rem;
  min-height: 1.8rem;
}

.results-n {
  font-size: .85rem;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.clear-btn {
  display: inline-flex;
  align-items: center;
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 500;
  color: var(--accent);
  border-radius: 999px;
  padding: .28rem .65rem;
  text-decoration: none;
  transition: background .15s;
}

.clear-btn:hover {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  text-decoration: none;
}

/* ============================================================
   Facade — wallpaper grid
   ============================================================ */

.wgrid {
  list-style: none;
  padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--grid-min), 1fr));
  gap: clamp(1rem, 1.8vw, 1.6rem);
}

/* ============================================================
   Facade — wallpaper card
   ============================================================ */

.card { list-style: none; }

.card-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid rgba(33,30,26,.06);
  box-shadow: var(--shadow);
  transition: transform .28s cubic-bezier(.22,1,.36,1), box-shadow .28s cubic-bezier(.22,1,.36,1);
}

.card-thumb:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-thumb > a {
  display: block;
  width: 100%; height: 100%;
}

.card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.card-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .45;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

.card-res {
  position: absolute;
  bottom: .5rem; left: .5rem;
  font-size: .72rem;
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
  padding: .26rem .55rem;
  border-radius: 7px;
  background: rgba(20,18,14,.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.18);
  pointer-events: none;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .72rem .15rem .2rem;
}

.card-title {
  font-size: .94rem;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
}

.card-dl {
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
  white-space: nowrap;
}

.card-dl:hover { color: var(--accent); text-decoration: none; }

/* ============================================================
   Facade — empty state
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
}

.empty-mark {
  width: 54px; height: 54px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.empty-mark::after {
  content: '';
  display: block;
  width: 22px; height: 22px;
  background: var(--line);
  border-radius: 4px;
}

.empty-state h3 {
  margin: 0 0 .5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}

.empty-state p {
  margin: 0 auto;
  font-size: .92rem;
  max-width: 34ch;
}

/* ============================================================
   Facade — footer
   ============================================================ */

.site-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  margin-top: 3rem;
}

.foot-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 3rem clamp(1.25rem, 4vw, 3rem) 0;
}

.foot-top {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2.5rem;
  padding-bottom: 2rem;
}

.foot-brand { max-width: 34ch; }

.foot-brand p {
  margin: .6rem 0 0;
  font-size: .92rem;
  color: var(--muted);
  line-height: 1.5;
}

.foot-cols {
  display: flex;
  gap: clamp(2rem, 5vw, 4.5rem);
}

.foot-col h4 {
  margin: 0 0 .75rem;
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.foot-col a {
  display: block;
  font-size: .92rem;
  color: var(--ink-2);
  text-decoration: none;
  margin-bottom: .45rem;
  transition: color .15s;
}

.foot-col a:hover { color: var(--accent); text-decoration: none; }

.impressum {
  padding: 1.5rem 0;
  border-top: 1px solid var(--line-2);
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.65;
}

.impressum a { color: var(--muted); }
.impressum a:hover { color: var(--accent); }

.foot-bot {
  border-top: 1px solid var(--line);
  padding: 1rem 0;
  font-size: .82rem;
  color: var(--muted);
}

@media (max-width: 619px) {
  .foot-top { flex-direction: column; }
  .foot-cols { flex-direction: column; gap: 1.5rem; }
}

/* ============================================================
   Facade — wallpaper detail page
   ============================================================ */

.wallpaper-preview {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: var(--radius, 12px);
  background: var(--bg-3, #f1ebe0);
}

.tags { margin: .75rem 0; }

.tags .tag {
  display: inline-block;
  background: var(--bg-3, #f1ebe0);
  border: 1px solid var(--line, #e6dfd1);
  border-radius: 999px;
  padding: .15rem .7rem;
  margin: 0 .35rem .35rem 0;
  font-size: .85rem;
  color: var(--ink-2, #4a443b);
}

.download-list { padding-left: 1.25rem; }

/* ============================================================
   Facade — howto OS tabs
   ============================================================ */

.howto-os-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1rem 0 1.5rem;
}

.howto-os-tab {
  display: inline-block;
  padding: .46rem .85rem;
  border: 1px solid var(--line, #e6dfd1);
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-2, #4a443b);
  font-size: .88rem;
  font-weight: 500;
  background: var(--bg-2, #fefcf8);
  transition: border-color .15s, color .15s;
}

.howto-os-tab:hover {
  border-color: color-mix(in srgb, var(--accent, #be6a4a) 50%, transparent);
  color: var(--ink, #211e1a);
  text-decoration: none;
}

.howto-os-tab--active {
  background: var(--ink, #211e1a);
  border-color: var(--ink, #211e1a);
  color: var(--bg, #f6f2ea);
}

/* ============================================================
   Facade — category links (simple page)
   ============================================================ */

.category-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.25rem;
  margin: 1rem 0 1.5rem;
}

/* ============================================================
   Blog
   ============================================================ */

.post-list { list-style: none; padding: 0; }
.post-list li { margin-bottom: 1.75rem; }
.post-list h2 { margin-bottom: .2rem; }

.post-meta {
  color: #6a7178;
  font-size: .9rem;
  margin: 0 0 .6rem;
}

/* ============================================================
   Error page
   ============================================================ */

.error-page {
  text-align: center;
  padding: 4rem 1rem;
}

/* ============================================================
   Screen-reader only
   ============================================================ */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   Locale switcher (facade nav, portal, auth forms)
   ============================================================ */

.locale-switcher {
  display: inline-flex;
  align-items: center;
  margin-left: 1.25rem;
  position: relative;
}

.auth-form > .locale-switcher {
  display: block;
  margin: 0 0 1rem;
  text-align: right;
}

.locale-switcher select {
  font: inherit;
  padding: .42rem 1.8rem .42rem 1.8rem;
  border: 1px solid var(--line, #c7ccd1);
  border-radius: 999px;
  background: var(--bg-2, #fff);
  color: var(--ink, #1f2328);
  cursor: pointer;
  appearance: none;
}

.site-header nav .locale-switcher,
.portal-header nav .locale-switcher {
  margin-left: 1.25rem;
}

/* ============================================================
   CMS editor area
   ============================================================ */

.editor-header nav a { margin-left: 1rem; }

.logout-form {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0;
}

.logout-form span { color: #6a7178; font-size: .9rem; }

.auth-form { max-width: 360px; }
.stacked-form { max-width: 560px; }

.stacked-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 1rem;
}

.stacked-form input[type="text"],
.stacked-form input[type="password"],
.stacked-form input[type="file"],
.stacked-form select,
.stacked-form textarea {
  display: block;
  width: 100%;
  margin-top: .3rem;
  padding: .45rem .6rem;
  font: inherit;
  font-weight: normal;
  border: 1px solid #c7ccd1;
  border-radius: 4px;
}

.stacked-form input[type="checkbox"] { margin-right: .4rem; }

.stacked-form button,
.link-button { font: inherit; cursor: pointer; }

.stacked-form button {
  padding: .5rem 1.1rem;
  border: none;
  border-radius: 4px;
  background: #0a5cb8;
  color: #fff;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: #b4232c;
  text-decoration: underline;
}

.translation-fieldset {
  margin: 0 0 1.4rem;
  padding: .8rem 1rem .2rem;
  border: 1px solid #e2e5e9;
  border-radius: 6px;
}

.translation-fieldset legend {
  padding: 0 .4rem;
  font-weight: 600;
  color: #555;
}
.trans-ok      { color: #2c7a3f; font-size: .85em; margin-left: .3rem; }
.trans-missing { color: #999;    font-size: .85em; margin-left: .3rem; }

.form-error { color: #b4232c; }
.form-success { color: #2c7a3f; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 2rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: .5rem .6rem;
  border-bottom: 1px solid #e2e5e9;
  vertical-align: middle;
}

.admin-table form { display: inline; }

.thumb {
  width: 64px; height: 40px;
  object-fit: cover;
  border-radius: 3px;
  background: #f0f2f4;
}

.stat-list { list-style: none; padding: 0; }
.stat-list li { margin-bottom: .5rem; }

/* ============================================================
   Editor nav — section labels and separators
   ============================================================ */

.editor-nav-label {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted, #837a6c);
  padding: .15rem .5rem;
  pointer-events: none;
}

.editor-nav-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--line, #e6dfd1);
  margin: 0 .3rem;
  vertical-align: middle;
}

/* ============================================================
   User portal (body.portal) — dark design system
   ============================================================ */

body.portal {
  --p-bg:          #0d1117;
  --p-bg2:         #0a0e14;
  --p-surface:     #151b24;
  --p-surface2:    #1b222d;
  --p-surface3:    #212a36;
  --p-border:      rgba(255,255,255,.085);
  --p-border2:     rgba(255,255,255,.15);
  --p-text:        #e7ecf3;
  --p-muted:       #98a3b3;
  --p-faint:       #6b7686;
  --p-accent:      #22c55e;
  --p-accent-soft: rgba(34,197,94,.12);
  --p-ok-bg:       rgba(34,197,94,.14);
  --p-ok-fg:       #5fe08a;
  --p-ok-dot:      #22c55e;
  --p-warn-bg:     rgba(245,158,11,.15);
  --p-warn-fg:     #fbbf24;
  --p-warn-dot:    #f59e0b;
  --p-danger-bg:   rgba(239,68,68,.14);
  --p-danger-fg:   #ff8585;
  --p-danger-dot:  #ef4444;
  --p-shadow:      0 1px 0 rgba(255,255,255,.03) inset, 0 8px 30px rgba(0,0,0,.35);
  --p-radius:      12px;
  --p-font:        'Space Grotesk', system-ui, sans-serif;
  --p-mono:        'JetBrains Mono', ui-monospace, monospace;

  font-family: var(--p-font);
  background: var(--p-bg);
  color: var(--p-text);
  background-image:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 32px 32px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: light) {
  body.portal {
    --p-bg:       #f5f7fa;
    --p-bg2:      #eef0f4;
    --p-surface:  #ffffff;
    --p-surface2: #f0f2f5;
    --p-surface3: #e5e8ed;
    --p-border:   rgba(0,0,0,.085);
    --p-border2:  rgba(0,0,0,.15);
    --p-text:     #131922;
    --p-muted:    #586272;
    --p-faint:    #8590a0;
    background-image:
      linear-gradient(rgba(0,0,0,.015) 1px, transparent 1px),
      linear-gradient(90deg, rgba(0,0,0,.015) 1px, transparent 1px);
    background-size: 32px 32px;
  }
  body.portal .p-topbar { background: rgba(245,247,250,.88); }
}

/* --- animations --- */
@keyframes p-fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes p-shake  { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
body.portal .fade-in { animation: p-fadein .3s ease both; }

/* --- layout --- */
body.portal .p-topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 1.5rem;
  background: rgba(13,17,23,.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--p-border);
}

body.portal .p-brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-weight: 600; font-size: .95rem;
  color: var(--p-text); text-decoration: none;
}

body.portal .p-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--p-accent); flex-shrink: 0;
}
body.portal .p-mark svg { color: #0a0e14; }

body.portal .p-nav {
  display: flex; align-items: center; gap: .15rem;
}

body.portal .p-nav-link {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .7rem; border-radius: 6px;
  background: none; border: none; cursor: pointer;
  color: var(--p-muted); font-size: .88rem; font-family: var(--p-font);
  text-decoration: none; transition: color .15s, background .15s;
}
body.portal .p-nav-link:hover, body.portal .p-nav-link.is-active {
  color: var(--p-text); background: var(--p-surface2);
}
body.portal a.p-nav-link { color: var(--p-muted); }
body.portal a.p-nav-link:hover { color: var(--p-text); text-decoration: none; }

body.portal .p-nav-sep {
  width: 1px; height: 18px; background: var(--p-border2); margin: 0 .25rem;
}

body.portal .p-container {
  max-width: 940px; margin: 0 auto; padding: 2rem 1.5rem;
  display: flex; flex-direction: column; gap: 1.25rem;
}

/* --- lang select --- */
body.portal select.p-lang {
  padding: .3rem .55rem; border-radius: 6px;
  background: var(--p-surface2); border: 1px solid var(--p-border);
  color: var(--p-text); font-family: var(--p-mono); font-size: .8rem;
  cursor: pointer; outline: none;
}

/* --- panels / cards --- */
body.portal .p-panel {
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  padding: 1.4rem;
  box-shadow: var(--p-shadow);
  position: relative; overflow: clip;
}

/* --- eyebrow / text hierarchy --- */
body.portal .p-eyebrow {
  font-family: var(--p-mono); font-size: .7rem; font-weight: 500;
  letter-spacing: .13em; text-transform: uppercase; color: var(--p-faint);
  margin: 0 0 .7rem;
}
body.portal .p-h1 { font-size: 1.5rem; font-weight: 700; margin: 0 0 .4rem; color: var(--p-text); }
body.portal .p-h2 { font-size: 1.12rem; font-weight: 600; margin: 0 0 .4rem; color: var(--p-text); }
body.portal .p-lede { color: var(--p-muted); font-size: .93rem; line-height: 1.7; max-width: 62ch; margin: 0 0 1.3rem; }
body.portal .p-panel-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
body.portal .p-muted { color: var(--p-muted); }
body.portal .p-mono  { font-family: var(--p-mono); }

/* --- glow blob on intro panel --- */
body.portal .p-glow {
  position: absolute; top: -40px; right: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34,197,94,.12) 0%, transparent 70%);
  pointer-events: none;
}

/* --- buttons --- */
body.portal .p-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.3rem; border-radius: 8px;
  font-family: var(--p-font); font-size: .9rem; font-weight: 500;
  cursor: pointer; border: none; transition: opacity .15s, background .15s;
  text-decoration: none;
}
body.portal .p-btn--primary  { background: var(--p-accent); color: #0a0e14; }
body.portal .p-btn--primary:hover  { opacity: .88; color: #0a0e14; text-decoration: none; }
body.portal .p-btn--secondary { background: var(--p-surface2); border: 1px solid var(--p-border2); color: var(--p-text); }
body.portal .p-btn--secondary:hover { background: var(--p-surface3); color: var(--p-text); text-decoration: none; }
body.portal .p-btn--ghost { background: transparent; border: 1px solid var(--p-border2); color: var(--p-text); }
body.portal .p-btn--ghost:hover { background: var(--p-surface2); color: var(--p-text); text-decoration: none; }
body.portal .p-btn:disabled { opacity: .4; cursor: not-allowed; }
body.portal .p-btn-full { width: 100%; }

body.portal .p-linkbtn {
  background: none; border: none; cursor: pointer;
  font-family: var(--p-font); font-size: .85rem;
  color: var(--p-muted); padding: 0;
  display: inline-flex; align-items: center; gap: .3rem;
  transition: color .15s; text-decoration: none;
}
body.portal .p-linkbtn:hover             { color: var(--p-text); text-decoration: none; }
body.portal .p-linkbtn--accent           { color: var(--p-accent); }
body.portal .p-linkbtn--accent:hover     { color: var(--p-ok-fg); }
body.portal .p-linkbtn--danger:hover     { color: var(--p-danger-fg); }
body.portal .p-dns-toggle {
  display: inline-flex; align-items: center; gap: .45rem;
  background: none; border: none; cursor: pointer; padding: 0;
  font-family: var(--p-font); font-size: .82rem; color: inherit;
}
body.portal .p-dns-toggle:disabled { opacity: .5; cursor: default; }
body.portal .p-dns-name  { font-size: .82rem; font-weight: 500; color: var(--p-text); white-space: nowrap; }
body.portal .p-dns-status { font-size: .75rem; color: var(--p-faint); width: 4rem; text-align: left; white-space: nowrap; }
body.portal .p-dns-toggle.active .p-dns-status { color: var(--p-accent); }
body.portal .p-dns-switch {
  display: inline-block; position: relative; flex-shrink: 0;
  width: 34px; height: 20px; border-radius: 10px;
  background: var(--p-surface3); border: 1px solid var(--p-border2);
  transition: background .18s, border-color .18s;
}
body.portal .p-dns-toggle.active .p-dns-switch { background: var(--p-accent); border-color: var(--p-accent); }
body.portal .p-dns-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: transform .18s;
}
body.portal .p-dns-toggle.active .p-dns-thumb { transform: translateX(14px); }

/* --- badges / dots --- */
body.portal .p-badge {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .25rem .65rem; border-radius: 999px;
  font-size: .82rem; font-weight: 500; line-height: 1;
  background: var(--p-surface3); color: var(--p-muted);
}
body.portal .p-badge--active  { background: var(--p-ok-bg);     color: var(--p-ok-fg); }
body.portal .p-badge--expired { background: var(--p-danger-bg); color: var(--p-danger-fg); }

body.portal .p-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--p-ok-dot);
  box-shadow: 0 0 0 3px rgba(34,197,94,.22);
  flex-shrink: 0;
}
body.portal .p-dot--danger { background: var(--p-danger-dot); box-shadow: 0 0 0 3px rgba(239,68,68,.22); }

/* --- PIN lock screen --- */
body.portal .p-lock {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
body.portal .p-lock-card {
  width: 100%; max-width: 400px;
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  padding: 2rem;
  box-shadow: var(--p-shadow);
}
body.portal .p-lock-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2rem;
}
body.portal .p-lock-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--p-accent-soft);
  border: 1px solid rgba(34,197,94,.25);
  display: flex; align-items: center; justify-content: center;
  color: var(--p-accent); margin: 0 auto 1.2rem;
}
body.portal .p-lock-card h1 {
  text-align: center; font-size: 1.45rem; font-weight: 600;
  margin: 0 0 .5rem; color: var(--p-text);
}
body.portal .p-lock-sub {
  text-align: center; color: var(--p-muted); font-size: .92rem;
  margin: 0 0 1.5rem; line-height: 1.5;
}
body.portal .p-pin-row {
  display: flex; gap: .5rem; margin-bottom: .5rem;
  position: relative; cursor: text;
}
/* 1×1 px invisible input — stays in the row so it's fully focusable and
   receives keyboard events; gives password managers no visible area for icons */
body.portal .p-pin-real {
  position: absolute; top: 0; left: 0;
  width: 1px; height: 1px;
  opacity: 0; font-size: 16px;
  border: none; background: transparent;
  padding: 0; overflow: hidden;
}
/* Visual-only display cells (not real inputs) */
body.portal .p-pin-cell {
  flex: 1; min-width: 0; height: 54px;
  background: var(--p-surface2);
  border: 1px solid var(--p-border2);
  border-radius: 10px;
  color: var(--p-text);
  font-family: var(--p-mono);
  font-size: 1.3rem; text-align: center;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, box-shadow .15s;
  user-select: none;
}
body.portal .p-pin-cell.active {
  border-color: var(--p-accent);
  box-shadow: 0 0 0 3px rgba(34,197,94,.18);
}
body.portal .p-pin-cell.filled { border-color: var(--p-accent); }
body.portal .p-pin-row.shake { animation: p-shake .4s ease; }
body.portal .p-pin-row.error .p-pin-cell { border-color: var(--p-danger-dot); }
body.portal .p-pin-err {
  min-height: 1.4rem; font-size: .85rem;
  color: var(--p-danger-fg);
  display: flex; align-items: center; gap: .35rem;
  margin-bottom: 1rem;
}
body.portal .p-pin-hint {
  text-align: center; color: var(--p-faint); font-size: .78rem; margin: .8rem 0 0;
}

/* --- validity bar --- */
body.portal .p-validity {
  display: grid; grid-template-columns: repeat(2,auto) 1fr;
  align-items: center; gap: 1.4rem;
  padding: 1.05rem 1.4rem;
}
body.portal .p-vitem { display: flex; flex-direction: column; gap: .2rem; }
body.portal .p-badge-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
body.portal .p-vlabel {
  font-family: var(--p-mono); font-size: .66rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--p-faint);
}
body.portal .p-vvalue { font-family: var(--p-mono); font-size: .88rem; }
body.portal .p-daysbadge {
  justify-self: end;
  font-family: var(--p-mono); font-size: .8rem; font-weight: 500;
  padding: .3rem .75rem; border-radius: 999px;
}
body.portal .p-daysbadge.ok      { background: var(--p-ok-bg);     color: var(--p-ok-fg); }
body.portal .p-daysbadge.warn    { background: var(--p-warn-bg);   color: var(--p-warn-fg); }
body.portal .p-daysbadge.expired { background: var(--p-danger-bg); color: var(--p-danger-fg); }

/* --- slots indicator --- */
body.portal .p-slots { display: inline-flex; gap: 5px; align-items: center; }
body.portal .p-slot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--p-surface3); border: 1px solid var(--p-border2);
}
body.portal .p-slot.filled { background: var(--p-accent); border-color: var(--p-accent); }

/* --- configs table --- */
body.portal .p-sechead {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .75rem;
}
body.portal .p-configs {
  width: 100%; border-collapse: collapse; font-size: .88rem;
}
body.portal .p-configs th {
  font-family: var(--p-mono); font-size: .66rem;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--p-faint); font-weight: 500;
  padding: .75rem 1rem; text-align: left;
  border-bottom: 1px solid var(--p-border);
}
body.portal .p-configs td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--p-border);
  vertical-align: middle;
}
body.portal .p-configs tbody tr:last-child td { border-bottom: none; }
body.portal .p-configs tbody tr:hover td { background: rgba(255,255,255,.015); }
body.portal .p-namecell {
  display: flex; align-items: center; gap: .6rem;
}
body.portal .p-devdot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--p-ok-dot); box-shadow: 0 0 0 3px rgba(34,197,94,.18);
  flex-shrink: 0;
}
body.portal .p-devdot.idle { background: var(--p-surface3); box-shadow: none; border: 1px solid var(--p-border2); }
body.portal .p-device-input {
  background: transparent; border: none; color: var(--p-text);
  font-family: var(--p-font); font-size: .88rem; padding: .2rem .3rem;
  border-radius: 4px; outline: none; width: 130px;
  transition: background .15s;
}
body.portal .p-device-input:focus { background: var(--p-surface2); }
body.portal .p-rename-ok {
  color: var(--p-accent); font-size: .75rem; flex-shrink: 0;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
body.portal .p-rename-ok.visible { opacity: 1; }
body.portal .p-traffic { display: block; font-size: .72rem; color: var(--p-faint); margin-top: .2rem; font-variant-numeric: tabular-nums; }
body.portal .p-tcol-muted { color: var(--p-muted); font-size: .83rem; }
body.portal .p-rowact { white-space: nowrap; }

/* --- add device row --- */
body.portal .p-addrow {
  margin-top: 1rem;
  display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap;
}
body.portal .p-addhint { margin: 0; font-size: .83rem; color: var(--p-muted); max-width: 42ch; line-height: 1.5; }

/* --- banners --- */
body.portal .p-banner {
  display: flex; gap: .9rem; align-items: flex-start;
  padding: 1rem 1.2rem;
  background: var(--p-danger-bg);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--p-radius);
  color: var(--p-danger-fg);
}
body.portal .p-banner p { margin: 0; font-size: .9rem; line-height: 1.6; }
body.portal .p-banner-ic { flex-shrink: 0; margin-top: .1rem; }

/* --- config reveal --- */
body.portal .p-warn-box {
  display: flex; gap: .9rem; align-items: flex-start;
  padding: 1rem 1.2rem;
  background: var(--p-warn-bg);
  border: 1px solid rgba(245,158,11,.3);
  border-radius: 8px; color: var(--p-warn-fg);
  margin-bottom: 1.5rem;
}
body.portal .p-warn-box p { margin: 0; font-size: .9rem; line-height: 1.6; }
body.portal .p-reveal-grid {
  display: grid; grid-template-columns: 200px minmax(0,1fr); gap: 1.5rem;
}
body.portal .p-qr-wrap {
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
}
body.portal .p-qr-box {
  width: 180px; height: 180px; border-radius: 10px;
  background: #fff; padding: 10px;
  display: flex; align-items: center; justify-content: center;
}
body.portal .p-qr-box img { width: 100%; height: 100%; display: block; }
body.portal .p-qr-cap {
  font-family: var(--p-mono); font-size: .65rem;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--p-faint); text-align: center;
}
body.portal .p-reveal-side-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .75rem;
}
body.portal .p-codebox {
  background: var(--p-bg2);
  border: 1px solid var(--p-border);
  border-radius: 8px; padding: 1rem;
  overflow-x: auto; margin-bottom: 1rem;
}
body.portal .p-codebox pre {
  margin: 0; font-family: var(--p-mono); font-size: .78rem;
  line-height: 1.65; white-space: pre; color: var(--p-text);
}
body.portal .p-reveal-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
body.portal .p-copybtn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .75rem; border-radius: 6px;
  background: var(--p-surface2); border: 1px solid var(--p-border2);
  color: var(--p-muted); font-family: var(--p-font); font-size: .82rem;
  cursor: pointer; transition: color .15s, background .15s;
}
body.portal .p-copybtn:hover { color: var(--p-text); }

/* --- network status --- */
body.portal .p-status-banner {
  display: flex; align-items: flex-start; gap: .9rem;
  padding: 1.1rem 1.3rem;
  background: var(--p-ok-bg);
  border: 1px solid rgba(34,197,94,.25);
  border-radius: var(--p-radius);
  color: var(--p-ok-fg);
  font-size: .92rem; line-height: 1.6;
}
body.portal .p-status-banner.degraded {
  background: var(--p-warn-bg);
  border-color: rgba(245,158,11,.3);
  color: var(--p-warn-fg);
}
body.portal .p-sb-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--p-ok-dot);
  box-shadow: 0 0 0 4px rgba(34,197,94,.2);
  flex-shrink: 0; margin-top: .3rem;
}
body.portal .p-sb-dot.degraded { background: var(--p-warn-dot); box-shadow: 0 0 0 4px rgba(245,158,11,.2); }
body.portal .p-status-banner div { flex: 1; }
body.portal .p-status-banner strong { display: block; margin-bottom: .25rem; }

body.portal .p-stat-tile {
  display: flex; flex-direction: column; gap: .3rem;
  padding: 1.05rem 1.4rem; max-width: 220px;
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
}
body.portal .p-stat-num {
  font-size: 1.9rem; font-weight: 700; font-family: var(--p-mono);
  color: var(--p-text); line-height: 1;
}
body.portal .p-stat-num .p-unit { font-size: 1rem; color: var(--p-muted); }

/* --- maintenance messages --- */
body.portal .p-maint-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .75rem; }
body.portal .p-maint-msg {
  padding: 1rem 1.2rem;
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
}
body.portal .p-maint-msg.sev-warning  { background: var(--p-warn-bg);   border-color: rgba(245,158,11,.3); }
body.portal .p-maint-msg.sev-critical { background: var(--p-danger-bg); border-color: rgba(239,68,68,.3); }
body.portal .p-maint-meta { font-family: var(--p-mono); font-size: .75rem; color: var(--p-faint); margin: 0 0 .4rem; }
body.portal .p-maint-title { margin: 0 0 .3rem; font-size: .95rem; font-weight: 600; color: var(--p-text); }
body.portal .p-maint-body  { margin: 0; font-size: .88rem; color: var(--p-muted); line-height: 1.6; }

/* --- setup guides tabs & steps --- */
body.portal .p-tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
body.portal .p-tab {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .45rem .9rem; border-radius: 8px;
  background: var(--p-surface); border: 1px solid var(--p-border);
  color: var(--p-muted); font-family: var(--p-font); font-size: .88rem;
  cursor: pointer; text-decoration: none; transition: all .15s;
}
body.portal .p-tab:hover { color: var(--p-text); border-color: var(--p-border2); text-decoration: none; }
body.portal .p-tab.is-active { background: var(--p-accent); border-color: var(--p-accent); color: #0a0e14; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
body.portal .p-tnum { font-family: var(--p-mono); font-size: .7rem; }

body.portal .p-guide-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; }
body.portal .p-guide-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--p-surface2); border: 1px solid var(--p-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--p-accent); flex-shrink: 0;
}
body.portal .p-guide-head h2 { margin: 0 0 .25rem; font-size: 1.05rem; }
body.portal .p-osmeta { font-family: var(--p-mono); font-size: .72rem; color: var(--p-faint); }

body.portal .p-step { display: flex; gap: 1rem; padding: 1.2rem 0; border-bottom: 1px solid var(--p-border); }
body.portal .p-step:last-of-type { border-bottom: none; }
body.portal .p-step-num {
  width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0;
  background: var(--p-surface2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--p-mono); font-size: .82rem; font-weight: 600; color: var(--p-accent);
}
body.portal .p-step-body h3 { margin: 0 0 .4rem; font-size: .95rem; color: var(--p-text); }
body.portal .p-step-body p  { margin: 0 0 .6rem; color: var(--p-muted); font-size: .88rem; line-height: 1.65; }
body.portal .p-step-body p:last-child { margin-bottom: 0; }
body.portal .p-codechip {
  font-family: var(--p-mono); font-size: .8rem;
  background: var(--p-surface2); border: 1px solid var(--p-border);
  border-radius: 4px; padding: .1rem .35rem; color: var(--p-text);
}
body.portal .p-applinks { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .7rem; }
body.portal .p-applink {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .75rem; border-radius: 6px;
  background: var(--p-surface2); border: 1px solid var(--p-border);
  color: var(--p-text); font-size: .84rem; text-decoration: none;
  transition: border-color .15s;
}
body.portal .p-applink:hover { border-color: var(--p-border2); text-decoration: none; }
body.portal .p-at { color: var(--p-faint); font-family: var(--p-mono); font-size: .78rem; }

/* --- responsive --- */
@media (max-width: 660px) {
  /* --- topbar --- */
  body.portal .p-topbar { padding-left: 1rem; padding-right: 1rem; }
  body.portal .p-brand { font-size: .92rem; }
  body.portal .p-nav { gap: .08rem; }
  body.portal .p-nav-sep { display: none; }
  body.portal .p-nav-link { padding: .5rem .55rem; min-height: 42px; }
  body.portal .p-navlabel { display: none; }

  /* --- container & typography --- */
  body.portal .p-container { padding: 1.25rem 1rem; }
  body.portal .p-h1 { font-size: 1.3rem; }
  body.portal .p-panel { padding: 1.25rem; }
  body.portal .p-lede { font-size: .9rem; }
  body.portal .p-panel-actions { display: flex; flex-direction: column; gap: .6rem; }
  body.portal .p-panel-actions .p-btn { width: 100%; justify-content: center; }

  /* --- validity bar --- */
  body.portal .p-validity { display: flex; flex-direction: column; align-items: flex-start; gap: .65rem; padding: 1.05rem 1.2rem; }

  /* --- section header --- */
  body.portal .p-sechead { flex-direction: column; align-items: flex-start; gap: .3rem; }

  /* --- configs table → stacked cards --- */
  body.portal .p-configs thead { display: none; }
  body.portal .p-configs tbody tr { display: block; padding: 1rem 1.1rem; border-bottom: 1px solid var(--p-border); }
  body.portal .p-configs tbody tr:hover { background: transparent; }
  body.portal .p-configs td { display: flex; justify-content: space-between; align-items: center; padding: .32rem 0; border-bottom: none; font-size: .88rem; }
  body.portal .p-configs td::before { content: attr(data-label); font-family: var(--p-mono); font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; color: var(--p-faint); align-self: center; flex-shrink: 0; }
  body.portal .p-configs td:first-child { padding-bottom: .7rem; margin-bottom: .45rem; border-bottom: 1px solid var(--p-border); }
  body.portal .p-configs td:first-child::before { display: none; }
  body.portal .p-namecell { gap: .5rem; }
  body.portal .p-device-input { width: auto; flex: 1; }
  body.portal .p-configs td.p-rowact { display: block; text-align: left; padding-top: .75rem; white-space: normal; }
  body.portal .p-rowact-inner { justify-content: flex-start !important; }
  body.portal .p-rowact .p-dns-filter-form { margin-right: auto; }

  /* --- add device row --- */
  body.portal .p-addrow { flex-direction: column; align-items: stretch; gap: .7rem; }
  body.portal .p-addrow .p-btn { width: 100%; justify-content: center; }
  body.portal .p-addhint { max-width: none; }

  /* --- config reveal (single-column) --- */
  body.portal .p-reveal-grid { grid-template-columns: minmax(0, 1fr); }
  body.portal .p-qr-box { width: 190px; height: 190px; }
  body.portal .p-reveal-actions { width: 100%; }
  body.portal .p-reveal-actions .p-btn { flex: 1; justify-content: center; }

  /* --- howto tabs --- */
  body.portal .p-tabs { gap: .4rem; }
  body.portal .p-tab { padding: .4rem .65rem; }

  /* --- PIN / lock screen --- */
  body.portal .p-pin-row { gap: .4rem; }
  body.portal .p-lock-card { max-width: 100%; padding: 1.5rem; }
  body.portal .p-lock-card h1 { font-size: 1.25rem; }
}

/* portal howto-body CMS content */
body.portal .howto-body { color: var(--p-muted); font-size: .9rem; line-height: 1.7; }
body.portal .howto-body h3 { color: var(--p-text); margin: 1.2rem 0 .4rem; font-size: .95rem; }
body.portal .howto-body p  { margin: 0 0 .75rem; }
body.portal .howto-body code {
  font-family: var(--p-mono); font-size: .82rem;
  background: var(--p-surface2); border: 1px solid var(--p-border);
  border-radius: 4px; padding: .1rem .35rem; color: var(--p-text);
}
body.portal .howto-body pre {
  background: var(--p-bg2); border: 1px solid var(--p-border); border-radius: 8px;
  padding: 1rem; overflow-x: auto; margin: .75rem 0;
  font-family: var(--p-mono); font-size: .78rem; color: var(--p-text);
}
body.portal .howto-body a { color: var(--p-accent); }

/* ============================================================
   CMS editor — dark theme (editor pages carry no body class;
   target via :not to avoid touching facade / portal)
   ============================================================ */

body:not(.facade):not(.portal) {
  background: #0d1117;
  color: #e6edf3;
}

body:not(.facade):not(.portal) a { color: #58a6ff; }

body:not(.facade):not(.portal) .site-header {
  background: rgba(13,17,23,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: #21262d;
}

body:not(.facade):not(.portal) .site-brand { color: #e6edf3; }
body:not(.facade):not(.portal) .brand-dot { background: #58a6ff; box-shadow: 0 0 0 4px rgba(88,166,255,.18); }

body:not(.facade):not(.portal) .editor-header nav a { color: #8b949e; margin-left: 1rem; }
body:not(.facade):not(.portal) .editor-header nav a:hover { color: #e6edf3; text-decoration: none; }
body:not(.facade):not(.portal) .editor-nav-label { color: #484f58; }
body:not(.facade):not(.portal) .editor-nav-sep { background: #21262d; }

body:not(.facade):not(.portal) .logout-form span { color: #8b949e; font-size: .9rem; }

body:not(.facade):not(.portal) .logout-form button {
  background: none;
  border: 1px solid #30363d;
  color: #8b949e;
  border-radius: 6px;
  padding: .3rem .8rem;
  cursor: pointer;
  font: inherit;
  font-size: .85rem;
  transition: color .15s, border-color .15s;
}
body:not(.facade):not(.portal) .logout-form button:hover { color: #e6edf3; border-color: #8b949e; }

body:not(.facade):not(.portal) main h1,
body:not(.facade):not(.portal) main h2,
body:not(.facade):not(.portal) main h3 { color: #e6edf3; }

body:not(.facade):not(.portal) .stacked-form input[type="text"],
body:not(.facade):not(.portal) .stacked-form input[type="password"],
body:not(.facade):not(.portal) .stacked-form input[type="file"],
body:not(.facade):not(.portal) .stacked-form input[type="number"],
body:not(.facade):not(.portal) .stacked-form select,
body:not(.facade):not(.portal) .stacked-form textarea {
  background: #161b22;
  border-color: #30363d;
  color: #e6edf3;
  border-radius: 6px;
}
body:not(.facade):not(.portal) .stacked-form input:focus,
body:not(.facade):not(.portal) .stacked-form select:focus,
body:not(.facade):not(.portal) .stacked-form textarea:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(88,166,255,.15);
}

body:not(.facade):not(.portal) .stacked-form button {
  background: #238636;
  border-radius: 6px;
  font-weight: 500;
  padding: .55rem 1.25rem;
  transition: background .15s;
}
body:not(.facade):not(.portal) .stacked-form button:hover { background: #2ea043; }
body:not(.facade):not(.portal) .link-button { color: #f85149; }

body:not(.facade):not(.portal) .translation-fieldset {
  border-color: #21262d;
  border-radius: 8px;
}
body:not(.facade):not(.portal) .translation-fieldset legend { color: #8b949e; }

body:not(.facade):not(.portal) .admin-table th,
body:not(.facade):not(.portal) .admin-table td { border-bottom-color: #21262d; }

body:not(.facade):not(.portal) .form-error { color: #f85149; }
body:not(.facade):not(.portal) .form-success { color: #3fb950; }
body:not(.facade):not(.portal) .trans-ok { color: #3fb950; }
body:not(.facade):not(.portal) .trans-missing { color: #484f58; }
body:not(.facade):not(.portal) .thumb { background: #161b22; }

/* Editor tab bars (settings page) */
body:not(.facade):not(.portal) .stab-bar { border-bottom-color: #21262d; }
body:not(.facade):not(.portal) .stab-bar--sub { border-bottom-color: #21262d; }
body:not(.facade):not(.portal) .stab { color: #8b949e; }
body:not(.facade):not(.portal) .stab.active { color: #e6edf3; border-bottom-color: #58a6ff; }
body:not(.facade):not(.portal) .stab-note { color: #484f58; }
body:not(.facade):not(.portal) .stab-section-label { color: #8b949e; border-top-color: #21262d; }

/* Dashboard action cards */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: .9rem;
  margin: 1.5rem 0 2rem;
}

.dash-card {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: 1.25rem;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid #21262d;
  background: #161b22;
  color: #e6edf3;
  transition: border-color .15s, background .15s;
}

.dash-card:hover {
  border-color: #388bfd;
  background: #1a2033;
  text-decoration: none;
  color: #e6edf3;
}

.dash-num {
  font-size: 2rem;
  font-weight: 700;
  color: #58a6ff;
  line-height: 1;
}

.dash-label {
  font-size: .85rem;
  color: #8b949e;
  font-weight: 500;
}

.dash-action {
  margin-top: .35rem;
  font-size: .78rem;
  color: #388bfd;
}

/* Howto image library */
.image-library {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #21262d;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: .75rem;
  margin-top: 1rem;
}

.image-card {
  border: 1px solid #21262d;
  border-radius: 8px;
  overflow: hidden;
  background: #161b22;
}

.image-card img {
  width: 100%;
  height: 96px;
  object-fit: cover;
  display: block;
}

.image-url {
  padding: .4rem .5rem;
  font-size: .72rem;
  word-break: break-all;
  color: #8b949e;
  border-top: 1px solid #21262d;
}

.image-url code {
  font-family: ui-monospace, monospace;
  user-select: all;
  cursor: text;
}
