:root {
  --bg: #f4f1ea;
  --surface: #fffefa;
  --surface-2: #f7f4ed;
  --surface-3: #ebe4d5;
  --line: rgba(22, 58, 66, .14);
  --line-strong: rgba(22, 58, 66, .28);
  --text: #173a43;
  --muted: #667b7d;
  --faint: #8c9a98;
  --brand-blue: #0e3a45;
  --brand-blue-2: #123f4b;
  --brand: #968b66;
  --brand-strong: #7d7351;
  --ok: #3eb083;
  --warn: #c88424;
  --danger: #d15a55;
  --shadow: rgba(14, 58, 69, .10);
  color-scheme: light;
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(150, 139, 102, .18), transparent 34rem),
    linear-gradient(180deg, #fbfaf6 0, var(--bg) 42%);
  color: var(--text);
}
button, input, select { font: inherit; }
[hidden] { display: none !important; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(390px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 32px;
  box-shadow: 0 24px 70px var(--shadow);
}
.mark {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--brand-blue);
  color: #f3ead3;
  font-weight: 800;
  letter-spacing: .04em;
  margin-bottom: 20px;
}
.mark.small { width: 34px; height: 34px; border-radius: 10px; margin: 0; flex: 0 0 auto; }
.login-card h1 { margin: 0 0 6px; font-size: 24px; }
.login-card p { margin: 0 0 22px; color: var(--muted); }
label, .label {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
  font-weight: 700;
}
input, select {
  width: 100%;
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
input:focus, select:focus { border-color: var(--brand); }
.form-error { min-height: 20px; margin-top: 12px; color: var(--danger); font-size: 13px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  min-height: 66px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-2));
  border-bottom: 1px solid rgba(255,255,255,.16);
  color: white;
  backdrop-filter: blur(10px);
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 170px; }
.brand span:not(.mark) { display: block; color: rgba(255,255,255,.72); font-size: 12px; }
.topbar .mark {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.28);
  color: #f3ead3;
}
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tab {
  border: 0;
  border-bottom: 2px solid transparent;
  color: rgba(255,255,255,.68);
  background: transparent;
  padding: 12px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover, .tab.active { color: white; }
.tab.active { border-bottom-color: var(--brand); }
.top-actions, .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.button {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.button:hover:not(:disabled) { border-color: var(--line-strong); filter: brightness(1.06); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: var(--brand); border-color: var(--brand); color: white; }
.button.primary:hover:not(:disabled) { background: var(--brand-strong); }
.button.ghost { background: transparent; }
.topbar .button.ghost {
  color: rgba(255,255,255,.88);
  border-color: rgba(255,255,255,.22);
}
.topbar .button.ghost:hover:not(:disabled) { background: rgba(255,255,255,.10); }
.button.danger { color: #b64640; }
.topbar .button.danger { color: #ffd6d3; }
.button.small { padding: 5px 8px; font-size: 12px; }

.notice {
  margin: 16px auto 0;
  width: min(1440px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-left: 4px solid var(--warn);
  border-radius: 12px;
  background: rgba(216, 154, 54, .10);
  padding: 12px 14px;
}
.panel { display: none; width: min(1440px, calc(100% - 32px)); margin: 16px auto 36px; }
.panel.active { display: block; }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 14px 36px var(--shadow);
}
.card h2 { margin: 0; font-size: 16px; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.card strong { display: block; font-size: 28px; margin: 6px 0 0; }
.card small, .muted { color: var(--muted); }
.bar { height: 7px; background: #e8e2d6; border-radius: 999px; overflow: hidden; margin-top: 12px; }
.bar span { display: block; height: 100%; width: 0; background: var(--ok); border-radius: inherit; transition: width .25s ease; }
.bar span.warn { background: var(--warn); }
.bar span.danger { background: var(--danger); }

.stack { display: grid; gap: 10px; }
.incident {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfaf6;
}
.dot { width: 10px; height: 10px; border-radius: 999px; margin-top: 6px; background: var(--ok); }
.dot.warning { background: var(--warn); }
.dot.critical { background: var(--danger); }
.incident h3 { margin: 0 0 3px; font-size: 14px; }
.incident p { margin: 0; color: var(--muted); }
.pill {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
  background: var(--surface-3);
}
.pill.ok { background: rgba(62, 176, 131, .16); color: #167455; }
.pill.warning { background: rgba(200, 132, 36, .16); color: #8b5d14; }
.pill.critical, .pill.error { background: rgba(209, 90, 85, .16); color: #9f302b; }

.facts { display: grid; grid-template-columns: minmax(130px, auto) 1fr; gap: 8px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.service {
  border: 1px solid var(--line);
  border-left: 4px solid var(--ok);
  border-radius: 14px;
  padding: 14px;
  background: #fbfaf6;
}
.service.bad { border-left-color: var(--danger); }
.service.warn { border-left-color: var(--warn); }
.service-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.service-title { font-weight: 750; }
.service-meta { color: var(--muted); font-size: 12px; display: grid; gap: 3px; margin: 10px 0; }
.service-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }

.controls { justify-content: flex-end; }
.controls select { width: auto; min-width: 130px; }
.controls input { width: 220px; }
.logs {
  margin: 0;
  min-height: 520px;
  max-height: 62vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f9f7f1;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  color: #193941;
  font: 12px/1.65 "Cascadia Code", Consolas, "Liberation Mono", monospace;
}
.toast-zone { position: fixed; right: 18px; bottom: 18px; z-index: 30; display: grid; gap: 8px; }
.toast {
  width: min(420px, calc(100vw - 36px));
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--ok);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 14px 36px var(--shadow);
}
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warn); }

@media (max-width: 1100px) {
  .topbar { grid-template-columns: 1fr; }
  .top-actions { justify-content: flex-start; }
  .grid.kpis, .grid.two { grid-template-columns: 1fr; }
}
