/* styles.css: all styling for the GNOME-style profile desktop, mobile fallback, and admin editor. */

/* ============ 1. VARIABLES + RESET ============ */
:root {
  --bg: #0d0e11;
  --bg-win: #121317;
  --bg-bar: #17181d;
  --bg-panel: #08090b;
  --bg-inset: #0e0f13;
  --surface: rgba(255, 255, 255, 0.025);
  --surface-hover: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: rgba(255, 255, 255, 0.78);
  --text-strong: rgba(255, 255, 255, 0.94);
  --text-muted: rgba(255, 255, 255, 0.4);

  --accent: #1793d1;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 45%, transparent);

  --st-online: #3ba55d;
  --st-idle: #c9a24a;
  --st-dnd: #c2524f;
  --st-offline: #6b6f78;

  --font-ui: "Cantarell", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --fs-xs: 0.6875rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-xl: clamp(1.75rem, 1.4rem + 1.6vw, 2.25rem);

  --s-1: 6px;
  --s-2: 12px;
  --s-3: 20px;
  --s-4: 28px;
  --s-5: 40px;

  --r-win: 12px;
  --r-in: 6px;
  --r-sm: 4px;

  --panel-h: 32px;
  --dock-gutter: 72px;
  --dur: 200ms;
  --ease: ease;
  --grain: 0.03;
}

/* Reduced motion (OS or Settings toggle) zeroes the one duration token every transition and animation uses. */
@media (prefers-reduced-motion: reduce) { :root { --dur: 0ms; } }
html[data-motion="reduce"] { --dur: 0ms; }
html[data-grain="off"] { --grain: 0; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg);
  isolation: isolate;          /* the wallpaper layer sits at z-index -1 inside body */
  color: var(--text);
  font: 400 var(--fs-base)/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;            /* the desktop never scrolls the page */
  overscroll-behavior: none;   /* no pull-to-refresh while dragging windows on phones */
  animation: fade-in calc(var(--dur) * 2.5) var(--ease) both;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
