/* Nalog.nl Logs — UI styles */
:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --border: #e3e8ef;
  --text: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --primary: #2563eb;
  --primary-soft: #e8efff;
  --primary-text: #ffffff;
  --sidebar: #0b1220;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #1e293b;
  --ok: #16a34a; --ok-soft: #e7f7ed;
  --warn: #d97706; --warn-soft: #fff4e0;
  --err: #dc2626; --err-soft: #fdecec;
  --crit: #9f1239; --crit-soft: #fde7ef;
  --info: #0284c7; --info-soft: #e3f3fc;
  --debug: #64748b; --debug-soft: #eef2f6;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);
  --radius: 10px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1020;
  --panel: #121a2c;
  --panel-2: #0f1626;
  --border: #22304a;
  --text: #e5ecf6;
  --muted: #94a3b8;
  --faint: #64748b;
  --primary: #4f8cff;
  --primary-soft: #1a2a4a;
  --sidebar: #070b16;
  --sidebar-active: #16213a;
  --ok-soft: #0f2d1d; --warn-soft: #33240b; --err-soft: #3a1414; --crit-soft: #3b0f22; --info-soft: #0c2a3c; --debug-soft: #1c2536;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
[x-cloak] { display: none !important; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 15px; }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #2563eb, #7c3aed); display: grid; place-items: center; font-size: 15px; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: #7b8aa5; }
.nav { padding: 6px 10px; flex: 1; }
.nav-section { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #5b6b86; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--sidebar-text);
  font-weight: 500; margin-bottom: 2px;
}
.nav a:hover { background: var(--sidebar-active); text-decoration: none; color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--primary); }
.nav svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.nav .count { margin-left: auto; background: var(--err); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; font-weight: 600; }
.sidebar-foot { padding: 12px 18px; font-size: 11.5px; color: #66758f; border-top: 1px solid #141d30; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); vertical-align: middle; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); }
.dot.err { background: var(--err); box-shadow: 0 0 0 3px rgba(220, 38, 38, .18); }
.dot.warn { background: var(--warn); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: var(--panel);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; }
.topbar .spacer { flex: 1; }
.content { padding: 22px 24px 40px; max-width: 1600px; width: 100%; }
.menu-btn { display: none; }

/* ---------- components ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-h h2, .card-h h3 { margin: 0; font-size: 14px; font-weight: 650; }
.card-h .spacer { flex: 1; }
.card-b { padding: 16px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-s { margin-top: 8px; }
.w-full { width: 100%; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

.kpi { padding: 16px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.trend-up { color: var(--err); } .trend-down { color: var(--ok); }
.kpi.accent-err { border-top: 3px solid var(--err); }
.kpi.accent-warn { border-top: 3px solid var(--warn); }
.kpi.accent-ok { border-top: 3px solid var(--ok); }
.kpi.accent-primary { border-top: 3px solid var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; font-weight: 550; cursor: pointer;
  white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--err); }
.btn.danger.solid { background: var(--err); color: #fff; border-color: var(--err); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 34px; padding: 0; }
.btn svg { width: 16px; height: 16px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 32px; font: inherit; font-size: 12.5px; font-weight: 550; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--primary-soft); color: var(--primary); }

input[type=text], input[type=password], input[type=email], input[type=number], input[type=url], input[type=time], input[type=search],
input[type=datetime-local], select, textarea {
  height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; font: inherit; background: var(--panel);
  color: var(--text); outline: none; min-width: 0;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 11.5px; color: var(--faint); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.switch { position: relative; width: 36px; height: 20px; flex: 0 0 36px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 20px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(16px); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--debug-soft); color: var(--debug); white-space: nowrap; line-height: 18px;
}
.badge.critical, .badge.lv-critical { background: var(--crit-soft); color: var(--crit); }
.badge.high, .badge.lv-error, .badge.down, .badge.err { background: var(--err-soft); color: var(--err); }
.badge.medium, .badge.lv-warning, .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.low, .badge.lv-info, .badge.info { background: var(--info-soft); color: var(--info); }
.badge.noise, .badge.lv-debug { background: var(--debug-soft); color: var(--debug); }
.badge.up, .badge.ok, .badge.resolved { background: var(--ok-soft); color: var(--ok); }
.badge.open { background: var(--primary-soft); color: var(--primary); }
.badge.outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600;
  padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--panel-2); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--panel-2); }
.table-wrap { overflow-x: auto; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button, .tabs a {
  border: 0; background: none; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs .on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .pill { background: var(--panel-2); border-radius: 10px; padding: 0 7px; font-size: 11px; margin-left: 4px; color: var(--muted); }

/* logs */
.log-list { font-family: var(--mono); font-size: 12.5px; }
.log-row { display: grid; grid-template-columns: 150px 78px 150px minmax(0, 1fr); gap: 10px; padding: 6px 14px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: start; }
.log-row:hover { background: var(--panel-2); }
.log-row.imp { box-shadow: inset 3px 0 0 var(--err); }
.log-row .msg { white-space: pre-wrap; word-break: break-word; }
.log-row .src { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-detail { background: var(--panel-2); padding: 12px 14px 14px; border-bottom: 1px solid var(--border); }
pre.block { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow: auto; max-height: 520px; margin: 0; white-space: pre-wrap; word-break: break-word; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* issues */
.issue-row td:first-child { width: 34px; }
.issue-title { font-weight: 600; color: var(--text); }
.issue-title:hover { color: var(--primary); }
.spark { display: inline-flex; align-items: flex-end; gap: 1px; height: 22px; }
.spark i { width: 3px; background: var(--primary); opacity: .55; border-radius: 1px; min-height: 1px; }
.ai-box { border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(180deg, var(--primary-soft), transparent 70%); padding: 16px; }
.ai-box h4 { margin: 14px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ai-box p { margin: 0; white-space: pre-wrap; }

/* uptime */
.bars { display: flex; gap: 2px; align-items: stretch; height: 26px; }
.bars i { flex: 1; min-width: 3px; border-radius: 2px; background: var(--ok); opacity: .85; }
.bars i.bad { background: var(--err); }
.bars i.none { background: var(--border); }
.status-pill { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }

/* misc */
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 6px; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 160px; }
.chart-box.xs { height: 90px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search], .toolbar input[type=text] { flex: 1; min-width: 220px; }
.copy { display: flex; gap: 6px; align-items: center; }
.copy code { flex: 1; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; overflow-x: auto; white-space: nowrap; }
.callout { border-radius: 8px; padding: 10px 14px; background: var(--info-soft); color: var(--text); border: 1px solid var(--border); font-size: 13px; }
.callout.warn { background: var(--warn-soft); }
.callout.err { background: var(--err-soft); }
.md h1, .md h2, .md h3 { font-size: 15px; margin: 14px 0 6px; }
.md p { margin: 6px 0; }
.md ul { margin: 6px 0; padding-left: 20px; }
.md code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(2, 6, 23, .55); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; border: 1px solid var(--border); }
.modal.wide { max-width: 860px; }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-h h3 { margin: 0; font-size: 16px; flex: 1; }
.modal-b { padding: 18px 20px; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* toast */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--sidebar); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 380px; font-size: 13px; }
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

/* dropdown */
.dd { position: relative; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 190px; padding: 6px; z-index: 50; }
.dd-menu a, .dd-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.dd-menu a:hover, .dd-menu button:hover { background: var(--panel-2); text-decoration: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 12px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 10% -10%, #1e3a8a 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #4c1d95 0, transparent 55%), #070b16; }
.login-card { width: 100%; max-width: 400px; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 30px; }
.login-card h1 { font-size: 20px; margin: 14px 0 4px; }
.login-card .field input { height: 40px; }
.login-card .btn { height: 40px; width: 100%; }

@media (max-width: 1200px) {
  .grid.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.main-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: -240px; z-index: 60; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex; }
  .grid.k3, .grid.k2, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .log-row { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 560px) {
  .grid.k4 { grid-template-columns: 1fr; }
}
