/* ═══════════════════════════════════════════════════════════════════════════
   SnajuOS Control Panel — premium dark-glass theme.
   Base: deep near-black slate. Accent: cyan #22d3ee → teal → green gradient.
   Zero external deps; premium system font stack; inline-SVG icons.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --bg:        #0a0e14;
  --bg-2:      #0d1117;
  --bg-3:      #0f172a;
  --panel:     rgba(255, 255, 255, 0.035);
  --panel-2:   rgba(255, 255, 255, 0.06);
  --panel-3:   rgba(255, 255, 255, 0.09);
  --border:    rgba(255, 255, 255, 0.08);
  --border-2:  rgba(255, 255, 255, 0.12);
  --text:      #e6edf3;
  --muted:     #8b98a5;
  --muted-2:   #6b7684;
  --accent:    #22d3ee;
  --accent-2:  #2dd4bf;
  --accent-3:  #34d399;
  --accent-dk: #0e7490;
  --grad:      linear-gradient(120deg, #22d3ee 0%, #2dd4bf 50%, #34d399 100%);
  --grad-soft: linear-gradient(120deg, rgba(34,211,238,.9), rgba(52,211,153,.9));
  --green:     #34d399;
  --green-bg:  rgba(52, 211, 153, 0.13);
  --red:       #f87171;
  --red-bg:    rgba(248, 113, 113, 0.13);
  --amber:     #fbbf24;
  --amber-bg:  rgba(251, 191, 36, 0.13);
  --radius:    14px;
  --radius-lg: 20px;
  --nav-w:     248px;
  --glow:      0 0 0 1px rgba(34,211,238,.35), 0 0 22px rgba(34,211,238,.22);
  --shadow:    0 8px 30px rgba(0,0,0,.45), 0 1px 2px rgba(0,0,0,.6);
  --shadow-sm: 0 2px 12px rgba(0,0,0,.35);
  --font:      -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
               "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:      ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Ambient page glow behind everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(80% 60% at 78% -10%, rgba(34,211,238,.10), transparent 60%),
    radial-gradient(70% 50% at 0% 100%, rgba(52,211,153,.07), transparent 60%),
    var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #67e8f9; }

code, pre, .mono { font-family: var(--mono); }

::selection { background: rgba(34,211,238,.28); color: #fff; }

/* Slim custom scrollbars. */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.16) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.24); background-clip: padding-box; }

/* ── App shell ─────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.nav {
  width: var(--nav-w);
  flex: 0 0 var(--nav-w);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015));
  border-right: 1px solid var(--border);
  padding: 22px 16px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.brand .logo, .brand img.logo { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; }
.brand img.logo { object-fit: cover; box-shadow: 0 0 0 1px var(--border), 0 4px 16px rgba(0,0,0,.5); }
.brand .wordmark { display: flex; flex-direction: column; line-height: 1.05; }
.brand .wordmark .name {
  font-weight: 700; font-size: 19px; letter-spacing: .3px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--accent);
}
.brand .wordmark .sub { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 2px; margin-top: 3px; }

.nav-links { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-links a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  color: var(--muted);
  font-weight: 500; font-size: 14.5px;
  position: relative;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.nav-links a:hover { background: var(--panel-2); color: var(--text); }
.nav-links a.active {
  background: linear-gradient(90deg, rgba(34,211,238,.16), rgba(52,211,153,.06));
  color: #eafcff;
  box-shadow: inset 0 0 0 1px rgba(34,211,238,.25);
}
.nav-links a.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 3px; background: var(--grad);
  box-shadow: 0 0 10px rgba(34,211,238,.7);
}
.nav-links a .ico { width: 19px; height: 19px; flex: 0 0 19px; opacity: .95; display: inline-flex; }
.nav-links a.active .ico { color: var(--accent); }

.nav-foot { border-top: 1px solid var(--border); padding-top: 14px; font-size: 12px; color: var(--muted); }
.nav-foot .who { color: var(--text); font-weight: 600; }
.nav-foot a { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-weight: 600; }

/* ── Main ──────────────────────────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 15px 30px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,14,20,.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: .2px; }
.topbar .meta { display: flex; align-items: center; gap: 18px; font-size: 13px; color: var(--muted); }
.topbar .meta .host { display: inline-flex; align-items: center; gap: 7px; }
.topbar .meta .host .mono { color: var(--text); }

/* Live status pill in the top bar. */
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  background: var(--green-bg); color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(52,211,153,.28);
  transition: color .3s, background .3s, box-shadow .3s;
}
.status-pill .beacon {
  width: 8px; height: 8px; border-radius: 50%; background: currentColor;
  position: relative; box-shadow: 0 0 8px currentColor;
}
.status-pill .beacon::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid currentColor; opacity: .6;
  animation: beacon 2.2s ease-out infinite;
}
.status-pill.warn { background: var(--amber-bg); color: var(--amber); box-shadow: inset 0 0 0 1px rgba(251,191,36,.28); }
.status-pill.down { background: var(--red-bg); color: var(--red); box-shadow: inset 0 0 0 1px rgba(248,113,113,.28); }
@keyframes beacon { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(2.4); opacity: 0; } }

