/* ===================================================================
   NACS Dashboard — Estilo Principal
   Need Solutions © 2026
   Design: Orion/Nexus Style
   =================================================================== */

/* ─── Variáveis CSS ─────────────────────────────────────────────── */
:root {
  /* Brand */
  --brand:        #06B6D4;
  --brand-strong: #0891B2;
  --brand-soft:   rgba(6,182,212,0.15);

  /* Status */
  --green-400:  #4ADE80;
  --green-500:  #22C55E;
  --red-400:    #F87171;
  --red-500:    #EF4444;
  --yellow-400: #FACC15;
  --yellow-500: #EAB308;
  --orange-400: #FB923C;
  --purple-500: #A855F7;

  /* Light theme */
  --bg:       #f0f4f9;
  --surface:  #ffffff;
  --surface2: #f7f9fc;
  --border:   rgba(15,23,42,.08);
  --text:     #0f172a;
  --text2:    #64748b;
  --accent-light: color-mix(in srgb, var(--brand) 12%, transparent);
  --shadow-soft: 0 1px 2px rgba(15,23,42,.04), 0 4px 14px rgba(15,23,42,.06);
  --shadow-card: 0 1px 3px rgba(15,23,42,.05), 0 10px 30px rgba(15,23,42,.08);

  /* Sidebar (always dark) */
  --nav:      #101010;
  --nav-text: #d9e5f4;

  /* Topbar */
  --tbh: 58px;

  /* Mobile nav height */
  --mnavh: calc(52px + env(safe-area-inset-bottom, 0px));

  /* Legacy color aliases (compatibilidade com JS/inline styles) */
  --cyan-400:   #22D3EE;
  --cyan-500:   #06B6D4;
  --cyan-600:   #0891B2;
  --cyan-700:   #0E7490;
  --orange-500: #F97316;
  --orange-400: #FB923C;
  --navy-800:   #0B1120;

  /* Misc */
  --font-sans: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Aliases para compatibilidade com JS inline */
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;
  --gray-200:       #e2e8f0;
}

[data-theme="dark"] {
  --bg:       #101010;
  --surface:  #171717;
  --surface2: #0c0c0d;
  --border:   #2a2a2c;
  --text:     #e6edf3;
  --text2:    #7d8590;
  --accent-light: color-mix(in srgb, var(--brand) 18%, transparent);
  --text-secondary: #7d8590;
  --text-muted:     #555d6a;
  --gray-200:       #2a2a2c;
}

/* ─── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
dialog { margin: auto; }
dialog:not([open]) { display: none !important; }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }
img { max-width: 100%; height: auto; display: block; }

[data-theme="light"] body {
  background:
    radial-gradient(ellipse 90% 50% at 50% -10%, color-mix(in srgb, var(--brand) 8%, transparent), transparent),
    linear-gradient(180deg, #f0f6ff, #edf3fa 50%, #edf3fa);
}
[data-theme="light"] .topbar {
  background: rgba(255,255,255,.9);
  border-bottom-color: rgba(15,23,42,.07);
}
[data-theme="light"] .card,
[data-theme="light"] .data-card {
  background: #fff;
  border-color: rgba(15,23,42,.08);
  box-shadow: 0 1px 3px rgba(15,23,42,.05), 0 8px 24px rgba(15,23,42,.06);
}
[data-theme="light"] table { color: #0f172a; }
[data-theme="light"] thead tr { background: #f8fafc; }
[data-theme="light"] tbody tr:hover { background: #f8fafc; }
[data-theme="light"] th { color: #64748b; }
[data-theme="light"] td { color: #0f172a; }

/* ─── Layout Grid ───────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns .25s ease;
}
.layout.collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

/* ─── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px 16px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--brand) 12%, transparent), transparent 24%),
    radial-gradient(circle at 8% 18%, color-mix(in srgb, var(--brand) 8%, transparent), transparent 34%),
    linear-gradient(180deg, #111111, #101010 55%, #0f0f10);
  color: var(--nav-text);
  overflow: visible;
  transition: padding .25s ease, transform .25s ease;
  z-index: 120;
  border-right: 1px solid rgba(255,255,255,.08);
}
.layout.collapsed .sidebar { padding: 22px 8px 14px; }

.sidebar-stack {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

/* Brand card */
.brand-card {
  padding: 0 8px 24px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  margin-bottom: 18px;
}
.layout.collapsed .brand-card { padding: 6px 0 16px; margin-bottom: 16px; }

.brand-mark {
  width: 100%;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0;
}
.layout.collapsed .brand-mark { justify-content: center; }

.brand-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 8px 20px rgba(0,0,0,.2);
  overflow: hidden;
  flex-shrink: 0;
}

