/* logs.btd.co.id — login/app UI project admin UI */

:root {
  --bg: #070b14;
  --sidebar-bg: #0a1020;
  --page-bg: #eef2f7;
  --card: #fff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #eab308;
  --warn-dark: #ca8a04;
  --border: #e2e8f0;
  --sidebar-width: 196px;
  --btn-primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --btn-primary-shadow: 0 8px 22px rgba(79, 70, 229, 0.38);
  --btn-primary-shadow-hover: 0 12px 28px rgba(79, 70, 229, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  line-height: 1.6;
  background: var(--page-bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
}

/* —— Login (dashboard-like) —— */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 20% 15%, rgba(99, 102, 241, 0.18) 0%, transparent 45%),
    radial-gradient(circle at 80% 85%, rgba(56, 189, 248, 0.12) 0%, transparent 40%),
    linear-gradient(160deg, #070b14 0%, #0f172a 55%, #111827 100%);
}
.login-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}
.login-box {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  padding: 28px 32px 24px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 28px 60px rgba(2, 6, 23, 0.35);
  text-align: center;
}
.login-logo { margin-bottom: 14px; }
.login-logo-img {
  /* Wide brand mark (not square) */
  width: auto;
  max-width: min(280px, 86%);
  max-height: 72px;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}
.login-title {
  font-size: clamp(1.05rem, 4.5vw, 1.2rem);
  line-height: 1.3;
  font-weight: 700;
  margin: 0 auto 0.25rem;
  max-width: 18em;
  color: var(--text);
}
.login-subtitle {
  margin: 0 auto 1.15rem;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.login-honeypot {
  position: absolute !important;
  left: -9999px !important;
  height: 0 !important;
  width: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.login-form { text-align: left; }

.form-group { margin-bottom: 1rem; }
.form-group input.input-readonly,
.form-group input[readonly],
.form-group input:disabled {
  background: #f1f5f9;
  color: var(--muted);
  cursor: not-allowed;
}
.form-group label {  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.form-group input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--text);
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  text-align: left;
}
.alert-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}
.alert-ok {
  background: #f0fdf4;
  color: var(--ok);
  border: 1px solid #bbf7d0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  color: #fff;
  background: var(--btn-primary-gradient);
  box-shadow: var(--btn-primary-shadow);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: var(--btn-primary-shadow-hover);
  transform: translateY(-1px);
}
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-dark); }

.front-page-footer {
  margin-top: 0.85rem;
  text-align: center;
}
.front-page-footer-version,
.front-page-footer-credit,
.front-page-footer-stack {
  margin: 0;
  font-size: 0.62rem;
  line-height: 1.5;
  color: rgba(148, 163, 184, 0.85);
  letter-spacing: 0.02em;
}
.front-page-footer-credit {
  margin-top: 0.2rem;
  font-size: 0.58rem;
}
.front-page-footer-credit a {
  color: inherit;
  text-decoration: none;
}
.front-page-footer-credit a:hover {
  color: #e2e8f0;
  text-decoration: underline;
}
.front-page-footer-credit .love {
  color: #f87171;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.front-page-footer-stack {
  margin-top: 0.15rem;
  font-size: 0.55rem;
  color: rgba(148, 163, 184, 0.7);
  letter-spacing: 0.03em;
}


/* ==========================================================================
   Admin shell — colors & layout project admin UI
   ========================================================================== */

.app-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  background: var(--page-bg);
  overflow-x: hidden;
}

/* —— Sidebar —— */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg);
  color: #e2e8f0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  min-height: 100vh;
  z-index: 40;
  border-right: 1px solid rgba(148, 163, 184, 0.08);
  /* sticky is positioned — absolute glow stays inside sidebar */
  overflow: hidden;
  transition: width 0.2s ease;
}
/* Desktop collapse control (top-right of sidebar) — icon button, not text */
.sidebar-collapse-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.3rem;
  z-index: 6;
  width: 1.85rem;
  height: 1.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.sidebar-collapse-btn:hover {
  background: rgba(99, 102, 241, 0.45);
  border-color: rgba(129, 140, 248, 0.65);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}
.sidebar-collapse-btn:active {
  transform: scale(0.96);
}
.sidebar-collapse-icon {
  display: block;
  width: 14px;
  height: 14px;
  background-color: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}
