:root {
  --nav: #223142;
  --nav-strong: #172433;
  --bg: #f3f6fa;
  --card: #ffffff;
  --line: #d8e0ea;
  --text: #122033;
  --muted: #65748a;
  --blue: #2563eb;
  --green: #10b981;
  --orange: #f59e0b;
  --red: #dc2626;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.is-hidden { display: none !important; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #0f2f63, #0fbda8); }
.login-card { width: min(430px, 100%); background: white; border-radius: 14px; padding: 28px; box-shadow: 0 22px 60px rgba(8, 20, 42, .28); }
.login-logo { width: 190px; display: block; margin: 0 auto 18px; }
.login-card h1 { margin: 0; font-size: 26px; }
.login-card p { color: var(--muted); line-height: 1.5; }
.login-card label { display: grid; gap: 8px; margin: 14px 0; font-weight: 700; }
.login-card input { height: 44px; border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; }
.login-card button { width: 100%; height: 46px; border: 0; border-radius: 6px; background: var(--blue); color: white; font-weight: 800; }
output { display: block; color: var(--red); margin-top: 12px; min-height: 20px; }
.app { min-height: 100vh; display: grid; grid-template-columns: 252px 1fr; }
.sidebar { background: var(--nav); color: white; padding: 16px 0; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 16px 26px; font-size: 18px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.nav-group { margin: 18px 0 8px; padding: 0 16px; color: #dbeafe; font-size: 12px; font-weight: 800; }
.nav-btn { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; color: #b8c4d2; padding: 12px 16px; text-align: left; }
.nav-btn:hover, .nav-btn.active { background: var(--nav-strong); color: white; }
.nav-btn span:first-child { width: 24px; text-align: center; color: #93a4b8; }
.main { min-width: 0; }
.topbar { height: 56px; display: flex; align-items: center; gap: 18px; padding: 0 24px; background: white; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.icon-btn { width: 38px; height: 38px; border: 0; background: transparent; color: #334155; font-size: 22px; }
.search { display: flex; align-items: center; flex: 1; max-width: 520px; border: 1px solid #cfd7e3; background: white; height: 36px; }
.search span { width: 34px; text-align: center; color: var(--muted); }
.search input { border: 0; outline: 0; flex: 1; height: 100%; padding: 0 8px; }
.search button, .secondary { border: 1px solid #93a4b8; background: white; color: #344256; padding: 8px 12px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.account-btn { border: 0; background: transparent; padding: 10px; color: #1f2937; }
.popover { display: none; position: fixed; right: 26px; top: 48px; width: 290px; background: white; border: 1px solid #cfd7e3; box-shadow: 0 16px 34px rgba(15, 23, 42, .16); z-index: 20; }
.popover.open { display: block; }
.account-menu { width: 190px; }
.account-menu a, .account-menu button { display: block; width: 100%; border: 0; background: white; color: #3b4658; text-align: left; padding: 12px 16px; text-decoration: none; }
.account-menu a:hover, .account-menu button:hover { background: #f1f5f9; }
.content { padding: 26px 48px 48px; }
.page-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 26px; }
.page-head h1 { margin: 0 0 6px; font-size: 24px; }
.page-head p { margin: 0; color: var(--muted); }
.quick-help { background: white; border: 1px solid var(--line); padding: 18px; border-radius: 4px; margin-bottom: 24px; line-height: 1.45; }
.status { min-height: 24px; color: var(--muted); margin-bottom: 12px; }
.grid { display: grid; gap: 18px; }
.metrics { grid-template-columns: repeat(4, minmax(160px, 1fr)); }
.metric, .card, .panel { background: white; border: 1px solid var(--line); border-radius: 6px; padding: 18px; }
.metric strong { display: block; font-size: 28px; margin-top: 8px; }
.metric span, .muted { color: var(--muted); }
.two-col { grid-template-columns: minmax(0, 1fr) 332px; align-items: start; }
.tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.tab { border: 0; background: transparent; color: var(--blue); padding: 10px 16px; border-radius: 4px; }
.tab.active { background: var(--blue); color: white; }
.list { display: grid; gap: 10px; }
.row { background: white; border: 1px solid var(--line); border-radius: 6px; padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.row h3 { margin: 0 0 6px; font-size: 16px; }
.row p { margin: 0; color: var(--muted); line-height: 1.4; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.badge { border: 1px solid #cbd5e1; border-radius: 999px; padding: 4px 8px; font-size: 12px; color: #475569; }
.badge.ok { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }
.badge.warn { color: #92400e; border-color: #fde68a; background: #fffbeb; }
.badge.danger { color: #991b1b; border-color: #fecaca; background: #fef2f2; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.actions button, .primary { border: 1px solid var(--blue); color: var(--blue); background: white; border-radius: 4px; padding: 8px 10px; }
.primary { background: var(--blue); color: white; }
.danger { border-color: var(--red) !important; color: var(--red) !important; }
.settings-form label { display: grid; gap: 6px; margin-bottom: 14px; color: #3d4958; }
.settings-form input, .settings-form textarea { border: 1px solid var(--line); border-radius: 4px; padding: 10px; width: 100%; }
.settings-form textarea { min-height: 82px; resize: vertical; }
.alerts { padding: 0; }
.alert-head { text-align: center; padding: 14px; font-weight: 800; border-bottom: 1px solid var(--line); }
.alert-row { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.alert-row p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.alert-link { display: block; padding: 14px; text-align: center; color: var(--muted); text-decoration: none; }
dialog { border: 0; border-radius: 8px; padding: 0; width: min(760px, calc(100vw - 32px)); }
.dialog header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dialog h2 { margin: 0; }
.dialog button { border: 0; background: transparent; font-size: 24px; }
.dialog pre { margin: 0; padding: 18px; max-height: 70vh; overflow: auto; white-space: pre-wrap; background: #f8fafc; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; z-index: 30; width: 252px; }
  .app.nav-open .sidebar { display: block; }
  .content { padding: 20px; }
  .metrics, .two-col { grid-template-columns: 1fr; }
  .search { max-width: none; }
}