.brand-full {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.brand-full strong {
  font-size: 1.02rem;
  font-weight: 750;
  color: #fff;
  line-height: 1;
}
.brand-full span {
  font-size: .78rem;
  color: rgba(217,229,244,.56);
  font-weight: 600;
  line-height: 1.25;
}
.layout.collapsed .brand-full { display: none; }

/* Edge toggle button */
.sidebar-edge-toggle {
  position: absolute;
  top: 88px;
  right: -16px;
  width: 32px;
  height: 32px;
  border: 1px solid color-mix(in srgb, var(--brand) 44%, rgba(255,255,255,.32));
  border-radius: 50%;
  background: linear-gradient(145deg, color-mix(in srgb, var(--brand) 84%, white 16%), var(--brand));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--brand) 34%, transparent), inset 0 1px 0 rgba(255,255,255,.22);
  z-index: 180;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-4px) scale(.96);
  transition: opacity .18s ease, transform .2s ease, box-shadow .2s ease;
}
.sidebar:hover .sidebar-edge-toggle,
.sidebar:focus-within .sidebar-edge-toggle {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}
.sidebar-edge-toggle:hover {
  transform: translateX(0) scale(1.04);
  box-shadow: 0 14px 30px color-mix(in srgb, var(--brand) 42%, transparent), inset 0 1px 0 rgba(255,255,255,.26);
}
.sidebar-edge-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Sidebar nav */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

/* Nav link */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 62px;
  padding: 8px 12px;
  border-radius: 20px;
  color: var(--nav-text);
  text-decoration: none;
  transition: background .2s ease, transform .2s ease, border-color .2s ease, box-shadow .2s ease;
  border: 1px solid transparent;
  cursor: pointer;
  position: relative;
}
.sidebar-link:hover {
  transform: translateX(2px);
  background: rgba(255,255,255,.035);
  color: var(--nav-text);
  text-decoration: none;
}
.sidebar-link.active {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--brand) 34%, rgba(28,18,22,.9)),
    color-mix(in srgb, var(--brand) 18%, rgba(18,18,20,.96)));
  border-color: color-mix(in srgb, var(--brand) 74%, rgba(255,255,255,.08));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 14px 28px color-mix(in srgb, var(--brand) 18%, rgba(0,0,0,.22));
}
.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 13px;
  bottom: 13px;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: var(--brand);
  box-shadow: 0 0 18px color-mix(in srgb, var(--brand) 46%, transparent);
}

/* Nav icon box */
.sidebar-link .nav-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: rgba(255,255,255,.055);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 12px 24px rgba(0,0,0,.18);
  overflow: hidden;
}
.sidebar-link.active .nav-icon {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--brand) 76%, rgba(255,255,255,.08)),
    color-mix(in srgb, var(--brand-strong) 88%, rgba(0,0,0,.08)));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 10px 20px color-mix(in srgb, var(--brand) 24%, transparent);
}
.sidebar-link .nav-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Nav copy */
.sidebar-link .nav-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.sidebar-link .nav-copy strong {
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.12;
}
.sidebar-link .nav-copy span {
  color: rgba(217,229,244,.56);
  font-size: .78rem;
  line-height: 1.28;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layout.collapsed .sidebar-link {
  justify-content: center;
  min-height: 54px;
  padding: 5px;
  border-radius: 18px;
}
.layout.collapsed .sidebar-link .nav-copy { display: none; }
.layout.collapsed .sidebar-link .nav-icon {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
  border-radius: 17px;
}
.layout.collapsed .sidebar-link.active::before {
  left: -8px;
  top: 12px;
  bottom: 12px;
  width: 3px;
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  position: relative;
  overflow: visible;
}

.sidebar-user-footer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  min-height: 68px;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px;
  background: rgba(255,255,255,.02);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03), 0 18px 34px rgba(0,0,0,.16);
}
.layout.collapsed .sidebar-user-footer-row {
  justify-content: center;
  min-height: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}
.layout.collapsed .sidebar-nav { gap: 14px; }

.sidebar-user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border-radius: 18px;
  background: transparent;
  border: none;
  color: var(--nav-text);
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  transition: transform .15s;
  text-align: left;
}
.sidebar-user-chip:hover { transform: translateY(-1px); }
.layout.collapsed .sidebar-user-chip { justify-content: center; padding: 8px; }

.sidebar-user-more {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  border: none;
  background: transparent;
  color: rgba(217,229,244,.6);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s, color .15s, transform .15s;
}
.sidebar-user-more:hover {
  background: rgba(255,255,255,.06);
  color: rgba(217,229,244,.95);
  transform: translateY(-1px);
}
.sidebar-user-more svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.layout.collapsed .sidebar-user-more { display: none; }

