/* =============================================================================
   sky1128 Admin · Premium dark dashboard
   Design tokens: assets/design/skynet.css
   Fonts: Oxanium (headings) + Outfit (body) via Google Fonts
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Oxanium:wght@400;600;700;800&family=Outfit:wght@300;400;500;600;700&display=swap');

/* ===== DESIGN TOKENS (mirrors skynet.css — import vars, don't deviate) ===== */
:root {
  /* Backgrounds */
  --bg:        #070b12;
  --bg-2:      #05070c;
  --card:      #0f1724;
  --card-2:    #121d2d;

  /* Borders */
  --line:        rgba(148, 163, 184, .16);
  --line-strong: rgba(148, 163, 184, .28);
  /* Alias used in admin.js inline styles */
  --border: rgba(148, 163, 184, .16);

  /* Text */
  --text:    #eef6ff;
  --muted:   #8fa3b8;
  --muted-2: #9fb2c7;

  /* Brand accents */
  --accent:   #38bdf8;
  --accent-2: #60a5fa;
  --warn:     #f59e0b;
  --danger:   #f87171;
  --ok:       #34d399;

  /* Legacy aliases — used in admin.js via CSS var() in inline styles */
  --green: #34d399;
  --red:   #f87171;
  --amber: #f59e0b;
  --blue:  #38bdf8;

  /* Typography */
  --head: 'Oxanium', 'Outfit', system-ui, sans-serif;
  --body: 'Outfit', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  /* Alias — admin.js uses var(--font) implicitly via inherited font-family */
  --font: var(--body);

  /* Shape */
  --radius:      16px;
  --radius-sm:   10px;
  --radius-lg:   24px;
  --radius-pill: 999px;
  --gap:         18px;

  /* Elevation */
  --shadow:      0 24px 70px rgba(0, 0, 0, .38);
  --shadow-glow: 0 24px 70px rgba(56, 189, 248, .12);

  /* Layout */
  --sidebar-w:  240px;
  --topbar-h:   60px;
  /* Surface aliases so old admin.js inline styles using --surface still work */
  --surface:    rgba(11, 17, 28, .96);
  --surface2:   rgba(16, 25, 40, .92);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; scroll-behavior: smooth; }

/* ===== BASE BODY ===== */
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 0%, rgba(56, 189, 248, .14), transparent 34%),
    radial-gradient(circle at 88% 14%, rgba(245, 158, 11, .10), transparent 30%),
    linear-gradient(135deg, var(--bg-2), #0b1220 55%, var(--bg));
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== LAYOUT SHELL ===== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* =============================================================================
   SIDEBAR
   ============================================================================= */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg,
    rgba(9, 14, 24, .99) 0%,
    rgba(6, 10, 17, .99) 100%);
  border-right: 1px solid rgba(56, 189, 248, .10);
  box-shadow: 12px 0 40px rgba(0, 0, 0, .30);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, .14) transparent;
}

/* ===== BRAND ===== */
.brand {
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(56, 189, 248, .10);
  flex-shrink: 0;
}

