:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-2: #eef4f5;
  --text: #172026;
  --muted: #65727d;
  --border: #d9e2e6;
  --accent: #0f7c80;
  --accent-strong: #085f63;
  --ok: #157347;
  --warning: #b7791f;
  --failed: #b42318;
  --unknown: #697586;
  --shadow: 0 10px 30px rgba(17, 36, 48, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
}
a { color: var(--accent); text-decoration: none; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; white-space: nowrap; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.brand { color: var(--text); font-weight: 800; white-space: nowrap; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.nav a {
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 650;
}
.nav a.active, .nav a:hover { background: var(--surface-2); color: var(--text); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.top-actions form { margin: 0; }

.page { width: min(1320px, calc(100% - 32px)); margin: 28px auto 60px; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 30px; line-height: 1.2; }
h2 { font-size: 18px; }
p { color: var(--muted); line-height: 1.6; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.metric, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metric { padding: 18px; min-height: 104px; }
.metric span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.metric strong { display: block; margin-top: 16px; font-size: 30px; line-height: 1; }

.dashboard-grid, .detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.panel { padding: 18px; margin-bottom: 18px; overflow-x: auto; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.table-panel { padding: 0; }
.table-panel h2 { padding: 18px 18px 0; }

table { width: 100%; border-collapse: collapse; min-width: 680px; }
.panel:not(.table-panel) table { min-width: 0; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; background: #fbfcfd; }
td { font-size: 14px; }
.empty { color: var(--muted); text-align: center; padding: 30px; }
.url-cell { max-width: 360px; overflow-wrap: anywhere; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.badge-ok { color: var(--ok); background: #e8f5ee; }
.badge-warning { color: var(--warning); background: #fff5df; }
.badge-failed { color: var(--failed); background: #fdecec; }
.badge-unknown { color: var(--unknown); background: #eef1f4; }

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  min-height: 36px;
  padding: 8px 12px;
  font-weight: 750;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-strong); color: white; }
.btn-danger { color: var(--failed); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.inline-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: center;
}
.wide-form { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
.note-form { grid-template-columns: repeat(5, minmax(120px, 1fr)) auto; }
input, select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  background: white;
}
.check { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 700; }
.check input { width: auto; min-height: auto; }
.actions { display: flex; gap: 7px; flex-wrap: wrap; }
.actions form { margin: 0; }
.note-row td { background: #fbfcfd; }
.log-excerpt { max-width: 360px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }

dl { display: grid; grid-template-columns: 140px 1fr; gap: 12px 20px; margin: 18px 0 0; }
dt { color: var(--muted); font-weight: 700; }
dd { margin: 0; font-weight: 750; }
h3 { margin: 18px 0 8px; font-size: 15px; }
.alert { padding: 12px 14px; border-radius: 6px; margin: 12px 0; }
.alert-failed { color: var(--failed); background: #fdecec; }
.log-box {
  max-height: 560px;
  overflow: auto;
  background: #101820;
  color: #d7e3ea;
  border-radius: 8px;
  padding: 16px;
  line-height: 1.55;
  font-size: 13px;
}
mark { display: block; background: #4b1f1f; color: #ffd7d7; }
.compact { max-height: 260px; }
.form-stack { display: grid; gap: 12px; }

@media (max-width: 900px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; }
  .metric-grid, .dashboard-grid, .detail-grid { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .page { width: min(100% - 20px, 1320px); margin-top: 18px; }
  h1 { font-size: 25px; }
  .metric strong { font-size: 26px; }
  .topbar { padding: 12px; }
  .nav a { padding: 7px 8px; }
  .panel:not(.table-panel) th,
  .panel:not(.table-panel) td {
    padding: 11px 10px;
    font-size: 13px;
  }
  .panel:not(.table-panel) td:nth-child(3) {
    overflow-wrap: anywhere;
  }
}
