/* PLUM — every colour below comes from CSS variables written by themes.js (hue / saturation / brightness / intensity). */
:root {
  --bg-0: hsl(232 38% 8%); --bg-1: hsl(250 40% 12%);
  --glow-a: hsl(232 80% 50% / .3); --glow-b: hsl(290 80% 50% / .2);
  --surface: hsl(232 30% 16% / .62); --surface-hi: hsl(232 30% 22% / .8); --surface-solid: hsl(232 32% 14%);
  --field: hsl(232 30% 11% / .75);
  --border: hsl(232 60% 72% / .16); --border-hi: hsl(232 70% 70% / .36);
  --text: hsl(232 25% 96%); --text-dim: hsl(232 18% 74%); --text-faint: hsl(232 14% 56%);
  --accent: hsl(232 80% 64%); --accent-hi: hsl(232 80% 76%); --accent-2: hsl(274 80% 62%); --accent-ink: hsl(232 45% 9%);
  --shadow: 0 14px 44px -16px hsl(232 60% 2% / .85); --track: hsl(232 30% 80% / .11); --glow: hsl(232 90% 60% / .4);
  --warn: hsl(38 95% 58%); --crit: hsl(350 88% 63%); --area-op: .3; --i: .7;
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --c0: hsl(232 80% 64%); --c1: hsl(280 80% 64%); --c2: hsl(332 80% 64%); --c3: hsl(24 80% 64%);
  --c4: hsl(77 80% 64%); --c5: hsl(127 80% 64%); --c6: hsl(177 80% 64%); --c7: hsl(222 80% 64%);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  min-height: 100dvh; font-family: var(--font); color: var(--text); background: var(--bg-0);
  line-height: 1.45; -webkit-font-smoothing: antialiased; overflow-x: hidden;
  -webkit-tap-highlight-color: transparent; font-variant-numeric: tabular-nums;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.i { flex: none; }

/* ---------- ambient background ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: linear-gradient(160deg, var(--bg-0), var(--bg-1)); }
.bg::after { content: ''; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(var(--track) 1px, transparent 1px), linear-gradient(90deg, var(--track) 1px, transparent 1px);
  background-size: 56px 56px; -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%); mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%); }
.bg i { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; animation: drift 32s ease-in-out infinite alternate; }
.bg i:nth-child(1) { top: -32vmax; left: -22vmax; background: radial-gradient(circle, var(--glow-a), transparent 62%); }
.bg i:nth-child(2) { bottom: -36vmax; right: -24vmax; background: radial-gradient(circle, var(--glow-b), transparent 62%); animation-delay: -14s; }
@keyframes drift { to { transform: translate(6vmax, 5vmax) scale(1.12); } }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 26px; padding: 24px 16px;
  background: var(--surface); border-right: 1px solid var(--border); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); padding: 0 8px; }
.brand .mark { width: 38px; height: 38px; filter: drop-shadow(0 0 calc(4px + 10px * var(--i)) var(--glow)); }
.brand b { display: block; font-size: 20px; letter-spacing: .24em; font-weight: 800; }
.brand small { display: block; font-size: 11px; color: var(--text-faint); letter-spacing: .06em; }
.brand.compact { display: none; padding: 0; }
.brand.compact b { display: inline; font-size: 17px; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; color: var(--text-dim);
  text-decoration: none; font-weight: 600; transition: background .25s, color .25s, box-shadow .25s; }
.nav a:hover { color: var(--text); background: var(--track); }
.nav a[aria-current="page"] { color: var(--text); background: linear-gradient(90deg, var(--glow), transparent 130%); box-shadow: inset 0 0 0 1px var(--border-hi); }
.nav a[aria-current="page"] .i { color: var(--accent-hi); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 0 6px; }
.net { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-faint); }
.net i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--glow); }
.net.off i { background: var(--warn); box-shadow: 0 0 10px var(--warn); }

.main-wrap { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px clamp(16px, 3vw, 40px) 0; max-width: 1280px; margin: 0 auto; }
.top-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.clock { display: flex; align-items: baseline; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 14px; }
.clock b { font-weight: 700; letter-spacing: .02em; }
.clock span { font-size: 11px; color: var(--text-faint); }
.main { padding: 18px clamp(16px, 3vw, 40px) 64px; max-width: 1280px; margin: 0 auto; }
.view { animation: view-in .5s var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(12px); } }

.bottom { display: none; position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 30; padding: 6px; gap: 4px;
  background: var(--surface-hi); border: 1px solid var(--border-hi); border-radius: 22px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4); }
.bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border-radius: 16px; text-decoration: none;
  font-size: 11px; font-weight: 600; color: var(--text-faint); transition: color .2s, background .2s; min-height: 52px; justify-content: center; }
.bottom a[aria-current="page"] { color: var(--text); background: linear-gradient(180deg, var(--glow), transparent 140%); box-shadow: inset 0 0 0 1px var(--border-hi); }
.bottom a[aria-current="page"] .i { color: var(--accent-hi); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .bottom { display: flex; }
  .brand.compact { display: flex; }
  .main { padding-bottom: 120px; }
}
@media (max-width: 420px) { .clock span { display: none; } }

/* ---------- common ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 6px 0 22px; }
.page-head h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.1; letter-spacing: -.025em; font-weight: 750; }
.sub, .hint { color: var(--text-dim); font-size: 14px; margin-top: 6px; max-width: 62ch; }
.hint { font-size: 13px; color: var(--text-faint); }
h2 { font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.sec { margin: 30px 0 14px; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-faint); }
.panel { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 22px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); }
.panel > h2 { margin-bottom: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 14px; font-weight: 650; font-size: 14px;
  background: var(--surface); border: 1px solid var(--border); transition: transform .2s var(--ease), border-color .2s, box-shadow .2s, background .2s; white-space: nowrap; }
.btn:hover { border-color: var(--border-hi); background: var(--surface-hi); }
.btn:active { transform: scale(.97); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
.btn.primary { border: 0; color: var(--accent-ink); background: var(--grad); box-shadow: 0 10px 30px -10px var(--glow), inset 0 1px 0 hsl(0 0% 100% / .35); }
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 14px 36px -8px var(--glow); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, transparent); background: color-mix(in srgb, var(--crit) 10%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--crit) 18%, transparent); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--text-dim);
  transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease); }
.icon-btn:hover { background: var(--track); color: var(--text); border-color: var(--border); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.danger:hover { color: var(--crit); }
#mode-btn { background: var(--surface); border-color: var(--border); width: 40px; height: 40px; border-radius: 50%; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-radius: 14px; background: var(--field); border: 1px solid var(--border); }
.seg button { border: 0; background: none; padding: 8px 14px; border-radius: 10px; color: var(--text-dim); font-weight: 650; font-size: 13px; transition: background .25s, color .25s, box-shadow .25s; min-height: 36px; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--grad); color: var(--accent-ink); box-shadow: 0 4px 16px -4px var(--glow); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
  color: var(--rc, var(--accent-hi)); background: color-mix(in srgb, var(--rc, var(--accent)) 14%, transparent); border: 1px solid color-mix(in srgb, var(--rc, var(--accent)) 34%, transparent); }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.chip.warning { --rc: var(--warn); } .chip.critical { --rc: var(--crit); }

/* fields */
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > label { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); font-weight: 650; }
.fld input, .fld select, input.num, select.sel, input.tm { height: 46px; padding: 0 14px; border-radius: 13px; background: var(--field); border: 1px solid var(--border); font-size: 16px; width: 100%; outline: none; transition: border-color .2s, box-shadow .2s; }
.fld input:focus, .fld select:focus, input.num:focus, select.sel:focus, input.tm:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
.fld .err { color: var(--crit); font-size: 12px; min-height: 0; }
.fld.bad input { border-color: var(--crit); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 340px) { .form-grid { grid-template-columns: 1fr; } }
select option { background: var(--surface-solid); color: var(--text); }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; background: transparent; cursor: pointer; --p: 50%; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--accent) var(--p), var(--track) var(--p)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--text); border: 4px solid var(--accent); box-shadow: 0 0 16px var(--glow); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 6px; background: var(--track); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 4px solid var(--accent); box-shadow: 0 0 16px var(--glow); }

