:root {
  --bg: #F9FAFC;
  --card: #FFFFFF;
  --line: #EBEBEB;
  --strong: #D5D6DB;
  --ink: #141416;
  --grey: #6C6E73;
  --soft: #F5F5F8;
  --green: #6FC688;
  --on-green: #141416;
  --lead: #0D5141;
  --lead-bg: #E9F6EC;
  --error: #9B2C2C;
  --error-bg: #FDECEC;
  --warn: #7A4B00;
  --warn-bg: #FFF4DB;
  --series-1: #2A78D6;
  --series-2: #EB6834;
  --series-3: #1BAF7A;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416;
    --card: #1C1C20;
    --line: #2E2E35;
    --strong: #45454E;
    --ink: #FFFFFF;
    --grey: #A9ABB2;
    --soft: #26262C;
    --lead: #6FC688;
    --lead-bg: #1F3326;
    --error: #F4B4B4;
    --error-bg: #3A1F1F;
    --warn: #F2C97D;
    --warn-bg: #3A2E14;
    --series-1: #3987E5;
    --series-2: #D95926;
    --series-3: #199E70;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

p, h1, h2, ul, ol, dl, dd { margin: 0; }

ul, ol { padding: 0; list-style: none; }

.bar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.bar-in {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.logo { display: block; height: 28px; width: auto; color: var(--ink); }

.product {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--grey);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -.02em;
}

button, .button {
  display: inline-block;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  padding: 8px 14px;
  border: 1px solid var(--strong);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

button:hover, .button:hover { border-color: var(--ink); }

button:disabled {
  opacity: .5;
  cursor: default;
  border-color: var(--line);
}

button.primary, .button.primary {
  background: var(--green);
  border-color: var(--green);
  color: var(--on-green);
}

button.primary:hover:not(:disabled), .button.primary:hover { border-color: var(--on-green); }

button.quiet { padding: 6px 12px; color: var(--grey); }

button:focus-visible, .button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.error {
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--error-bg);
  color: var(--error);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.signin {
  max-width: 440px;
  padding: 32px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 16px -8px rgba(15, 15, 15, .1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.signin h2 { font-size: 20px; font-weight: 600; }

.signin p { color: var(--grey); }

.signin .why { font-size: 13px; }

.signin .button { margin-top: 8px; }

.workspace-list { display: flex; flex-direction: column; gap: 12px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 20px;
  align-items: center;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.workspace-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.workspace-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }

.workspace-title h2 { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }

.workspace-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--grey);
  overflow-wrap: anywhere;
}

.workspace-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.state {
  padding: 1px 8px;
  white-space: nowrap;
  border: 1px solid var(--strong);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--grey);
}

.state.ready { color: var(--lead); background: var(--lead-bg); border-color: transparent; }

.empty { color: var(--grey); padding: 12px 0; }

.loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  color: var(--grey);
  font-size: 14px;
}

.dots { display: flex; gap: 6px; }

.dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: wave 1.4s ease-in-out infinite;
}

.dots i:nth-child(2) { animation-delay: .16s; }

.dots i:nth-child(3) { animation-delay: .32s; }

@keyframes wave {
  0%, 60%, 100% { transform: none; opacity: .35; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.sheet {
  width: min(560px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 18px 48px rgba(15, 15, 15, .2);
}

.sheet[open] { display: flex; flex-direction: column; }

.sheet::backdrop { background: rgba(20, 20, 22, .35); }

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 12px;
}

.sheet-head h2 { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }

.label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--grey);
}

.search { display: flex; flex-direction: column; gap: 6px; padding: 0 20px 16px; }

.search input {
  font: inherit;
  font-size: 15px;
  padding: 8px 12px;
  border: 1px solid var(--strong);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}

.users-list { border-top: 1px solid var(--line); overflow: auto; min-height: 0; flex: 1; }

.users-list > li { border-bottom: 1px solid var(--line); }

.users-list .empty, .users-list .loading { padding: 12px 20px; }