svg { display: block; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Wallpaper layer: its own element so the quick-settings brightness slider filters the wallpaper only, never windows or text. */
.wallpaper { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(120% 90% at 50% 30%, #15171c 0%, #0f1013 55%, #0b0c0f 100%); filter: brightness(var(--wp-bright, 1)); }
/* Night light: a faint warm wash over everything (cosmetic). Uses the existing amber status tone, so no new colour. */
.nightlight { position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: 0; background: color-mix(in srgb, var(--st-idle) 9%, transparent); transition: opacity calc(var(--dur) * 3) var(--ease); }
html[data-night="on"] .nightlight { opacity: 1; }

/* wallpaper: film grain (SVG data URI) and a vignette, both below every window */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body::after { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.45)); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ============ 2. LAYOUT (desktop shell) ============ */
.panel {
  position: fixed; inset: 0 0 auto 0; z-index: 30; height: var(--panel-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 6px;
  background: var(--bg-panel); font: 700 var(--fs-sm)/1 var(--font-ui); color: var(--text);
}
.panel__left, .panel__right { display: flex; align-items: center; gap: 6px; }
.panel__right { justify-content: flex-end; }
.panel__clock { font-weight: 700; letter-spacing: 0.01em; color: var(--text-strong); white-space: nowrap; }
.panel__date { margin-right: 0.5em; }
.panel__status { display: flex; gap: 10px; padding: 0 6px; font-size: 15px; color: var(--text); }
.panel__btn.panel__status { gap: 10px; padding: 0 8px; }
.panel__ic { display: grid; transition: opacity var(--dur) var(--ease); }
html[data-wifi="off"] .panel__ic[data-ic="wifi"] { opacity: 0.35; } /* mirrors the Wi-Fi / airplane tiles */
.panel__sync { font: 400 var(--fs-xs) var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.panel__btn { display: inline-flex; align-items: center; gap: 8px; height: 24px; padding: 0 10px; border-radius: var(--r-in); font-size: 15px; transition: background var(--dur) var(--ease); }
.panel__btn span { font-size: var(--fs-sm); font-weight: 700; }
.panel__btn:hover, .panel__btn[aria-expanded="true"] { background: var(--surface-hover); }

.menu { position: absolute; top: calc(var(--panel-h) + 4px); right: 6px; min-width: 200px; padding: 6px; background: #17181d; border: 1px solid var(--border-strong); border-radius: var(--r-win); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); font-weight: 400; }
.menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r-in); font-size: var(--fs-base); text-align: left; transition: background var(--dur) var(--ease); }
.menu__item:hover { background: var(--surface-hover); }

/* Two permitted translucent surfaces, no more: the dock and the quick-settings popover (max blur 8px, alpha >= 0.6 each).
   The power menu was already opaque (it never had a blur), so it stays that way and the cap holds. */
.dock {
  position: fixed; z-index: 20; padding: 6px; border-radius: var(--r-win);
  background: rgba(22, 23, 28, 0.72); border: 1px solid var(--border);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  /* max-content stops a left:50% fixed box from shrinking to half the viewport; overflow scrolls the strip on narrow screens */
  width: max-content; max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; touch-action: pan-x;
}
.dock::-webkit-scrollbar { display: none; }
html[data-dock="bottom"] .dock { left: 50%; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); translate: -50% 0; }
html[data-dock="top"] .dock { left: 50%; top: calc(var(--panel-h) + 8px); translate: -50% 0; }
html[data-dock="left"] .dock { left: 8px; top: calc(50% + var(--panel-h) / 2); translate: 0 -50%; }
.dock__list { display: flex; gap: 4px; }
html[data-dock="left"] .dock__list { flex-direction: column; }
.dock__item { flex: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; position: relative; display: grid; place-items: center; inline-size: 44px; block-size: 44px; padding: 6px; border-radius: var(--r-win); font-size: 26px; color: var(--text-muted); transition: color var(--dur) var(--ease), background var(--dur) var(--ease); }
.dock__item[data-focused="true"] { color: var(--text-strong); }
.dock__item:active { color: var(--text-strong); background: var(--surface-hover); } /* tap feedback on touch */
@media (hover: hover) { .dock__item:hover { color: var(--text-strong); background: var(--surface-hover); } }
.dock__dot { position: absolute; inline-size: 4px; block-size: 4px; border-radius: 50%; background: var(--text-muted); opacity: 0; transition: opacity var(--dur) var(--ease); }
html[data-dock="bottom"] .dock__dot { bottom: 2px; }
html[data-dock="top"] .dock__dot { bottom: 2px; }
html[data-dock="left"] .dock__dot { left: 2px; }
.dock__item[data-open="true"] .dock__dot { opacity: 1; }
.dock__item[data-focused="true"] .dock__dot { background: var(--accent); }
.dock__tip { position: fixed; left: 0; top: 0; z-index: 40; padding: 4px 9px; white-space: nowrap; border-radius: var(--r-in); background: #1b1c22; border: 1px solid var(--border-strong); font: 700 var(--fs-xs) var(--font-ui); color: var(--text-strong); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity var(--dur) var(--ease), visibility 0s linear var(--dur); }
.dock__tip[data-show="true"] { opacity: 1; visibility: visible; transition-delay: 0s; }

/* workspace = viewport minus panel and dock gutter; windows live and clamp inside it */
.workspace { position: fixed; z-index: 2; inset: var(--panel-h) 0 0 0; pointer-events: none; }
html[data-dock="bottom"] .workspace { bottom: var(--dock-gutter); }
html[data-dock="top"] .workspace { top: calc(var(--panel-h) + var(--dock-gutter)); }
html[data-dock="left"] .workspace { left: var(--dock-gutter); }

.snap { position: absolute; z-index: 2147483000; pointer-events: none; border: 1px solid var(--accent-line); border-radius: var(--r-win); background: color-mix(in srgb, var(--accent) 20%, transparent); transition: left var(--dur) var(--ease), top var(--dur) var(--ease), width var(--dur) var(--ease), height var(--dur) var(--ease); }

/* overview: dim scrim below the windows, transparent focus buttons above them */
.ov-dim { position: fixed; z-index: 1; inset: var(--panel-h) 0 0 0; background: rgba(5, 6, 8, 0.62); opacity: 0; visibility: hidden; transition: opacity var(--dur) var(--ease), visibility 0s linear var(--dur); }
html[data-overview] .ov-dim { opacity: 1; visibility: visible; transition-delay: 0s; }
.overview { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.ov-item { position: fixed; pointer-events: auto; border-radius: var(--r-win); touch-action: none; } /* none: the swipe-down-to-close gesture must not be claimed as a scroll */
html[data-overview] .ov-dim { touch-action: none; }
.ov-item:hover, .ov-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ov-item__cap { position: absolute; left: 0; right: 0; top: calc(100% + 8px); text-align: center; font: 700 var(--fs-sm) var(--font-ui); color: var(--text-strong); }

.noscript { padding: var(--s-4); }

/* ============ 3. COMPONENTS: windows ============ */
.win {
  position: absolute; display: flex; flex-direction: column; overflow: hidden; pointer-events: auto;
  background: var(--bg-win); border: 1px solid var(--border); border-radius: var(--r-win);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transform-origin: 0 0;
  translate: var(--tx, 0px) var(--ty, 0px); scale: var(--sc, 1);
  transition: opacity var(--dur) var(--ease), scale var(--dur) var(--ease), translate var(--dur) var(--ease), border-color var(--dur) var(--ease), visibility 0s;
}
.win:focus { outline: none; }
.win.is-animating { transition: left var(--dur) var(--ease), top var(--dur) var(--ease), width var(--dur) var(--ease), height var(--dur) var(--ease), opacity var(--dur) var(--ease), scale var(--dur) var(--ease), translate var(--dur) var(--ease), visibility 0s; }
.win.is-dragging { user-select: none; }
.win[data-focused="true"] { border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong)); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55); }
.win[data-state="closed"] { opacity: 0; scale: 0.96; visibility: hidden; pointer-events: none; transition: opacity var(--dur) var(--ease), scale var(--dur) var(--ease), visibility 0s linear var(--dur); }
.win[data-state="minimized"] { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity var(--dur) var(--ease), scale var(--dur) var(--ease), translate var(--dur) var(--ease), visibility 0s linear var(--dur); }
.win.is-max { border-radius: 0; }
html[data-overview] .win { pointer-events: none; }
html[data-overview] .win:not([data-state="closed"]) { opacity: 1; visibility: visible; transition: opacity var(--dur) var(--ease), scale var(--dur) var(--ease), translate var(--dur) var(--ease), visibility 0s; }

.win__bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 38px; padding: 0 8px; background: var(--bg-bar); border-bottom: 1px solid var(--border); touch-action: none; user-select: none; }
.win__title { font: 700 var(--fs-sm)/1 var(--font-ui); color: var(--text-strong); opacity: 0.5; transition: opacity var(--dur) var(--ease); }
.win[data-focused="true"] .win__title { opacity: 1; }
.win__ctls { justify-self: end; display: flex; gap: 6px; opacity: 0; transition: opacity var(--dur) var(--ease); }
.win[data-focused="true"] .win__ctls, .win:hover .win__ctls, .win:focus-within .win__ctls { opacity: 1; }
.win__ctl { display: grid; place-items: center; inline-size: 22px; block-size: 22px; border-radius: 50%; font-size: 14px; background: var(--surface-hover); color: var(--text); transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.win__ctl:hover { background: var(--border-strong); color: var(--text-strong); }
.win__body { flex: 1; min-height: 0; overflow: auto; position: relative; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.win__body--term { background: #0b0c0f; }

.win__rz { position: absolute; z-index: 5; touch-action: none; }
.win__rz[data-edge="n"] { top: 0; left: 12px; right: 12px; height: 5px; cursor: ns-resize; }
.win__rz[data-edge="s"] { bottom: 0; left: 12px; right: 12px; height: 5px; cursor: ns-resize; }
.win__rz[data-edge="e"] { right: 0; top: 12px; bottom: 12px; width: 5px; cursor: ew-resize; }
.win__rz[data-edge="w"] { left: 0; top: 12px; bottom: 12px; width: 5px; cursor: ew-resize; }
.win__rz[data-edge="nw"] { top: 0; left: 0; width: 12px; height: 12px; cursor: nwse-resize; }
.win__rz[data-edge="se"] { bottom: 0; right: 0; width: 12px; height: 12px; cursor: nwse-resize; }
.win__rz[data-edge="ne"] { top: 0; right: 0; width: 12px; height: 12px; cursor: nesw-resize; }
.win__rz[data-edge="sw"] { bottom: 0; left: 0; width: 12px; height: 12px; cursor: nesw-resize; }
.win.is-max .win__rz { display: none; }

/* lock screen + dialogs (opaque) */
.lock { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; gap: 6px; text-align: center; background: #0a0b0d; }
.lock:focus { outline: none; }
.lock__time { font: 700 clamp(3.5rem, 12vw, 6rem)/1 var(--font-ui); letter-spacing: -0.03em; color: var(--text-strong); }
.lock__date { font-size: var(--fs-base); color: var(--text); }
.lock__hint { margin-top: var(--s-4); font: 400 var(--fs-xs) var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }

.dlg { margin: auto; width: min(420px, calc(100vw - 32px)); padding: var(--s-4); background: var(--bg-win); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r-win); }
.dlg::backdrop { background: rgba(5, 6, 8, 0.7); }
.dlg p + p { margin-top: var(--s-2); }
.dlg__title { font: 700 1.25rem/1.2 var(--font-ui); color: var(--text-strong); letter-spacing: -0.01em; }
.dlg__sub { font: 400 var(--fs-sm) var(--font-mono); color: var(--text-muted); margin-bottom: var(--s-2); }
.dlg__keys { font: 400 var(--fs-xs)/1.7 var(--font-mono); color: var(--text-muted); }
.dlg__error { margin-top: var(--s-2); font-size: var(--fs-sm); color: var(--text-strong); }
.dlg__actions { display: flex; justify-content: flex-end; gap: var(--s-1); margin-top: var(--s-3); }
.login .ad-field { margin-top: var(--s-2); }

.btn { padding: 7px 16px; border-radius: var(--r-in); background: var(--surface-hover); border: 1px solid var(--border); font-weight: 700; font-size: var(--fs-sm); transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.btn:hover { border-color: var(--border-strong); background: var(--border); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--accent:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); border-color: transparent; }
.btn--ghost { background: transparent; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ============ 3b. COMPONENTS: profile card ============ */
.pf { container-type: inline-size; background: var(--bg-win); padding-bottom: var(--s-4); --ring-bg: var(--bg-win); }
.pf__banner {
  aspect-ratio: 16 / 6;
  background:
    radial-gradient(60% 90% at 18% 20%, color-mix(in srgb, var(--accent) 17%, transparent), transparent 70%),
    radial-gradient(50% 80% at 82% 70%, rgba(60, 120, 110, 0.14), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 28px),
    #101116;
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 45%, transparent 100%);
}
/* Animated avatar/banner (media.js): media fills the banner behind the mask; the gradient stays underneath as the fallback layer. */
.pf__hero { position: relative; }
.pf__banner { position: relative; overflow: hidden; }
.pf__banner-media { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
/* Pause/play sits outside the masked banner so the fade does not hide it. Hover/focus on desktop; always faintly visible on touch. */
.pf__banner-ctl { position: absolute; right: var(--s-2); bottom: var(--s-2); inline-size: 32px; block-size: 32px; display: grid; place-items: center; border-radius: var(--r-in); background: rgba(0, 0, 0, 0.45); color: var(--text); font-size: 16px; opacity: 0; transition: opacity var(--dur) var(--ease); }
.pf__hero:hover .pf__banner-ctl, .pf__banner-ctl:focus-visible { opacity: 1; }
@media (hover: none) { .pf__banner-ctl { opacity: 0.7; } }
.pf__who { padding: 0 var(--s-4); }
.pf__avatar { position: relative; inline-size: 112px; block-size: 112px; margin-top: -56px; }
.pf__avatar-img, .pf__avatar-fallback { display: block; inline-size: 100%; block-size: 100%; border-radius: 50%; border: 5px solid var(--ring-bg); object-fit: cover; }
.pf__avatar-fallback { display: grid; place-items: center; background: linear-gradient(135deg, #1b2630, #14181d); font: 500 1.5rem var(--font-mono); color: var(--text-muted); }
.pf__avatar-img:not([hidden]) + .pf__avatar-fallback { display: none; }
.pf__status { position: absolute; right: 4px; bottom: 4px; inline-size: 24px; block-size: 24px; border-radius: 50%; border: 5px solid var(--ring-bg); background: var(--st, var(--st-online)); transition: background var(--dur) var(--ease); }
.pf__status[data-status="online"] { --st: var(--st-online); }
.pf__status[data-status="idle"] { --st: var(--st-idle); }
.pf__status[data-status="dnd"] { --st: var(--st-dnd); }
.pf__status[data-status="offline"] { --st: var(--st-offline); }
.pf__name { margin-top: var(--s-2); font: 700 var(--fs-xl)/1.1 var(--font-ui); letter-spacing: -0.03em; color: var(--text-strong); }
.pf__handle { margin-top: var(--s-1); font: 400 var(--fs-sm) var(--font-mono); color: var(--text-muted); }
.pf__meta { margin-top: var(--s-2); display: flex; flex-wrap: wrap; gap: 4px 12px; font: 400 var(--fs-xs) var(--font-mono); letter-spacing: 0.04em; color: var(--text-muted); }
.pf__meta span + span::before { content: "\00b7"; margin-right: 12px; }
.pf__body { display: grid; gap: var(--s-3); padding: var(--s-3) var(--s-4) 0; }
.pf__badges, .pf__tags { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.pf-badge { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 6px; border: 1px solid var(--border); border-radius: var(--r-sm); font: 500 var(--fs-xs) var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); }
.pf-badge__glyph { display: grid; place-items: center; inline-size: 18px; block-size: 20px; background: var(--accent-soft); color: var(--accent); font-size: 10px; letter-spacing: 0; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.pf__panel { border: 1px solid var(--border); border-radius: var(--r-win); background: var(--surface); padding: var(--s-3); }
.pf__panel p + p { margin-top: var(--s-2); }
.pf__label { margin-bottom: var(--s-2); font: 500 var(--fs-xs) var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-muted); }
.pf__fetch { display: grid; gap: var(--s-3); font: 400 var(--fs-sm) var(--font-mono); }
.pf__logo { color: var(--accent); font-size: var(--fs-xs); line-height: 1.3; overflow-x: auto; }
.pf__rows { display: grid; gap: 4px; align-content: start; }
.pf__rows > div { display: grid; grid-template-columns: 5.5rem 1fr; gap: var(--s-2); }
.pf__rows dt { color: var(--accent); text-transform: uppercase; letter-spacing: 0.1em; font-size: var(--fs-xs); line-height: 1.9; }
.pf__rows dd { overflow-wrap: anywhere; }
@container (min-width: 460px) { .pf__fetch { grid-template-columns: auto 1fr; gap: var(--s-4); align-items: start; } }

.pf__connections { display: grid; gap: 2px; margin-inline: calc(var(--s-2) * -1); }
.pf-conn { position: relative; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: var(--s-2); padding: 10px var(--s-2); border-radius: var(--r-sm); transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.pf-conn::before { content: ""; position: absolute; inset-block: 6px; inset-inline-start: 0; inline-size: 2px; background: var(--accent); translate: -4px 0; opacity: 0; transition: translate var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.pf-conn:hover, .pf-conn:focus-visible { background: var(--surface-hover); color: var(--text-strong); }
.pf-conn:hover::before, .pf-conn:focus-visible::before { translate: 0 0; opacity: 1; }
.pf-conn__icon { font-size: 18px; color: var(--text-muted); transition: color var(--dur) var(--ease); }
.pf-conn:hover .pf-conn__icon { color: var(--accent); }
.pf-conn__name { font-weight: 700; }
.pf-conn__value { font: 400 var(--fs-xs) var(--font-mono); color: var(--text-muted); text-align: end; overflow-wrap: anywhere; }
.pf__tags li { padding: 4px 10px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); font: 500 var(--fs-xs) var(--font-mono); letter-spacing: 0.06em; }
.pf__footer { padding-top: var(--s-3); border-top: 1px solid var(--accent-line); font: 400 var(--fs-xs) var(--font-mono); letter-spacing: 0.04em; color: var(--text-muted); }

/* ============ 3c. COMPONENTS: apps ============ */
.term { padding: 16px 18px; font: 400 var(--fs-sm)/1.7 var(--font-mono); min-height: 100%; }
.term__line { color: var(--text); }
.term__ps { color: var(--accent); font-weight: 500; }
.term__dim { color: var(--text-muted); }
.term__fetch { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: var(--s-2) 0; }
.term__logo { color: var(--accent); line-height: 1.3; font-size: var(--fs-sm); }
.term__head { color: var(--accent); font-weight: 500; }
.term__rule { block-size: 1px; background: var(--border-strong); margin: 4px 0 6px; }
.term__rows > div { display: grid; grid-template-columns: 6.5rem 1fr; gap: 8px; }
.term__rows dt { color: var(--accent); }
.term__rows dd { overflow-wrap: anywhere; }
.term__swatches { display: flex; margin-top: var(--s-2); }
.term__swatches i { inline-size: 22px; block-size: 18px; background: rgba(255, 255, 255, var(--a, 0.2)); }
.term__swatches .term__acc { background: var(--accent); }
.term__cursor { display: inline-block; inline-size: 8px; block-size: 1em; vertical-align: text-bottom; background: var(--text); }
/* Interactive terminal: output lines, the live input row, and the matrix effect (palette tokens only). */
.term__out { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.term__out--dim { color: var(--text-muted); }
.term__out--err { color: var(--text-strong); }
.term__form { display: flex; gap: 8px; align-items: baseline; }
.term__form .term__line { flex: none; }
.term__input { flex: 1; min-inline-size: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text-strong); font: inherit; caret-color: var(--accent); }
.term__matrix { margin: 0; color: var(--accent); font: inherit; line-height: 1.15; white-space: pre; overflow: hidden; }

.files { container-type: inline-size; display: grid; grid-template-columns: 180px 1fr; min-height: 100%; }
.files__side { display: flex; flex-direction: column; gap: 2px; padding: var(--s-2); background: var(--bg-bar); border-right: 1px solid var(--border); }
.files__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-in); font-size: var(--fs-sm); font-weight: 700; color: var(--text); text-align: left; transition: background var(--dur) var(--ease); }
.files__item svg { font-size: 16px; color: var(--text-muted); }
.files__item:hover { background: var(--surface-hover); }
.files__item[aria-current="true"] { background: var(--accent-soft); color: var(--text-strong); }
.files__item[aria-current="true"] svg { color: var(--accent); }
.files__main { min-width: 0; overflow: auto; }
.files__path { padding: 10px var(--s-3); border-bottom: 1px solid var(--border); font: 400 var(--fs-xs) var(--font-mono); color: var(--text-muted); }
.files__doc { padding: var(--s-3); max-width: 62ch; }
.files__doc h3 { margin-bottom: var(--s-2); font: 700 1.25rem/1.2 var(--font-ui); letter-spacing: -0.01em; color: var(--text-strong); }
.files__doc p + p { margin-top: var(--s-2); }
@container (max-width: 460px) {
  .files { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .files__side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
}

.repos { padding: var(--s-3); }
.repos__msg { font: 400 var(--fs-sm) var(--font-mono); color: var(--text-muted); }
.repos__msg:empty { display: none; }
.repos__list { display: grid; gap: var(--s-2); }
.repo__link { display: grid; gap: 6px; padding: var(--s-2) var(--s-3); border: 1px solid var(--border); border-radius: var(--r-win); background: var(--surface); transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.repo__link:hover { background: var(--surface-hover); border-color: var(--accent-line); }
.repo__name { font: 500 var(--fs-base) var(--font-mono); color: var(--accent); }
.repo__desc { font-size: var(--fs-sm); color: var(--text); }
.repo__meta { display: flex; gap: var(--s-3); font: 400 var(--fs-xs) var(--font-mono); color: var(--text-muted); }
.repo__lang, .repo__stars { display: inline-flex; align-items: center; gap: 6px; }
.repo__dot { inline-size: 9px; block-size: 9px; border-radius: 50%; background: var(--dot, var(--st-offline)); }
.repo__stars svg { font-size: 12px; }

.adw { padding: var(--s-3); display: grid; gap: var(--s-2); align-content: start; }
.adw__heading { margin-top: var(--s-1); font: 700 var(--fs-sm) var(--font-ui); color: var(--text-muted); }
.adw__note, .adw__empty { font: 400 var(--fs-xs) var(--font-mono); color: var(--text-muted); }
.adw-list { border: 1px solid var(--border); border-radius: var(--r-win); background: var(--surface); overflow: hidden; }
.adw-list > li + li { border-top: 1px solid var(--border); }
.adw-row { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: var(--s-2); padding: 12px var(--s-3); transition: background var(--dur) var(--ease); }
a.adw-row:hover { background: var(--surface-hover); }
.adw-row__icon { font-size: 18px; color: var(--text-muted); }
.adw-row__text, .adw-row--switch label { display: grid; gap: 2px; }
.adw-row__title { font-weight: 700; color: var(--text-strong); }
.adw-row__sub { font: 400 var(--fs-xs) var(--font-mono); color: var(--text-muted); }
.adw-row__go { font-size: 14px; color: var(--text-muted); }
a.adw-row:hover .adw-row__go { color: var(--accent); }
.adw-row--switch { grid-template-columns: 1fr auto; }
.adw-card { padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--r-win); background: var(--surface); }
.adw-card__title { margin-bottom: var(--s-2); font-weight: 700; color: var(--text-strong); }
.adw-card__title--sub { display: flex; justify-content: space-between; margin: var(--s-3) 0 var(--s-2); }
.adw-card .qs__range { inline-size: 100%; }
.adw-card .qs__range:disabled { opacity: 0.4; cursor: default; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg__btn { flex: 1 1 80px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--r-in); background: var(--bg-inset); color: var(--text); transition: border-color var(--dur) var(--ease); }
.seg__btn:hover { border-color: rgba(255, 255, 255, 0.22); }
.seg__btn[aria-pressed="true"] { border-color: var(--accent); color: var(--text-strong); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.swatch { inline-size: 28px; block-size: 28px; border-radius: 50%; background: var(--sw); border: 2px solid transparent; box-shadow: inset 0 0 0 2px var(--bg-win); transition: border-color var(--dur) var(--ease); }
.swatch:hover { border-color: var(--border-strong); }
.swatch[aria-pressed="true"] { border-color: var(--text-strong); }
.swatch-custom input { inline-size: 28px; block-size: 28px; padding: 0; border: 1px solid var(--border-strong); border-radius: 50%; background: none; cursor: pointer; }
.switch { appearance: none; inline-size: 38px; block-size: 22px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background var(--dur) var(--ease); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; inline-size: 16px; block-size: 16px; border-radius: 50%; background: var(--text-strong); transition: translate var(--dur) var(--ease); }
.switch:checked { background: var(--accent); }
.switch:checked::after { translate: 16px 0; }

.dk { padding: var(--s-3); }
.dk__table { width: 100%; border-collapse: collapse; font: 400 var(--fs-sm) var(--font-mono); }
.dk__table th, .dk__table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dk__table thead th { font-size: var(--fs-xs); font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.dk__table tbody th { font-weight: 500; color: var(--text-strong); }
.dk__table td { color: var(--text); }
.dk__st { display: inline-flex; align-items: center; gap: 8px; }
.dk__st i { inline-size: 7px; block-size: 7px; border-radius: 50%; background: var(--st-offline); }
.dk__st[data-up="true"] i { background: var(--accent); }
.dk__note { margin-top: var(--s-2); font: 400 var(--fs-xs) var(--font-mono); color: var(--text-muted); }

/* ---- quick settings popover (GNOME 45 style; design only) ---- */
.qs { position: fixed; z-index: 35; top: calc(var(--panel-h) + 4px); right: 6px; inline-size: min(360px, calc(100vw - 12px)); padding: 12px; display: grid; gap: 12px; border-radius: 16px; background: rgba(22, 23, 28, 0.88); border: 1px solid var(--border-strong); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); font-weight: 400; animation: qs-in var(--dur) var(--ease) both; }
@keyframes qs-in { from { opacity: 0; translate: 0 -4px; } to { opacity: 1; translate: 0 0; } }
.qs__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qs__tile { display: flex; align-items: center; gap: 10px; min-block-size: 48px; padding: 6px 14px; border-radius: 999px; text-align: left; font-size: 18px; color: var(--text); background: rgba(255, 255, 255, 0.07); transition: background var(--dur) var(--ease), color var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.qs__tx { display: grid; min-inline-size: 0; line-height: 1.25; }
.qs__name { font: 700 var(--fs-sm)/1.25 var(--font-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qs__sub { font: 400 var(--fs-xs)/1.25 var(--font-ui); opacity: 0.7; }
.qs__tile[data-on="true"] { background: var(--accent); color: #fff; } /* accent = on, muted grey = off */
.qs__tile[aria-disabled="true"] { opacity: 0.5; cursor: default; }
.qs__tile[data-key="dark"] { cursor: not-allowed; }
.qs__sliders { display: grid; gap: 10px; padding: 2px 4px; }
.qs__row { display: flex; align-items: center; gap: 12px; font-size: 18px; color: var(--text); }
.qs__val { flex: none; inline-size: 3.2ch; text-align: right; font: 400 var(--fs-xs) var(--font-mono); color: var(--text-muted); }
/* Hard-stop gradient is the standard way to paint the filled part of a range track in Chromium/WebKit (--p is set from JS). */
.qs__range { appearance: none; -webkit-appearance: none; flex: 1; min-inline-size: 0; block-size: 20px; background: transparent; cursor: pointer; --p: 50%; }
.qs__range::-webkit-slider-runnable-track { block-size: 12px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--p), rgba(255, 255, 255, 0.14) var(--p)); }
.qs__range::-webkit-slider-thumb { -webkit-appearance: none; inline-size: 20px; block-size: 20px; margin-top: -4px; border-radius: 50%; border: 0; background: var(--text-strong); }
.qs__range::-moz-range-track { block-size: 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); }
.qs__range::-moz-range-progress { block-size: 12px; border-radius: 999px; background: var(--accent); }
.qs__range::-moz-range-thumb { inline-size: 20px; block-size: 20px; border-radius: 50%; border: 0; background: var(--text-strong); }
.qs__foot { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.qs__link, .qs__pwr { display: inline-flex; align-items: center; justify-content: center; gap: 8px; block-size: 36px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); font-size: 16px; transition: background var(--dur) var(--ease); }
.qs__link { padding: 0 14px; }
.qs__link span { font: 700 var(--fs-sm) var(--font-ui); }
.qs__pwr { inline-size: 36px; }
.qs__hint { flex: 1; min-inline-size: 0; text-align: center; font: 400 var(--fs-xs) var(--font-mono); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (hover: hover) { .qs__tile:not([aria-disabled="true"]):hover { background: rgba(255, 255, 255, 0.12); } .qs__tile[data-on="true"]:not([aria-disabled="true"]):hover { background: color-mix(in srgb, var(--accent) 88%, #fff); } .qs__link:hover, .qs__pwr:hover { background: rgba(255, 255, 255, 0.12); } }
@media (hover: none) { .qs__tile:active, .qs__link:active, .qs__pwr:active { background: var(--border-strong); } }

/* ---- Music app: split pane in wide windows, list + bottom bar in narrow ones (container query, so it follows the window not the screen) ---- */
.mu { position: absolute; inset: 0; container: mu / inline-size; background: var(--bg-win); }
/* A container query cannot restyle its own container, so the grid lives on this inner box. */
.mu__box { display: grid; grid-template-columns: minmax(0, 1fr) 300px; block-size: 100%; }
.mu__list { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-block-size: 0; border-right: 1px solid var(--border); }
.mu__head { display: flex; gap: 8px; padding: 10px 12px 6px; }
.mu__search { flex: 1; min-inline-size: 0; display: flex; align-items: center; gap: 8px; padding: 0 10px; block-size: 34px; border-radius: var(--r-in); background: var(--bg-inset); border: 1px solid var(--border); color: var(--text-muted); font-size: 15px; }
.mu__search:focus-within { border-color: var(--accent-line); }
.mu__q { flex: 1; min-inline-size: 0; border: 0; outline: 0; background: transparent; color: var(--text-strong); font: 400 var(--fs-sm) var(--font-ui); }
.mu__q::-webkit-search-cancel-button { display: none; }
.mu__icon { display: inline-grid; place-items: center; inline-size: 34px; block-size: 34px; border-radius: var(--r-in); font-size: 18px; color: var(--text); transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.mu__icon[aria-pressed="true"] { color: var(--accent); }
.mu__tag { padding: 0 14px 6px; font: 400 var(--fs-xs) var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.mu__scroll { overflow: auto; min-block-size: 0; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.mu__row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; inline-size: 100%; padding: 6px 12px; text-align: left; transition: background var(--dur) var(--ease); }
.mu__row[data-current="true"] { background: var(--accent-soft); }
.mu__thumb { display: block; inline-size: 40px; block-size: 40px; }
.mu__txt { display: grid; min-inline-size: 0; line-height: 1.3; }
.mu__rt { font-size: var(--fs-sm); font-weight: 700; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mu__ra { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mu__end { display: flex; align-items: center; gap: 8px; font: 400 var(--fs-xs) var(--font-mono); color: var(--text-muted); }
.mu__err { color: var(--st-dnd); }
.mu__row[data-error="true"] .mu__rt { color: var(--text-muted); }
.mu__msg { padding: 14px; font-size: var(--fs-sm); color: var(--text-muted); }
.mu__msg:empty { display: none; }
.mu__retry { margin-left: 10px; }
@media (hover: hover) { .mu__row:hover, .mu__icon:hover { background: var(--surface-hover); } .mu__icon:hover { color: var(--text-strong); } }
@media (hover: none) { .mu__row:active, .mu__icon:active { background: var(--surface-hover); } }
/* cover art: images and the generated tile share one look, corners 6px max */
.mu-img, .mu-cover { display: grid; place-items: center; inline-size: 100%; block-size: 100%; border-radius: var(--r-in); object-fit: cover; }
.mu-cover { font: 700 18px/1 var(--font-ui); color: var(--text-strong); }
.mu-cover--lg { font-size: 64px; }
/* Five muted tones from existing palette colours mixed deep into the window background (no new colours). */
.mu-tone-0 { background: color-mix(in srgb, var(--accent) 22%, var(--bg-bar)); }
.mu-tone-1 { background: color-mix(in srgb, var(--st-online) 20%, var(--bg-bar)); }
.mu-tone-2 { background: color-mix(in srgb, var(--st-idle) 20%, var(--bg-bar)); }
.mu-tone-3 { background: color-mix(in srgb, var(--st-dnd) 20%, var(--bg-bar)); }
.mu-tone-4 { background: color-mix(in srgb, var(--text) 14%, var(--bg-bar)); }
/* playing marker: three-bar equaliser; the static triangle replaces it under reduced motion */
.mu__eq, .mu__tri { display: none; color: var(--accent); }
.mu__row[data-current="true"] .mu__eq { display: inline-flex; align-items: flex-end; gap: 2px; block-size: 12px; }
.mu__eq i { inline-size: 2px; block-size: 100%; background: currentColor; transform-origin: bottom; animation: mu-eq 900ms ease-in-out infinite; animation-play-state: paused; }
.mu__eq i:nth-child(2) { animation-delay: -300ms; animation-duration: 700ms; }
.mu__eq i:nth-child(3) { animation-delay: -600ms; animation-duration: 1100ms; }
.mu__box[data-playing="true"] .mu__eq i { animation-play-state: running; }
@keyframes mu-eq { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .mu__row[data-current="true"] .mu__eq { display: none; } .mu__row[data-current="true"] .mu__tri { display: inline; } }
html[data-motion="reduce"] .mu__row[data-current="true"] .mu__eq { display: none; }
html[data-motion="reduce"] .mu__row[data-current="true"] .mu__tri { display: inline; }
/* now playing */
.mu__now { display: grid; align-content: start; gap: 10px; padding: 16px; min-block-size: 0; overflow: auto; }
.mu__art { inline-size: min(100%, 210px); aspect-ratio: 1; justify-self: center; }
.mu__info { text-align: center; min-inline-size: 0; }
.mu__title { font-size: var(--fs-base); font-weight: 700; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mu__artist { font-size: var(--fs-sm); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mu__meta { font: 400 var(--fs-xs) var(--font-mono); color: var(--text-muted); min-block-size: 1.2em; }
.mu__seekrow { display: flex; align-items: center; gap: 8px; }
.mu__t { flex: none; inline-size: 4.2ch; font: 400 var(--fs-xs) var(--font-mono); color: var(--text-muted); }
.mu__tot { text-align: right; }
.mu__ctl { display: flex; align-items: center; justify-content: center; gap: 6px; }
.mu__play { display: grid; place-items: center; inline-size: 44px; block-size: 44px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 22px; }
.mu__play:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.mu__i-pause, .mu__box[data-playing="true"] .mu__i-play { display: none; }
.mu__box[data-playing="true"] .mu__i-pause { display: block; }
.mu__i-rep1, .mu__box[data-repeat="one"] .mu__i-rep { display: none; }
.mu__box[data-repeat="one"] .mu__i-rep1 { display: block; }
.mu__vol { display: flex; align-items: center; gap: 6px; }
@container mu (max-width: 559px) {
  .mu__box { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .mu__list { border-right: 0; border-bottom: 1px solid var(--border); }
  .mu__now { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "art info ctl" "seek seek seek"; align-items: center; gap: 8px 12px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); overflow: visible; }
  .mu__art { grid-area: art; inline-size: 44px; justify-self: stretch; }
  .mu-cover--lg { font-size: 20px; }
  .mu__info { grid-area: info; text-align: left; }
  .mu__meta, .mu__vol, .mu__shuffle, .mu__repeat { display: none; }
  .mu__seekrow { grid-area: seek; }
  .mu__ctl { grid-area: ctl; gap: 2px; }
  .mu__icon { inline-size: 36px; block-size: 36px; }
}

/* ============ 4. RESPONSIVE: the desktop metaphor stays on phones (down to 360px) ============ */
.edge { display: none; }
@media (max-width: 768px) {
  :root { --dock-gutter: calc(62px + env(safe-area-inset-bottom, 0px)); }
  .dock { padding: 5px; }
  .dock__list { gap: 2px; }
  .dock__item { inline-size: 38px; block-size: 38px; padding: 5px; font-size: 22px; }
  .win__bar { grid-template-columns: minmax(0, 1fr) auto; } /* title left, controls right: room for 32px targets */
  .win__bar > span { display: none; }
  .win__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px; }
  .menu { right: 4px; }
}
@media (max-width: 419px) {
  .panel__date, .panel__sync { display: none; } /* time only; the sync tag moves out of the cramped panel */
  .panel__status { gap: 6px; padding: 0 4px; }
  .panel__btn { padding: 0 6px; }
}
/* touch: controls always visible (no hover to reveal them) and large enough to hit */
@media (hover: none), (pointer: coarse), (max-width: 768px) {
  .win__ctls { opacity: 1; }
  .win__bar { min-height: 44px; }
  .win__ctl { inline-size: 32px; block-size: 32px; font-size: 16px; }
}
/* touch: no 8-edge resize (windows are fixed-size or maximized); invisible swipe-up zone along the bottom edge */
@media (pointer: coarse), (max-width: 768px) {
  .win__rz { display: none; }
  .edge { display: block; position: fixed; left: 0; right: 0; bottom: 0; height: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 25; touch-action: none; }
  html[data-overview] .edge { display: none; }
}
/* tap feedback for things that otherwise only react to hover */
@media (hover: none) {
  .panel__btn:active, .menu__item:active, .files__item:active, .btn:active, .win__ctl:active { background: var(--border-strong); }
  .pf-conn:active { background: var(--surface-hover); color: var(--text-strong); }
  .pf-conn:active::before { translate: 0 0; opacity: 1; }
  .pf-conn:active .pf-conn__icon { color: var(--accent); }
  .repo__link:active { background: var(--surface-hover); border-color: var(--accent-line); }
  a.adw-row:active { background: var(--surface-hover); }
  .swatch:active { border-color: var(--border-strong); }
}

/* ============ 5. ADMIN EDITOR (same variables, fonts, and restraint as the public site) ============ */
.admin-body { overflow: auto; height: auto; min-height: 100%; background: var(--bg); }
.admin-body::after { display: none; }
.ad-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--s-2); padding: 10px var(--s-3); background: var(--bg-panel); border-bottom: 1px solid var(--border); }
.ad-top__title { margin-right: auto; font: 500 var(--fs-xs) var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-muted); }
.ad { position: relative; z-index: 2; display: grid; gap: var(--s-4); max-width: 1280px; margin: 0 auto; padding: var(--s-4) var(--s-3) var(--s-5); }
@media (min-width: 1000px) { .ad { grid-template-columns: minmax(0, 1fr) 520px; align-items: start; } .ad__preview { position: sticky; top: 72px; } }
.ad__form { display: grid; gap: var(--s-3); }
.ad-sec { display: grid; gap: var(--s-2); padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--r-win); background: var(--bg-win); }
.ad-sec > legend, .ad-sec__head { font: 500 var(--fs-xs) var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-muted); }
.ad-sec__head { display: flex; align-items: center; justify-content: space-between; }
.ad-grid { display: grid; gap: var(--s-2); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.ad-field { display: grid; gap: 6px; }
.ad-label { font: 500 var(--fs-xs) var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.ad-hint { font: 400 var(--fs-xs) var(--font-mono); color: var(--text-muted); }
.ad-imgrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.ad-imgrow .ad-hint[data-bad="true"] { color: var(--text-strong); }
.ad-imgrow .btn:disabled { opacity: 0.5; cursor: progress; }
.ad-input, .ad-select, .ad-area { width: 100%; padding: 8px 10px; background: var(--bg-inset); color: var(--text-strong); border: 1px solid var(--border-strong); border-radius: var(--r-in); font: 400 var(--fs-sm) var(--font-mono); transition: border-color var(--dur) var(--ease); }
.ad-input:hover, .ad-select:hover, .ad-area:hover { border-color: rgba(255, 255, 255, 0.22); }
.ad-area { min-height: 110px; resize: vertical; line-height: 1.6; font-family: var(--font-ui); font-size: var(--fs-base); }
.ad-area--tall { min-height: 220px; }
input[type="color"].ad-input { padding: 2px; block-size: 36px; }
.ad-rows { display: grid; gap: var(--s-1); }
.ad-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-1); align-items: center; }
.ad-row--kv { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; }
.ad-row--conn { grid-template-columns: 130px minmax(0, 1fr) minmax(0, 1.4fr) auto; }
@media (max-width: 640px) { .ad-row--conn { grid-template-columns: 1fr auto; } .ad-row--kv { grid-template-columns: 1fr auto; } }
.ad-x, .ad-add { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); border-radius: var(--r-in); color: var(--text); font: 500 var(--fs-xs) var(--font-mono); transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.ad-x { inline-size: 32px; block-size: 32px; font-size: 14px; }
.ad-add { padding: 6px 12px; justify-self: start; }
.ad-x:hover, .ad-add:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.ad-check { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); }
.ad-check input { accent-color: var(--accent); inline-size: 16px; block-size: 16px; }
.ad__frame { border: 1px solid var(--border-strong); border-radius: var(--r-win); background: var(--bg-win); overflow: hidden; max-height: calc(100vh - 100px); overflow-y: auto; }
.ad__frame-label { padding: 8px var(--s-3); border-bottom: 1px solid var(--border); background: var(--bg-bar); font: 500 var(--fs-xs) var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-muted); }
.toast { position: fixed; left: var(--s-3); bottom: var(--s-3); z-index: 50; padding: 10px 16px; border-radius: var(--r-in); background: #17181d; border: 1px solid var(--border-strong); font: 500 var(--fs-sm) var(--font-mono); color: var(--text-strong); opacity: 0; translate: 0 6px; pointer-events: none; transition: opacity var(--dur) var(--ease), translate var(--dur) var(--ease); }
.toast[data-show="true"] { opacity: 1; translate: 0 0; }
.toast[data-bad="true"] { border-color: var(--st-dnd); }

/* native colour input: make the custom swatch circular like its neighbours */
.swatch-custom input::-webkit-color-swatch-wrapper { padding: 0; }
.swatch-custom input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.swatch-custom input::-moz-color-swatch { border: 0; border-radius: 50%; }
