/* ============================================================
   Nimbus Panel — soft-dark theme with aurora accents
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0a0d16;
  --bg-elev:     #0e1220;
  --panel:       #131826;
  --panel-2:     #171d2d;
  --border:      #212639;
  --border-soft: #1a1f30;

  --text:        #e7ebf5;
  --text-muted:  #8891ab;
  --text-faint:  #5c657d;

  --accent:      #5cf0c3;   /* cyan-lime */
  --accent-2:    #a08bff;   /* violet */
  --accent-3:    #ff9d7a;   /* peach */
  --accent-glow: rgba(92,240,195,.35);

  --success:     #5cf0c3;
  --warning:     #ffc46b;
  --error:       #ff6b7a;

  --rail-w:      76px;
  --radius:      14px;
  --radius-sm:   10px;
  --radius-lg:   20px;
  --shadow-lg:   0 20px 50px -20px rgba(0,0,0,.6), 0 8px 20px -10px rgba(0,0,0,.4);
  --shadow-sm:   0 4px 14px -6px rgba(0,0,0,.5);
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv02','cv03','cv04','cv11','ss01';
  overflow-x: hidden;
}

::selection { background: var(--accent-glow); color: #06110d; }

/* ── Custom scrollbars ────────────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(160,139,255,.35) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(160,139,255,.4), rgba(92,240,195,.35));
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
  transition: background .2s;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  background-clip: padding-box;
  box-shadow: 0 0 12px var(--accent-glow);
}
*::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, var(--accent), var(--accent-3));
  background-clip: padding-box;
}
*::-webkit-scrollbar-corner { background: transparent; }
/* Firefox thumb has no hover; leave the base color */

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ── Aurora background blobs ── */
.aurora-bg {
  position: fixed; inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.aurora-blob {
  position: absolute;
  width: 55vmax; height: 55vmax;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .18;
  will-change: transform;
}
.aurora-blob.a { background: #5cf0c3; top: -20vmax; left: -15vmax; animation: float1 22s ease-in-out infinite; }
.aurora-blob.b { background: #a08bff; bottom: -25vmax; right: -20vmax; opacity: .22; animation: float2 26s ease-in-out infinite; }
.aurora-blob.c { background: #ff9d7a; top: 30vmax; left: 40vmax; opacity: .10; animation: float3 30s ease-in-out infinite; }

@keyframes float1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(6vmax,4vmax)} }
@keyframes float2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-5vmax,-3vmax)} }
@keyframes float3 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(3vmax,-4vmax)} }

/* ── App shell ── */
.app {
  position: relative;
  z-index: auto;
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
}

/* ── Left icon rail ── */
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 0 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, rgba(19,24,38,.85), rgba(10,13,22,.65));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-soft);
}

.rail-brand {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 14px;
  background: linear-gradient(140deg, rgba(160,139,255,.14), rgba(92,240,195,.10));
  border: 1px solid var(--border);
  margin-bottom: 14px;
  transition: transform .2s ease;
}
.rail-brand:hover { transform: translateY(-1px) rotate(-4deg); }

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  align-items: center;
}

.rail-item {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color .18s, background .18s, transform .18s;
}
.rail-item:hover {
  color: var(--text);
  background: rgba(160,139,255,.09);
}

/* Per-icon micro-animations on hover */
.rail-item svg {
  transition: transform .28s cubic-bezier(.2,1.6,.4,1);
  transform-origin: center;
}
/* Dashboard — pointer tilts + whole gauge nods */
.rail-item[href="/"]:hover svg { animation: rail-dash .55s ease; }
@keyframes rail-dash {
  0%   { transform: rotate(0) scale(1); }
  35%  { transform: rotate(-12deg) scale(1.08); }
  70%  { transform: rotate(6deg)  scale(1.06); }
  100% { transform: rotate(0) scale(1); }
}
/* Build — shield tilt */
.rail-item[href="/build"]:hover svg { animation: rail-tilt .55s cubic-bezier(.2,1.6,.4,1); }
@keyframes rail-tilt {
  0%   { transform: rotate(0) scale(1); }
  40%  { transform: rotate(-15deg) scale(1.10); }
  70%  { transform: rotate(8deg) scale(1.05); }
  100% { transform: rotate(0) scale(1); }
}
/* Devices — phone buzz */
.rail-item[href="/devices"]:hover svg { animation: rail-buzz .5s ease-in-out; }
@keyframes rail-buzz {
  0%,100% { transform: translateX(0) rotate(0); }
  15% { transform: translateX(-1.5px) rotate(-6deg); }
  30% { transform: translateX(1.5px) rotate(6deg); }
  45% { transform: translateX(-1.5px) rotate(-4deg); }
  60% { transform: translateX(1.5px) rotate(4deg); }
  75% { transform: translateX(-1px) rotate(-2deg); }
}
/* Logs — pulse (mirrors the alert dot) */
.rail-item[href="/logs"]:hover svg { animation: rail-pulse .6s ease-out; }
@keyframes rail-pulse {
  0%   { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255,157,122,0)); }
  40%  { transform: scale(1.18); filter: drop-shadow(0 0 6px rgba(255,157,122,.55)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255,157,122,0)); }
}
/* APK — hop */
.rail-item[href="/apk"]:hover svg { animation: rail-hop .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes rail-hop {
  0%   { transform: translateY(0) rotate(0); }
  40%  { transform: translateY(-4px) rotate(-6deg); }
  70%  { transform: translateY(-1px) rotate(4deg); }
  100% { transform: translateY(0) rotate(0); }
}
/* Music — beat bounce + tiny pulse dot when playing */
#ytp-rail-toggle:hover svg { animation: rail-beat .55s cubic-bezier(.3,1.6,.5,1); }
@keyframes rail-beat {
  0%   { transform: scale(1) rotate(0); }
  30%  { transform: scale(1.12) rotate(-6deg); }
  60%  { transform: scale(.96) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
#ytp-rail-toggle .rail-pulse {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(92,240,195,.22);
  opacity: 0;
  transform: scale(.6);
  transition: opacity .18s, transform .18s;
  pointer-events: none;
}
#ytp-rail-toggle.playing .rail-pulse {
  opacity: 1;
  transform: scale(1);
  animation: rail-pulse-dot 1.2s ease-in-out infinite;
}
@keyframes rail-pulse-dot {
  0%,100% { box-shadow: 0 0 0 3px rgba(92,240,195,.22); }
  50%     { box-shadow: 0 0 0 6px rgba(92,240,195,.05); }
}

/* Settings — full spin */
.rail-item[href="/settings"]:hover svg { animation: rail-spin .7s cubic-bezier(.4,.1,.3,1); }
@keyframes rail-spin {
  from { transform: rotate(0); }
  to   { transform: rotate(90deg); }
}
/* Logout icon — arrow slides out */
.rail-foot .logout:hover svg { animation: rail-out .35s ease forwards; }
@keyframes rail-out {
  from { transform: translateX(0); }
  to   { transform: translateX(2px); }
}
.rail-item.active {
  color: var(--accent);
  background: rgba(92,240,195,.10);
}
.rail-item.active::before {
  content: "";
  position: absolute;
  left: -14px; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 22px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Tooltip */
.rail-item[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--panel-2);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, transform .15s;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}
.rail-item:hover[data-tip]::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.rail-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.rail-foot .logout { color: var(--text-faint); }
.rail-foot .logout:hover { color: var(--error); background: rgba(255,107,122,.10); }

.conn-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 4px rgba(92,101,125,.12);
  transition: background .2s, box-shadow .2s;
}
.conn-dot.online, .conn-dot.ws { background: var(--accent); box-shadow: 0 0 0 4px rgba(92,240,195,.18); }
.conn-dot.sse                  { background: var(--warning); box-shadow: 0 0 0 4px rgba(255,196,107,.18); }
.conn-dot.offline              { background: var(--text-faint); }