.user {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 20px;
  border: 0;
  border-radius: 0;
  text-align: left;
  white-space: normal;
  background: var(--card);
}

.user:hover, .user:focus-visible { background: var(--soft); }

.user:focus-visible { outline-offset: -2px; }

.user-name { display: flex; flex-direction: column; min-width: 0; }

.user-name strong { font-weight: 600; overflow-wrap: anywhere; }

.user-name span, .user-id {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--grey);
  overflow-wrap: anywhere;
}

.sheet .error { margin: 12px 20px 20px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
}

.views {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.views a {
  padding: 6px 14px;
  border-radius: 7px;
  color: var(--grey);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.views a:hover { color: var(--ink); }

.views a[aria-current="page"] { background: var(--soft); color: var(--ink); }

.state.warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; }

.state.bad { color: var(--error); background: var(--error-bg); border-color: transparent; }

.state.busy { color: var(--ink); background: var(--soft); border-color: transparent; }

.operations { display: flex; flex-direction: column; gap: 20px; }

.overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }

.tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
}

.tile-value { font-size: 24px; font-weight: 600; line-height: 1.2; }

.tile-detail { color: var(--grey); font-size: 13px; overflow-wrap: anywhere; }

.tile-list { font-size: 13px; color: var(--grey); display: flex; flex-direction: column; gap: 2px; }

.tile-list code, .mono { font-family: var(--mono); font-size: 12px; overflow-wrap: break-word; }

button.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--lead);
  font-size: inherit;
  text-decoration: underline;
}

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }

.overview-head { display: flex; justify-content: flex-end; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.pager-at { color: var(--grey); font-size: 14px; text-align: center; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.field select {
  font: inherit;
  font-size: 14px;
  padding: 7px 10px;
  border: 1px solid var(--strong);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  max-width: 100%;
}

.ops-list { min-width: 0; }

.ops-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
}

.ops-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--grey);
}

.ops-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: break-word;
}

.ops-table tbody tr:last-child td { border-bottom: 0; }

.ops-table tbody tr { cursor: pointer; }

.ops-table tbody tr:hover td { background: var(--soft); }

.sub { display: block; color: var(--grey); font-size: 12px; }

.ops-table button.link { color: var(--ink); text-align: left; white-space: normal; }

.sheet-body {
  border-top: 1px solid var(--line);
  padding: 16px 20px 20px;
  overflow: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  font-size: 14px;
}

.facts dt { color: var(--grey); }

.facts dd { overflow-wrap: anywhere; }

.copy { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.copy button { padding: 2px 10px; font-size: 12px; }

.note {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  background: var(--warn-bg);
  color: var(--warn);
}

.timeline { display: flex; flex-direction: column; border-left: 2px solid var(--line); }

.timeline li {
  display: grid;
  grid-template-columns: 2.5em minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 6px 0 6px 12px;
  font-size: 14px;
}

.timeline .seq, .timeline time { font-family: var(--mono); font-size: 12px; color: var(--grey); }

.timeline .phase { font-family: var(--mono); overflow-wrap: anywhere; }

.timeline .code { grid-column: 2 / -1; font-family: var(--mono); font-size: 12px; color: var(--error); }

.sheet h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--grey);
}