/* ---------- dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
@media (max-width: 560px) { .tile { padding: 13px 14px; } .tile-v { font-size: 24px; } .page-head .btn.primary { width: 100%; } }
.tile { padding: 16px 18px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.tile-l { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); font-weight: 650; }
.tile-v { font-size: 28px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; }
.tile-v small { font-size: 15px; color: var(--text-dim); font-weight: 600; }
.tile-s { font-size: 12.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 18px; }
.card { --rc: var(--ac); position: relative; display: flex; flex-direction: column; gap: 16px; padding: 20px; border-radius: 24px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
  transition: transform .35s var(--ease), border-color .3s, box-shadow .3s; }
.card::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(260px 170px at 100% 0%, color-mix(in srgb, var(--ac) calc(10% + 22% * var(--i)), transparent), transparent); }
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--ac) 50%, transparent); box-shadow: var(--shadow), 0 0 40px -12px var(--ac); }
.card[data-status="warning"] { --rc: var(--warn); } .card[data-status="critical"] { --rc: var(--crit); }
.card.enter { animation: card-in .7s var(--ease) both; animation-delay: calc(var(--n, 0) * 70ms); }
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.card > * { position: relative; }
.card-top { display: flex; align-items: center; gap: 12px; }
.badge { width: 42px; height: 42px; flex: none; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--ac), var(--accent-2)); box-shadow: 0 8px 22px -8px var(--ac); }
.ttl { min-width: 0; flex: 1; }
.ttl h3 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttl p { font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-main { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring .rb { stroke: var(--track); }
.ring .rf { stroke: var(--rc); transition: stroke-dashoffset 1.1s var(--ease), stroke .4s; filter: drop-shadow(0 0 calc(2px + 7px * var(--i)) var(--rc)); }
.ring-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-c b { font-size: 28px; font-weight: 750; letter-spacing: -.03em; line-height: 1; }
.ring-c span { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.nums { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.left b { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.left span { margin-left: 6px; font-size: 13px; color: var(--text-dim); }
.of { font-size: 13px; color: var(--text-dim); }
.spark { height: 46px; margin-top: 6px; }
.reset { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 11px 14px; border-radius: 14px; background: var(--field); border: 1px solid var(--border); font-size: 13px; color: var(--text-dim); }
.reset > div:first-child { display: flex; align-items: center; gap: 8px; min-width: 0; }
.reset b { color: var(--text); font-weight: 650; }
.reset .cd { font-weight: 750; color: var(--rc); font-size: 14px; letter-spacing: .02em; }
.adj { display: grid; grid-template-columns: 46px 1fr 46px; gap: 8px; }
.adj .sq { height: 46px; border-radius: 14px; border: 1px solid var(--border); background: var(--field); display: grid; place-items: center; transition: background .2s, border-color .2s, transform .15s var(--ease); }
.adj .sq:hover { border-color: var(--ac); background: var(--surface-hi); }
.adj .sq:active { transform: scale(.9); }
.adj input { height: 46px; text-align: center; font-size: 18px; font-weight: 700; border-radius: 14px; background: var(--field); border: 1px solid var(--border); outline: none; width: 100%; min-width: 0; transition: border-color .2s, box-shadow .2s; }
.adj input:focus { border-color: var(--ac); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ac) 35%, transparent); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tools { display: flex; gap: 2px; }
.empty { text-align: center; padding: 56px 20px; border: 1px dashed var(--border-hi); border-radius: 24px; color: var(--text-dim); }
.empty h2 { font-size: 20px; color: var(--text); margin-bottom: 8px; }
.empty .btn { margin-top: 18px; }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; touch-action: pan-y; overflow: visible; }
.chart .gl { stroke: var(--track); stroke-dasharray: 2 6; }
.chart .yt, .chart .xt { fill: var(--text-faint); font-size: 11px; }
.chart .ln { filter: drop-shadow(0 0 calc(2px + 7px * var(--i)) color-mix(in srgb, currentColor 70%, transparent)); }
.chart .dot { fill: var(--bg-0); stroke-width: 2.2; }
.chart .cl { stroke: var(--border-hi); stroke-dasharray: 3 4; }
.chart .cd { fill: var(--surface-solid); stroke-width: 3; }
.chart .cur { transition: opacity .15s; }
.chart-tip { position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; opacity: 0; transition: opacity .15s; display: flex; flex-direction: column; gap: 1px;
  padding: 8px 12px; border-radius: 12px; background: var(--surface-solid); border: 1px solid var(--border-hi); box-shadow: var(--shadow); white-space: nowrap; font-size: 12px; }
.tt-l { color: var(--text-dim); } .tt-v { font-weight: 750; font-size: 14px; } .tt-v i { font-style: normal; font-weight: 500; color: var(--text-dim); font-size: 12px; }
.ln.anim { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.3s cubic-bezier(.45, .05, .2, 1) .05s forwards; }
.ar.anim { opacity: 0; animation: fade .9s ease .55s forwards; }
.dot.anim { opacity: 0; animation: fade .5s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

/* ---------- analytics ---------- */
.controls { display: flex; gap: 10px; flex-wrap: wrap; }
.pills { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin-bottom: 4px; scrollbar-width: thin; }
.pill { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text-dim); transition: all .25s; }
.pill i { width: 9px; height: 9px; border-radius: 50%; background: var(--pc); box-shadow: 0 0 8px var(--pc); }
.pill:hover { color: var(--text); border-color: var(--border-hi); }
.pill[aria-pressed="true"] { color: var(--text); border-color: var(--pc); background: color-mix(in srgb, var(--pc) 16%, transparent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 16px 0 20px; }
.stat { padding: 12px 14px; border-radius: 16px; background: var(--field); border: 1px solid var(--border); }
.stat span { display: block; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--text-faint); font-weight: 650; }
.stat b { font-size: 21px; font-weight: 750; letter-spacing: -.01em; }
.stat small { display: block; font-size: 12px; color: var(--text-dim); }
.up { color: var(--warn); } .down { color: var(--accent-hi); }
.panel-head h2 { font-size: 20px; letter-spacing: -.01em; }
.big-chart { height: 300px; }
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.mini-card { text-align: left; cursor: pointer; padding: 16px 18px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); transition: transform .3s var(--ease), border-color .3s; display: block; width: 100%; }
.mini-card:hover { transform: translateY(-2px); border-color: var(--pc); }
.mini-card.sel { border-color: var(--pc); box-shadow: 0 0 30px -12px var(--pc); }
.mini-card .mh { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.mini-card .mh b { font-size: 14px; } .mini-card .mh span { font-size: 12px; color: var(--text-dim); }
.mini-card .mc { height: 70px; }
@media (max-width: 560px) { .big-chart { height: 240px; } }

/* ---------- appearance ---------- */
.ap-grid { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 18px; align-items: start; }
.ap-grid .wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .ap-grid { grid-template-columns: 1fr; } }
.wheel-wrap { display: grid; place-items: center; padding: 8px 0 14px; }
.wheel { position: relative; border-radius: 50%; touch-action: none; cursor: crosshair; box-shadow: 0 0 0 1px var(--border-hi), 0 0 calc(20px + 50px * var(--i)) var(--glow); }
.wheel canvas { display: block; border-radius: 50%; }
.wheel-knob { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 0 1px hsl(0 0% 0% / .4), 0 4px 16px hsl(0 0% 0% / .5); pointer-events: none; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 24px; }
.preset { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 8px; border-radius: 18px; background: var(--field); border: 1px solid var(--border); font-weight: 650; font-size: 13px; transition: all .25s var(--ease); }
.preset:hover { transform: translateY(-2px); border-color: var(--border-hi); }
.preset .sw { width: 46px; height: 46px; border-radius: 50%; box-shadow: 0 6px 20px -6px var(--sc), inset 0 0 0 2px hsl(0 0% 100% / .18); }
.preset[aria-pressed="true"] { border-color: var(--accent); background: var(--surface-hi); box-shadow: 0 0 26px -8px var(--glow); }
.slider-row { display: grid; grid-template-columns: 110px 1fr 44px; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 14px; }
.slider-row output { text-align: right; color: var(--text-dim); font-weight: 650; }
.mode-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.pv-row { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .pv-row { grid-template-columns: 1fr; } }
.pv-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pv-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- settings ---------- */
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 18px; align-items: start; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--border); }
.row:first-of-type { border-top: 0; padding-top: 0; }
.row .lbl { flex: 1 1 200px; min-width: 0; }
.row .lbl b { display: block; font-weight: 650; font-size: 14.5px; }
.row .lbl span { color: var(--text-dim); font-size: 13px; }
.row .ctl { flex: 0 1 260px; min-width: 0; }
.row .ctl.fill { flex: 1 1 100%; }
.thr { display: grid; grid-template-columns: 1fr 84px; gap: 14px; align-items: center; width: 100%; }
.zones { display: flex; height: 12px; border-radius: 8px; overflow: hidden; margin: 8px 0 6px; background: var(--track); }
.zones i { display: block; height: 100%; transition: width .35s var(--ease); }
.zones .z1 { background: var(--accent); } .zones .z2 { background: var(--warn); } .zones .z3 { background: var(--crit); }
.zone-l { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-faint); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.now-line { font-size: 13px; color: var(--text-dim); margin-top: 8px; }
.now-line b { color: var(--text); }