/* ── Main content ── */
.content {
  padding: 28px 34px 40px;
  min-width: 0;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ── Page header (non-dashboard) ── */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 22px;
  flex-wrap: wrap;
}
.page-header .ph-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, var(--text) 60%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-header .ph-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}
.page-header .ph-actions {
  display: flex; gap: 8px; align-items: center;
}

/* ── Hero greeting card (dashboard) ── */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 26px 30px;
  margin-bottom: 22px;
  background:
    radial-gradient(1200px 300px at 100% 0%, rgba(160,139,255,.18), transparent 60%),
    radial-gradient(700px 240px at 0% 100%, rgba(92,240,195,.14), transparent 60%),
    linear-gradient(145deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: center;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,157,122,.06) 0, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(92,240,195,.06) 0, transparent 40%);
  pointer-events: none;
}
.hero-left { position: relative; z-index: 1; min-width: 0; }

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 10px;
}
.hero-eyebrow::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.hero-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.hero-title .accent {
  background: linear-gradient(90deg, var(--accent), var(--accent-2) 60%, var(--accent-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-face-inline {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 14px;
  background: linear-gradient(140deg, rgba(92,240,195,.10), rgba(160,139,255,.08));
  border: 1px solid var(--border);
  animation: gentle 6s ease-in-out infinite;
  flex-shrink: 0;
}
.hero-face-inline .face { width: 34px; height: 34px; }
@keyframes gentle { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-3px)} }

.hero-sub {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 15px;
  max-width: 60ch;
  line-height: 1.5;
}

.hero-status {
  margin-top: 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.hero-status .pill strong {
  color: currentColor;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Right block: analog clock icon */
.hero-right {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-left: 24px;
  border-left: 1px solid var(--border-soft);
  gap: 8px;
}
.hero-clock-svg {
  filter: drop-shadow(0 8px 24px rgba(160,139,255,.28));
}
.hero-clock-svg line {
  transition: transform .2s cubic-bezier(.4,2.2,.6,1);
}
.hero-clock-svg #hand-second {
  transition: none;
}
.hero-clock-digit {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

/* ── Stat tiles ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-tile {
  position: relative;
  padding: 20px 22px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform .2s, border-color .2s;
}
.stat-tile:hover { transform: translateY(-2px); border-color: var(--accent-2); }
.stat-tile .st-icon {
  position: absolute;
  top: 16px; right: 16px;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(160,139,255,.12);
  color: var(--accent-2);
}
.stat-tile.accent .st-icon { background: rgba(92,240,195,.12); color: var(--accent); }
.stat-tile.warm .st-icon   { background: rgba(255,157,122,.12); color: var(--accent-3); }

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  font-weight: 600;
}
.stat-value {
  margin-top: 10px;
  font-size: 38px;
  line-height: 1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-tile.accent .stat-value { color: var(--accent); }
.stat-tile.warm   .stat-value { color: var(--accent-3); }
.stat-foot {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-faint);
}

/* ── Card ── */
.card {
  background: linear-gradient(160deg, rgba(23,29,45,.85), rgba(19,24,38,.85));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.card-title .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-2);
}
.card-body { padding: 20px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  padding: 12px 18px;
  text-align: left;
  color: var(--text-faint);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255,255,255,.015);
}
.data-table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover td { background: rgba(160,139,255,.04); }
.row-active td { background: rgba(92,240,195,.05); }

/* ── Logs (severity + collapsed duplicates) ───────────── */
.log-table td { vertical-align: top; }
.log-row { position: relative; }
.log-row > td:first-child {
  position: relative;
  padding-left: 22px !important;
}
.log-row > td:first-child::before {
  content: "";
  position: absolute;
  left: 6px; top: 10px; bottom: 10px;
  width: 3px;
  border-radius: 3px;
  background: var(--text-faint);
  opacity: .55;
}
.log-row.sev-critical > td:first-child::before { background: linear-gradient(180deg, #ff6b7a, #a08bff); opacity: .95; box-shadow: 0 0 8px rgba(255,107,122,.5); }
.log-row.sev-error    > td:first-child::before { background: var(--error); opacity: .85; }
.log-row.sev-warn     > td:first-child::before { background: var(--warning); opacity: .8; }
.log-row.sev-info     > td:first-child::before { background: var(--accent-2); opacity: .7; }

.log-row.sev-critical:hover td { background: rgba(255,107,122,.04); }
.log-row.sev-error:hover    td { background: rgba(255,107,122,.03); }
.log-row.sev-warn:hover     td { background: rgba(255,196,107,.04); }
.log-row.sev-info:hover     td { background: rgba(160,139,255,.04); }

/* Small uppercase severity chip in the time cell */
.sev-tag {
  display: inline-block;
  padding: 1px 7px;
  margin-right: 8px;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  vertical-align: 1px;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
}
.sev-tag.sev-critical { background: rgba(255,107,122,.15); color: #ff9aa5; border: 1px solid rgba(255,107,122,.3); }
.sev-tag.sev-error    { background: rgba(255,107,122,.10); color: var(--error);   border: 1px solid rgba(255,107,122,.25); }
.sev-tag.sev-warn     { background: rgba(255,196,107,.10); color: var(--warning); border: 1px solid rgba(255,196,107,.30); }
.sev-tag.sev-info     { background: rgba(160,139,255,.10); color: var(--accent-2); border: 1px solid rgba(160,139,255,.30); }

.log-msg { display: flex; align-items: flex-start; gap: 10px; }
.log-msg .log-text {
  color: var(--error);
  font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
  flex: 1;
}
.log-row.sev-warn     .log-msg .log-text { color: var(--warning); }
.log-row.sev-info     .log-msg .log-text { color: var(--text); }
.log-row.sev-critical .log-msg .log-text { color: #ff9aa5; }

.log-count {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(160,139,255,.12);
  color: var(--accent-2);
  border: 1px solid rgba(160,139,255,.25);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  animation: countPop .35s cubic-bezier(.2,1.6,.4,1);
}
@keyframes countPop {
  0%   { transform: scale(.4); opacity: 0; }
  100% { transform: scale(1);  opacity: 1; }
}

.mono { font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.error-msg { color: var(--error); font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 44px 20px !important;
}
.empty .face { margin: 0 auto 14px; display: block; }
.empty-title { color: var(--text); font-weight: 600; margin-bottom: 4px; }

/* ── Status pills ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.pill::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  opacity: .8;
}
.pill.online   { color: var(--accent);    background: rgba(92,240,195,.09);  border-color: rgba(92,240,195,.25); }
.pill.offline  { color: var(--text-faint);}
.pill.active   { color: var(--accent);    background: rgba(92,240,195,.09);  border-color: rgba(92,240,195,.25); }
.pill.warm     { color: var(--accent-3);  background: rgba(255,157,122,.09); border-color: rgba(255,157,122,.25); }
.pill.violet   { color: var(--accent-2);  background: rgba(160,139,255,.09); border-color: rgba(160,139,255,.25); }

/* Legacy classes still used in templates */
.status-dot { display: none; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge-green { background: rgba(92,240,195,.10); color: var(--accent); border-color: rgba(92,240,195,.25); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: rgba(160,139,255,.08); border-color: var(--accent-2); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #06110d;
  box-shadow: 0 8px 20px -8px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary:hover { filter: brightness(1.05); border: none; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: rgba(255,255,255,.05); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(160,139,255,.15);
}
.form-input:disabled { opacity: .5; cursor: not-allowed; }
.form-input-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.form-hint { display: block; margin-top: 6px; font-size: 11.5px; color: var(--text-faint); }

.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-group-grow { flex: 1; min-width: 200px; }
.form-group-end  { flex-shrink: 0; }

.filter-form { display: flex; gap: 8px; align-items: center; }
.upload-form .form-row { align-items: flex-end; }

.token-row { display: flex; gap: 8px; }
.token-row .form-input { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: 12px; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* ── Alerts ── */
.alert {
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 18px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
}
.alert a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.alert-error   { background: rgba(255,107,122,.08); border-color: rgba(255,107,122,.25); color: var(--error); }
.alert-warning { background: rgba(255,196,107,.07); border-color: rgba(255,196,107,.28); color: var(--warning); }

/* ── Login page ── */
.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 380px;
  padding: 36px 32px 30px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(23,29,45,.85), rgba(14,18,32,.85));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-align: center;
}
.login-face { margin: 0 auto 14px; display: block; }
.login-hello { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.login-hello .accent {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 6px 0 24px;
}
.login-card .form-group label {
  text-align: left;
}

/* ── Chart canvas polish ── */
canvas { max-width: 100%; }

/* Pulse the chart card when a new install event lands */
.card.chart-pulse {
  animation: chartPulse 1.1s ease-out;
}
@keyframes chartPulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-glow), 0 0 0 0 rgba(160,139,255,.3); border-color: var(--border); }
  25%  { box-shadow: 0 0 0 4px var(--accent-glow), 0 0 40px 4px rgba(160,139,255,.35); border-color: var(--accent); }
  100% { box-shadow: 0 0 0 0 transparent, 0 0 0 0 transparent; border-color: var(--border); }
}
.card.chart-pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 0%, var(--accent-glow) 45%, transparent 90%);
  transform: translateX(-100%);
  animation: chartSweep 1.1s ease-out;
  mix-blend-mode: overlay;
}
.card.chart-pulse { position: relative; }
@keyframes chartSweep {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* ── First-run setup modal ── */
.setup-modal[hidden] { display: none !important; }
.setup-modal {
  position: fixed; inset: 0;
  z-index: 200;
  display: grid;
  place-items: safe center;
  padding: 60px 20px 20px;
  overflow-y: auto;
  opacity: 1;
  animation: setupIn .22s ease both;
}
@keyframes setupIn { from { opacity: 0 } to { opacity: 1 } }

.setup-backdrop {
  position: absolute; inset: 0;
  background: radial-gradient(1200px 600px at 30% 20%, rgba(92,240,195,.12), transparent 60%),
              radial-gradient(1000px 500px at 70% 90%, rgba(160,139,255,.14), transparent 60%),
              rgba(6,10,20,.75);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
}

.setup-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 30px 30px 24px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(23,29,45,.94), rgba(14,18,32,.94));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  text-align: left;
  animation: setupCardIn .28s cubic-bezier(.2,1.2,.4,1) both;
  overflow: visible;
}
@keyframes setupCardIn {
  from { transform: translateY(12px) scale(.98); }
  to   { transform: translateY(0)    scale(1); }
}

.setup-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  z-index: 3;
  transition: color .15s, background .15s, transform .15s;
}
.setup-close:hover { color: var(--text); background: rgba(255,107,122,.10); border-color: rgba(255,107,122,.3); }
.setup-close:active { transform: scale(.94); }

.setup-face {
  position: relative;
  display: grid; place-items: center;
  width: 96px; height: 96px;
  margin: -66px auto 14px;
  border-radius: 26px;
  background: linear-gradient(140deg, rgba(92,240,195,.18), rgba(160,139,255,.14));
  border: 1px solid var(--border);
  box-shadow: 0 14px 34px -12px rgba(0,0,0,.55), 0 0 0 6px rgba(19,24,38,.6);
  animation: gentle 6s ease-in-out infinite;
}
.setup-face svg { transition: transform .35s cubic-bezier(.2,1.6,.4,1); }
.setup-face.react svg { animation: faceBounce .55s cubic-bezier(.2,1.6,.4,1); }
@keyframes faceBounce {
  0%   { transform: scale(1) rotate(0); }
  30%  { transform: scale(1.14) rotate(-6deg); }
  60%  { transform: scale(.96) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
.setup-face-spark {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  opacity: 0;
  pointer-events: none;
}
.setup-face.react .setup-face-spark {
  animation: spark .6s ease-out forwards;
}
.setup-face-spark.s1 { top: 8px;  left: 10px; background: var(--accent);   animation-delay: 0s; }
.setup-face-spark.s2 { top: 14px; right: 6px; background: var(--accent-2); animation-delay: .05s; }
.setup-face-spark.s3 { bottom: 10px; left: 14px; background: var(--accent-3); animation-delay: .10s; }
@keyframes spark {
  0%   { transform: scale(0) translate(0,0);      opacity: 0; }
  30%  { transform: scale(1.4) translate(-8px,-8px); opacity: 1; }
  100% { transform: scale(0) translate(-16px,-16px); opacity: 0; }
}

/* Progress */
.setup-progress {
  position: relative;
  margin: 6px auto 22px;
  width: 220px;
}
.sp-bar {
  height: 3px;
  background: rgba(255,255,255,.06);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.sp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  border-radius: 999px;
  transition: width .38s cubic-bezier(.4,.1,.3,1);
  box-shadow: 0 0 12px var(--accent-glow);
}
.sp-dots {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sp-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #212639;
  border: 2px solid var(--panel-2);
  transition: transform .3s, background .3s;
}
.sp-dot.active  { background: var(--accent); }
.sp-dot.current { transform: scale(1.4); box-shadow: 0 0 0 4px rgba(255,255,255,.06); }

/* Step containers */
.setup-steps {
  position: relative;
  min-height: 240px;
  overflow: hidden;
}
.setup-step {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
}
.setup-step.active {
  display: flex;
  animation: stepStay .01s;
}
.setup-step.enter-right { animation: stepEnterRight .38s cubic-bezier(.2,1.1,.35,1) both; }
.setup-step.enter-left  { animation: stepEnterLeft  .38s cubic-bezier(.2,1.1,.35,1) both; }
.setup-step.leave-left  { display: flex; animation: stepLeaveLeft  .34s ease both; }
.setup-step.leave-right { display: flex; animation: stepLeaveRight .34s ease both; }
@keyframes stepEnterRight {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes stepEnterLeft {
  from { opacity: 0; transform: translateX(-28px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes stepLeaveLeft {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-28px); }
}
@keyframes stepLeaveRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(28px); }
}

.setup-eyebrow {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 6px;
}
.setup-eyebrow.accent-eyebrow {
  color: var(--accent-3);
}
.setup-title {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 6px;
}
.setup-title .accent {
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.setup-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 4px auto 20px;
  max-width: 40ch;
}

.setup-input {
  text-align: center;
  font-size: 17px;
  padding: 14px 16px;
  border-radius: 14px;
  letter-spacing: 0.01em;
}
.setup-input:focus {
  transform: translateY(-1px);
  box-shadow: 0 0 0 4px rgba(160,139,255,.18);
}

/* Quick picks under address input */
.quick-picks {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.qp {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.qp:hover { color: var(--text); border-color: var(--accent-2); }
.qp.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(92,240,195,.10);
}

.swatches { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.sw {
  --c: #5cf0c3;
  width: 46px; height: 46px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--c);
  cursor: pointer;
  position: relative;
  transition: transform .2s cubic-bezier(.2,1.6,.4,1), box-shadow .2s;
  box-shadow: 0 4px 14px -6px rgba(0,0,0,.4);
  animation: swIn .32s cubic-bezier(.2,1.4,.4,1) both;
}
.setup-step[data-step="2"].active .sw:nth-child(1) { animation-delay: .02s }
.setup-step[data-step="2"].active .sw:nth-child(2) { animation-delay: .06s }
.setup-step[data-step="2"].active .sw:nth-child(3) { animation-delay: .10s }
.setup-step[data-step="2"].active .sw:nth-child(4) { animation-delay: .14s }
.setup-step[data-step="2"].active .sw:nth-child(5) { animation-delay: .18s }
.setup-step[data-step="2"].active .sw:nth-child(6) { animation-delay: .22s }
@keyframes swIn { from { opacity: 0; transform: translateY(10px) scale(.7); } to { opacity: 1; transform: none; } }

.sw:hover { transform: translateY(-3px) scale(1.06); }
.sw:active { transform: translateY(0) scale(.95); }
.sw.active {
  border-color: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,.10),
              0 10px 28px -6px var(--c);
  transform: translateY(-2px) scale(1.05);
}
.sw.active::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12l5 5 9-11'/></svg>") center/22px no-repeat;
  opacity: .75;
  animation: checkIn .28s cubic-bezier(.2,1.6,.4,1) both;
}
@keyframes checkIn { from { opacity: 0; transform: scale(.4); } to { opacity: .75; transform: scale(1); } }

.chips { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.chip {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s cubic-bezier(.2,1.4,.4,1);
  animation: swIn .32s cubic-bezier(.2,1.4,.4,1) both;
}
.setup-step[data-step="3"].active .chip:nth-child(1) { animation-delay: .02s }
.setup-step[data-step="3"].active .chip:nth-child(2) { animation-delay: .07s }
.setup-step[data-step="3"].active .chip:nth-child(3) { animation-delay: .12s }
.setup-step[data-step="3"].active .chip:nth-child(4) { animation-delay: .17s }
.chip:hover { color: var(--text); border-color: var(--accent-2); transform: translateY(-2px); }
.chip:active { transform: translateY(0) scale(.96); }
.chip.active {
  color: #06110d;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 8px 20px -8px var(--accent-glow);
  transform: translateY(-2px);
}

.setup-preview {
  margin: 4px 0 8px;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(92,240,195,.06), rgba(160,139,255,.06));
  border: 1px dashed var(--border);
  animation: previewIn .5s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes previewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.sp-eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 6px;
}
.sp-line {
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

/* Wizard navigation */
.setup-nav {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.setup-nav .btn { padding: 11px 20px; border-radius: 12px; }
.setup-nav .btn:disabled {
  opacity: 0;
  pointer-events: none;
}
.btn-next {
  position: relative;
  overflow: hidden;
}
.btn-next::before {
  content: "";
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-20deg);
  transition: left .55s;
}
.btn-next:hover::before { left: 130%; }
.btn-next.is-final {
  animation: finalPulse 1.8s ease-in-out infinite;
}
@keyframes finalPulse {
  0%,100% { box-shadow: 0 8px 20px -8px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.25); }
  50%     { box-shadow: 0 12px 30px -6px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.25); }
}

.setup-modal.closing { animation: setupOut .22s ease both; }
@keyframes setupOut { to { opacity: 0; } }

/* ── Bool toggles (build page extra-perms) ───────────── */
.bool-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}
.bool-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface-2, rgba(255,255,255,.04));
  transition: background .15s;
  cursor: pointer;
  user-select: none;
}
.bool-row:hover { background: rgba(160,139,255,.08); }
.bool-row span {
  font-size: 13.5px;
  color: var(--text);
}
/* iOS-style pill switch */
.bool-switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}
.bool-switch input { display: none; }
.bool-track {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  background: var(--border);
  transition: background .2s;
}
.bool-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
  transition: transform .2s;
}
.bool-switch input:checked ~ .bool-track { background: var(--accent); }
.bool-switch input:checked ~ .bool-thumb { transform: translateX(16px); }