.content { padding: 28px 30px 56px; max-width: 1240px; width: 100%; }

/* ── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 24px;
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(34,211,238,.14), transparent 55%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  margin-bottom: 26px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(52,211,153,.16), transparent 65%);
  pointer-events: none;
}
.hero .logo, .hero img.logo { width: 72px; height: 72px; flex: 0 0 72px; border-radius: 16px; position: relative; z-index: 1; }
.hero img.logo { object-fit: cover; box-shadow: 0 0 0 1px var(--border-2), 0 8px 26px rgba(0,0,0,.5); }
.hero h2 { margin: 0 0 5px; font-size: 27px; letter-spacing: -.4px; position: relative; z-index: 1; }
.hero .greet { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero .tag { color: var(--muted); margin: 0; position: relative; z-index: 1; }
.hero .state { margin-left: auto; text-align: right; position: relative; z-index: 1; }

/* ── Cards / grid ──────────────────────────────────────────────────────── */
.grid { display: grid; gap: 18px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.card h3 { margin: 0 0 15px; font-size: 12.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); font-weight: 650; }

/* Stat cards with radial gauge. */
.card.stat { display: flex; align-items: center; gap: 18px; }
.card.stat .gauge-wrap { flex: 0 0 84px; }
.card.stat .stat-body { min-width: 0; }
.card.stat .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); font-weight: 600; }
.card.stat .value { font-size: 25px; font-weight: 700; margin: 3px 0 4px; letter-spacing: -.5px; }
.card.stat .value small { font-size: 14px; color: var(--muted); font-weight: 500; }
.card.stat .sub { font-size: 12px; color: var(--muted-2); }

/* Radial gauge (SVG). */
.gauge { width: 84px; height: 84px; transform: rotate(-90deg); }
.gauge .track { fill: none; stroke: rgba(255,255,255,.08); stroke-width: 8; }
.gauge .fill {
  fill: none; stroke: url(#gaugeGrad); stroke-width: 8; stroke-linecap: round;
  transition: stroke-dashoffset .7s cubic-bezier(.4,0,.2,1), stroke .3s;
}
.gauge-wrap { position: relative; }
.gauge-wrap .gauge-num {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; letter-spacing: -.3px;
}

.section-title { font-size: 12.5px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); margin: 34px 0 14px; font-weight: 650; }

/* Quick-action tiles. */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tile {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text); font-weight: 600;
  transition: border-color .18s, transform .18s, box-shadow .18s, background .18s;
  box-shadow: var(--shadow-sm);
}
.tile:hover { border-color: rgba(34,211,238,.5); transform: translateY(-2px); box-shadow: var(--glow), var(--shadow-sm); color: var(--text); }
.tile .t-ico {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(34,211,238,.18), rgba(52,211,153,.12));
  color: var(--accent); box-shadow: inset 0 0 0 1px rgba(34,211,238,.25);
}
.tile .t-ico svg { width: 22px; height: 22px; }
.tile .t-body { display: flex; flex-direction: column; line-height: 1.3; }
.tile .t-body small { font-weight: 500; color: var(--muted); font-size: 12px; }

/* ── Usage bars ────────────────────────────────────────────────────────── */
.bar { height: 8px; background: rgba(255,255,255,.06); border-radius: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--grad); border-radius: 6px; transition: width .7s cubic-bezier(.4,0,.2,1); box-shadow: 0 0 10px rgba(34,211,238,.4); }
.bar.warn > span { background: linear-gradient(90deg, #b45309, var(--amber)); box-shadow: 0 0 10px rgba(251,191,36,.4); }
.bar.crit > span { background: linear-gradient(90deg, #991b1b, var(--red)); box-shadow: 0 0 10px rgba(248,113,113,.4); }

/* ── Tables ────────────────────────────────────────────────────────────── */
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border); }
table.data th { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 650; }
table.data tbody tr, table.data tr { transition: background .14s; }
table.data tbody tr:hover { background: rgba(255,255,255,.025); }
table.data tr:last-child td { border-bottom: none; }
table.data td.name { font-weight: 600; }

/* Healthy pulse dot for service rows. */
.svc { display: inline-flex; align-items: center; gap: 9px; }
.svc .pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--green); position: relative; box-shadow: 0 0 8px var(--green); }
.svc .pulse.down { background: var(--red); box-shadow: 0 0 8px var(--red); }
.svc .pulse.warn { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.svc .pulse::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 1px solid currentColor; color: inherit; animation: beacon 2.4s ease-out infinite; }
.svc .pulse.down::after, .svc .pulse.warn::after { animation: none; opacity: 0; }