.brand strong {
  display: block;
  font-family: var(--head);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.04em;
  background: linear-gradient(90deg, var(--text) 30%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand small {
  display: block;
  font-family: var(--head);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(56, 189, 248, .55);
  margin-top: 5px;
}

/* ===== SIDEBAR NAV ===== */
.sidebar nav {
  padding: 8px 0;
  flex: 1;
}

/* ===== NAV GROUPS ===== */
.nav-group {
  padding: 10px 0;
  border-bottom: 1px solid rgba(148, 163, 184, .06);
}

.nav-group > span,
.nav-group > summary {
  display: block;
  padding: 0 18px 7px;
  font-family: var(--head);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(143, 163, 184, .42);
  user-select: none;
}

.nav-group > summary {
  cursor: pointer;
  list-style: none;
  transition: color .15s;
}

.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::marker { display: none; }
.nav-group > summary:hover { color: rgba(143, 163, 184, .72); }

.sidebar button {
  display: block;
  width: calc(100% - 16px);
  margin: 1px 8px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: rgba(143, 163, 184, .70);
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all .16s ease;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar button:hover {
  background: rgba(56, 189, 248, .06);
  color: var(--text);
  border-color: rgba(56, 189, 248, .12);
}

.sidebar button.active {
  background: rgba(56, 189, 248, .10);
  color: var(--accent);
  border-color: rgba(56, 189, 248, .22);
  font-weight: 600;
}

/* ===== DANGER ZONE NAV ===== */
.nav-group.danger-zone {
  border-bottom-color: rgba(248, 113, 113, .08);
}

.nav-group.danger-zone > span {
  color: rgba(248, 113, 113, .42);
}

.nav-group.danger-zone button:hover {
  background: rgba(248, 113, 113, .07);
  color: var(--danger);
  border-color: rgba(248, 113, 113, .18);
}

.nav-group.danger-zone button.active {
  background: rgba(248, 113, 113, .10);
  color: var(--danger);
  border-color: rgba(248, 113, 113, .26);
}

/* ===== LINKS GROUP (details/summary) ===== */
.nav-group.links-group {
  border-bottom: none;
}

.links-group a {
  display: block;
  padding: 8px 12px 8px 26px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  color: rgba(143, 163, 184, .65);
  font-size: 12.5px;
  transition: all .15s;
  border: 1px solid transparent;
}

.links-group a:hover {
  background: rgba(96, 165, 250, .07);
  color: var(--text);
  border-color: rgba(96, 165, 250, .14);
  text-decoration: none;
}

/* ===== LOGOUT BTN ===== */
.logout-btn {
  display: block;
  width: calc(100% - 20px);
  margin: 12px 10px 14px;
  padding: 9px 14px;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 500;
  color: rgba(143, 163, 184, .55);
  border: 1px solid rgba(248, 113, 113, .12);
  border-radius: var(--radius);
  background: rgba(248, 113, 113, .04);
  text-align: center;
  cursor: pointer;
  transition: all .18s;
  flex-shrink: 0;
}

.logout-btn:hover {
  background: rgba(248, 113, 113, .09);
  border-color: rgba(248, 113, 113, .28);
  color: var(--danger);
}

/* =============================================================================
   TOPBAR
   ============================================================================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  height: var(--topbar-h);
  background: rgba(7, 11, 18, .70);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.topbar h1 {
  font-family: var(--head);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--text);
  white-space: nowrap;
  line-height: 1.2;
}

#page-subtitle {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

.me {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  line-height: 1.4;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line);
  white-space: nowrap;
  flex-shrink: 0;
}

.me strong {
  display: block;
  font-family: var(--head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--text);
}

/* =============================================================================
   STATUS STRIP
   ============================================================================= */
.status-strip {
  display: flex;
  gap: 8px;
  padding: 9px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 12, .50);
  flex-wrap: wrap;
  flex-shrink: 0;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(11, 17, 28, .70);
  font-family: var(--head);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  transition: all .15s;
}

.status-pill.ok {
  color: var(--ok);
  border-color: rgba(52, 211, 153, .28);
  background: rgba(52, 211, 153, .06);
}

.status-pill.warn {
  color: var(--warn);
  border-color: rgba(245, 158, 11, .28);
  background: rgba(245, 158, 11, .06);
}

.status-pill.muted {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(11, 17, 28, .50);
}

/* =============================================================================
   CONTENT AREA
   ============================================================================= */
.content {
  padding: 24px 28px 32px;
  flex: 1;
  min-width: 0;
}

/* ===== NOTICE BANNERS ===== */
.notice {
  padding: 13px 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(245, 158, 11, .22);
  border-radius: var(--radius);
  background: rgba(245, 158, 11, .05);
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.65;
}

.notice strong { color: var(--warn); }

/* =============================================================================
   CARDS
   ============================================================================= */
.card {
  background: linear-gradient(145deg, rgba(17, 29, 45, .92), rgba(9, 15, 25, .94));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  transition: border-color .2s;
}

.card:last-child { margin-bottom: 0; }
.card:hover { border-color: var(--line-strong); }

.card h2 {
  font-family: var(--head);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

/* ===== STAT CARDS ===== */
.grid.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

/* Power-stats variant — wider minimums for watt/cost values */
.grid.stats.power-stats {
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
}

.card.stat {
  padding: 16px 18px;
  margin: 0;
  background: linear-gradient(135deg, rgba(17, 29, 45, .88), rgba(9, 15, 25, .90));
  border: 1px solid var(--line);
  transition: all .2s ease;
}

.card.stat:hover {
  border-color: rgba(56, 189, 248, .22);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, .06), 0 8px 32px rgba(56, 189, 248, .06);
  transform: translateY(-1px);
}

.card.stat .label {
  font-family: var(--head);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.card.stat .value {
  font-family: var(--head);
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  letter-spacing: -.04em;
}

/* ===== TWO-COL GRID ===== */
.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.grid.two .card { margin-bottom: 0; }

/* =============================================================================
   TABLES
   ============================================================================= */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  text-align: left;
  padding: 8px 14px;
  font-family: var(--head);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, .07);
  vertical-align: middle;
  color: var(--text);
}

.table tr:last-child td { border-bottom: none; }

.table tbody tr {
  transition: background .12s;
}

.table tbody tr:hover {
  background: rgba(56, 189, 248, .04);
}

.table td strong {
  font-weight: 600;
  color: var(--text);
}

.table tr.file-row[data-open] { cursor: pointer; }
.table tr.file-row[data-open]:hover { background: rgba(96, 165, 250, .05); }

/* =============================================================================
   TOOLBAR
   ============================================================================= */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar h2 {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Count badge inside headings */
.count {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  font-family: var(--head);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
  background: rgba(148, 163, 184, .07);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
  text-transform: none;
}

/* File path display */
.path {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* Back/breadcrumb link */
.crumb {
  cursor: pointer;
  color: var(--accent);
  font-size: 13px;
  transition: opacity .15s;
  flex-shrink: 0;
}

.crumb:hover {
  opacity: .72;
  text-decoration: underline;
}

/* =============================================================================
   BADGES
   ============================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-family: var(--head);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid var(--line-strong);
  background: rgba(148, 163, 184, .06);
  color: var(--muted);
}

.badge.ok,
.badge.active {
  color: var(--ok);
  background: rgba(52, 211, 153, .08);
  border-color: rgba(52, 211, 153, .28);
}

.badge.bad,
.badge.used,
.badge.expired {
  color: var(--danger);
  background: rgba(248, 113, 113, .08);
  border-color: rgba(248, 113, 113, .26);
}

/* =============================================================================
   FILE TYPE TAGS
   ============================================================================= */
.type-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  margin-right: 5px;
  text-transform: uppercase;
  vertical-align: middle;
  letter-spacing: .04em;
}

.type-dir {
  color: var(--accent-2);
  background: rgba(96, 165, 250, .10);
  border: 1px solid rgba(96, 165, 250, .22);
}

.type-file {
  color: var(--muted);
  background: rgba(148, 163, 184, .07);
  border: 1px solid var(--line);
}

/* =============================================================================
   MUTED UTILITY
   ============================================================================= */
.muted {
  color: var(--muted);
  font-size: 12px;
}

/* =============================================================================
   LIST ITEMS
   ============================================================================= */
.list {
  display: flex;
  flex-direction: column;
}

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(148, 163, 184, .08);
  transition: background .12s;
}

.item:last-child { border-bottom: none; padding-bottom: 0; }

.item-info strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.item-info .muted { margin-top: 2px; }

/* =============================================================================
   SERVICE GRID & CARDS
   ============================================================================= */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.service-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(14, 21, 34, .70);
  color: var(--text);
  height: 100%;
  min-height: 68px;
  transition: all .2s ease;
}

