/* UI pages: sidebar tree, command palette, overview, project, side peek, incidents, infra.
   Tokens and shared classes (pills, tags, tables, callouts, toggles) come from base.css. */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.section-h { font-size: 18px; margin: 32px 0 6px; }
.p-icon { display: inline-block; width: 22px; text-align: center; margin-right: 6px; }
.notes { overflow-wrap: anywhere; }
.notes > :first-child { margin-top: 0; }

/* ---------- sidebar ---------- */
.menu-btn { display: none; }
.sb { display: flex; flex-direction: column; min-height: 100%; padding: 8px 6px 0; }
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 8px; }
.sb-workspace { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; text-decoration: none; padding: 4px 6px; border-radius: var(--radius); }
.sb-workspace:hover { background: var(--hover); }
.sb-logo { font-size: 18px; }
.sb-close { display: none; }
.sb-item {
  display: flex; align-items: center; gap: 6px; width: 100%; min-height: 28px; padding: 2px 8px;
  border: 0; border-radius: var(--radius); background: transparent; color: var(--text-2);
  font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer;
}
.sb-item:hover { background: var(--hover); color: var(--text); }
.sb-item.active { background: var(--active); color: var(--text); font-weight: 500; }
.sb-ico { flex: 0 0 20px; text-align: center; font-size: 14px; }
.sb-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-kbd { font-size: 11px; color: var(--text-3); }
.sb-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red-bg);
  color: var(--red); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}
.sb-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.sb-life { font-size: 11px; color: var(--text-3); }
.sb-section {
  margin: 18px 8px 4px; font-size: 12px; font-weight: 500; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em;
}
.sb-section a { text-decoration: none; }
.sb-section a:hover { color: var(--text); }
.sb-tree, .sb-groups { list-style: none; margin: 0; padding: 0; }
.sb-groups { padding-left: 22px; }
.sb-sub { min-height: 26px; font-size: 13px; }
.sb-empty { padding: 4px 30px; font-size: 12px; color: var(--text-3); }
details.sb-node > summary { list-style: none; padding-left: 2px; }
details.sb-node > summary::-webkit-details-marker { display: none; }
.sb-caret { flex: 0 0 16px; text-align: center; color: var(--text-3); }
.sb-caret::before { content: "▸"; display: inline-block; font-size: 11px; transition: transform .12s ease; }
details.sb-node[open] > summary .sb-caret::before { transform: rotate(90deg); }
.sb-link { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; color: inherit; text-decoration: none; }
.sdot { flex: 0 0 auto; font-size: 11px; line-height: 1; width: 16px; text-align: center; }
.sdot-ok { color: var(--green); } .sdot-warn { color: var(--yellow); } .sdot-down { color: var(--red); }
.sdot-silent { color: var(--purple); } .sdot-unknown, .sdot-disabled { color: var(--gray); }
.sdot-retired { color: var(--brown); }
.sb-bottom { margin-top: auto; padding: 12px 0 8px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--sidebar); }
.sb-user > summary { list-style: none; }
.sb-user > summary::-webkit-details-marker { display: none; }
.sb-avatar {
  flex: 0 0 22px; height: 22px; border-radius: 3px; background: var(--brown-bg); color: var(--brown);
  font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
}
.sb-user-menu { padding: 4px 0 4px 28px; }
.sb-email { padding: 0 8px 4px; overflow-wrap: anywhere; }
.sb-user-menu form { margin: 0; }

