:root {
  --burgundy: #a51f38;
  --burgundy-dark: #84182d;
  --charcoal: #141617;
  --muted: #4e555a;
  --line: #d8dcE0;
  --canvas: #f3f4f6;
  --surface: #ffffff;
  --pale: #f7f8f9;
  --warn: #8a5a00;
  --warn-bg: #fff6e8;
  --bad: #8d1d2c;
  --bad-bg: #fdecee;
  --ok: #1f6b45;
  --ok-bg: #eef7f2;
  --header: 48px;
  --text: 13px;
  --pad: 16px;
  color: var(--charcoal);
  background: var(--canvas);
  font: var(--text) / 1.4 "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

body { margin: 0; min-height: 100vh; }

button, select, input, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--burgundy);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 8px;
  top: -40px;
  background: var(--surface);
  padding: 8px;
  z-index: 5;
}

.skip:focus { top: 8px; }

.header {
  min-height: var(--header);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 var(--pad);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 3;
}

.brand { display: flex; align-items: center; gap: 8px; min-width: 180px; }

.brand-name { font-weight: 650; letter-spacing: 0; }

.sim-pill {
  border: 1px solid var(--burgundy);
  color: var(--burgundy);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 650;
}

.secondary-nav { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; }

.secondary-nav button, .tabs button, .icon-button, .text-button {
  border: 0;
  background: transparent;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 4px;
  white-space: nowrap;
}

.secondary-nav button[aria-current="page"], .tabs button[aria-selected="true"] {
  background: var(--burgundy);
  color: white;
}

.header-tools { display: flex; align-items: center; gap: 8px; position: relative; }

.persona {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.persona select {
  min-height: 32px;
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  padding: 4px 8px;
}

.count {
  background: var(--burgundy);
  color: white;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 11px;
}

.popover {
  position: absolute;
  right: 190px;
  top: 42px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 12px;
  z-index: 4;
}

.popover-title { margin: 0 0 8px; font-weight: 650; }

.popover ul { margin: 0; padding-left: 18px; }

main { padding: var(--pad); }

.banner {
  margin: 0 0 12px;
  padding: 8px 12px;
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid #efd3a4;
}

.banner:empty { display: none; }

.tabs { display: flex; gap: 4px; margin-bottom: 8px; }

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

.filters label, .stack label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.filters label { flex: 0 0 168px; }

.filters label:first-child { flex-basis: 240px; }

.stack label { width: 100%; }

.filters label.check, .stack label.check {
  flex-direction: row;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  min-height: 40px;
}

.filters input:not([type="checkbox"]),
.filters select,
.stack input:not([type="checkbox"]),
.stack select,
.stack textarea {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  padding: 4px 8px;
}

.filters label.check input, .stack label.check input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
}

.counts { display: flex; gap: 12px; color: var(--muted); margin: 0 0 8px; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: auto;
  max-height: calc(100vh - 210px);
}

table { width: 100%; border-collapse: collapse; min-width: 860px; }

th, td {
  text-align: left;
  padding: 4px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  height: 36px;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  background: var(--pale);
  font-weight: 650;
  z-index: 1;
}

.status { display: inline-flex; align-items: center; gap: 6px; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }

.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }

.row-button {
  background: transparent;
  border: 0;
  color: var(--burgundy);
  font-weight: 650;
  min-height: 40px;
  padding: 0;
}

.name-line, .ip-line { display: flex; align-items: center; gap: 8px; }

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

.decision { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.decision input { min-height: 32px; min-width: 180px; border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px; }

.host-copy { display: inline-flex; align-items: center; gap: 6px; }

.host-copy.copied { color: var(--burgundy); border-color: var(--burgundy); }

.cell-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  flex: 0 0 auto;
  background: var(--pale);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--charcoal);
  text-decoration: none;
}

.cell-icon:hover, .cell-icon.copied { color: var(--burgundy); }

td .text-button {
  min-height: 32px;
  padding: 0 12px;
  background: var(--pale);
  border: 1px solid var(--line);
  color: var(--charcoal);
}

td .text-button:hover { border-color: var(--burgundy); color: var(--burgundy); }

.drawer form.stack { padding: 12px 16px; }

.primary, .ghost {
  min-height: 40px;
  border-radius: 4px;
  padding: 0 12px;
}

.primary { background: var(--burgundy); color: white; border: 0; }
.primary:hover { background: var(--burgundy-dark); }
.ghost { background: var(--surface); border: 1px solid var(--line); }

.state-panel, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 16px;
}

.state-panel h2, .panel h2 { margin: 0 0 8px; font-size: 16px; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 23, 0.35);
  z-index: 5;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(440px, 100%);
  height: 100%;
  background: var(--surface);
  z-index: 6;
  overflow: auto;
  border-left: 1px solid var(--line);
}

.drawer-bar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
}

.drawer-bar h2 { margin: 0; font-size: 16px; }

.drawer section { padding: 12px 16px; border-bottom: 1px solid var(--line); }

.drawer h3 { margin: 0 0 8px; font-size: 13px; }

.drawer dl { display: grid; grid-template-columns: 140px 1fr; gap: 4px 8px; margin: 0; }

.drawer dt { color: var(--muted); }

.drawer dd { margin: 0; }

.stack { display: flex; flex-direction: column; gap: 8px; }

.notice, .error, .ok-note {
  padding: 8px 10px;
  border: 1px solid var(--line);
}

.notice { background: var(--warn-bg); color: var(--warn); }
.error { background: var(--bad-bg); color: var(--bad); }
.ok-note { background: var(--ok-bg); color: var(--ok); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }

.card { border: 1px solid var(--line); background: var(--pale); padding: 12px; }

.card h3 { margin: 0 0 4px; font-size: 13px; }

.card p { margin: 0; }

.live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 860px) {
  .header { height: auto; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .secondary-nav { order: 3; width: 100%; overflow-x: auto; }
  .filters .optional-filter { display: none; }
  .popover { right: 8px; }
}