.service-card:hover {
  border-color: rgba(56, 189, 248, .28);
  background: rgba(56, 189, 248, .04);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 8px 26px rgba(56, 189, 248, .07);
}

.service-card strong {
  font-family: var(--head);
  font-size: 13px;
  font-weight: 700;
  display: block;
  letter-spacing: -.01em;
}

.service-card p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

/* =============================================================================
   NODE CARDS (Homelab)
   ============================================================================= */
.node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.node-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.node-card .toolbar { margin-bottom: 0; }

.node-card .kv {
  display: grid;
  grid-template-columns: 122px 1fr;
  gap: 6px 12px;
  font-size: 13px;
}

.node-card .kv span { color: var(--muted); font-size: 12px; }

.node-card .kv strong {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}

.cost-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: auto;
}

.cost-grid > div {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, .04);
  padding: 10px 12px;
  text-align: center;
}

.cost-grid > div span {
  display: block;
  font-family: var(--head);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.cost-grid > div strong {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.source-note {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: 11px;
  color: rgba(143, 163, 184, .48);
  line-height: 1.5;
}

/* =============================================================================
   FORM CONTROLS
   ============================================================================= */
.input {
  width: 100%;
  padding: 9px 13px;
  background: rgba(7, 11, 18, .72);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--body);
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  min-width: 0;
}

.input::placeholder { color: rgba(143, 163, 184, .45); }

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .11);
}