/* ---------- command palette ---------- */
.palette { position: fixed; inset: 0; z-index: 70; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.palette-box {
  position: relative; margin: 12vh auto 0; width: min(640px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .5); overflow: hidden;
}
.palette-box input.palette-input {
  height: 52px; padding: 0 18px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
  background: transparent; font-size: 17px; box-shadow: none;
}
.palette-results { max-height: min(56vh, 460px); overflow-y: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius);
  color: var(--text); text-decoration: none;
}
.palette-item:hover, .palette-item[aria-selected="true"] { background: var(--active); }
.pi-icon { flex: 0 0 18px; text-align: center; color: var(--text-2); }
.pi-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-ctx { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.pi-type { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.palette-empty { padding: 18px; color: var(--text-2); text-align: center; }
.palette-foot { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }
.palette-foot kbd { margin-right: 2px; }

/* ---------- overview ---------- */
.ov-counts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 20px; }
.ov-count { display: inline-flex; align-items: center; gap: 6px; }
.ov-updated { color: var(--text-3); font-size: 12px; margin-left: auto; }
.ov-table td { white-space: nowrap; }
.ov-name a, .inc-title a { text-decoration: none; font-weight: 500; }
.ov-name a:hover, .inc-title a:hover { text-decoration: underline; }
.ov-latest { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.ov-latest a { text-decoration: none; }
.ratio { font-variant-numeric: tabular-nums; }
.ratio-bad { color: var(--yellow); font-weight: 600; }
.callout-title { font-weight: 500; }
.callout-title a { text-decoration: none; }
.callout-title a:hover { text-decoration: underline; }

/* ---------- 24-segment hourly strip ---------- */
.strip { display: inline-flex; gap: 2px; vertical-align: middle; flex: 0 0 auto; }
.seg { display: block; width: 6px; height: 14px; border-radius: 1px; background: rgba(255, 255, 255, .055); }
.seg-ok { background: var(--green); } .seg-warn { background: var(--yellow); } .seg-down { background: var(--red); }
.seg-silent { background: var(--purple); } .seg-unknown, .seg-disabled { background: var(--gray); }
.seg-retired { background: var(--brown); }
.strip-days .seg { width: 18px; }

/* ---------- project page ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 13px; color: var(--text-2); font-size: 13px;
  text-decoration: none;
}
.chip:hover { background: var(--hover); color: var(--text); }
.chip.active { background: var(--active); color: var(--text); border-color: transparent; }
.chip-n { color: var(--text-3); font-variant-numeric: tabular-nums; }
details.group { margin: 6px 0; scroll-margin-top: 16px; }
.group-n { color: var(--text-3); font-weight: 400; }
.rows { list-style: none; margin: 2px 0 8px; padding: 0; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: var(--radius);
  color: var(--text); text-decoration: none;
}
.row:hover { background: var(--hover); }
.row-pill { flex: 0 0 96px; }
.row-main { flex: 1 1 auto; min-width: 0; }
.row-name { font-weight: 500; }
.row-evidence { display: block; color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.retired-note { margin-top: 16px; }

/* ---------- side peek ---------- */
.peek-panel { min-height: 100%; }
.peek-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -8px 0 8px; }
.peek-crumb { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek-buttons { display: flex; gap: 2px; flex: 0 0 auto; }
.peek-buttons a { text-decoration: none; }
.peek-title { font-size: 26px; font-weight: 700; margin: 4px 0 8px; outline: none; }
.peek-h { font-size: 15px; margin: 24px 0 8px; }
.props-tight .prop { min-height: 28px; padding: 2px 0; }
.props-tight .prop-key { flex-basis: 120px; }
.pk-incident { margin: 12px 0; }
.pk-events { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12px; color: var(--text-2); }
.pk-events li { padding: 1px 0; }
.pk-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; margin-top: 10px; }
.pk-actions form { margin: 0; }
details.pk-form > summary { list-style: none; }
details.pk-form > summary::-webkit-details-marker { display: none; }
details.pk-form[open] { flex: 1 1 100%; }
details.pk-form[open] > summary { background: var(--active); }
details.pk-form > form {
  margin-top: 8px; padding: 4px 12px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.pk-check { border-top: 1px solid var(--border); padding: 12px 0; }
.pk-check-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.pk-check-name { font-weight: 600; text-decoration: none; }
a.pk-check-name:hover { text-decoration: underline; }
.kv { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 3px 10px; margin: 0; font-size: 13px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.params { list-style: none; margin: 0; padding: 0; }
.params li { padding: 1px 0; }
.param-k { color: var(--text-2); }
.param-v { color: var(--text); background: var(--surface-2); }
.pk-history { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 10px 0 2px; }
.pk-strip { display: flex; align-items: center; gap: 8px; }
.pk-recent { margin-top: 6px; }
.pk-recent > summary { font-weight: 500; font-size: 13px; color: var(--text-2); }
.recent { list-style: none; margin: 4px 0; padding: 0; font-size: 12px; }
.recent li { padding: 2px 0; overflow-wrap: anywhere; }
.pk-edit { margin-top: 8px; }

/* ---------- incidents ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.filter-bar select { width: auto; min-width: 160px; }
.board-group { margin: 22px 0; }
.group-h { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0 0 6px; }
.inc-title { white-space: normal; min-width: 220px; }

/* ---------- phones / narrow windows ---------- */
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; position: fixed; top: 10px; left: 10px; z-index: 45; background: var(--bg); border: 1px solid var(--border); }
  .sb-close { display: inline-flex; }
  .row { flex-wrap: wrap; gap: 6px 10px; }
  .row-pill { flex-basis: auto; }
  .row .strip { flex-basis: 100%; }
  .ov-updated { margin-left: 0; flex-basis: 100%; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 4px; }
  .palette-box { margin-top: 8vh; }
}