.sidebar-avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
  background: linear-gradient(145deg, color-mix(in srgb, var(--brand) 88%, white 12%), var(--brand-strong));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: .94rem;
  border: 1px solid color-mix(in srgb, var(--brand) 55%, rgba(255,255,255,.22));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 22%, transparent), inset 0 1px 0 rgba(255,255,255,.18);
}
.layout.collapsed .sidebar-avatar { width: 48px; height: 48px; flex-basis: 48px; }

.sidebar-user-text { display: grid; gap: 3px; min-width: 0; flex: 1; }
.sidebar-user-name {
  font-size: .84rem;
  font-weight: 700;
  color: rgba(245,248,252,.94);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-role { font-size: .74rem; color: rgba(217,229,244,.54); font-weight: 500; }
.sidebar-user-chevron {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: rgba(217,229,244,.4);
  transition: transform .2s ease;
}
.sidebar-user-more.open .sidebar-user-chevron { transform: rotate(180deg); }
.layout.collapsed .sidebar-user-text { display: none; }

/* User popup menu */
.sidebar-user-menu {
  display: none;
  position: absolute;
  left: calc(100% + 14px);
  bottom: 0;
  width: 320px;
  max-width: min(320px, calc(100vw - 300px));
  z-index: 260;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--brand) 12%, transparent), transparent 40%),
    linear-gradient(180deg, rgba(7,10,16,.9), rgba(11,14,20,.94));
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 32px rgba(0,0,0,.22);
}
.sidebar-user-menu.open { display: flex; }
.layout.collapsed .sidebar-user-menu {
  left: calc(100% + 14px);
  max-width: min(320px, calc(100vw - 116px));
}

.sidebar-user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  color: rgba(217,229,244,.88);
  background: rgba(255,255,255,.02);
  border: none;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s, transform .15s;
  text-decoration: none;
  width: 100%;
  border-radius: 14px;
}
.sidebar-user-menu-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
  text-decoration: none;
  transform: translateX(2px);
}
.sidebar-user-menu-item svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-user-menu-item-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.06);
}
.sidebar-user-menu-item-copy { display: grid; gap: 2px; min-width: 0; flex: 1; }
.sidebar-user-menu-item-copy strong { font-size: .9rem; font-weight: 700; line-height: 1.1; color: inherit; }
.sidebar-user-menu-item-copy span { font-size: .74rem; line-height: 1.3; color: rgba(217,229,244,.5); font-weight: 500; }
.sidebar-user-menu-item:hover .sidebar-user-menu-item-icon {
  background: color-mix(in srgb, var(--brand) 14%, rgba(255,255,255,.04));
  border-color: color-mix(in srgb, var(--brand) 26%, transparent);
}
.sidebar-user-menu-item--sair { color: #f87171; }
.sidebar-user-menu-item--sair .sidebar-user-menu-item-copy span { color: rgba(248,113,113,.72); }
.sidebar-user-menu-item--sair:hover { background: rgba(239,68,68,.08); color: #fca5a5; }
.sidebar-user-menu-item--sair:hover .sidebar-user-menu-item-icon {
  background: rgba(239,68,68,.10);
  border-color: rgba(248,113,113,.24);
}

/* ─── Content Area ──────────────────────────────────────────────── */
.content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  border-left: 1px solid rgba(255,255,255,.04);
}
[data-theme="dark"] .content { border-left-color: var(--border); }
[data-theme="light"] .content {
  border-left-color: rgba(208,221,239,.96);
  background: transparent;
}

/* ─── Topbar ────────────────────────────────────────────────────── */
.topbar {
  height: var(--tbh);
  background: #141414;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  flex-shrink: 0;
}
[data-theme="light"] .topbar {
  background: rgba(255,255,255,.9);
  border-bottom-color: rgba(15,23,42,.07);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar-title {
  font-weight: 700;
  font-size: .95rem;
  flex: 1;
  color: #f1f5f9;
  margin: 0;
  letter-spacing: -.02em;
}
[data-theme="light"] .topbar-title { color: var(--text); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  color: #94a3b8;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.topbar-icon-btn:hover {
  background: rgba(255,255,255,.1);
  color: #f1f5f9;
}
[data-theme="light"] .topbar-icon-btn {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text2);
}
[data-theme="light"] .topbar-icon-btn:hover {
  background: var(--surface2);
  color: var(--text);
}
.topbar-icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* GenieACS status */
.genie-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.genie-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.genie-label { color: #64748b; }
.genie-status.connected .genie-dot {
  background: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34,197,94,.2);
  animation: dotPulse 2s infinite;
}
.genie-status.disconnected .genie-dot { background: #475569; }
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
  50%       { box-shadow: 0 0 0 5px rgba(34,197,94,.06); }
}

/* Hamburger (mobile only) */
.btn-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.05);
  color: #94a3b8;
  cursor: pointer;
  border-radius: 10px;
  transition: background .13s, color .13s;
  flex-shrink: 0;
}
.btn-hamburger:hover { background: rgba(255,255,255,.1); color: #f1f5f9; }
.btn-hamburger svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="light"] .btn-hamburger { border-color: var(--border); background: var(--surface); color: var(--text2); }