textarea.input {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

select[data-role] {
  background: rgba(7, 11, 18, .72);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--body);
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: auto;
}

select[data-role]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .11);
}

/* =============================================================================
   BUTTONS
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 14px;
  background: rgba(148, 163, 184, .06);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-family: var(--head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.5;
  transition: all .18s ease;
  white-space: nowrap;
}

.btn:hover {
  background: rgba(56, 189, 248, .10);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.btn:disabled {
  opacity: .40;
  pointer-events: none;
  cursor: not-allowed;
}

button.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid rgba(248, 113, 113, .20);
  border-radius: var(--radius-pill);
  color: var(--danger);
  font-family: var(--head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  line-height: 1.5;
  transition: all .18s ease;
  white-space: nowrap;
}

button.danger:hover {
  background: rgba(248, 113, 113, .10);
  border-color: var(--danger);
}

button.danger:disabled {
  opacity: .35;
  pointer-events: none;
}

/* Actions cell/flex container */
.actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* =============================================================================
   VIP FORM
   ============================================================================= */
.vip-form {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(160px, 1fr) minmax(190px, 1.4fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

/* =============================================================================
   LOADER STATE
   ============================================================================= */
.loader {
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .02em;
}

/* =============================================================================
   ERROR STATE
   ============================================================================= */
.error {
  padding: 16px 20px;
  background: rgba(248, 113, 113, .06);
  border: 1px solid rgba(248, 113, 113, .20);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}

.error strong { color: var(--danger); }
.error a { color: var(--accent); }

/* =============================================================================
   TOAST NOTIFICATIONS
   ============================================================================= */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(17, 29, 45, .98), rgba(9, 15, 25, .98));
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: toast-slide-in .22s cubic-bezier(.16, 1, .3, 1);
}

.toast.ok { border-color: rgba(52, 211, 153, .32); }
.toast.bad { border-color: rgba(248, 113, 113, .32); }

@keyframes toast-slide-in {
  from { opacity: 0; transform: translateY(12px) scale(.95); }
  to   { opacity: 1; transform: translateY(0)   scale(1);   }
}

/* =============================================================================
   LOGIN MODE  —  body.login-mode hides shell, centers card
   ============================================================================= */
body.login-mode .sidebar,
body.login-mode .topbar,
body.login-mode .status-strip { display: none !important; }

