:root {
  --navy: #11233f;
  --navy-2: #1a3153;
  --ink: #172033;
  --muted: #69758a;
  --line: #dfe5ee;
  --surface: #ffffff;
  --canvas: #f4f6f9;
  --blue: #1f67d2;
  --blue-soft: #eaf2ff;
  --amber: #d98916;
  --amber-soft: #fff5df;
  --green: #237a58;
  --green-soft: #e8f7f0;
  --red: #bb3f4a;
  --red-soft: #fff0f1;
  --shadow: 0 12px 32px rgba(25, 44, 78, .07);
  --radius: 15px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.48;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, a.button { touch-action: manipulation; }
code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  width: 252px;
  flex-direction: column;
  color: #e9eff8;
  background: linear-gradient(180deg, var(--navy) 0%, #0d1c32 100%);
  box-shadow: 10px 0 35px rgba(9, 25, 49, .1);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 22px 22px;
  color: #fff;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 11px;
  color: var(--navy);
  background: #ffcc70;
  font-size: 20px;
  font-weight: 850;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.4);
}
.brand-mark.large { width: 50px; height: 50px; border-radius: 14px; font-size: 25px; }
.brand span:last-child, .login-brand div { display: flex; flex-direction: column; }
.brand strong, .login-brand strong { letter-spacing: -.02em; font-size: 16px; }
.brand small, .login-brand small { margin-top: 1px; color: #99a9c0; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.nav { display: grid; gap: 3px; padding: 8px 13px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 9px;
  color: #bac7d9;
  font-weight: 620;
}
.nav a span { display: inline-grid; width: 24px; place-items: center; color: #92a5bf; font-size: 16px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.07); text-decoration: none; }
.nav a.active { color: #fff; background: var(--navy-2); box-shadow: inset 3px 0 #ffcc70; }
.nav a.active span { color: #ffcc70; }
.sidebar-footer { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 20px 22px; border-top: 1px solid rgba(255,255,255,.08); color: #9fb0c7; font-size: 12px; }
.sidebar-footer form { margin-left: auto; }
.status-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #42c892; box-shadow: 0 0 0 3px rgba(66,200,146,.13); }
.status-dot.bad { background: var(--red); box-shadow: 0 0 0 3px rgba(187,63,74,.13); }
.link-button { padding: 0; border: 0; color: #c5d1e2; background: none; cursor: pointer; }
.link-button:hover { color: #fff; }

.main { min-height: 100vh; margin-left: 252px; padding: 29px 34px 56px; }
.topbar { display: flex; min-height: 65px; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.topbar h1 { margin: 1px 0 0; font-size: 28px; letter-spacing: -.035em; line-height: 1.18; }
.eyebrow { margin: 0; color: #71809a; font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.header-meta { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.lead { margin: 9px 0 0; color: #42516a; font-size: 16px; }

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 720;
  line-height: 1.1;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.button:hover { text-decoration: none; transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--blue); box-shadow: 0 5px 14px rgba(31,103,210,.18); }
.button.primary:hover { background: #185ab9; }
.button.secondary { color: #30415d; border-color: var(--line); background: #fff; }
.button.secondary:hover { border-color: #bbc6d5; background: #f9fafc; }
.button.warning { color: #5f3600; background: #ffc65b; }
.button.danger { color: #fff; background: var(--red); }
.button.danger-outline { color: var(--red); border-color: #ebc3c7; background: #fff; }
.button.tiny { min-height: 30px; padding: 5px 9px; border-radius: 7px; font-size: 12px; }
.button.wide { width: 100%; }

.flash-stack { display: grid; gap: 8px; margin: -8px 0 18px; }
.flash { padding: 11px 14px; border: 1px solid; border-radius: 9px; box-shadow: var(--shadow); }
.flash.success { color: #175e44; border-color: #bde5d3; background: var(--green-soft); }
.flash.error { color: #8b2731; border-color: #f0c4c8; background: var(--red-soft); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 18px; }
.stat-card { position: relative; overflow: hidden; padding: 18px 19px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stat-card::after { position: absolute; width: 74px; height: 74px; top: -34px; right: -25px; border-radius: 50%; background: #edf2f8; content: ""; }
.stat-card.accent::after { background: #ffe8b8; }
.stat-card.danger-card::after { background: #ffd7db; }
.stat-card span, .stat-card small { position: relative; z-index: 1; display: block; }
.stat-card span { color: var(--muted); font-size: 12px; font-weight: 680; }
.stat-card strong { position: relative; z-index: 1; display: block; margin: 6px 0 2px; font-size: 30px; letter-spacing: -.04em; }
.stat-card small { color: #8490a1; font-size: 11px; }
.compact-stats .stat-card { box-shadow: none; }

.panel { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel.no-padding { padding: 0; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.panel-heading h2 { margin: 2px 0 0; font-size: 17px; letter-spacing: -.025em; }
.panel-heading > a { font-size: 12px; font-weight: 700; }
.content-grid { display: grid; gap: 17px; margin-bottom: 18px; }
.content-grid.two-thirds { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.content-grid.detail-grid { grid-template-columns: minmax(0, 1.72fr) minmax(310px, .78fr); align-items: start; }
.stack { display: grid; align-content: start; gap: 16px; }
.stack > .panel { margin-top: 0; }
.sticky-panel { position: sticky; top: 24px; }

.activity-list { display: grid; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 11px 3px; border-top: 1px solid #edf0f4; color: var(--ink); }
.activity-item:first-child { border-top: 0; }
.activity-item:hover { text-decoration: none; background: #fafbfd; }
.activity-icon { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 9px; font-weight: 850; }
.activity-icon.warning { color: #855009; background: var(--amber-soft); }
.activity-copy { min-width: 0; flex: 1; }
.activity-copy strong, .activity-copy small { display: block; }
.activity-copy small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.health-list { display: grid; gap: 13px; }
.health-list > div { display: flex; align-items: center; gap: 10px; }
.health-list > div > span:nth-child(2) { min-width: 0; flex: 1; }
.health-list strong, .health-list small { display: block; }
.health-list small { color: var(--muted); font-size: 11px; }
hr { margin: 18px 0; border: 0; border-top: 1px solid var(--line); }
.compact-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin: 0; }
.compact-kpis div { padding: 10px; border-radius: 9px; background: #f7f9fc; }
.compact-kpis dt { color: var(--muted); font-size: 11px; }
.compact-kpis dd { margin: 2px 0 0; font-size: 18px; font-weight: 800; }

.badge { display: inline-flex; align-items: center; width: fit-content; margin: 1px 3px 1px 0; padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: .01em; white-space: nowrap; }
.badge.new { color: #8a5204; background: var(--amber-soft); }
.badge.in_progress { color: #155bb4; background: var(--blue-soft); }
.badge.resolved { color: #176247; background: var(--green-soft); }
.badge.danger { color: #922f38; background: var(--red-soft); }
.badge.neutral { color: #546176; background: #edf1f6; }

.filter-panel { margin-bottom: 15px; padding: 14px 16px; box-shadow: none; }
.filter-form { display: flex; align-items: end; gap: 11px; }
.filter-form label, .stack-form label { display: grid; gap: 5px; color: #536078; font-size: 11px; font-weight: 750; }
.filter-form .grow { min-width: 220px; flex: 1; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cfd7e3;
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  background: #fff;
}
input, select { min-height: 38px; padding: 7px 10px; }
textarea { resize: vertical; padding: 9px 10px; }
input:focus, select:focus, textarea:focus { border-color: #77a6e9; box-shadow: 0 0 0 3px rgba(31,103,210,.1); }
.check-label { display: inline-flex !important; min-height: 38px; align-items: center; gap: 7px !important; white-space: nowrap; }
.check-label input { width: 16px; min-height: 16px; }
.stack-form { display: grid; gap: 13px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid #e8ecf2; text-align: left; vertical-align: top; }
th { color: #778398; background: #f8fafc; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfe; }
td strong, td small { display: block; }
td small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.wide-cell { min-width: 280px; max-width: 480px; }
.row-link { display: block; color: var(--ink); }
.row-link:hover { color: var(--blue); text-decoration: none; }
.deleted-row { opacity: .62; }
.key-dot { display: inline-grid; width: 22px; height: 22px; margin-right: 3px; place-items: center; border-radius: 6px; color: #8994a4; background: #eef1f5; font-size: 10px; font-weight: 850; }
.key-dot.on { color: #176247; background: var(--green-soft); }
.danger-text { color: var(--red) !important; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 15px; margin: 18px 0; color: var(--muted); font-size: 12px; }
.empty-state { display: grid; min-height: 175px; place-content: center; gap: 5px; padding: 24px; color: var(--muted); text-align: center; }
.empty-state strong { color: #3d4b61; font-size: 16px; }
.empty-state.compact { min-height: 85px; }

.detail-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 18px; padding: 23px 25px; border: 1px solid #dce4ef; border-radius: var(--radius); background: linear-gradient(120deg, #fff 0%, #f1f6fd 100%); box-shadow: var(--shadow); }
.detail-hero h2 { margin: 9px 0 0; font-size: 24px; letter-spacing: -.035em; }
.hero-meta { display: grid; min-width: 330px; grid-template-columns: 1fr 1fr; gap: 11px 22px; margin: 0; }
.hero-meta dt, .detail-list dt { color: var(--muted); font-size: 10px; font-weight: 780; letter-spacing: .06em; text-transform: uppercase; }
.hero-meta dd, .detail-list dd { margin: 2px 0 0; font-weight: 650; }
.user-identity { display: flex; align-items: center; gap: 15px; }
.avatar { display: grid; width: 58px; height: 58px; flex: 0 0 auto; place-items: center; border-radius: 17px; color: #fff; background: linear-gradient(145deg, #245fbd, #173b76); font-size: 23px; font-weight: 850; box-shadow: 0 8px 20px rgba(31,103,210,.2); }
blockquote { margin: 0; padding: 13px 16px; border-left: 4px solid #f0ac35; border-radius: 0 9px 9px 0; color: #4d3d20; background: #fff8e9; font-size: 15px; }
.result-snapshot { max-height: 580px; overflow: auto; margin: 0; padding: 16px; border: 1px solid #dce2eb; border-radius: 10px; color: #26354c; background: #f7f9fc; font: 12px/1.55 ui-monospace, Consolas, monospace; white-space: pre-wrap; }
.technical-details summary, .danger-zone summary { cursor: pointer; font-weight: 750; }
.technical-details pre, details pre { max-height: 420px; overflow: auto; margin: 14px 0 0; padding: 13px; border-radius: 8px; color: #314058; background: #f5f7fa; font-size: 11px; white-space: pre-wrap; }
.timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.timeline li { display: grid; grid-template-columns: 14px 1fr; gap: 9px; padding-bottom: 16px; }
.timeline li > span { position: relative; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--blue); }
.timeline li > span::after { position: absolute; width: 1px; height: 34px; top: 10px; left: 3px; background: #dbe1ea; content: ""; }
.timeline li:last-child > span::after { display: none; }
.timeline strong, .timeline small { display: block; }
.timeline small { color: var(--muted); font-size: 10px; }
.timeline p { margin: 5px 0 0; color: #536078; font-size: 12px; }

.monitor-card-list { display: grid; gap: 10px; }
.monitor-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px; border: 1px solid #e0e6ef; border-radius: 10px; background: #fbfcfe; }
.monitor-card > div:first-child { min-width: 0; }
.monitor-card strong, .monitor-card span, .monitor-card small { display: block; }
.monitor-card span { color: #4f5e75; }
.monitor-card small { color: var(--muted); font-size: 11px; }
.inline-actions { display: flex; align-items: center; gap: 7px; }
.inline-actions.vertical { flex-direction: column; align-items: stretch; }
.inline-actions form { margin: 0; }
.metric-bars { display: grid; gap: 8px; }
.metric-bars > div { display: grid; grid-template-columns: 85px 1fr 35px; align-items: center; gap: 10px; font-size: 11px; }
.metric-bars > div > div { height: 7px; overflow: hidden; border-radius: 99px; background: #edf1f6; }
.metric-bars i { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.detail-list { display: grid; gap: 10px; margin: 0 0 15px; }
.detail-list div { padding: 10px; border-radius: 8px; background: rgba(255,255,255,.6); }
.danger-zone-soft { border-color: #efc4c8; background: var(--red-soft); }
.danger-zone { border-color: #ecc3c7; background: #fffafb; }
.danger-zone p { color: #705058; font-size: 12px; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; padding: 4px; width: fit-content; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.tabs a { padding: 7px 12px; border-radius: 7px; color: var(--muted); font-weight: 680; }
.tabs a:hover { text-decoration: none; background: #f5f7fa; }
.tabs a.active { color: var(--blue); background: var(--blue-soft); }
.event-card { border-left: 4px solid #8fa0b6; box-shadow: none; }
.event-card.error, .event-card.critical { border-left-color: var(--red); }
.event-card.warning { border-left-color: var(--amber); }
.event-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.event-header h2 { margin: 7px 0 0; font-size: 16px; }
.event-count { text-align: right; }
.event-count strong, .event-count small { display: block; }
.event-count strong { font-size: 22px; }
.event-count small { color: var(--muted); font-size: 10px; }
.event-meta { display: flex; gap: 22px; margin: 12px 0; color: var(--muted); font-size: 11px; }

.notice { margin-bottom: 16px; padding: 12px 15px; border: 1px solid #cbdcf4; border-radius: 10px; color: #315277; background: #eff6ff; }
.settings-section { margin-bottom: 16px; }
.settings-list { display: grid; }
.setting-row { display: grid; grid-template-columns: 1fr minmax(230px, 340px); gap: 24px; padding: 15px 2px; border-top: 1px solid #e7ebf1; }
.setting-row:first-child { border-top: 0; }
.setting-row p { margin: 3px 0 5px; color: var(--muted); font-size: 12px; }
.setting-row code { color: #66738a; font-size: 10px; }
.setting-row small { display: block; margin-top: 4px; color: #8a95a5; font-size: 10px; }
.setting-control { display: grid; gap: 8px; }
.secret-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.secret-grid div { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 10px 12px; border-radius: 8px; background: #f6f8fb; }
.inline-json { max-width: 340px; max-height: 140px; overflow: auto; margin: 0; font-size: 10px; white-space: pre-wrap; }

.security-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(270px, .75fr); gap: 16px; align-items: start; }
.password-form { max-width: 620px; }
.password-form label small { color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.45; }
.security-summary { background: linear-gradient(145deg, #fff 0%, #f4f8fd 100%); }
.security-hint { margin: 4px 0 0; padding: 12px; border-radius: 8px; color: #536078; background: #edf3fa; font-size: 11px; line-height: 1.5; }

.auth-body { display: grid; min-height: 100vh; place-items: center; background: radial-gradient(circle at 15% 20%, #203d66 0, #132844 30%, #0b192d 72%); }
.auth-main { width: min(100%, 1000px); padding: 24px; }
.login-shell { display: grid; grid-template-columns: 1fr minmax(340px, 430px); align-items: center; gap: 80px; }
.login-brand { display: flex; align-items: center; gap: 15px; color: #fff; }
.login-brand strong { font-size: 26px; }
.login-card { padding: 29px; border: 1px solid rgba(255,255,255,.28); border-radius: 18px; background: rgba(255,255,255,.98); box-shadow: 0 28px 80px rgba(0,0,0,.25); }
.login-card h1 { margin: 5px 0 7px; font-size: 26px; letter-spacing: -.035em; }

@media (max-width: 1120px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .content-grid.two-thirds, .content-grid.detail-grid { grid-template-columns: 1fr; }
  .sticky-panel { position: static; }
}
@media (max-width: 820px) {
  .sidebar { position: static; width: 100%; }
  .brand { padding: 15px 16px; }
  .nav { display: flex; overflow-x: auto; padding: 6px 10px 10px; }
  .nav a { flex: 0 0 auto; padding: 8px 10px; }
  .nav a span { display: none; }
  .sidebar-footer { display: none; }
  .main { margin-left: 0; padding: 21px 16px 44px; }
  .topbar { min-height: 48px; }
  .topbar h1 { font-size: 24px; }
  .filter-form { align-items: stretch; flex-direction: column; }
  .filter-form .grow { min-width: 0; }
  .detail-hero { flex-direction: column; }
  .hero-meta { min-width: 0; width: 100%; }
  .setting-row { grid-template-columns: 1fr; gap: 12px; }
  .security-layout { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; gap: 28px; }
  .login-brand { justify-content: center; }
}
@media (max-width: 540px) {
  .stats-grid { grid-template-columns: 1fr; }
  .compact-kpis, .secret-grid, .hero-meta { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar .button { width: 100%; }
  .panel { padding: 16px; border-radius: 12px; }
  .monitor-card { align-items: stretch; flex-direction: column; }
  .inline-actions { flex-wrap: wrap; }
  .pagination { align-items: stretch; flex-direction: column; text-align: center; }
}