/* ── Build page ───────────────────────────────────────── */
.build-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
}
.build-card { position: relative; }
.build-card.saved { animation: buildSaved 1.2s ease-out; }
@keyframes buildSaved {
  0%   { box-shadow: 0 0 0 0 var(--accent-glow); }
  30%  { box-shadow: 0 0 0 4px var(--accent-glow), 0 0 30px var(--accent-glow); border-color: var(--accent); }
  100% { box-shadow: 0 0 0 0 transparent; border-color: var(--border); }
}

/* Faux Android home-screen launcher preview */
.launcher-preview {
  margin-bottom: 20px;
  padding: 24px 20px 18px;
  border-radius: 14px;
  background:
    radial-gradient(600px 180px at 50% 0%, rgba(160,139,255,.16), transparent 55%),
    radial-gradient(600px 180px at 50% 100%, rgba(92,240,195,.12), transparent 55%),
    linear-gradient(160deg, rgba(14,18,32,.9), rgba(10,13,22,.9));
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}
.launcher-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}
.lp-frame {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.lp-glow {
  position: absolute;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  filter: blur(20px);
  top: -10px;
  z-index: -1;
  animation: lpBreathe 4s ease-in-out infinite;
}
@keyframes lpBreathe { 0%,100%{opacity:.6} 50%{opacity:1} }

.lp-icon {
  width: 84px; height: 84px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(92,240,195,.12), rgba(160,139,255,.08));
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid; place-items: center;
  box-shadow: 0 14px 30px -12px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.06);
  transition: transform .3s cubic-bezier(.2,1.6,.4,1);
}
.lp-icon img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.launcher-preview:hover .lp-icon { transform: translateY(-2px) rotate(-3deg); }