body.login-mode .app-shell { display: block; min-height: 100vh; }
body.login-mode main       { min-height: 100vh; }

body.login-mode .content {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 32px;
  background: linear-gradient(145deg, rgba(17, 29, 45, .97), rgba(9, 15, 25, .98));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), 0 0 80px rgba(56, 189, 248, .07);
}

.login-card h2 {
  font-family: var(--head);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--text);
  margin-bottom: 22px;
  text-transform: none;
  letter-spacing: -.03em;
}

.login-fields {
  display: grid;
  gap: 12px;
}

.login-fields .input { width: 100%; }

.login-fields .btn {
  width: 100%;
  padding: 11px 14px;
  font-size: 12px;
  letter-spacing: .12em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #021520;
  border-radius: var(--radius);
}

.login-fields .btn:hover {
  opacity: .88;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #021520;
}

.login-error {
  padding: 10px 13px;
  margin-bottom: 14px;
  background: rgba(248, 113, 113, .08);
  border: 1px solid rgba(248, 113, 113, .22);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
}

/* =============================================================================
   ACCESSIBILITY
   ============================================================================= */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.input:focus-visible {
  /* handled by box-shadow; suppress duplicate outline */
  outline: none;
}

/* =============================================================================
   PREFERS REDUCED MOTION
   ============================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* =============================================================================
   RESPONSIVE — collapse sidebar below 900 px
   ============================================================================= */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }

  .topbar {
    height: auto;
    min-height: 52px;
    padding: 12px 18px;
    flex-wrap: wrap;
  }

  .topbar-title { display: block; }

  .status-strip { padding-inline: 18px; }

  .content { padding: 16px 18px 24px; }

  .vip-form { grid-template-columns: 1fr; }

  .grid.two { grid-template-columns: 1fr; }

  .node-grid { grid-template-columns: 1fr; }

  .service-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* =============================================================================
   HOMELAB REALTIME DASHBOARD — new components (additive only)
   ============================================================================= */

/* ── Spike colour classes ─── */
.hl-mval.is-cool { color: var(--ok); }
.hl-mval.is-warm { color: var(--warn); }
.hl-mval.is-hot  { color: var(--danger); animation: hl-pulse 1.6s ease-in-out infinite; }

@keyframes hl-pulse {
  0%, 100% { text-shadow: none; }
  50%       { text-shadow: 0 0 12px rgba(248, 113, 113, .60); }
}

@media (prefers-reduced-motion: reduce) {
  .hl-mval.is-hot { animation: none; }
}

/* ── Node wrapper ─── */
.hl-node-wrap {
  margin-bottom: 36px;
}
.hl-node-wrap:last-child { margin-bottom: 0; }

/* ── Offline card ─── */
.hl-node-offline {
  display: flex;
  flex-direction: column;
  margin-bottom: 18px;
}
.hl-node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ── Hero card ─── */
.hl-hero-card { margin-bottom: 14px; }

.hl-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.hl-node-name {
  font-family: var(--head);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.05em;
  color: var(--text);
  line-height: 1.1;
}