/* chevrons-left « collapse */
.sidebar-collapse-icon--collapse {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='11 17 6 12 11 7'/%3E%3Cpolyline points='18 17 13 12 18 7'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='11 17 6 12 11 7'/%3E%3Cpolyline points='18 17 13 12 18 7'/%3E%3C/svg%3E");
}
/* chevrons-right » expand */
.sidebar-collapse-icon--expand {
  display: none;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='13 17 18 12 13 7'/%3E%3Cpolyline points='6 17 11 12 6 7'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='13 17 18 12 13 7'/%3E%3Cpolyline points='6 17 11 12 6 7'/%3E%3C/svg%3E");
}
body.sidebar-collapsed .sidebar-collapse-icon--collapse {
  display: none;
}
body.sidebar-collapsed .sidebar-collapse-icon--expand {
  display: block;
}
/* Collapsed: icon rail only */
body.sidebar-collapsed {
  --sidebar-width: 58px;
}
body.sidebar-collapsed .sidebar-inner {
  padding: 2rem 0.35rem 0.75rem;
}
body.sidebar-collapsed .sidebar-brand {
  margin-bottom: 0.75rem;
}
body.sidebar-collapsed .sidebar-brand-tagline,
body.sidebar-collapsed .sidebar-brand-login,
body.sidebar-collapsed .sidebar-brand-uptime,
body.sidebar-collapsed .sidebar-link > span:not(.sidebar-icon),
body.sidebar-collapsed .sidebar-logout-label,
body.sidebar-collapsed .sidebar-build-label {
  display: none !important;
}
body.sidebar-collapsed .sidebar-brand-logo-wrap {
  padding: 0.35rem;
}
body.sidebar-collapsed .sidebar-brand-logo {
  width: auto;
  max-width: 36px;
  height: 28px;
}
body.sidebar-collapsed .sidebar-brand-link {
  padding: 0.35rem;
  justify-content: center;
}
body.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: 0.6rem 0.35rem;
  gap: 0;
}
body.sidebar-collapsed .sidebar-logout-btn {
  justify-content: center;
  padding: 0.55rem 0.35rem;
}
body.sidebar-collapsed .sidebar-collapse-btn {
  right: 50%;
  transform: translateX(50%);
}
.sidebar-backdrop-glow {
  pointer-events: none !important;
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(99, 102, 241, 0.18) 0%, transparent 45%),
    radial-gradient(circle at 80% 100%, rgba(56, 189, 248, 0.08) 0%, transparent 40%);
  opacity: 0.9;
}
.sidebar-inner {
  position: relative;
  z-index: 1;
  padding: 0.9rem 0.55rem 0.85rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  box-sizing: border-box;
  pointer-events: auto;
}
.sidebar-nav {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}
.sidebar-nav .sidebar-link {
  pointer-events: auto;
  cursor: pointer;
  position: relative;
  z-index: 2;
}
.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.15rem;
  text-align: center;
}
.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.55rem;
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  transition: background 0.15s ease;
  width: 100%;
}
.sidebar-brand-link--stacked {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.55rem;
}
.sidebar-brand-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
}
.sidebar-brand-logo-wrap {
  flex-shrink: 0;
  padding: 0.55rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.sidebar-brand-logo {
  /* Wide logo: keep height, allow wider box */
  width: auto;
  max-width: 140px;
  height: 40px;
  display: block;
  border-radius: 6px;
  object-fit: contain;
}
.sidebar-brand-tagline {
  display: block;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  line-height: 1.35;
  max-width: 100%;
}
.sidebar-brand-login {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #e2e8f0;
  line-height: 1.35;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Same pattern as sidebar brand uptime (under Login) */
.sidebar-brand-uptime {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  color: #94a3b8;
  line-height: 1.25;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-brand-uptime[hidden] {
  display: none !important;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  flex: 1;
  overflow-y: auto;
  padding-right: 0.15rem;
  margin-bottom: 0.85rem;
  justify-content: flex-start;
  align-content: flex-start;
}
/* Account + Logout glued together (not pushed to bottom) */
.sidebar-nav-tail {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  flex: 0 0 auto;
  margin-top: 0;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.55rem;
  border-radius: 8px;
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.82rem;
  text-decoration: none;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.sidebar-link.is-active,
.sidebar-link:hover {
  background: rgba(99, 102, 241, 0.22);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-block;
  background-color: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  opacity: 0.95;
}
.sidebar-icon-home {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 10.5 12 3l9 7.5'/%3E%3Cpath d='M5 10v10h14V10'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 10.5 12 3l9 7.5'/%3E%3Cpath d='M5 10v10h14V10'/%3E%3C/svg%3E");
}
.sidebar-icon-log {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/%3E%3C/svg%3E");
}
.sidebar-icon-syslog {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19h16M7 16V9m5 7V5m5 11v-4'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19h16M7 16V9m5 7V5m5 11v-4'/%3E%3C/svg%3E");
}
.sidebar-icon-device {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='12' rx='2'/%3E%3Cpath d='M8 20h8M12 16v4'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='12' rx='2'/%3E%3Cpath d='M8 20h8M12 16v4'/%3E%3C/svg%3E");
}
.sidebar-icon-setup {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E");
}
.sidebar-icon-api {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 7h6M4 12h16M4 17h10'/%3E%3Ccircle cx='16' cy='7' r='2'/%3E%3Ccircle cx='10' cy='17' r='2'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 7h6M4 12h16M4 17h10'/%3E%3Ccircle cx='16' cy='7' r='2'/%3E%3Ccircle cx='10' cy='17' r='2'/%3E%3C/svg%3E");
}
.sidebar-icon-user {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 4-6 8-6s8 2 8 6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 4-6 8-6s8 2 8 6'/%3E%3C/svg%3E");
}
.sidebar-icon-logout {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4M16 17l5-5-5-5M21 12H9'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4M16 17l5-5-5-5M21 12H9'/%3E%3C/svg%3E");
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
/* Logout — under Account in nav (match dashboard red style) */
.sidebar-logout-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.62rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.28);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.14) 0%, rgba(127, 29, 29, 0.22) 100%);
  color: #fecaca;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.sidebar-logout-btn--nav {
  margin-top: 0;
  flex: 0 0 auto;
}
.sidebar-logout-btn:hover {
  color: #fff;
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.28) 0%, rgba(185, 28, 28, 0.38) 100%);
  border-color: rgba(252, 165, 165, 0.55);
  box-shadow: 0 10px 22px rgba(127, 29, 29, 0.28);
  transform: translateY(-1px);
}
.sidebar-logout-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}
.sidebar-logout-btn .sidebar-icon {
  width: 17px;
  height: 17px;
  background-color: currentColor;
  flex-shrink: 0;
}
.sidebar-logout-label {
  letter-spacing: 0.02em;
}
.sidebar-build-label {
  margin: 0;
  text-align: center;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: #64748b;
}