.lp-name {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.lp-caption {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.lbl-hint {
  font-size: 10.5px;
  color: var(--text-faint);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}
.lbl-hint .mono { font-size: 11px; color: var(--accent-2); }

.build-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
  flex-wrap: wrap;
}

/* Autosave status pill in the card header */
[data-field="autosave-status"] {
  font-size: 11px;
  color: var(--text-faint);
  transition: color .2s;
}
[data-field="autosave-status"].ok  { color: var(--accent); }
[data-field="autosave-status"].err { color: #ff9d7a; }

.install-log {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,.28);
  overflow: hidden;
}
.install-log .il-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.install-log .il-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .04em;
}
.install-log .il-title .il-ok  { color: var(--accent);  }
.install-log .il-title .il-err { color: #ff9d7a; }
.install-log .il-body {
  margin: 0;
  padding: 12px 14px;
  max-height: 320px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Compact dropzone variant for build page */
.dropzone.dropzone-sm {
  padding: 18px 16px;
}
.dropzone.dropzone-sm .dz-icon {
  width: 44px; height: 44px;
  margin-bottom: 8px;
}
.dropzone.dropzone-sm .dz-title { font-size: 13.5px; }
.dropzone.dropzone-sm .dz-sub   { font-size: 12px; }

/* ── APK dropzone ─────────────────────────────────────── */
.dropzone {
  position: relative;
  margin-top: 4px;
  padding: 32px 24px;
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.015);
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
  overflow: hidden;
}
.dropzone:hover { border-color: var(--accent-2); background: rgba(160,139,255,.05); }
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(92,240,195,.08);
  transform: scale(1.01);
  box-shadow: 0 0 0 4px rgba(92,240,195,.12), 0 12px 30px -14px var(--accent-glow);
}
.dropzone.has-file { border-style: solid; border-color: var(--accent); background: rgba(92,240,195,.05); }
.dropzone.uploading { pointer-events: none; opacity: .85; }