.tile-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.incidents {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.incidents[aria-busy="true"] #inc-open, .incidents[aria-busy="true"] #inc-resolved { opacity: .55; }

.section-title:focus { outline: none; }

.section-title:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.incident-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.incident {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.incident:last-child { border-bottom: 0; }

.incident:hover { background: var(--soft); }

.incident-head { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; min-width: 0; }

.incident-head button.link {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  white-space: normal;
}

.incident-head button.link:hover { text-decoration: underline; }

.incident-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  font-size: 13px;
  color: var(--grey);
  overflow-wrap: anywhere;
}

.incident-meta .unacked { color: var(--warn); }

.ack-how { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

.timeline .detail {
  grid-column: 2 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--grey);
}

.resources {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.section-title { font-size: 20px; font-weight: 600; }

.section-subtitle { margin: 8px 0 0; font-size: 16px; font-weight: 600; }

.resources[aria-busy="true"] .charts, .resources[aria-busy="true"] #res-stats { opacity: .55; }

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  gap: 12px;
}

.chart {
  margin: 0;
  padding: 14px 16px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

.chart-title { margin: 0; font-size: 14px; font-weight: 600; }

.chart-unit { font-size: 12px; color: var(--grey); white-space: nowrap; }

.legend { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12px; color: var(--grey); }

.legend li { display: flex; align-items: center; gap: 6px; }

.key {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 2px;
  margin-right: 6px;
  vertical-align: middle;
  border-radius: 1px;
  background: var(--series-1);
}

.legend .key { margin-right: 0; }

.key.s2 { background: var(--series-2); }

.key.s3 { background: var(--series-3); }

.key.ref { background: var(--grey); }

.key.unknown { width: 8px; height: 3px; background: var(--warn); }

.chart-frame { min-width: 0; border-radius: 6px; cursor: crosshair; }

.chart-frame:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.plot { display: block; overflow: visible; }

.plot .grid { stroke: var(--line); stroke-width: 1; }

.plot .axis { stroke: var(--strong); stroke-width: 1; }

.plot .tick { fill: var(--grey); font-size: 11px; font-variant-numeric: tabular-nums; }

.plot .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

.plot .line.ref { stroke-width: 1.5; }

.plot .s1 { stroke: var(--series-1); fill: var(--series-1); }

.plot .s2 { stroke: var(--series-2); fill: var(--series-2); }

.plot .s3 { stroke: var(--series-3); fill: var(--series-3); }

.plot .ref { stroke: var(--grey); fill: var(--grey); }

.plot .line.s1, .plot .line.s2, .plot .line.s3, .plot .line.ref { fill: none; }

.plot .band { stroke: none; opacity: .16; }

.plot .dot { stroke: none; }

.plot .marker { stroke: var(--card); stroke-width: 2; }

.plot .cross { stroke: var(--grey); stroke-width: 1; }

.plot .unknown-mark { fill: var(--warn); }

.readout { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--grey); }

.readout strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.readout-when { color: var(--ink); }

.unknown-note { color: var(--warn); }

.stats-table tbody tr { cursor: auto; }

.stats-table tbody tr:hover td { background: none; }

.stats-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.count.bad { color: var(--error); font-weight: 600; }

.count.warn { color: var(--warn); font-weight: 600; }

.codes { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

.codes + .codes { margin-top: 4px; }

.codes-label { font-size: 12px; color: var(--grey); }

.chip {
  padding: 0 6px;
  border-radius: 6px;
  background: var(--soft);
  font-family: var(--mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.chip.bad { background: var(--error-bg); color: var(--error); font-weight: 600; }

@media (prefers-reduced-motion: no-preference) {
  .charts, #res-stats, #inc-open, #inc-resolved { transition: opacity .2s; }
}

@media (prefers-reduced-motion: reduce) {
  .dots i { animation: none; opacity: 1; }
}

@media (max-width: 640px) {
  .workspace { grid-template-columns: 1fr; }
  .workspace-actions { justify-content: flex-start; }
  h1 { font-size: 24px; }
  .ops-table, .ops-table tbody, .ops-table tr, .ops-table td { display: block; }
  .ops-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ops-table tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .ops-table tbody tr:last-child { border-bottom: 0; }
  .ops-table td {
    display: grid;
    grid-template-columns: 7.5em minmax(0, 1fr);
    gap: 8px;
    padding: 3px 14px;
    border: 0;
  }
  .ops-table td::before {
    content: attr(data-label);
    color: var(--grey);
    font-size: 12px;
  }
  .stats-table .num { text-align: left; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 8px; }
  .incident-timeline li { grid-template-columns: 2.5em minmax(0, 1fr); }
  .incident-timeline li time { grid-column: 2; }
}