/* API access panel */
.api-status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  align-items: center;
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-size: 0.85rem;
}
.api-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.78rem;
}
.api-scopes-fieldset {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 0.9rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
}
.api-scopes-fieldset legend {
  padding: 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.api-scopes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.35rem 0.75rem;
}
.api-scope-label {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
}
.api-scope-label input {
  margin-top: 0.2rem;
}
.api-token-once {
  margin: 0.75rem 0;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
}
.api-example {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
/* Compact whitelist + catalog (same idea as SysLOG fixed columns) */
.api-whitelist-table,
.api-catalog-table {
  table-layout: fixed;
  width: 100%;
}
.api-whitelist-table th,
.api-whitelist-table td,
.api-catalog-table th,
.api-catalog-table td {
  padding: 0.4rem 0.4rem;
  vertical-align: top;
}
.api-whitelist-wrap {
  max-height: none;
  min-height: 0;
  margin-bottom: 0.5rem;
}
.api-whitelist-table .api-col-name { width: 8rem; }
.api-whitelist-table .api-col-token { width: 18rem; }
.api-whitelist-table .api-col-networks { width: 6.5rem; }
.api-whitelist-table .api-col-scopes { width: 5rem; }
.api-whitelist-table .api-col-status { width: 4.2rem; }
.api-whitelist-table .api-col-used { width: 6.5rem; }
.api-whitelist-table .api-col-actions { width: 11rem; white-space: nowrap; }
.api-whitelist-table tr[data-token-id] td {
  background: #fafbff;
}
.api-token-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.35rem 0.45rem;
  min-width: 0;
}
.api-token-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.7rem;
  line-height: 1.35;
  word-break: break-all;
  overflow-wrap: anywhere;
  color: #0f172a;
  flex: 1 1 10rem;
  min-width: 0;
}
.api-token-value.is-prefix-only {
  color: var(--muted);
}
.api-catalog-table .api-cat-method { width: 4.5rem; }
.api-catalog-table .api-cat-path { width: 16rem; }
.api-catalog-table .api-cat-scope { width: 5rem; }
.api-catalog-table .api-cat-auth { width: 9rem; }
.api-catalog-table .api-cat-desc { width: auto; }
.api-catalog-table .api-cat-path,
.api-catalog-table td:nth-child(2) {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.74rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.api-catalog-table .api-cat-desc,
.api-catalog-table td:nth-child(5) {
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-word;
}
.api-catalog-table .badge-scope,
.api-whitelist-table .badge-scope {
  background: #eef2ff;
  color: #4338ca;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  line-height: 1.25;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}
.api-catalog-table .badge-group-service {
  background: #ecfdf5;
  color: #047857;
}
.api-catalog-table .badge-group-session {
  background: #f1f5f9;
  color: #475569;
}
.mono-prefix {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 60;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: none;
  background: var(--bg);
  color: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 0;
}
.sidebar-toggle-bar {
  display: block;
  width: 16px;
  height: 2px;
  background: #e2e8f0;
  border-radius: 2px;
}
/* Below drawer sidebar (mobile z-index 50) so menu stays clickable */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 35;
  backdrop-filter: blur(2px);
  -webkit-tap-highlight-color: transparent;
}

/* —— Main content ——
 * Always fills remaining width beside sidebar (expands when sidebar collapses).
 */
.main-content.dash-module-main,
.dash-module-page .main-content {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 1.25rem 1.75rem 2.5rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: padding 0.2s ease;
}
/* Children stretch full content width */
.main-content.dash-module-main > *,
.dash-module-page .main-content > * {
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}
body.sidebar-collapsed .main-content.dash-module-main,
body.sidebar-collapsed .dash-module-page .main-content {
  /* slightly more side padding when rail is narrow */
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* —— Overview hero (exact dashboard palette) —— */
.overview-hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 38%, #312e81 72%, #4338ca 100%);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.22);
}
.overview-hero-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 88% 12%, rgba(56, 189, 248, 0.28) 0%, transparent 38%),
    radial-gradient(circle at 8% 88%, rgba(129, 140, 248, 0.32) 0%, transparent 42%);
  pointer-events: none;
}
.overview-hero-grid {
  position: absolute;
  inset: 0;
  opacity: 0.14;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.35) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  pointer-events: none;
}
.overview-hero-inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.75rem 1.85rem 1.35rem;
}
.overview-hero-badge {
  display: inline-flex;
  padding: 0.24rem 0.65rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #bae6fd;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  margin-bottom: 0.6rem;
}
.overview-hero-copy h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.45rem, 3vw, 1.95rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.2;
}
.overview-hero-copy p {
  margin: 0;
  max-width: 34rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.94rem;
  line-height: 1.55;
}
.overview-hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-top: 1rem;
}
.overview-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #bbf7d0;
  background: rgba(22, 163, 74, 0.18);
  border: 1px solid rgba(74, 222, 128, 0.35);
}
.overview-live-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.25);
  animation: overview-pulse 2s ease-in-out infinite;
}
@keyframes overview-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(0.92); }
}
.overview-hero-meta-item {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.72);
}
.overview-hero-meta-item strong {
  color: #fff;
  font-weight: 700;
}