/* ─── Page Body ─────────────────────────────────────────────────── */
.page-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  background: var(--bg);
}
[data-theme="light"] .page-body { background: transparent; }
.page-body::-webkit-scrollbar { width: 6px; }
.page-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Mobile overlay ────────────────────────────────────────────── */
.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1999;
  backdrop-filter: blur(2px);
}
.sb-overlay.visible { display: block; }

/* ─── Mobile bottom nav ─────────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--mnavh);
  padding: 4px 4px env(safe-area-inset-bottom, 0px);
  background: rgba(18,18,20,.96);
  border-top: 1px solid rgba(255,255,255,.07);
  z-index: 2050;
  align-items: stretch;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
[data-theme="light"] .mobile-nav {
  background: rgba(242,242,247,.94);
  border-top-color: rgba(0,0,0,.08);
}
.mobile-nav-btn {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px 4px;
  color: rgba(160,174,192,.65);
  text-decoration: none;
  font-size: .62rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s, background .15s;
}
[data-theme="light"] .mobile-nav-btn { color: rgba(60,60,67,.45); }
.mobile-nav-btn.active {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
}
.mobile-nav-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.mobile-nav-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; line-height: 1; }
.mobile-nav-btn:active { opacity: .7; }

/* ─── Profile bottom sheet ──────────────────────────────────────── */
.profile-sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 3000;
}
.profile-sheet-backdrop.open { display: block; }

.profile-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3001;
  background: #1c1c1e;
  border-radius: 20px 20px 0 0;
  border-top: 1px solid rgba(255,255,255,.1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.32,1,.23,1);
  max-height: 92svh;
  overflow-y: auto;
}
.profile-sheet.open { transform: translateY(0); }
[data-theme="light"] .profile-sheet { background: #f2f2f7; }

.profile-sheet-handle {
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255,255,255,.2);
  margin: 10px auto 4px;
}
[data-theme="light"] .profile-sheet-handle { background: rgba(0,0,0,.15); }

.profile-sheet-user {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
[data-theme="light"] .profile-sheet-user { border-color: rgba(0,0,0,.07); }

.profile-sheet-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
}
.profile-sheet-info { flex: 1; min-width: 0; }
.profile-sheet-name {
  font-size: 1rem;
  font-weight: 700;
  color: #f2f2f7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="light"] .profile-sheet-name { color: #1c1c1e; }
.profile-sheet-role {
  display: inline-block;
  margin-top: 5px;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--brand) 18%, transparent);
  color: color-mix(in srgb, var(--brand) 72%, white 28%);
}

