:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #dbe2ee;
  --accent: #1d4ed8;
  --ok: #166534;
  --warn: #a16207;
  --err: #b91c1c;
  --off: #6b7280;
}
html[data-theme='dark'] {
  --bg: #0f172a;
  --surface: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: #374151;
  --accent: #60a5fa;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #f87171;
  --off: #9ca3af;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, "Segoe UI", Arial, sans-serif; color: var(--text); background: var(--bg); }
.topbar { display:flex; justify-content:space-between; align-items:center; padding: 12px 18px; background:#0b1220; color:#fff; }
.brand { font-weight:700; letter-spacing:0.2px; }
.menu-nav { position: relative; }
.menu-toggle { min-width: 40px; min-height: 40px; border-radius: 8px; background: #1e293b; color:#fff; border:1px solid #334155; cursor:pointer; font-size:1.1rem; }
.menu-popover { position:absolute; top: calc(100% + 8px); right: 0; width: 210px; background: var(--surface); border:1px solid var(--border); border-radius:10px; box-shadow: 0 12px 24px rgba(0,0,0,.2); padding:8px; z-index:20; display:flex; flex-direction:column; gap:3px; }
.menu-popover[hidden] { display: none !important; }
.menu-popover a,
.menu-link { width:100%; text-align:left; text-decoration:none; color: var(--text); background: transparent; border:none; border-radius:8px; padding:8px 10px; cursor:pointer; font: inherit; }
.menu-popover a:hover, .menu-popover a.active,
.menu-link:hover, .menu-link.active { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.menu-popover hr { width: 100%; border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.menu-popover form { margin: 0; }
.menu-fallback { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; justify-content:flex-end; }
.menu-fallback a { color:#dbeafe; text-decoration:none; border:1px solid #334155; border-radius:999px; padding:4px 9px; }
.container { max-width: 1200px; margin: 0 auto; padding: 18px; }
.page-head h1 { margin: 0 0 6px; }
.page-head p { margin: 0 0 4px; color: var(--muted); }
.status-header { display:grid; gap:10px; padding:12px 14px; margin: 10px 0 14px; background: var(--surface); border:1px solid var(--border); border-radius:12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.status-header-grid { display:grid; gap:10px 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); color: var(--muted); font-size: .9rem; }
.status-header-grid strong,
.status-summary-item strong { color: var(--text); }
.status-summary-band { display:flex; flex-wrap:wrap; gap:10px 14px; padding-top:10px; border-top:1px solid var(--border); }
.status-summary-item { display:flex; align-items:center; gap:8px; color: var(--muted); font-size: .92rem; }
small { color: var(--muted); }
.grid { display:grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); }
.card { background: var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px; margin: 10px 0; box-shadow: 0 1px 2px rgba(0,0,0,.07); }
.summary-card h3 { margin-top:0; }
.badge { display:inline-block; color:#fff; padding:3px 8px; border-radius:999px; font-size:.82rem; }
.green { background: var(--ok); }
.yellow { background: var(--warn); }
.red { background: var(--err); }
.gray { background: var(--off); }
.alert { border-radius:10px; padding:10px 12px; margin: 8px 0; }
.alert.success { background:#ecfdf3; border:1px solid #bbf7d0; color:#065f46; }
.alert.warning { background:#fffbeb; border:1px solid #fde68a; color:#92400e; }
.alert.error { background:#fef2f2; border:1px solid #fecaca; color:#991b1b; }
html[data-theme='dark'] .alert.success { background:#052e20; border-color:#166534; color:#bbf7d0; }
html[data-theme='dark'] .alert.warning { background:#3b2f06; border-color:#a16207; color:#fde68a; }
html[data-theme='dark'] .alert.error { background:#3f1010; border-color:#b91c1c; color:#fecaca; }
.inline-form { display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end; }
label { display:flex; flex-direction:column; gap:6px; font-size:.93rem; }
input, select, textarea, button { font: inherit; border-radius:8px; border:1px solid var(--border); padding:8px; background: var(--surface); color: var(--text); }
input:focus, select:focus, textarea:focus, button:focus, a:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .btn { background: var(--accent); color:#fff; border:none; cursor:pointer; text-decoration:none; display:inline-block; padding:8px 12px; }
table { width:100%; border-collapse: collapse; }
th, td { text-align:left; border-bottom:1px solid var(--border); padding:8px; vertical-align:top; }
th { color: var(--muted); }
pre { background:#0b1020; color:#dbeafe; padding:10px; border-radius:8px; max-height:300px; overflow:auto; white-space:pre-wrap; }
.empty-state { border:1px dashed var(--border); border-radius:10px; padding:12px; color: var(--muted); background: color-mix(in srgb, var(--surface) 92%, var(--bg)); }
.expand-table .details { display:none; }
.expand-table .details.open { display:table-row; }
.helper { color: var(--muted); }
.login-shell { min-height:100vh; display:flex; align-items:center; justify-content:center; }
.login-card { width:min(460px,92vw); background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:16px; }
.about-modal { border:1px solid var(--border); border-radius:12px; background: var(--surface); color:var(--text); width:min(620px, 94vw); padding: 14px 16px; }
.about-modal::backdrop { background: rgba(0,0,0,.45); }
.about-modal-header { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:8px; }
.about-close { min-width: 34px; min-height: 34px; border-radius:8px; background: transparent; color: var(--text); border:1px solid var(--border); }
.about-modal p,
.about-modal ul { margin: 8px 0; }

.warder-top-grid { margin-top: 14px; gap: 18px; }
.warder-toggle-form { display:flex; flex-direction:column; gap:14px; margin-top:10px; }
.checkbox-row { flex-direction:row; align-items:center; gap:10px; }
.checkbox-lg { width:1.1rem; height:1.1rem; }

.table-scroll { overflow-x:auto; }
.section-heading-row { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:12px; }
.section-heading-row .helper { margin: 0; }
.sort-toggle { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:8px; }
.sort-toggle .helper { margin: 0; }
.sort-link { border:1px solid var(--border); border-radius:999px; padding:6px 10px; text-decoration:none; color: var(--text); background: var(--surface); font-size: 0.92rem; line-height: 1.2; }
.sort-link:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.sort-link.active { background: var(--accent); border-color: var(--accent); color:#fff; }
.warder-actions-table { min-width: 760px; }
.warder-actions-table th,
.warder-actions-table td { white-space: nowrap; }
.warder-actions-table th:last-child,
.warder-actions-table td:last-child { white-space: normal; min-width: 260px; }

.overview-modules .summary-card { min-height: 170px; }
.overview-secondary-grid { align-items:start; }
.overview-activity-card { min-width: 0; }

@media (max-width: 720px) {
  .container { padding: 14px; }
  .status-header-grid { grid-template-columns: 1fr 1fr; }
  .status-summary-band { flex-direction: column; align-items: flex-start; }
}