/* ---------- dialog / toasts ---------- */
dialog.dlg { border: 1px solid var(--border-hi); background: var(--surface-solid); color: var(--text); border-radius: 26px; padding: 0; width: min(580px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  box-shadow: 0 40px 90px -20px hsl(230 60% 2% / .8), 0 0 60px -20px var(--glow); overflow: hidden; }
dialog.dlg.small { width: min(420px, calc(100vw - 24px)); }
dialog.dlg::backdrop { background: hsl(230 50% 3% / .62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
dialog.dlg[open] { animation: dlg-in .32s var(--ease); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.dlg-inner { padding: 24px; overflow-y: auto; max-height: calc(100dvh - 24px); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.dlg-title { font-size: 20px; font-weight: 750; letter-spacing: -.01em; }
.dlg-msg { color: var(--text-dim); margin: 8px 0 4px; font-size: 14.5px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.quick .pill { padding: 7px 12px; font-size: 12.5px; }
.quick-l { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px; font-weight: 650; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; background: var(--sw); box-shadow: 0 0 0 1px var(--border-hi); transition: transform .2s var(--ease); }
.swatches button:hover { transform: scale(1.12); }
.swatches button[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 16px var(--sw); }
@media (max-width: 640px) {
  dialog.dlg { margin: auto auto 0; width: 100%; max-width: 100%; border-radius: 26px 26px 0 0; }
  dialog.dlg.small { width: 100%; }
  .dlg-inner { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}
#toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 16px; font-size: 14px; font-weight: 550; max-width: min(420px, calc(100vw - 24px));
  background: var(--surface-solid); border: 1px solid var(--border-hi); box-shadow: var(--shadow), 0 0 30px -12px var(--glow); animation: toast-in .4s var(--ease); }
.toast.out { opacity: 0; transform: translateY(10px); transition: all .25s; }
.toast.bad { border-color: var(--crit); }
.toast-act { border: 0; background: none; color: var(--accent-hi); font-weight: 750; padding: 4px 6px; border-radius: 8px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@media (max-width: 860px) { #toasts { left: 12px; right: 12px; bottom: calc(90px + env(safe-area-inset-bottom)); align-items: center; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