/* ── Status pills ──────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.pill.ok   { background: var(--green-bg); color: var(--green); }
.pill.down { background: var(--red-bg);   color: var(--red); }
.pill.warn { background: var(--amber-bg); color: var(--amber); }
.pill.muted{ background: rgba(148,163,184,.12); color: var(--muted); }

/* ── Buttons / forms ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 11px;
  padding: 10px 17px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s, transform .1s;
  font-family: inherit; text-decoration: none;
}
.btn:hover { border-color: rgba(34,211,238,.55); color: var(--text); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); color: #052027; border: none; box-shadow: 0 4px 18px rgba(34,211,238,.3); }
.btn.primary:hover { box-shadow: 0 6px 24px rgba(34,211,238,.45); color: #04191f; }
.btn.danger:hover { border-color: var(--red); color: var(--red); }
.btn-row { display: flex; gap: 11px; flex-wrap: wrap; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; font-weight: 600; }
.field input[type=text], .field input[type=password], .field input[type=number], .field select {
  width: 100%; padding: 11px 13px;
  background: rgba(0,0,0,.28); border: 1px solid var(--border-2);
  border-radius: 10px; color: var(--text); font-size: 14.5px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--muted-2); }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34,211,238,.16); }
.field.check { display: flex; align-items: center; gap: 10px; }
.field.check label { margin: 0; }
.field.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.notice { padding: 13px 16px; border-radius: 11px; margin-bottom: 20px; font-size: 14px; }
.notice.ok    { background: var(--green-bg); color: var(--green); border: 1px solid rgba(52,211,153,.3); }
.notice.err   { background: var(--red-bg);   color: var(--red);   border: 1px solid rgba(248,113,113,.3); }
.notice.info  { background: rgba(34,211,238,.10); color: var(--accent); border: 1px solid rgba(34,211,238,.3); }

/* ── Logs / preformatted ───────────────────────────────────────────────── */
pre.term {
  background: rgba(0,0,0,.45); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; overflow: auto; font-size: 13px; line-height: 1.6;
  color: #cbd5e1; max-height: 520px; white-space: pre-wrap; word-break: break-word;
}

.kv { display: grid; grid-template-columns: 180px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.muted { color: var(--muted); }
.mt { margin-top: 22px; }

/* ═══════════════════════════════════════════════════════════════════════
   Premium iOS-style toggle switch (used in wizard + settings)
   ═══════════════════════════════════════════════════════════════════════ */
.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex: 0 0 50px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 999px;
  background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1px var(--border-2);
  transition: background .25s, box-shadow .25s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 24px; width: 24px; left: 3px; top: 3px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.switch input:checked + .slider { background: var(--grad); box-shadow: inset 0 0 0 1px rgba(34,211,238,.4), 0 0 14px rgba(34,211,238,.35); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { box-shadow: inset 0 0 0 1px var(--border-2), 0 0 0 3px rgba(34,211,238,.3); }

.toggle-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px; border-radius: 13px;
  background: var(--panel); border: 1px solid var(--border);
  margin-bottom: 12px;
}
.toggle-row .tr-body { flex: 1; min-width: 0; }
.toggle-row .tr-body strong { display: block; font-size: 15px; }
.toggle-row .tr-body small { color: var(--muted); font-size: 12.5px; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .grid.cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --nav-w: 100%; }
  .app { flex-direction: column; }
  .nav {
    width: 100%; flex: none; height: auto; position: sticky; bottom: 0; top: auto;
    order: 2; flex-direction: row; align-items: center; gap: 0;
    padding: 8px 6px; border-right: none; border-top: 1px solid var(--border);
  }
  .nav .brand, .nav-foot { display: none; }
  .nav-links { flex-direction: row; justify-content: space-around; width: 100%; gap: 2px; }
  .nav-links a { flex-direction: column; gap: 4px; padding: 8px 6px; font-size: 10px; border-radius: 10px; }
  .nav-links a.active::before { display: none; }
  .nav-links a span:last-child { font-size: 10px; }
  .main { order: 1; }
  .grid.cols-4 { grid-template-columns: 1fr; }
  .hero { flex-direction: column; text-align: center; }
  .hero .state { margin: 0; text-align: center; }
  .kv { grid-template-columns: 1fr; }
  .topbar { padding: 13px 18px; }
  .content { padding: 22px 18px 40px; }
}

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