:root {
  color-scheme: light;
  --ink: #1d2c30;
  --muted: #63747a;
  --line: #dbe3e3;
  --page: #f5f8f8;
  --surface: #ffffff;
  --teal: #126d68;
  --teal-soft: #e4f2ef;
  --amber: #a25d12;
  --amber-soft: #fff2dd;
  --red: #ad3f3b;
  --red-soft: #fbe9e7;
  --gray-soft: #edf1f2;
}

* { box-sizing: border-box; }
html { font-family: Arial, Helvetica, sans-serif; background: var(--page); color: var(--ink); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #59a7a2; outline-offset: 2px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1400px; min-height: 68px; padding: 0 28px; margin: auto; display: flex; align-items: center; gap: 38px; }
.brand { color: var(--ink); font-weight: 700; font-size: 17px; white-space: nowrap; display: inline-flex; align-items: center; gap: 11px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 25px; height: 25px; display: inline-flex; align-items: flex-end; gap: 3px; }
.brand-mark span { width: 5px; background: var(--teal); border-radius: 1px; }
.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 24px; }
.nav { align-self: stretch; display: flex; align-items: center; gap: 6px; }
.nav a { color: var(--muted); padding: 10px 13px; border-radius: 4px; font-size: 14px; font-weight: 600; }
.nav a:hover, .nav a[aria-current='page'] { color: var(--teal); background: var(--teal-soft); text-decoration: none; }
.account { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.text-button { border: 0; background: none; color: var(--teal); font-weight: 600; padding: 8px 0; }
.text-button:hover { text-decoration: underline; }

.shell { width: 100%; max-width: 1400px; margin: 0 auto; padding: 34px 28px 70px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.eyebrow { color: var(--teal); text-transform: uppercase; font-size: 11px; font-weight: 700; letter-spacing: 0; margin-bottom: 7px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 28px; line-height: 1.2; margin-bottom: 7px; }
h2 { font-size: 17px; line-height: 1.25; margin: 0; }
.subtle, .section-note { color: var(--muted); }
.subtle { font-size: 14px; margin-bottom: 0; }
.section-note { font-size: 12px; }
.primary-link, .primary-button { background: var(--teal); color: #fff; border: 1px solid var(--teal); border-radius: 4px; font-weight: 700; font-size: 13px; padding: 10px 15px; display: inline-flex; align-items: center; gap: 11px; min-height: 40px; }
.primary-link:hover, .primary-button:hover { background: #0d5955; text-decoration: none; }

.section { margin-bottom: 34px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 15px; }
.section-head a { font-size: 13px; font-weight: 700; }
.metrics { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metrics-five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric { min-height: 92px; padding: 18px 21px; display: flex; flex-direction: column; gap: 8px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-label { font-size: 12px; color: var(--muted); }
.metric strong { font-size: 26px; line-height: 1; font-weight: 700; }
.tone-online { color: var(--teal); }
.tone-alert { color: var(--amber); }
.tone-offline { color: var(--red); }
.status-track { display: flex; height: 8px; overflow: hidden; margin-top: 21px; border-radius: 4px; background: var(--gray-soft); }
.bar-online, .dot-online { background: var(--teal); }
.bar-alert, .dot-alert { background: var(--amber); }
.bar-offline, .dot-offline { background: var(--red); }
.bar-muted, .dot-muted { background: #9faeb1; }
.status-legend { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 11px; color: var(--muted); font-size: 12px; }
.status-legend span, .status { display: inline-flex; align-items: center; gap: 7px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 38px; }
.compact-list { border-top: 1px solid var(--line); }
.compact-row { min-height: 65px; padding: 12px 2px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.row-identity { min-width: 0; }
.row-identity strong, .row-identity small { display: block; }
.row-identity strong { font-size: 14px; }
.row-identity small { margin-top: 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.event-row time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.status { white-space: nowrap; font-size: 12px; font-weight: 700; }
.status-online { color: var(--teal); }
.status-alert { color: var(--amber); }
.status-offline { color: var(--red); }
.status-muted { color: var(--muted); }
.empty-state { margin: 0; padding: 25px 0; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.summary-foot { color: var(--muted); font-size: 12px; margin: 12px 0 0; }
.summary-foot strong { color: var(--ink); }

.filter-form { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.filter-form label { font-weight: 700; }
.filter-form select, .filter-form button, .login-form input, .history-form select, .history-form input, .history-form button { border: 1px solid #bac9ca; border-radius: 4px; background: #fff; color: var(--ink); min-height: 39px; }
.filter-form select { min-width: 230px; max-width: 360px; padding: 7px 11px; }
.filter-form button { padding: 7px 14px; font-weight: 700; }
.filter-form button:hover { background: var(--teal-soft); }
.table-scroll { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 900px; font-size: 13px; background: var(--surface); }
th, td { text-align: left; padding: 13px 15px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #edf3f3; color: #53676c; font-size: 11px; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
td { white-space: nowrap; }
td small { display: block; margin-top: 4px; color: var(--muted); }
td { overflow-wrap: anywhere; white-space: normal; }
tbody tr:hover { background: #f8fbfa; }
.correlation-list { border-top: 1px solid var(--line); }
.correlation-row { padding: 14px 3px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.correlation-row small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.correlation-row time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.correlation-label { font-weight: 700; font-size: 13px; }

.history-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; margin-bottom: 14px; }
.history-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 700; }
.history-form select, .history-form input { min-width: 150px; padding: 7px 10px; }
.history-form select[multiple] { min-width: 280px; max-width: 440px; min-height: 132px; }
.history-form .field-note { font-weight: 400; color: var(--muted); }
.history-form button { padding: 7px 14px; font-weight: 700; }
.history-form button:hover { background: var(--teal-soft); }
.history-chart { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow-x: auto; }
.history-chart svg { width: 100%; min-width: 720px; height: auto; aspect-ratio: 960 / 300; display: block; }
.history-chart .grid { stroke: var(--line); stroke-width: 1; }
.history-chart .series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.history-chart .axis { fill: var(--muted); font-size: 11px; font-family: Arial, Helvetica, sans-serif; }
.history-legend { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 18px; }
.history-legend li { display: flex; flex-direction: column; gap: 3px; min-width: 180px; max-width: 320px; font-size: 12px; }
.history-legend li span { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; }
.history-legend small { color: var(--muted); }
.history-swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

.login-wrap { min-height: 60vh; display: flex; align-items: center; justify-content: center; }
.login-panel { width: min(100%, 390px); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 30px; }
.login-panel h1 { font-size: 23px; }
.login-form { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; }
.login-form label { font-size: 13px; font-weight: 700; }
.login-form input { width: 100%; padding: 8px 11px; margin-bottom: 11px; }
.login-form button { justify-content: center; width: 100%; margin-top: 3px; }
.form-error { color: var(--red); background: var(--red-soft); padding: 10px; font-size: 13px; border-radius: 4px; margin: 18px 0 0; }
.footer { max-width: 1400px; width: 100%; margin: auto; padding: 18px 28px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 11px; }

@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; gap: 8px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .metrics-five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric:nth-child(3) { border-right: 0; }
}
@media (max-width: 620px) {
  .topbar-inner { padding: 12px 18px 0; gap: 8px 18px; }
  .brand { font-size: 16px; }
  .account { margin-left: auto; }
  .account-name { display: none; }
  .nav { order: 3; width: 100%; gap: 2px; overflow-x: auto; }
  .nav a { white-space: nowrap; padding: 10px 9px; }
  .shell { padding: 24px 18px 46px; }
  .page-head { margin-bottom: 25px; }
  h1 { font-size: 24px; }
  .metrics, .metrics-five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric, .metric:nth-child(3) { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 78px; padding: 14px; }
  .metric:nth-child(even) { border-right: 0; }
  .metric strong { font-size: 23px; }
  .filter-form { width: 100%; flex-wrap: wrap; }
  .filter-form select { flex: 1; min-width: 150px; }
  .history-form { align-items: stretch; }
  .history-form select, .history-form input, .history-form button { width: 100%; }
  .history-form select[multiple] { max-width: none; }
  .correlation-row { align-items: flex-start; flex-direction: column; gap: 7px; }
  .footer { padding: 16px 18px; flex-wrap: wrap; }
}