.dz-icon {
  display: inline-grid; place-items: center;
  width: 56px; height: 56px;
  margin-bottom: 12px;
  border-radius: 16px;
  background: linear-gradient(140deg, rgba(92,240,195,.14), rgba(160,139,255,.10));
  border: 1px solid var(--border);
  color: var(--accent);
  transition: transform .2s;
}
.dropzone.dragover .dz-icon,
.dropzone.has-file .dz-icon { transform: translateY(-2px) rotate(-6deg); }

.dz-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.dz-sub {
  font-size: 13px;
  color: var(--text-muted);
}
.dz-sub .link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.dz-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(255,255,255,.04);
}
.dz-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .15s linear;
  box-shadow: 0 0 10px var(--accent-glow);
}
.upload-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

/* ── Dashboard onboarding ─────────────────────────────── */
.card.onboard {
  padding: 26px 28px;
  border: 1px dashed var(--border);
  background: linear-gradient(160deg, rgba(23,29,45,.7), rgba(19,24,38,.7));
}
.onboard-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 22px;
  align-items: flex-start;
}
.onboard-face {
  display: grid; place-items: center;
  width: 84px; height: 84px;
  border-radius: 22px;
  background: linear-gradient(140deg, rgba(92,240,195,.14), rgba(160,139,255,.10));
  border: 1px solid var(--border);
  animation: gentle 6s ease-in-out infinite;
  flex-shrink: 0;
}
.onboard-face .face { width: 64px; height: 64px; }
.onboard-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 6px;
}
.onboard-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 18px;
}
.onboard-title .accent {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.onboard-steps {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 14px;
}
.onboard-steps li {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: start;
}
.onboard-steps .os-num {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: 10px;
  background: rgba(160,139,255,.15);
  color: var(--accent-2);
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.onboard-steps .os-title { color: var(--text); font-weight: 600; margin-bottom: 2px; }
.onboard-steps .os-body  { color: var(--text-muted); font-size: 13px; line-height: 1.45; }
.onboard-steps a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ── Star field (login) ───────────────────────────────── */
.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, #10162a 0%, var(--bg) 60%);
}
.aurora-bg.aurora-dim .aurora-blob { opacity: .10; }
.login-body { position: relative; }
.login-body > .login-card { position: relative; z-index: 2; }
.login-body > .starfield { z-index: 0; }
.login-body > .aurora-bg { z-index: 1; }

/* ── Confetti ─────────────────────────────────────────── */
.nimbus-confetti {
  position: fixed;
  background: var(--c, #5cf0c3);
  border-radius: 2px;
  pointer-events: none;
  z-index: 300;
  transform: translate(-50%, -50%);
  animation: confettiFly cubic-bezier(.15,.6,.4,1) both;
  box-shadow: 0 0 8px rgba(0,0,0,.15);
}
@keyframes confettiFly {
  0%   { opacity: 1; transform: translate(-50%, -50%) rotate(0); }
  60%  { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx, 0px)),
                         calc(-50% + var(--dy, 0px) + 260px))
               rotate(var(--rot, 0deg));
  }
}

/* ── Toasts ───────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 220;
  display: flex; flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
  max-width: 340px;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(23,29,45,.94), rgba(14,18,32,.96));
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px -14px rgba(0,0,0,.55), 0 6px 14px -6px rgba(0,0,0,.4);
  color: var(--text);
  font-size: 13px;
  min-width: 240px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateX(120%) scale(.96);
  transition: transform .34s cubic-bezier(.2,1.35,.4,1), opacity .25s;
  cursor: pointer;
}
.toast.in  { opacity: 1; transform: translateX(0) scale(1); }
.toast.out { opacity: 0; transform: translateX(30%) scale(.98); }
.toast .t-icon {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.toast-success .t-icon { background: rgba(92,240,195,.14); color: var(--accent); }
.toast-error   .t-icon { background: rgba(255,107,122,.14); color: var(--error); }
.toast-info    .t-icon { background: rgba(160,139,255,.14); color: var(--accent-2); }
.toast .t-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.toast .t-title {
  font-weight: 600; font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.toast .t-msg { color: var(--text); line-height: 1.4; word-wrap: break-word; }

/* ── Midnight easter ──────────────────────────────────── */
#hero-clock.midnight { animation: midnightWink 2.4s ease-in-out; }
@keyframes midnightWink {
  0%,100% { color: var(--text-muted); text-shadow: none; }
  25%     { color: var(--accent);   text-shadow: 0 0 14px var(--accent-glow); }
  50%     { color: var(--accent-2); text-shadow: 0 0 14px rgba(160,139,255,.5); }
  75%     { color: var(--accent-3); text-shadow: 0 0 14px rgba(255,157,122,.5); }
}
.face.wink-now { animation: winkFace 1.2s ease-in-out; transform-origin: center; }
@keyframes winkFace {
  0%,100% { transform: scale(1) rotate(0); }
  30%     { transform: scale(1.15) rotate(-8deg); }
  60%     { transform: scale(.95) rotate(6deg); }
}