.hl-node-sub,
.hl-node-cpu {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* ── 8-metric grid ─── */
.hl-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.hl-metric-cell {
  background: rgba(148, 163, 184, .04);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition: border-color .2s;
}

.hl-metric-cell:hover { border-color: var(--line-strong); }

.hl-mlabel {
  display: block;
  font-family: var(--head);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.hl-mval {
  display: block;
  font-family: var(--head);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  transition: color .35s;
}

.hl-mono {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

/* ── Cost strip ─── */
.hl-cost-strip {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.hl-cost-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 88px;
}

.hl-cost-lbl {
  font-family: var(--head);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.hl-cost-item strong {
  font-family: var(--head);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.hl-cost-note {
  flex: 1;
  font-size: 11px;
  color: rgba(143, 163, 184, .42);
  line-height: 1.5;
  text-align: right;
  min-width: 100px;
}

/* ── Graph + Energy row ─── */
.hl-row-graph {
  display: grid;
  grid-template-columns: 1fr 270px;
  gap: 14px;
  margin-bottom: 14px;
  align-items: stretch;
}

.hl-graph-card,
.hl-energy-card { margin-bottom: 0; }

/* ── Section label ─── */
.hl-section-label {
  font-family: var(--head);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ── Graph legend ─── */
.hl-graph-legend {
  display: flex;
  gap: 14px;
  margin-bottom: 10px;
}

.hl-leg-w {
  font-family: var(--head);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: rgba(56, 189, 248, .85);
}

.hl-leg-t {
  font-family: var(--head);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: rgba(245, 158, 11, .85);
}

/* ── Power SVG ─── */
.hl-graph-wrap {
  position: relative;
  width: 100%;
  min-height: 120px;
  cursor: crosshair;
}

.hl-graph-host { width: 100%; }

.hl-graph-cursor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s ease;
}

.hl-graph-cursor.is-on { opacity: 1; }

.hl-cursor-line {
  position: absolute;
  top: 0;
  bottom: 22px;
  width: 1px;
  background: rgba(56, 189, 248, .5);
}

.hl-cursor-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .25);
}

.hl-cursor-tip {
  position: absolute;
  transform: translate(-50%, calc(-100% - 14px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 9px;
  background: rgba(7, 11, 18, .96);
  border: 1px solid rgba(56, 189, 248, .35);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: .02em;
  line-height: 1.25;
}

.hl-tip-main { font-size: 13px; font-weight: 800; color: var(--accent); }
.hl-tip-temp { color: var(--warn); }
.hl-tip-cost { color: #4ade80; font-weight: 700; }
.hl-tip-date { font-size: 10px; color: var(--muted); letter-spacing: .04em; }

/* faint raw power line behind the smoothed line (shows real spikes subtly) */
.hl-line-w-raw {
  stroke: var(--accent);
  stroke-width: 1;
  opacity: .22;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* range selector tabs (24h / týden / měsíc) */
.hl-graph-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.hl-graph-top .hl-section-label { margin-bottom: 0; }

.hl-range-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: rgba(148, 163, 184, .08);
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: var(--radius-sm);
}

.hl-range-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 4px 11px;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}

.hl-range-btn:hover { color: var(--text); }

.hl-range-btn.is-active {
  background: rgba(56, 189, 248, .18);
  color: var(--accent);
}

.hl-leg-cost {
  font-family: var(--head);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: rgba(74, 222, 128, .9);
}

/* daily energy bars (week / month range) */
.hl-ebar-svg {
  fill: rgba(56, 189, 248, .5);
  transition: fill .12s ease;
}

.hl-power-svg:hover .hl-ebar-svg { fill: rgba(56, 189, 248, .62); }

.hl-graph-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border: 1px dashed rgba(148, 163, 184, .18);
  border-radius: var(--radius-sm);
  line-height: 1.65;
}

.hl-power-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.hl-line-w {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.hl-line-t {
  stroke: var(--warn);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 4 3;
  opacity: .75;
}

.hl-area-w { opacity: 1; }

.hl-dot-w {
  fill: var(--accent);
  stroke: rgba(7, 11, 18, .8);
  stroke-width: 1.5;
  opacity: .7;
  cursor: default;
}

.hl-dot-w:hover { opacity: 1; r: 4; }

.hl-axis-lbl {
  font-family: var(--mono);
  font-size: 9px;
  fill: rgba(143, 163, 184, .55);
}

.hl-axis-ln {
  stroke: rgba(148, 163, 184, .22);
  stroke-width: 1;
}

.hl-grid-ln {
  stroke: rgba(148, 163, 184, .08);
  stroke-width: 1;
}

/* ── Energy card ─── */
.hl-energy-card {
  display: flex;
  flex-direction: column;
}

.hl-energy-hero {
  margin-bottom: 12px;
}

.hl-etoday-val {
  font-family: var(--head);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.05em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.hl-etoday-unit {
  font-family: var(--head);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .04em;
}

.hl-energy-bars-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hl-energy-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 80px;
}

.hl-ebar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  cursor: default;
}

.hl-ebar {
  width: 100%;
  background: linear-gradient(180deg, var(--accent), rgba(56, 189, 248, .4));
  border-radius: 3px 3px 0 0;
  transition: opacity .3s;
  min-height: 3px;
}

.hl-ebar-wrap:hover .hl-ebar { opacity: 1 !important; }

.hl-ebar-lbl {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  margin-top: 4px;
  text-align: center;
  white-space: nowrap;
}

.hl-energy-foot {
  margin-top: 10px;
  font-size: 11px;
  color: rgba(143, 163, 184, .45);
  line-height: 1.4;
}

/* ── HW + Net row ─── */
.hl-row-hw {
  display: grid;
  grid-template-columns: 1fr 270px;
  gap: 14px;
  align-items: stretch;
}

.hl-hw-card,
.hl-net-card { margin-bottom: 0; }

/* ── Hardware spec ─── */
.hl-hw-spec {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hl-hw-sec { display: flex; flex-direction: column; gap: 4px; }

.hl-hw-stitle {
  font-family: var(--head);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(56, 189, 248, .72);
  margin-bottom: 5px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(56, 189, 248, .10);
}

.hl-hw-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.55;
  padding: 3px 0;
}

.hl-hw-k {
  color: var(--muted);
  font-size: 12.5px;
  flex-shrink: 0;
}

.hl-hw-row span:last-child {
  color: var(--text);
  font-weight: 500;
  word-break: break-word;
}

.hl-hw-module {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  font-size: 13.5px;
  padding: 4px 0;
  border-top: 1px solid rgba(148, 163, 184, .06);
}

.hl-hw-slot {
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(56, 189, 248, .72);
  font-weight: 700;
  letter-spacing: .04em;
}

.hl-hw-module span:last-child {
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

/* ── Network panel ─── */
.hl-net-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hl-iface {
  padding: 10px 12px;
  background: rgba(148, 163, 184, .04);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.hl-iface-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.hl-iface-name {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .02em;
}

.hl-iface-io {
  display: flex;
  gap: 12px;
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}

.hl-rx { color: var(--ok); }
.hl-tx { color: var(--accent-2); }

/* ── Sparklines ─── */
.hl-spark-wrap {
  width: 100%;
  height: 36px;
}

.hl-spark-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.hl-spark-rx {
  stroke: var(--ok);
  stroke-width: 1.5;
  stroke-linejoin: round;
  opacity: .8;
}

.hl-spark-tx {
  stroke: var(--accent-2);
  stroke-width: 1.5;
  stroke-linejoin: round;
  opacity: .8;
}

/* ── Live heartbeat ─── */
.hl-hero-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}

.hl-live {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hl-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, .55);
  animation: hl-beat 1.6s ease-out infinite;
}

.hl-live.is-stale .hl-live-dot {
  background: var(--warn, #f59e0b);
  animation: none;
  box-shadow: none;
}

.hl-live.is-stale { color: rgba(245, 158, 11, .85); }

@keyframes hl-beat {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); }
  70%  { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ── Energy cost (Kč) ─── */
.hl-etoday-cost {
  font-family: var(--head);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.hl-emonth {
  display: block;
  font-weight: 600;
  color: rgba(56, 189, 248, .8);
}

.hl-elast { display: block; }

/* ── Responsive ─── */
@media (max-width: 900px) {
  .hl-metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .hl-row-graph    { grid-template-columns: 1fr; }
  .hl-row-hw       { grid-template-columns: 1fr; }
  .hl-cost-strip   { gap: 10px; }
  .hl-mval         { font-size: 18px; }
}