/* —— Stat cards —— */
.overview-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}
.overview-stats--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.overview-stats--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.overview-stats--5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
/* Database row: D1 D2 D3 · PGSQL REPLICA wraps under Database 1 */
.overview-stats--database {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 0.85rem;
}
.overview-stats--database > .overview-stat-card--replica,
.overview-stats--database > .overview-stat-card--replica-warn,
.overview-stats--database > .overview-stat-card--replica-down {
  grid-column: 1;
}
.overview-stat-card--replica-size::after {
  background: linear-gradient(90deg, #0e7490, #67e8f9);
}
.overview-stat-card--replica-size .overview-stat-icon {
  background: #0e7490;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cellipse cx='12' cy='5' rx='8' ry='3'/%3E%3Cpath d='M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cellipse cx='12' cy='5' rx='8' ry='3'/%3E%3Cpath d='M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6'/%3E%3C/svg%3E");
}
.overview-stat-card--database3::after {
  background: linear-gradient(90deg, #ea580c, #fb923c);
}
.overview-stat-card--database3 .overview-stat-icon {
  background: #ea580c;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cellipse cx='12' cy='5' rx='8' ry='3'/%3E%3Cpath d='M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cellipse cx='12' cy='5' rx='8' ry='3'/%3E%3Cpath d='M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6'/%3E%3C/svg%3E");
}
.overview-stat-card--database3 .overview-stat-value {
  color: #c2410c;
}
.overview-stat-card--database3-offline::after {
  background: linear-gradient(90deg, #78716c, #a8a29e);
}
.overview-stat-card--database3-offline .overview-stat-icon {
  background: #78716c;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cellipse cx='12' cy='5' rx='8' ry='3'/%3E%3Cpath d='M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cellipse cx='12' cy='5' rx='8' ry='3'/%3E%3Cpath d='M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6'/%3E%3C/svg%3E");
}
.overview-stat-card--database3-offline .overview-stat-value {
  color: #57534e;
  font-size: 0.95rem;
  font-weight: 700;
}
.overview-stat-card--replica::after {
  background: linear-gradient(90deg, #059669, #34d399);
}
.overview-stat-card--replica .overview-stat-icon {
  background: #059669;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M16 3h5v5M8 3H3v5M12 22V8M3 8l9-5 9 5'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M16 3h5v5M8 3H3v5M12 22V8M3 8l9-5 9 5'/%3E%3C/svg%3E");
}
.overview-stat-card--replica .overview-stat-value {
  color: #047857;
  font-size: 1.15rem;
}
.overview-stat-card--replica-warn::after {
  background: linear-gradient(90deg, #d97706, #fbbf24);
}
.overview-stat-card--replica-warn .overview-stat-icon {
  background: #d97706;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M16 3h5v5M8 3H3v5M12 22V8M3 8l9-5 9 5'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M16 3h5v5M8 3H3v5M12 22V8M3 8l9-5 9 5'/%3E%3C/svg%3E");
}
.overview-stat-card--replica-warn .overview-stat-value {
  color: #b45309;
  font-size: 1.15rem;
}
.overview-stat-card--replica-down::after {
  background: linear-gradient(90deg, #dc2626, #f87171);
}
.overview-stat-card--replica-down .overview-stat-icon {
  background: #dc2626;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M16 3h5v5M8 3H3v5M12 22V8M3 8l9-5 9 5'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M16 3h5v5M8 3H3v5M12 22V8M3 8l9-5 9 5'/%3E%3C/svg%3E");
}
.overview-stat-card--replica-down .overview-stat-value {
  color: #b91c1c;
  font-size: 1.05rem;
}
.overview-stat-card--device::after {
  background: linear-gradient(90deg, #4f46e5, #818cf8);
}
.overview-stat-card--device .overview-stat-icon {
  background: #4f46e5;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='12' rx='2'/%3E%3Cpath d='M8 20h8M12 16v4'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='12' rx='2'/%3E%3Cpath d='M8 20h8M12 16v4'/%3E%3C/svg%3E");
}
.overview-stat-card--udp::after {
  background: linear-gradient(90deg, #0891b2, #22d3ee);
}
.overview-stat-card--udp .overview-stat-icon {
  background: #0891b2;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M5 12a7 7 0 0 1 14 0M2 12a10 10 0 0 1 20 0'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M5 12a7 7 0 0 1 14 0M2 12a10 10 0 0 1 20 0'/%3E%3C/svg%3E");
}
.overview-stat-card--tcp::after {
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
}
.overview-stat-card--tcp .overview-stat-icon {
  background: #7c3aed;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 7h16M4 12h16M4 17h10'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 7h16M4 12h16M4 17h10'/%3E%3C/svg%3E");
}
.overview-stat-card--disabled::after {
  background: linear-gradient(90deg, #94a3b8, #cbd5e1);
}
.overview-stat-card--disabled .overview-stat-value {
  color: #64748b;
}
.overview-stat-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1.1rem 1.15rem;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.overview-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.09);
}
.overview-stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 16px 16px 0 0;
}
.overview-stat-card--total::after { background: linear-gradient(90deg, #6366f1, #818cf8); }
.overview-stat-card--up::after { background: linear-gradient(90deg, #16a34a, #4ade80); }
.overview-stat-card--down::after { background: linear-gradient(90deg, #dc2626, #f87171); }
.overview-stat-card--logs::after { background: linear-gradient(90deg, #0f766e, #14b8a6); }
.overview-stat-card--database::after { background: linear-gradient(90deg, #78716c, #a8a29e); }
.overview-stat-icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background: #f1f5f9;
  mask-size: 55%;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: 55%;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}
.overview-stat-card--total .overview-stat-icon {
  background: #6366f1;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='2' y='3' width='20' height='14' rx='2'/%3E%3Cpath d='M8 21h8M12 17v4'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='2' y='3' width='20' height='14' rx='2'/%3E%3Cpath d='M8 21h8M12 17v4'/%3E%3C/svg%3E");
}
.overview-stat-card--up .overview-stat-icon {
  background: #16a34a;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M22 11.08V12a10 10 0 11-5.93-9.14'/%3E%3Cpath d='M22 4L12 14.01l-3-3'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M22 11.08V12a10 10 0 11-5.93-9.14'/%3E%3Cpath d='M22 4L12 14.01l-3-3'/%3E%3C/svg%3E");
}
.overview-stat-card--database .overview-stat-icon {
  background: #78716c;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cellipse cx='12' cy='5' rx='8' ry='3'/%3E%3Cpath d='M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cellipse cx='12' cy='5' rx='8' ry='3'/%3E%3Cpath d='M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6'/%3E%3C/svg%3E");
}
.overview-stat-card--logs .overview-stat-icon {
  background: #0f766e;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z'/%3E%3Cpath d='M14 2v6h6M16 13H8M16 17H8M10 9H8'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z'/%3E%3Cpath d='M14 2v6h6M16 13H8M16 17H8M10 9H8'/%3E%3C/svg%3E");
}
.overview-stat-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.overview-stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.overview-stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.15;
}
.overview-stat-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

/* —— Content panels —— */
.view-panel[hidden] { display: none !important; }
/* Host metrics bar */
.overview-host-metrics-card {
  margin: 0 0 1.15rem;
  padding: 1rem 1.35rem 1.05rem;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  text-align: center;
}
.overview-host-metrics-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.65rem 1.25rem;
}
.overview-host-metrics-item {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.overview-host-metrics-item--cpu { color: #0284c7; }
.overview-host-metrics-item--mem { color: #7c3aed; }
.overview-host-metrics-item--disk { color: #d97706; }
.overview-host-metrics-item--iops { color: #059669; }

/* Host stack (OS / Nginx / …) — dashboard OverviewHostStack layout */
.overview-host-stack-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}
.overview-host-stack-wrap:empty {
  display: none;
}
.overview-host-stack-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 0.45rem 0.65rem;
  width: 100%;
}
.overview-host-stack-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  min-width: 6.5rem;
  padding: 0.42rem 0.55rem;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.12);
  text-align: center;
  line-height: 1.25;
}
.overview-host-stack-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.overview-host-stack-value {
  font-size: 0.74rem;
  font-weight: 600;
  color: #475569;
  word-break: break-word;
}
.overview-host-stack-item--os .overview-host-stack-label { color: #2563eb; }
.overview-host-stack-item--os .overview-host-stack-value { color: #1d4ed8; }
.overview-host-stack-item--nginx .overview-host-stack-label { color: #059669; }
.overview-host-stack-item--nginx .overview-host-stack-value { color: #047857; }
.overview-host-stack-item--nodejs .overview-host-stack-label { color: #65a30d; }
.overview-host-stack-item--nodejs .overview-host-stack-value { color: #4d7c0f; }
.overview-host-stack-item--postgresql .overview-host-stack-label { color: #0284c7; }
.overview-host-stack-item--postgresql .overview-host-stack-value { color: #0369a1; }
.overview-host-stack-item--openssl .overview-host-stack-label { color: #d97706; }
.overview-host-stack-item--openssl .overview-host-stack-value { color: #b45309; }
.overview-host-stack-item--ssl .overview-host-stack-label { color: #db2777; }
.overview-host-stack-item--ssl .overview-host-stack-value { color: #be185d; }

/* Overview pie charts: always 2 per row (3rd wraps to next line) */
.overview-pie-charts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.85rem;
  margin: 0 0 1.15rem;
  align-items: stretch;
}
/* Keep --3 class for markup compat; still 2 columns, not 3 */
.overview-pie-charts--3 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.overview-pie-charts > .overview-sev-chart-card {
  margin: 0;
  height: 100%;
  min-width: 0;
}

/* Severity / Category pie (donut) — Overview */
.overview-sev-chart-card {
  margin: 0 0 1.15rem;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}
.overview-sev-chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.85rem 1rem;
  padding: 1.25rem 1.35rem 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}
.overview-sev-chart-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.overview-sev-chart-head .muted {
  margin: 0;
}
.overview-sev-chart-link {
  flex-shrink: 0;
}
.overview-sev-chart-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem 2.5rem;
  padding: 1.35rem 1.35rem 1.5rem;
}
.overview-sev-chart-visual {
  flex: 0 0 auto;
}
.overview-sev-chart-ring {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}
.overview-sev-chart-hole {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
}
.overview-sev-chart-total-value {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}
.overview-sev-chart-total-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.overview-sev-chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 200px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}
/*
 * Side-by-side cards (Severities | Categories):
 * pie LEFT · compact legend RIGHT — no scroll; all items fit in one box
 */
.overview-pie-charts .overview-sev-chart-body {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  padding: 0.85rem 1rem 0.95rem;
}
.overview-pie-charts .overview-sev-chart-visual {
  flex: 0 0 auto;
}
.overview-pie-charts .overview-sev-chart-ring {
  width: 132px;
  height: 132px;
}
.overview-pie-charts .overview-sev-chart-hole {
  width: 78px;
  height: 78px;
  gap: 0.05rem;
  padding: 0.15rem;
  box-sizing: border-box;
}
/* Center counter (number) + "events" — keep compact inside donut hole */
.overview-pie-charts .overview-sev-chart-total-value {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.overview-pie-charts .overview-sev-chart-total-label {
  font-size: 0.42rem;
  letter-spacing: 0.03em;
  line-height: 1;
  font-weight: 600;
}
/* 2-col compact legend: 8 severities → 4 short rows, no scroll */
.overview-pie-charts .overview-sev-chart-legend {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.28rem 0.4rem;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}
.overview-pie-charts .overview-sev-chart-legend--cats,
.overview-pie-charts .overview-sev-chart-legend--brands {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
/* Single-line row: swatch · name · % · count */
.overview-pie-charts .overview-sev-chart-legend-item {
  padding: 0.28rem 0.4rem;
  gap: 0.28rem 0.32rem;
  border-radius: 8px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}
.overview-pie-charts .overview-sev-chart-legend-swatch {
  width: 0.55rem;
  height: 0.55rem;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.12);
}
.overview-pie-charts .overview-sev-chart-legend-copy {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.35rem;
  min-width: 0;
}
.overview-pie-charts .overview-sev-chart-legend-label {
  font-size: 0.68rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.overview-pie-charts .overview-sev-chart-legend-meta {
  font-size: 0.62rem;
  line-height: 1.15;
  white-space: nowrap;
}
.overview-pie-charts .overview-sev-chart-legend-value {
  font-size: 0.72rem;
  line-height: 1.15;
  white-space: nowrap;
}
.overview-pie-charts .overview-sev-chart-head {
  padding: 0.85rem 1rem 0.7rem;
}
.overview-pie-charts .overview-sev-chart-head h2 {
  font-size: 0.95rem;
}
.overview-pie-charts .overview-sev-chart-head .muted {
  font-size: 0.75rem;
}
.overview-sev-chart-legend-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fafbfc;
}
.overview-sev-chart-legend-swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.14);
}
.overview-sev-chart-legend-copy {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}
.overview-sev-chart-legend-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f172a;
  text-transform: none;
  word-break: break-word;
}
.overview-sev-chart-legend-meta {
  font-size: 0.7rem;
  color: var(--muted);
}
.overview-sev-chart-legend-value {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}
.overview-sev-chart-legend-item--emerg .overview-sev-chart-legend-swatch {
  background: #7f1d1d;
  box-shadow: 0 0 0 3px rgba(127, 29, 29, 0.14);
}
.overview-sev-chart-legend-item--emerg .overview-sev-chart-legend-value { color: #7f1d1d; }
.overview-sev-chart-legend-item--alert .overview-sev-chart-legend-swatch {
  background: #b91c1c;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.14);
}
.overview-sev-chart-legend-item--alert .overview-sev-chart-legend-value { color: #b91c1c; }
.overview-sev-chart-legend-item--crit .overview-sev-chart-legend-swatch {
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}
.overview-sev-chart-legend-item--crit .overview-sev-chart-legend-value { color: #dc2626; }
.overview-sev-chart-legend-item--err .overview-sev-chart-legend-swatch {
  background: #ea580c;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.14);
}
.overview-sev-chart-legend-item--err .overview-sev-chart-legend-value { color: #c2410c; }
.overview-sev-chart-legend-item--warning .overview-sev-chart-legend-swatch {
  background: #d97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.14);
}
.overview-sev-chart-legend-item--warning .overview-sev-chart-legend-value { color: #b45309; }
.overview-sev-chart-legend-item--notice .overview-sev-chart-legend-swatch {
  background: #0891b2;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.14);
}
.overview-sev-chart-legend-item--notice .overview-sev-chart-legend-value { color: #0e7490; }
.overview-sev-chart-legend-item--info .overview-sev-chart-legend-swatch {
  background: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.overview-sev-chart-legend-item--info .overview-sev-chart-legend-value { color: #1d4ed8; }
.overview-sev-chart-legend-item--debug .overview-sev-chart-legend-swatch {
  background: #64748b;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.14);
}
.overview-sev-chart-legend-item--debug .overview-sev-chart-legend-value { color: #475569; }

@media (max-width: 1100px) {
  /* Still 2 per row until phone width */
  .overview-pie-charts,
  .overview-pie-charts--3 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .overview-pie-charts .overview-sev-chart-ring {
    width: 140px;
    height: 140px;
  }
  .overview-pie-charts .overview-sev-chart-hole {
    width: 84px;
    height: 84px;
  }
  .overview-pie-charts .overview-sev-chart-total-value {
    font-size: 0.78rem;
  }
  .overview-pie-charts .overview-sev-chart-total-label {
    font-size: 0.42rem;
  }
}
@media (max-width: 720px) {
  /* Phone / narrow: 1 pie per row */
  .overview-pie-charts,
  .overview-pie-charts--3 {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .overview-pie-charts .overview-sev-chart-body {
    flex-direction: column;
    flex-wrap: wrap;
    align-items: center;
  }
  .overview-pie-charts .overview-sev-chart-legend {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    overflow: visible;
    max-height: none;
  }
  .overview-pie-charts .overview-sev-chart-ring {
    width: 128px;
    height: 128px;
  }
  .overview-pie-charts .overview-sev-chart-hole {
    width: 76px;
    height: 76px;
  }
  .overview-pie-charts .overview-sev-chart-total-value {
    font-size: 0.68rem;
  }
  .overview-pie-charts .overview-sev-chart-total-label {
    font-size: 0.4rem;
  }
}

.overview-panel-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  margin-bottom: 1rem;
}
.overview-panel-head {
  padding: 1.1rem 1.25rem 0.65rem;
  border-bottom: 1px solid var(--border);
}
.overview-panel-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.overview-panel-head .muted { margin: 0; }
.overview-panel-body {
  padding: 1rem 1.25rem 1.25rem;
}
.feature-list {
  margin: 0;
  padding-left: 1.15rem;
}
.feature-list li { margin: 0.35rem 0; }
.account-form {
  max-width: 420px;
}

/* Data tables (SysLOG / Device) */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.data-table th,
.data-table td {
  padding: 0.45rem 0.55rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}
.data-table tbody tr:hover {
  background: rgba(148, 163, 184, 0.08);
}
.data-table .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
}
.data-table .nowrap {
  white-space: nowrap;
}
#syslogTableBody.is-loading {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.syslog-table-wrap {
  /* 2× previous height — show many more of the 200 rows */
  max-height: min(234vh, 2760px);
  min-height: 1260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.device-table-wrap {
  max-height: min(62vh, 560px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.syslog-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.syslog-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  align-items: center;
}
.syslog-toolbar-row--search .syslog-input {
  flex: 0 1 18rem;
  width: 18rem;
  min-width: 12rem;
  max-width: 22rem;
}
.syslog-toolbar-row--filters .syslog-select {
  flex: 0 1 auto;
}
.syslog-input,
.syslog-select {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  min-width: 0;
}
.syslog-input {
  flex: 0 1 18rem;
  width: 18rem;
  min-width: 12rem;
  max-width: 22rem;
}
.syslog-select {
  flex: 0 1 auto;
}
.syslog-date {
  min-width: 8.5rem;
  max-width: 11rem;
}
.syslog-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.syslog-pager-info {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 12rem;
  text-align: center;
}
.syslog-live-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
  user-select: none;
}
.syslog-meta {
  margin: 0 0 0.55rem;
}
/*
 * SysLOG columns (6): Time · Device · Network · Sev · Host · Message
 * Widths from <colgroup> (JS-resizable, saved in localStorage).
 */
.syslog-table {
  table-layout: fixed;
  width: 100%;
}
.syslog-table th,
.syslog-table td {
  padding: 0.4rem 0.4rem;
}
.syslog-table thead th {
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: none;
}
/* Default col widths (overridden by JS when saved prefs exist) */
.syslog-table col.syslog-col-time { width: 5.4rem; }
.syslog-table col.syslog-col-device { width: 7.5rem; }
.syslog-table col.syslog-col-network { width: 6rem; }
.syslog-table col.syslog-col-sev { width: 4rem; }
.syslog-table col.syslog-col-host { width: 14rem; }
.syslog-table col.syslog-col-msg { width: auto; }

.syslog-table td.syslog-time {
  white-space: normal;
  vertical-align: top;
  padding-right: 0.35rem;
}
.syslog-time {
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.syslog-time-date,
.syslog-time-clock {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  font-family: inherit;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.syslog-time-clock {
  margin-top: 0.1rem;
}
.syslog-table td.syslog-device,
.syslog-table td.syslog-network,
.syslog-table td.syslog-host {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.syslog-table td.syslog-sev {
  white-space: nowrap;
}
.syslog-msg {
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: none;
}

/* Column resize handle (drag right edge of header) */
.syslog-col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
  touch-action: none;
}
.syslog-col-resizer::after {
  content: '';
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: transparent;
  transition: background 0.12s ease;
}
.syslog-col-resizer:hover::after,
.syslog-col-resizer.is-active::after {
  background: #2563eb;
}
body.syslog-col-resizing,
body.syslog-col-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}
/* Search match highlight */
.syslog-hl,
.syslog-table strong.syslog-hl {
  font-weight: 800;
  color: #0f172a;
  background: #fef08a;
  padding: 0 0.12em;
  border-radius: 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.badge-net .syslog-hl {
  background: #fde68a;
  color: #1e1b4b;
}
/* Sev is 4th col: Time, Device, Network, Sev, Host, Message */
.syslog-table tr.sev-crit td.syslog-sev { color: #b91c1c; font-weight: 700; }
.syslog-table tr.sev-err td.syslog-sev { color: #c2410c; font-weight: 600; }
.syslog-table tr.sev-warn td.syslog-sev { color: #b45309; font-weight: 600; }
.syslog-table tr.sev-info td.syslog-sev { color: #0369a1; }

/* err: MESSAGE matches Sev color so the row stands out when scanning */
.syslog-table tr.sev-err td.syslog-msg {
  color: #c2410c;
}
.syslog-table tr.sev-err td.syslog-msg .syslog-hl {
  color: #9a3412;
  background: #ffedd5;
}

.device-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin: 0 0 1.1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
}
.device-filter-bar .form-group {
  margin: 0;
  min-width: 10rem;
}
.device-filter-bar .device-select {
  min-width: 11rem;
}
.device-filter-meta {
  flex: 1 1 auto;
  min-width: 8rem;
}
.device-filter-count {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
  padding: 0.45rem 0;
}
.device-filter-hint {
  margin: 0.35rem 0 1rem;
  padding: 0 0.15rem;
}
.device-form {
  margin-bottom: 1.15rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.device-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
}
.device-form-grid > .form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  min-width: 0;
}
.device-form-grid > .form-group > label {
  margin-bottom: 0.35rem;
  line-height: 1.25;
  min-height: 1.25em;
}
/* Same height for text/number inputs and select dropdowns */
.device-form-grid > .form-group > input,
.device-form-grid > .form-group > select,
.device-form .device-select {
  width: 100%;
  box-sizing: border-box;
  height: 2.5rem;
  min-height: 2.5rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.25;
  background: #fff;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
}
.device-form-grid > .form-group > select,
.device-form .device-select {
  /* keep native arrow usable on some browsers */
  -webkit-appearance: menulist;
  appearance: menulist;
  padding-right: 0.5rem;
}
.device-form-grid > .form-group > input:focus,
.device-form-grid > .form-group > select:focus,
.device-form .device-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.device-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.form-group--check {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100%;
  padding-bottom: 0;
}
.form-group--check .check-label {
  height: 2.5rem;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}
.check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}
.device-actions {
  white-space: nowrap;
  text-align: right;
}
.col-order {
  width: 4.5rem;
  text-align: center;
}
.device-order-btns {
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: center;
}
.device-order-btns .btn {
  min-width: 2rem;
  padding: 0.15rem 0.4rem;
  line-height: 1.1;
  font-weight: 700;
}
.device-order-btns .btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.device-table tbody tr[data-device-id] {
  cursor: grab;
}
/* Last seen older than 3 days */
.device-table .device-last-seen--stale {
  color: #b91c1c;
  font-weight: 700;
}
.device-table tbody tr[data-device-id].is-dragging {
  opacity: 0.45;
  background: #eff6ff;
  cursor: grabbing;
}
.device-table tbody tr[data-device-id].drag-over-above {
  box-shadow: inset 0 2px 0 0 #2563eb;
}
.device-table tbody tr[data-device-id].drag-over-below {
  box-shadow: inset 0 -2px 0 0 #2563eb;
}
.device-table tbody tr[data-device-id].is-reorder-busy {
  pointer-events: none;
  opacity: 0.7;
}
.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}
.badge-ok {
  background: #d1fae5;
  color: #047857;
}
.badge-off {
  background: #f1f5f9;
  color: #64748b;
}
.badge-host {
  background: #e0f2fe;
  color: #0369a1;
}
.badge-net {
  background: #ede9fe;
  color: #6d28d9;
}
.badge-cat {
  letter-spacing: 0.06em;
}
.badge-cat-router {
  background: #ffedd5;
  color: #c2410c;
}
.badge-cat-switch {
  background: #dbeafe;
  color: #1d4ed8;
}
.badge-cat-server {
  background: #e0e7ff;
  color: #4338ca;
}
.badge-cat-appliance {
  background: #fce7f3;
  color: #be185d;
}
.badge-brand {
  background: #ecfdf5;
  color: #047857;
  letter-spacing: 0.02em;
}

/* Setup panel */
.setup-proto-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.setup-proto-card {
  margin: 0;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  min-width: 0;
}
.setup-proto-card legend {
  padding: 0 0.25rem;
}
.setup-ports {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.55rem 0 0.65rem;
}
.setup-port-row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}
.setup-port-input {
  flex: 1;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  max-width: 10rem;
}
.setup-port-add {
  min-width: 2rem;
  font-weight: 700;
}
.setup-live-meta {
  margin: 0 0 0.75rem;
}
.setup-section-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}
.setup-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.35rem 0 1.15rem;
}
.device-form-grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.device-form-grid--5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.device-form-grid--6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.device-form-grid--7 {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.device-select {
  width: 100%;
  box-sizing: border-box;
  height: 2.5rem;
  min-height: 2.5rem;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.25;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
@media (max-width: 1200px) {
  .device-form-grid--6,
  .device-form-grid--7 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 1100px) {
  .device-form-grid--5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .device-form-grid--4,
  .device-form-grid--5,
  .device-form-grid--6,
  .device-form-grid--7 {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 800px) {
  .setup-proto-grid {
    grid-template-columns: 1fr;
  }
  .device-form-grid--4,
  .device-form-grid--5,
  .device-form-grid--6,
  .device-form-grid--7 {
    grid-template-columns: 1fr;
  }
}
.btn-sm {
  padding: 0.28rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 7px;
}
/* Solid slate — same shape/shadow as primary; gray color for Enable etc. */
.btn-secondary {
  color: #0f172a;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border: 1px solid transparent;
  box-shadow: 0 8px 22px rgba(148, 163, 184, 0.35);
}
.btn-secondary:hover:not(:disabled) {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  color: #0f172a;
  box-shadow: 0 12px 28px rgba(100, 116, 139, 0.4);
  transform: translateY(-1px);
}
/* Edit / + use .btn-primary (same solid indigo as SysLOG Search / Clear / Refresh) */
/* Same solid filled + shadow + hover lift as .btn-primary; colors stay semantic */
.btn-warning {
  color: #422006;
  background: linear-gradient(135deg, #facc15 0%, #eab308 100%);
  border: 1px solid transparent;
  box-shadow: 0 8px 22px rgba(234, 179, 8, 0.38);
}
.btn-warning:hover:not(:disabled) {
  background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
  color: #422006;
  box-shadow: 0 12px 28px rgba(202, 138, 4, 0.45);
  transform: translateY(-1px);
}
/* Solid red — project Cancel / danger */
.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: 1px solid transparent;
  box-shadow: 0 8px 22px rgba(220, 38, 38, 0.38);
}
.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
  box-shadow: 0 12px 28px rgba(185, 28, 28, 0.45);
  transform: translateY(-1px);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
}
.status-pill.status-up {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #86efac;
}
.status-pill.status-down {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
}

/* Setup → Syslog service master ON/OFF */
.setup-service-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
  padding: 0.95rem 1.1rem;
  margin: 0 0 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  background: #f8fafc;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.setup-service-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  min-width: 0;
}
.setup-service-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.setup-service-actions .btn {
  min-width: 5.5rem;
}
.setup-service-actions .btn.is-active {
  outline: 2px solid rgba(15, 23, 42, 0.18);
  outline-offset: 2px;
}
.setup-service-bar.is-off {
  background: linear-gradient(135deg, #fef2f2 0%, #fff1f2 100%);
  border-color: rgba(248, 113, 113, 0.5);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.08), 0 8px 22px rgba(220, 38, 38, 0.06);
}
.setup-service-bar.is-on {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border-color: rgba(74, 222, 128, 0.5);
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.08), 0 8px 22px rgba(22, 163, 74, 0.06);
}

.status-pill.status-up,
.status-pill.status-down {
  gap: 0.35rem;
}
.status-pill.status-up::before,
.status-pill.status-down::before {
  content: '';
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-pill.status-up::before {
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
}
.status-pill.status-down::before {
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}

/* —— App confirm modal —— */
body.app-modal-open {
  overflow: hidden;
}
.app-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.app-modal[hidden] {
  display: none !important;
}
.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: appModalFadeIn 0.18s ease-out;
}
.app-modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  padding: 1.45rem 1.4rem 1.25rem;
  box-shadow:
    0 24px 48px rgba(2, 6, 23, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  animation: appModalPopIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  text-align: center;
}
.app-modal-panel--confirm {
  max-width: 24.5rem;
}
.app-modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.85rem;
}
.app-modal-icon-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 999px;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}
.app-modal-icon-glyph--danger {
  color: #b91c1c;
  background: linear-gradient(160deg, #fee2e2 0%, #fecaca 100%);
  border: 1px solid #fca5a5;
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.16);
}
.app-modal-icon-glyph--ok {
  color: #15803d;
  background: linear-gradient(160deg, #dcfce7 0%, #bbf7d0 100%);
  border: 1px solid #86efac;
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.14);
}
.app-modal-icon-glyph--info {
  color: #4338ca;
  background: linear-gradient(160deg, #e0e7ff 0%, #c7d2fe 100%);
  border: 1px solid #a5b4fc;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.14);
}
.app-modal-title {
  margin: 0 0 0.45rem;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.app-modal-body {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-line;
}
.app-modal-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}
/* DOM order = visual left → right (no CSS order overrides) */
.app-modal-actions .btn {
  min-width: 7rem;
  flex: 0 0 auto;
}
.app-modal-actions .btn-ghost {
  background: #fff;
  box-shadow: none;
}

@keyframes appModalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes appModalPopIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-modal-backdrop,
  .app-modal-panel {
    animation: none;
  }
}

@media (max-width: 900px) {
  .device-form-grid {
    grid-template-columns: 1fr;
  }
}

.build-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: min(60vh, 520px);
  overflow: auto;
}
.build-log-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 0.7rem 0.85rem;
}
.build-log-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.25rem;
}
.build-log-head time {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}
.build-log-item p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text);
}

body.sidebar-open { overflow: hidden; }

@media (max-width: 1200px) {
  .overview-stats--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overview-stats--database { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .overview-stats,
  .overview-stats--3,
  .overview-stats--4,
  .overview-stats--5,
  .overview-stats--database { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    /* Above dim overlay (35) so nav links remain clickable */
    z-index: 50;
    width: var(--sidebar-width);
    max-width: min(var(--sidebar-width), 86vw);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.3);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    pointer-events: auto;
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
    pointer-events: auto;
  }
  body.sidebar-open .sidebar-overlay {
    display: block;
    z-index: 35;
    pointer-events: auto;
  }
  .sidebar-toggle { display: flex; }
  /* Mobile uses hamburger drawer; hide desktop collapse control */
  .sidebar-collapse-btn { display: none; }
  /* Force full drawer labels even if desktop-collapse state is in localStorage */
  body.sidebar-collapsed { --sidebar-width: 196px; }
  body.sidebar-collapsed .sidebar-inner {
    padding: 0.9rem 0.55rem 0.85rem;
  }
  body.sidebar-collapsed .sidebar-brand-tagline,
  body.sidebar-collapsed .sidebar-brand-login,
  body.sidebar-collapsed .sidebar-brand-uptime,
  body.sidebar-collapsed .sidebar-link > span:not(.sidebar-icon),
  body.sidebar-collapsed .sidebar-logout-label,
  body.sidebar-collapsed .sidebar-build-label {
    display: revert !important;
  }
  body.sidebar-collapsed .sidebar-brand-logo-wrap {
    padding: 0.5rem 0.65rem;
  }
  body.sidebar-collapsed .sidebar-brand-logo {
    width: 64px;
    height: 64px;
  }
  body.sidebar-collapsed .sidebar-brand-link {
    padding: 0.35rem 0.25rem 0.15rem;
    justify-content: center;
  }
  body.sidebar-collapsed .sidebar-link {
    justify-content: flex-start;
    padding: 0.55rem 0.55rem;
    gap: 0.45rem;
  }
  body.sidebar-collapsed .sidebar-logout-btn {
    justify-content: flex-start;
    padding: 0.55rem 0.55rem;
  }
  /* Ensure drawer content is interactive above any glow/pseudo layers */
  .sidebar-inner,
  .sidebar-nav,
  .sidebar-nav .sidebar-link,
  .sidebar-logout-btn,
  .sidebar-brand-link {
    position: relative;
    z-index: 2;
    pointer-events: auto;
  }
  .sidebar-backdrop-glow {
    pointer-events: none !important;
    z-index: 0;
  }
  .main-content.dash-module-main,
  .dash-module-page .main-content {
    padding: 3.5rem 1rem 1.5rem;
  }
}
@media (max-width: 560px) {
  .login-box { padding: 22px 18px 18px; }
  .overview-stats,
  .overview-stats--3,
  .overview-stats--4,
  .overview-stats--5,
  .overview-stats--database { grid-template-columns: 1fr; }
  .overview-hero-inner { padding: 1.35rem 1.15rem 1.15rem; }
}