/* ── Tour (spotlight overlay) ─────────────────────────── */
.tour-backdrop {
  position: fixed; inset: 0;
  z-index: 190;
  background: transparent;
  pointer-events: auto;
  opacity: 0;
  transition: opacity .3s ease;
}
.tour-backdrop.in { opacity: 1; }
.tour-spot {
  position: fixed;
  z-index: 191;
  border-radius: 14px;
  background: transparent;
  box-shadow:
    0 0 0 9999px rgba(6,10,20,.72),
    0 0 0 2px var(--accent),
    0 0 24px var(--accent-glow);
  pointer-events: none;
  transition: all .38s cubic-bezier(.2,1.2,.4,1), opacity .3s;
}
.tour-tip {
  position: fixed;
  z-index: 192;
  width: 280px;
  max-width: calc(100vw - 40px);
  padding: 14px 16px 12px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(23,29,45,.96), rgba(14,18,32,.96));
  border: 1px solid var(--border);
  box-shadow: 0 20px 48px -14px rgba(0,0,0,.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity .28s ease, transform .28s cubic-bezier(.2,1.3,.4,1);
  opacity: 0;
  transform: translateY(6px);
}
.tour-tip.in { opacity: 1; transform: none; }
.tour-tip .tt-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  background: linear-gradient(90deg, var(--text), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tour-tip .tt-body {
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.45;
  margin-bottom: 14px;
}
.tour-tip .tt-nav {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
}
.tour-tip .tt-progress {
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.tour-tip .tt-buttons { display: flex; gap: 6px; }
.tour-tip .tt-buttons .btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

/* ── Radial (pie) menu ────────────────────────────────── */
.radial-host {
  position: fixed; inset: 0;
  z-index: 240;
  pointer-events: auto;
  background: radial-gradient(circle at 50% 50%, rgba(6,10,20,.35), rgba(6,10,20,.55));
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .18s ease;
}
.radial-host.open    { opacity: 1; }
.radial-host.closing { opacity: 0; pointer-events: none; }

/* Ripple that expands from the click point */
.radial-ripple {
  position: absolute;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  opacity: .8;
}
.radial-host.open .radial-ripple {
  animation: radialRipple .55s cubic-bezier(.2,1.2,.4,1) forwards;
}
@keyframes radialRipple {
  0%   { transform: translate(-50%, -50%) scale(0);  opacity: .8; }
  60%  { opacity: .35; }
  100% { transform: translate(-50%, -50%) scale(14); opacity: 0; }
}

/* Center label at the click point */
.radial-center {
  position: absolute;
  transform: translate(-50%, -50%) scale(.7);
  pointer-events: none;
  text-align: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(23,29,45,.9);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px -10px rgba(0,0,0,.6);
  opacity: 0;
  transition: opacity .22s .12s ease, transform .28s .12s cubic-bezier(.2,1.4,.4,1);
  white-space: nowrap;
}
.radial-host.open .radial-center { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.radial-center .rc-title {
  font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
}
.radial-center .rc-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Orbit buttons */
.radial-btn {
  position: absolute;
  --c: var(--accent);
  --tx: 0px; --ty: 0px;
  width: 52px; height: 52px;
  margin-left: -26px; margin-top: -26px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(160deg,
    color-mix(in srgb, var(--c) 40%, #131826),
    color-mix(in srgb, var(--c) 10%, #131826));
  color: var(--c);
  box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--c) 60%, transparent),
              inset 0 0 0 1px color-mix(in srgb, var(--c) 40%, transparent);
  display: grid; place-items: center;
  cursor: pointer;
  opacity: 0;
  transform: translate(0, 0) scale(.3);
  transition: box-shadow .18s, transform .18s;
  animation: radialBtnIn .38s cubic-bezier(.2,1.5,.35,1) forwards;
}
.radial-host.closing .radial-btn {
  animation: radialBtnOut .22s ease forwards;
}
@keyframes radialBtnIn {
  0%   { opacity: 0; transform: translate(0,0) scale(.3); }
  100% { opacity: 1; transform: translate(var(--tx), var(--ty)) scale(1); }
}
@keyframes radialBtnOut {
  0%   { opacity: 1; transform: translate(var(--tx), var(--ty)) scale(1); }
  100% { opacity: 0; transform: translate(0,0) scale(.3); }
}
.radial-btn:hover {
  transform: translate(var(--tx), var(--ty)) scale(1.14);
  box-shadow: 0 14px 30px -8px color-mix(in srgb, var(--c) 65%, transparent),
              inset 0 0 0 1px var(--c),
              0 0 22px color-mix(in srgb, var(--c) 45%, transparent);
}
.radial-btn:active { transform: translate(var(--tx), var(--ty)) scale(.94); }

.radial-btn .rb-icon { display: grid; place-items: center; }
.radial-btn .rb-label {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(19,24,38,.94);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11.5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s;
}
.radial-btn:hover .rb-label { opacity: 1; }

/* Clickable device rows */
tr.device-row { cursor: pointer; }
tr.device-row:hover td:first-child { color: var(--accent); }

/* Row focus flash after "Открыть в фильтре" action */
.row-focus > td {
  background: color-mix(in srgb, var(--accent) 12%, transparent) !important;
  animation: rowFocus 2.2s ease;
}
@keyframes rowFocus {
  0%,100% { box-shadow: inset 0 0 0 0 transparent; }
  20%,60% { box-shadow: inset 3px 0 0 0 var(--accent); }
}

/* ── Info card popover ────────────────────────────────── */
.info-card {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -46%) scale(.96);
  z-index: 250;
  width: min(360px, calc(100vw - 40px));
  padding: 20px 22px 18px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(23,29,45,.96), rgba(14,18,32,.96));
  border: 1px solid var(--border);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.7), 0 12px 20px -10px rgba(0,0,0,.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity .22s ease, transform .28s cubic-bezier(.2,1.3,.4,1);
}
.info-card.in { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.info-card .ic-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.info-card .ic-close:hover { color: var(--text); background: rgba(255,107,122,.10); border-color: rgba(255,107,122,.3); }
.info-card .ic-title {
  font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-right: 32px;
  word-break: break-all;
  background: linear-gradient(90deg, var(--text), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.info-card .ic-rows { display: grid; gap: 8px; }
.info-card .ic-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.info-card .ic-row:last-child { border-bottom: none; }
.info-card .ic-k { color: var(--text-muted); text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.14em; align-self: center; }
.info-card .ic-v { color: var(--text); word-break: break-all; }

/* ── Small screens ── */
@media (max-width: 720px) {
  :root { --rail-w: 64px; }
  .content { padding: 20px 18px 30px; }
  .hero {
    grid-template-columns: 1fr;
    padding: 22px;
    gap: 18px;
  }
  .hero-title { font-size: 24px; }
  .hero-clock { font-size: 42px; }
  .hero-right {
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--border-soft);
    padding-top: 14px;
    align-items: flex-start;
  }
  .rail-item[data-tip]::after { display: none; }
}

/* ─────────────────────────────────────────────────────────
   Users / teams / login tabs / top user chip
   ───────────────────────────────────────────────────────── */

/* Login tabs — switch between "login+password" and "owner key" */
.login-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  margin-bottom: 14px;
}
.login-tab {
  flex: 1;
  padding: 8px 10px;
  border: none; background: transparent;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.login-tab:hover { color: var(--text); }
.login-tab.active {
  background: rgba(160,139,255,.14);
  color: var(--text);
}
.login-form { display: none; }
.login-form.active { display: block; }

/* Top-centre user chip (avatar + nick + role) */
.user-chip {
  position: fixed;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  z-index: 850;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(20,24,36,.85), rgba(15,18,28,.9));
  backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 8px 24px -12px rgba(0,0,0,.5);
}
.uc-avatar {
  position: relative;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: rgba(255,255,255,.13);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.uc-avatar:hover { transform: scale(1.05); }
.uc-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.uc-fallback { font-weight: 700; font-size: 13px; color: var(--text-muted); }
.uc-cam {
  position: absolute; right: -2px; bottom: -2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  color: #06110d;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #0d1220;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.uc-avatar:hover .uc-cam { opacity: 1; }
.uc-meta {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  color: inherit; text-decoration: none;
  line-height: 1.1;
}
.uc-nick {
  font-size: 12.5px; font-weight: 700; color: var(--text);
}
.uc-role {
  margin-top: 2px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255,255,255,.05);
  color: var(--text-faint);
}
.uc-role-owner {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06110d;
}

/* Users list page */
.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.user-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(160deg, rgba(23,29,45,.85), rgba(19,24,38,.85));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; flex-direction: column; gap: 12px;
}
.uc-block {
  display: flex; align-items: center; gap: 12px;
  color: inherit; text-decoration: none;
}
.uc-av-lg, .uc-av-xl {
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255,255,255,.13);
  border: 1px solid var(--border-soft);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-weight: 700;
  flex-shrink: 0;
}
.uc-av-lg { width: 44px; height: 44px; font-size: 16px; }
.uc-av-xl { width: 96px; height: 96px; font-size: 32px; }
.uc-av-lg img, .uc-av-xl img { width: 100%; height: 100%; object-fit: cover; }
.uc-nick-lg { font-weight: 700; font-size: 15px; color: var(--text); }
.uc-role-lg { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); margin-top: 2px; }
.uc-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  border-top: 1px solid var(--border-soft);
  padding-top: 10px;
}
.uc-stats > div {
  display: flex; flex-direction: column; align-items: center;
}
.s-num { font-weight: 700; font-size: 15px; color: var(--text); }
.s-num.accent { color: var(--accent); }
.s-lbl { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; }
.uc-actions {
  display: flex; gap: 6px;
  border-top: 1px solid var(--border-soft);
  padding-top: 10px;
}
.uc-actions .btn { flex: 1; }