.profile-sheet-actions { padding: 8px 12px 12px; }
.profile-sheet-action {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 10px;
  border: none;
  background: none;
  color: #f2f2f7;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 12px;
  text-decoration: none;
  transition: background .12s;
  -webkit-tap-highlight-color: transparent;
}
[data-theme="light"] .profile-sheet-action { color: #1c1c1e; }
.profile-sheet-action:active { background: rgba(255,255,255,.06); }
.profile-sheet-action-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: #2c2c2e;
}
[data-theme="light"] .profile-sheet-action-icon { background: #e5e5ea; }
.profile-sheet-action-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #f2f2f7;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
[data-theme="light"] .profile-sheet-action-icon svg { stroke: #1c1c1e; }
.profile-sheet-action-copy { flex: 1; text-align: left; }
.profile-sheet-action-copy strong { display: block; line-height: 1.2; }
.profile-sheet-action-copy span { font-size: .75rem; color: #8e8e93; font-weight: 500; }
.profile-sheet-action--danger { color: #ff453a !important; }
.profile-sheet-action--danger .profile-sheet-action-icon { background: rgba(255,69,58,.15) !important; }
.profile-sheet-action--danger .profile-sheet-action-icon svg { stroke: #ff453a !important; }
.profile-sheet-divider { height: 1px; background: rgba(255,255,255,.07); margin: 4px 10px; }
[data-theme="light"] .profile-sheet-divider { background: rgba(0,0,0,.07); }

/* ─── Stat cards ────────────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: border-color .15s;
}
.stat-card:hover { border-color: var(--brand); }
[data-theme="light"] .stat-card {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: var(--shadow-soft);
}

/* ─── Data / Table cards ────────────────────────────────────────── */
.data-card, .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
[data-theme="light"] .data-card, [data-theme="light"] .card {
  background: linear-gradient(180deg, #fff, #f8fbff);
  box-shadow: var(--shadow-soft);
}
.card-header {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}

/* ─── Tables ────────────────────────────────────────────────────── */
table { color: var(--text); width: 100%; border-collapse: collapse; }
thead tr { background: var(--surface2); }
tbody tr { border-top: 1px solid var(--border); transition: background .1s; }
tbody tr:hover { background: var(--surface2); }
th, td { padding: 11px 14px; text-align: left; font-size: .875rem; }
th { font-weight: 700; font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; color: var(--text2); }

/* ─── Forms ─────────────────────────────────────────────────────── */
.form-control, .form-select {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  background: var(--surface2);
  border-color: var(--brand);
  color: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.form-control::placeholder { color: var(--text2); }
.form-label, label { color: var(--text2); font-size: .875rem; font-weight: 600; }
.input-group-text {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text2);
}
[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
  background: #fff;
  border-color: rgba(15,23,42,.12);
}

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
[data-theme="light"] .btn-primary {
  box-shadow: 0 14px 24px color-mix(in srgb, var(--brand) 16%, transparent);
}

/* ─── Modals ────────────────────────────────────────────────────── */
.modal-content {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  border-radius: 12px;
}
.modal-header { border-bottom-color: var(--border); }
.modal-footer { border-top-color: var(--border); }
.btn-close { filter: invert(1) grayscale(1) opacity(.6); }

/* ─── Nav tabs ──────────────────────────────────────────────────── */
.nav-tabs { border-color: var(--border); }
.nav-tabs .nav-link { color: var(--text2); }
.nav-tabs .nav-link.active { color: var(--text); background: var(--surface); border-color: var(--border) var(--border) transparent; }

/* ─── Alerts ────────────────────────────────────────────────────── */
.alert-info    { background: rgba(6,182,212,.12);   color: #67E8F9; border: none; }
.alert-success { background: rgba(34,197,94,.12);   color: #4ADE80; border: none; }
.alert-warning { background: rgba(234,179,8,.12);   color: #FACC15; border: none; }
.alert-danger  { background: rgba(239,68,68,.12);   color: #F87171; border: none; }
[data-theme="light"] .alert-info    { background: rgba(6,182,212,.08);  color: #0369a1; }
[data-theme="light"] .alert-success { background: rgba(34,197,94,.08);  color: #16a34a; }
[data-theme="light"] .alert-warning { background: rgba(234,179,8,.08);  color: #b45309; }
[data-theme="light"] .alert-danger  { background: rgba(239,68,68,.08);  color: #dc2626; }

/* ─── Badges ────────────────────────────────────────────────────── */
.badge-online  { background: rgba(34,197,94,.15);  color: var(--green-400); padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700; }
.badge-offline { background: rgba(100,116,139,.15); color: #64748b;          padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700; }
.badge-signal-excellent { background: rgba(34,197,94,.15);  color: var(--green-400);  padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700; }
.badge-signal-good      { background: rgba(6,182,212,.15);  color: var(--brand);      padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700; }
.badge-signal-fair      { background: rgba(234,179,8,.15);  color: var(--yellow-400); padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700; }
.badge-signal-poor      { background: rgba(251,146,60,.15); color: var(--orange-400); padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700; }
.badge-signal-none      { background: rgba(239,68,68,.15);  color: var(--red-400);    padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700; }

/* Status dot */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 5px;
  vertical-align: middle;
}

/* ─── Toast ─────────────────────────────────────────────────────── */
#toastContainer {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(400px, calc(100vw - 24px));
  pointer-events: none;
}
.toast-item {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) 18px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 16px;
  border-radius: 16px;
  font-size: .85rem;
  font-weight: 600;
  animation: toastIn .24s cubic-bezier(.22,.61,.36,1);
  line-height: 1.45;
  pointer-events: auto;
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 38px rgba(0,0,0,.35);
  overflow: hidden;
}
.toast-item::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: currentColor;
  opacity: .9;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(22px) scale(.97); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
.toast-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  font-size: 1.1rem;
}
.toast-message { color: inherit; opacity: .96; word-break: break-word; }
.toast-close {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  color: inherit;
  opacity: .72;
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}
.toast-close:hover { opacity: 1; }
.success { background: rgba(5,46,35,.95);  color: #86efac; border: 1px solid rgba(34,197,94,.28); }
.error   { background: rgba(69,10,10,.95); color: #fca5a5; border: 1px solid rgba(248,113,113,.28); }
.warning { background: rgba(67,28,0,.95);  color: #fcd34d; border: 1px solid rgba(251,191,36,.28); }
.info    { background: rgba(9,24,55,.95);  color: #93c5fd; border: 1px solid rgba(96,165,250,.28); }

/* ─── Loading overlay ───────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  backdrop-filter: blur(3px);
}
.loading-overlay.show { display: flex; }
.spinner-ring {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Skeleton ──────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
  display: inline-block;
}
.skeleton-text { height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ─── Empty state ───────────────────────────────────────────────── */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text2);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; opacity: .4; }
.empty-state h4 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: .875rem; }

/* ─── Page section ──────────────────────────────────────────────── */
.page-section-title { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.page-section-subtitle { font-size: .875rem; color: var(--text2); margin-bottom: 20px; }

/* ─── Connection status (legacy compat) ─────────────────────────── */
.connection-status { display: flex; align-items: center; gap: 5px; }
.connection-dot { width: 7px; height: 7px; border-radius: 50%; }
.connection-status.connected .connection-dot { background: var(--green-500); }
.connection-status.disconnected .connection-dot { background: #475569; }

/* ─── Dropdown menus ────────────────────────────────────────────── */
.dropdown-menu {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  border-radius: 12px;
}
.dropdown-item { color: var(--text); }
.dropdown-item:hover { background: var(--surface2); color: var(--text); }

/* ─── List groups ───────────────────────────────────────────────── */
.list-group-item { background: var(--surface); border-color: var(--border); color: var(--text); }

/* ─── HR ────────────────────────────────────────────────────────── */
hr { border-color: var(--border); }

/* ─── Mobile table cards ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .mc-wrap { overflow: visible !important; }
  .mc-table, .mc-table tbody, .mc-table tr, .mc-table td { display: block !important; width: 100% !important; }
  .mc-table thead { display: none !important; }
  .mc-table tbody { display: grid !important; gap: 12px; padding: 14px !important; }
  .mc-table tbody tr {
    padding: 16px !important;
    border: 1px solid rgba(255,255,255,.08) !important;
    border-radius: 18px !important;
    background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015)) !important;
  }
  [data-theme="light"] .mc-table tbody tr {
    border-color: rgba(0,0,0,.07) !important;
    background: linear-gradient(180deg, #fff, #f8fafc) !important;
  }
  .mc-table td { padding: 0 !important; border: none !important; }
  .mc-table td + td {
    margin-top: 12px !important;
    padding-top: 12px !important;
    border-top: 1px solid rgba(255,255,255,.06) !important;
  }
  [data-theme="light"] .mc-table td + td { border-top-color: rgba(0,0,0,.06) !important; }
  .mc-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 5px;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #8ea0b8;
  }
  .mc-table td[data-label="Ações"] > * { width: 100%; }
  .mc-table td[data-label="Ações"] button, .mc-table td[data-label="Ações"] a {
    flex: 1; min-height: 38px; justify-content: center; border-radius: 10px;
  }
  .mc-table { min-width: 0 !important; }
}

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .layout {
    min-height: 100vh;
    grid-template-columns: 1fr !important;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 284px;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.32,1,.23,1);
    z-index: 2000;
    border-right: 1px solid rgba(255,255,255,.1);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-edge-toggle { display: none !important; }
  .btn-hamburger { display: flex !important; }
  .mobile-nav { display: flex; }
  .content {
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: visible;
    padding-bottom: var(--mnavh);
  }
  .page-body { overflow-x: hidden; overflow-y: visible; height: auto; }
}

@media (max-width: 640px) {
  .page-body { padding: 14px; }
  #toastContainer { left: 12px; right: 12px; max-width: none; }
  .mobile-nav {
    left: 0; right: 0; bottom: 0;
    border-radius: 0;
    border-left: none; border-right: none; border-bottom: none;
    padding: 4px 4px env(safe-area-inset-bottom, 0px);
  }
  .mobile-nav-btn { font-size: .6rem; gap: 3px; padding: 6px 4px 4px; }
  .mobile-nav-btn svg { width: 20px; height: 20px; }
}

@media (max-width: 420px) {
  .page-body { padding: 12px; }
  .mobile-nav-btn span { font-size: .58rem; }
}

/* ─── Page header ───────────────────────────────────────────────── */
.page-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 4px;
  letter-spacing: -.02em;
}
.page-header p {
  font-size: .875rem;
  color: var(--text2);
  margin: 0;
}

/* ─── Stat cards grid ───────────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .15s, box-shadow .15s;
  display: block;
  overflow: hidden;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  text-decoration: none;
  color: var(--text);
}
[data-theme="light"] .stat-card {
  background: #fff;
  box-shadow: var(--shadow-soft);
}
.stat-card.cyan  { border-top: 3px solid var(--brand); }
.stat-card.green { border-top: 3px solid var(--green-500); }
.stat-card.red   { border-top: 3px solid var(--red-500); }
.stat-card.purple{ border-top: 3px solid var(--purple-500); }

.stat-card-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
}
.stat-info { flex: 1; min-width: 0; }
.stat-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: -.03em;
}
.stat-sub {
  font-size: .75rem;
  color: var(--text2);
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-left: 12px;
}
.stat-icon.cyan   { background: rgba(6,182,212,.12);   color: var(--brand); }
.stat-icon.green  { background: rgba(34,197,94,.12);   color: var(--green-400); }
.stat-icon.red    { background: rgba(239,68,68,.12);   color: var(--red-400); }
.stat-icon.purple { background: rgba(168,85,247,.12);  color: var(--purple-500); }

/* ─── Card header ───────────────────────────────────────────────── */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.card-header h5 {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.card-header-icon { color: var(--text2); font-size: .9rem; }

/* ─── Chart legend ──────────────────────────────────────────────── */
.chart-legend { display: flex; flex-direction: column; gap: 8px; }
.chart-legend-item { display: flex; align-items: center; gap: 8px; font-size: .8rem; }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.chart-legend-label { flex: 1; color: var(--text2); }
.chart-legend-value { font-weight: 700; color: var(--text); }

/* ─── Table wrapper ─────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

/* ─── Text accent ───────────────────────────────────────────────── */
.text-cyan { color: var(--brand) !important; }
.text-green { color: var(--green-400) !important; }
.text-red   { color: var(--red-400) !important; }

/* ─── Login page ────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080c14;
  position: relative;
  overflow: hidden;
  font-family: var(--font-sans);
}

/* Animated background circles */
.login-bg-circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .18;
  pointer-events: none;
  animation: bgFloat 12s ease-in-out infinite;
}
.login-bg-circle:nth-child(1) {
  width: 500px; height: 500px; top: -120px; left: -80px;
  background: radial-gradient(circle, var(--brand), transparent 70%);
  animation-duration: 14s;
}
.login-bg-circle:nth-child(2) {
  width: 400px; height: 400px; top: 40%; right: -100px;
  background: radial-gradient(circle, #6366f1, transparent 70%);
  animation-delay: -4s; animation-duration: 10s;
}
.login-bg-circle:nth-child(3) {
  width: 300px; height: 300px; bottom: -80px; left: 20%;
  background: radial-gradient(circle, #10b981, transparent 70%);
  animation-delay: -8s;
}
.login-bg-circle:nth-child(4) {
  width: 200px; height: 200px; top: 60%; left: 10%;
  background: radial-gradient(circle, var(--brand), transparent 70%);
  animation-delay: -2s; animation-duration: 18s; opacity: .1;
}
@keyframes bgFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-30px) scale(1.05); }
}

/* Grid overlay */
.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 30%, transparent 100%);
  pointer-events: none;
}

/* Card */
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  margin: 24px;
  padding: 36px 36px 28px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 24px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 32px 64px rgba(0,0,0,.5);
}

/* Logo */
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.login-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: 0 8px 20px rgba(6,182,212,.3);
  flex-shrink: 0;
}
.login-logo-text .app-name {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}
.login-logo-text .app-company {
  font-size: .75rem;
  color: rgba(217,229,244,.5);
  font-weight: 600;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 6px;
  letter-spacing: -.02em;
}
.login-subtitle {
  font-size: .875rem;
  color: rgba(217,229,244,.56);
  margin: 0 0 28px;
}

.login-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.22);
  color: #fca5a5;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.login-form { display: flex; flex-direction: column; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }

/* Override Bootstrap form-control for login dark background */
.login-page .form-control {
  background: rgba(255,255,255,.05) !important;
  border-color: rgba(255,255,255,.1) !important;
  color: #f1f5f9 !important;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: .9rem;
}
.login-page .form-control:focus {
  background: rgba(255,255,255,.07) !important;
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(6,182,212,.18) !important;
}
.login-page .form-control::placeholder { color: rgba(255,255,255,.3) !important; }
.login-page .form-label { color: rgba(217,229,244,.7) !important; font-size: .82rem !important; }
.login-page .password-input-wrapper {
  position: relative;
}
.login-page .password-input-wrapper .form-control {
  border-radius: 12px;
  padding-right: 44px;
}
.login-page .btn-toggle-password {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 42px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 12px 12px 0;
}
.login-page .btn-toggle-password:hover { color: rgba(255,255,255,.8); }

.btn-login {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #fff;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(6,182,212,.3);
}
.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(6,182,212,.4);
}
.btn-login:disabled { opacity: .7; cursor: not-allowed; transform: none; }

.login-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.07);
  text-align: center;
  font-size: .75rem;
  color: rgba(217,229,244,.35);
  font-weight: 500;
}

.spinner-ring.xs { width: 16px; height: 16px; border-width: 2px; }

/* ─── Btn ghost / outline ───────────────────────────────────────── */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  font-family: inherit;
}
.btn-ghost:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--brand);
  color: var(--brand);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-outline:hover { background: var(--accent-light); }

/* ─── Table toolbar ─────────────────────────────────────────────── */
.table-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-input-wrapper .bi-search,
.search-input-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text2);
  font-size: .9rem;
  pointer-events: none;
}
.search-input-wrapper .form-control {
  padding-left: 36px;
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.filter-tab {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.filter-tab:hover {
  background: var(--surface2);
  color: var(--text);
}
.filter-tab.active {
  background: color-mix(in srgb, var(--brand) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  color: var(--brand);
}

/* Pagination */
.pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
.pagination-info {
  font-size: .8rem;
  color: var(--text2);
  font-weight: 500;
}
.pagination {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.pagination .page-item .page-link {
  min-width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  text-decoration: none;
}
.pagination .page-item .page-link:hover {
  background: var(--surface2);
  color: var(--text);
}
.pagination .page-item.active .page-link {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.pagination .page-item.disabled .page-link {
  opacity: .4;
  cursor: not-allowed;
}

/* Spinner size variants */
.spinner-ring.sm { width: 24px; height: 24px; border-width: 2px; }
.spinner-ring.xs { width: 16px; height: 16px; border-width: 2px; }

/* Modal danger */
.modal-danger .modal-header { background: rgba(239,68,68,.08); border-bottom-color: rgba(239,68,68,.15); }
.modal-danger .modal-title { color: var(--red-400); }

/* ─── Page header h1 reset ──────────────────────────────────────── */
.page-header h1 {
  font-size: 1.35rem !important;
  font-weight: 800 !important;
  letter-spacing: -.025em;
  margin: 0 0 4px !important;
}
.page-header p { font-size: .875rem; color: var(--text2); margin: 0; }

/* ─── Right actions area ────────────────────────────────────────── */
.right-actions { flex-shrink: 0; }

/* ─── Table action buttons ──────────────────────────────────────── */
.btn-action {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  transition: background .13s, color .13s, border-color .13s;
  text-decoration: none;
  font-size: .85rem;
}
.btn-action:hover { background: var(--surface); color: var(--text); }
.btn-action.cyan  { background: rgba(6,182,212,.1);  border-color: rgba(6,182,212,.25);  color: var(--brand); }
.btn-action.cyan:hover { background: rgba(6,182,212,.2); }
.btn-action.danger { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.2); color: var(--red-400); }
.btn-action.danger:hover { background: rgba(239,68,68,.16); }

/* ─── Bootstrap btn size/icon overrides ────────────────────────── */
.btn-sm { font-size: .8rem !important; padding: 5px 12px !important; }
.btn-icon {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 8px !important;
}
.font-mono { font-family: var(--font-mono); }

/* ─── Bootstrap btn-secondary dark override ─────────────────────── */
[data-theme="dark"] .btn-secondary {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text2);
}
[data-theme="dark"] .btn-secondary:hover {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
  color: var(--text);
}

/* ─── Light theme content body gradient ─────────────────────────── */
[data-theme="light"] .page-body {
  background: transparent;
  background-image:
    radial-gradient(circle at top right, color-mix(in srgb, var(--brand) 5%, transparent), transparent 40%);
}

/* ─── Card body ─────────────────────────────────────────────────── */
.card-body { padding: 18px; }

/* ─── Device detail header ──────────────────────────────────────── */
.device-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--brand) 14%, var(--nav)),
    color-mix(in srgb, var(--brand) 6%, #0f0f10));
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-wrap: wrap;
}
[data-theme="light"] .device-detail-header {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--brand) 8%, #fff),
    #fff);
  border-bottom-color: rgba(15,23,42,.08);
}
.device-detail-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 30%, transparent);
}
.device-detail-info { flex: 1; min-width: 0; }
.device-detail-info h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 4px;
  letter-spacing: -.02em;
}
[data-theme="light"] .device-detail-info h2 { color: var(--text); }
.device-detail-info p { color: rgba(217,229,244,.6); font-size: .875rem; }
[data-theme="light"] .device-detail-info p { color: var(--text2); }
.device-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

/* ─── Info grid (device detail overview) ────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 8px;
}
.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.info-item:nth-child(even) { border-right: none; }
.info-item:nth-last-child(1),
.info-item:nth-last-child(2):nth-child(odd) { border-bottom: none; }
.info-item:last-child:nth-child(odd) { border-right: none; }
.info-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
}
.info-value {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}
@media (max-width: 480px) {
  .info-grid { grid-template-columns: 1fr; }
  .info-item { border-right: none; }
  .info-item:last-child { border-bottom: none; }
}