/* Modal shell (add-admin) */
.modal-shell {
  position: fixed; inset: 0; z-index: 950;
  display: flex; align-items: center; justify-content: center;
}
/* CSS `display: flex` overrides the HTML `hidden` attribute, so a modal
 * marked hidden in the template still shows. Restore the intent explicitly. */
.modal-shell[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  width: min(360px, 92vw);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(20,24,36,.98), rgba(15,18,28,.98));
  box-shadow: 0 24px 60px -18px rgba(0,0,0,.6);
}
.modal-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* Profile page layout */
.profile-grid {
  display: grid; grid-template-columns: 1fr;
  gap: 14px; margin-top: 18px;
}
.profile-hero {
  display: flex; align-items: center; gap: 20px;
  padding: 20px;
}
.profile-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; flex: 1;
}
.profile-stats > div {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px;
}
.profile-stats .s-num { font-size: 22px; }

.hourly-chart {
  display: grid; grid-template-columns: repeat(24, 1fr);
  gap: 3px; height: 120px; align-items: end;
  padding-top: 8px;
}
.hb {
  height: 100%;
  display: flex; align-items: flex-end;
  border-radius: 3px;
  background: rgba(255,255,255,.03);
  overflow: hidden;
}
.hb i {
  display: block; width: 100%;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  min-height: 2px;
  transition: filter .15s;
}
.hb:hover i { filter: brightness(1.2); }
.hourly-labels {
  display: flex; justify-content: space-between;
  margin-top: 6px;
  font-size: 10px; color: var(--text-faint); font-variant-numeric: tabular-nums;
}

/* Empty hints */
.empty-hint {
  padding: 12px; text-align: center; font-size: 12px; color: var(--text-faint);
  border: 1px dashed var(--border-soft); border-radius: 10px;
}

/* Teams list in settings */
.teams-list { display: flex; flex-direction: column; gap: 6px; }
.team-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: rgba(255,255,255,.02);
}
.tr-name { font-weight: 600; }

/* Small table */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--border-soft); }
.tbl th { font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.tbl .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

/* ─────────────────────────────────────────────────────────
   Floating YouTube music player
   ───────────────────────────────────────────────────────── */
.ytp {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 900;
  width: 288px;
  padding: 8px 10px 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(20,24,36,.92), rgba(15,18,28,.94));
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow:
    0 20px 60px -20px rgba(0,0,0,.55),
    0 0 0 1px rgba(255,255,255,.02) inset;
  color: var(--text);
  font-size: 13px;
  transition: box-shadow .2s;
}
.ytp.is-playing {
  box-shadow:
    0 20px 60px -20px rgba(0,0,0,.6),
    0 0 0 1px var(--accent-glow) inset;
}

.ytp-drag {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 2px 6px;
  cursor: grab;
  user-select: none;
}
.ytp-drag:active { cursor: grabbing; }
.ytp-title-tag {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
}
.ytp-spacer { flex: 1; }
.ytp-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.ytp-icon:hover { background: rgba(255,255,255,.05); color: var(--text); border-color: var(--border-soft); }
/* Make sure clicks land on the <button>, not on the inner <svg>. */
.ytp-icon svg,
.ytp-btn svg { pointer-events: none; }

/* Animated EQ bars */
.ytp-eq {
  display: inline-flex; align-items: flex-end; gap: 2px;
  width: 14px; height: 14px;
}
.ytp-eq i {
  flex: 1; height: 100%;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-radius: 2px;
  transform-origin: bottom;
  transform: scaleY(.35);
}
.ytp.is-playing .ytp-eq i {
  animation: ytpEq 900ms ease-in-out infinite;
}
.ytp.is-playing .ytp-eq i:nth-child(1) { animation-delay: 0ms; }
.ytp.is-playing .ytp-eq i:nth-child(2) { animation-delay: 180ms; }
.ytp.is-playing .ytp-eq i:nth-child(3) { animation-delay: 360ms; }
.ytp.is-playing .ytp-eq i:nth-child(4) { animation-delay: 540ms; }
@keyframes ytpEq {
  0%,100% { transform: scaleY(.3); }
  50%     { transform: scaleY(1); }
}

/* Main row */
.ytp-main {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 2px 8px;
}
.ytp-cover {
  width: 42px; height: 42px; flex: 0 0 42px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,.04);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
  border: 1px solid var(--border-soft);
}
.ytp-cover img { width: 100%; height: 100%; object-fit: cover; }
.ytp-meta { flex: 1; min-width: 0; }
.ytp-track {
  font-weight: 700; font-size: 12.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ytp-artist {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}

/* Progress */
.ytp-progress { padding: 0 2px 6px; cursor: pointer; }
.ytp-bar {
  height: 3px; border-radius: 2px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.ytp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%;
  transition: width .15s linear;
}
.ytp-time {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text-faint);
  margin-top: 3px; font-variant-numeric: tabular-nums;
}

/* Controls */
.ytp-ctrls {
  display: flex; align-items: center; gap: 2px;
  padding: 2px 2px 0;
}
.ytp-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.ytp-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }
.ytp-btn.active { color: var(--accent); }
.ytp-btn.active::after {
  content: '';
  position: absolute;
  bottom: 2px; left: 50%;
  transform: translateX(-50%);
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--accent);
}
.ytp-play {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06110d;
  box-shadow: 0 6px 16px -8px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.25);
  border: none;
  margin: 0 4px;
}
.ytp-play:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #06110d; }
.ytp-side { width: 22px; height: 22px; border-radius: 6px; }

.ytp-ctrls-spacer { flex: 1; }

.ytp-vol {
  position: relative;
  display: inline-flex; align-items: center;
  color: var(--text-faint);
}
/* Popup opens above the vol button. `.open` pins it while user is dragging. */
.ytp-vol-pop {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  padding: 10px 8px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(20,24,36,.98), rgba(15,18,28,.98));
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.55);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 10;
}
.ytp-vol:hover .ytp-vol-pop,
.ytp-vol-pop.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
/* Small hover bridge so pointer can travel from button to popup */
.ytp-vol-pop::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 100%; height: 8px;
}

.ytp-vol-slider {
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  writing-mode: bt-lr; /* legacy */
  width: 6px; height: 90px;
  background: rgba(255,255,255,.08);
  border-radius: 3px; outline: none; cursor: pointer;
}
.ytp-vol-slider::-webkit-slider-runnable-track {
  width: 6px; background: rgba(255,255,255,.08); border-radius: 3px;
}
.ytp-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid #0d1220; cursor: pointer;
}
.ytp-vol-slider::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid #0d1220; cursor: pointer;
}
.ytp-vol-num {
  font-size: 10px; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.ytp-vol-btn.muted { color: #ff9d7a; }

/* Search panel */
.ytp-search {
  border-top: 1px solid var(--border-soft);
  margin-top: 8px; padding-top: 10px;
}
.ytp-input {
  width: 100%; padding: 8px 12px; font-size: 12.5px;
  border-radius: 9px;
}
.ytp-results {
  margin-top: 8px;
  max-height: 260px;
  overflow: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.ytp-loading, .ytp-empty {
  padding: 12px; text-align: center; font-size: 12px; color: var(--text-faint);
}
.ytp-error {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px;
  border: 1px solid rgba(255,157,122,.28);
  background: rgba(255,157,122,.06);
  border-radius: 10px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}
.ytp-err-icon {
  color: #ff9d7a;
  flex: 0 0 18px;
  margin-top: 1px;
}
.ytp-err-body { flex: 1; min-width: 0; }
.ytp-err-head {
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}
.ytp-err-tail {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11.5px;
  word-break: break-word;
}
.ytp-err-tail code, .ytp-err-tail a {
  color: var(--accent);
  word-break: break-all;
}
.ytp-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px;
  border-radius: 9px;
  transition: background .12s;
}
.ytp-row:hover { background: rgba(255,255,255,.04); }
.ytp-row-thumb {
  width: 44px; height: 32px; object-fit: cover; border-radius: 5px; flex: 0 0 44px;
  background: rgba(255,255,255,.05);
}
.ytp-row-meta { flex: 1; min-width: 0; }
.ytp-row-title {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ytp-row-sub {
  font-size: 11px; color: var(--text-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
.ytp-row-btn {
  width: 28px; height: 28px; border-radius: 7px;
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  transition: background .12s, border-color .12s, color .12s;
}
.ytp-row-btn:hover { color: var(--text); border-color: var(--accent-2); }
.ytp-row-btn.primary {
  border-color: transparent;
  background: rgba(92,240,195,.14);
  color: var(--accent);
}
.ytp-row-btn.primary:hover { background: rgba(92,240,195,.24); }

/* Queue */
.ytp-queue {
  border-top: 1px solid var(--border-soft);
  margin-top: 8px; padding-top: 10px;
  max-height: 240px; overflow: auto;
  display: flex; flex-direction: column; gap: 3px;
}
.ytp-qrow {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 4px;
  border-radius: 8px;
}
.ytp-qrow.active { background: rgba(160,139,255,.10); }
.ytp-qi {
  width: 20px; text-align: center; font-size: 11px; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.ytp-qmeta { flex: 1; min-width: 0; }
.ytp-qt {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ytp-qs {
  font-size: 11px; color: var(--text-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Mini mode — hide search/queue/progress, keep essentials */
.ytp.ytp-mini { width: 280px; }
.ytp.ytp-mini .ytp-search,
.ytp.ytp-mini .ytp-queue,
.ytp.ytp-mini .ytp-progress { display: none; }
.ytp.ytp-mini .ytp-cover { width: 40px; height: 40px; flex-basis: 40px; }
.ytp.ytp-mini .ytp-vol-slider { width: 50px; }

/* Toggle chip when player hidden */
.ytp-toggle {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 900;
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(20,24,36,.9), rgba(15,18,28,.92));
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px -12px rgba(0,0,0,.5);
  transition: color .15s, transform .15s, border-color .15s;
}
.ytp-toggle:hover { color: var(--accent); border-color: var(--accent-2); transform: translateY(-1px); }

