:root {
  color-scheme: light;
  font-family: "Segoe UI", "Liberation Sans", Arial, sans-serif;
  color: #172335;
  background: #edf1f5;
  font-synthesis: none;
  --canvas: #edf1f5;
  --surface: #fff;
  --ink: #172335;
  --subtle: #4a5b70;
  --rule: #dce4ec;
  --blue: #224d9a;
  --blue-wash: #ecf2fd;
  --green: #16533a;
  --green-wash: #e5f3ea;
  --amber: #755006;
  --amber-wash: #fff3d4;
  --red: #94342e;
  --red-wash: #fbebe8;
  --topbar: #192b44;
  --radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; font-size: .9375rem; line-height: 1.48; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .63; }
:focus-visible { outline: 3px solid #376ac1; outline-offset: 3px; }

.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.topbar { background: var(--topbar); color: #fff; }
.topbar-inner {
  max-width: 1680px;
  margin-inline: auto;
  min-height: 76px;
  padding: 14px clamp(16px, 3vw, 42px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.brand, .topbar-actions, .connection { display: flex; align-items: center; }
.brand { gap: 11px; }
.brand-mark {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding-bottom: 10px;
  inline-size: 39px;
  block-size: 39px;
  flex: none;
  border: 1px solid #58779a;
  border-radius: 10px;
  background: #213d61;
}
.brand-mark i { inline-size: 4px; background: #b7d4ff; border-radius: 2px 2px 1px 1px; }
.brand-mark i:nth-child(1) { block-size: 7px; }
.brand-mark i:nth-child(2) { block-size: 13px; }
.brand-mark i:nth-child(3) { block-size: 17px; }
.brand-name { font-size: 1.13rem; font-weight: 720; line-height: 1.2; letter-spacing: -.025em; }
.brand-caption { margin-top: 3px; color: #c3d1e2; font-size: .79rem; }
.topbar-actions { gap: 9px; }
.connection {
  gap: 8px;
  margin-inline-end: 10px;
  color: #e0e9f4;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.connection-dot {
  inline-size: 7px;
  block-size: 7px;
  flex: none;
  border-radius: 50%;
  background: #a6b8ce;
}
.connection[data-state="ok"] .connection-dot { background: #8de0af; }
.connection[data-state="error"] .connection-dot { background: #ffcd72; }
.topbar :focus-visible { outline-color: #b7d4ff; }

.button {
  min-height: 40px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font-weight: 650;
  font-size: .875rem;
  line-height: 1.35;
}
.button-outline { border-color: #b7c8db; color: var(--blue); background: var(--surface); }
.button-outline:hover:not(:disabled) { background: var(--blue-wash); border-color: #7f9ec6; }
.topbar .button-outline { border-color: #6682a3; color: #fff; background: #28415f; }
.topbar .button-outline:hover:not(:disabled), .topbar .button-quiet:hover:not(:disabled) { background: #355373; }
.topbar .button-quiet { color: #e0e9f4; }
.button-primary { color: #fff; background: var(--blue); }
.button-primary:hover:not(:disabled) { background: #1b3d79; }

.auth-shell { width: min(100% - 32px, 460px); margin: clamp(30px, 10vh, 105px) auto; }
.auth-card {
  padding: clamp(20px, 5vw, 34px);
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 12px 30px #182e4810;
}
.auth-card h1 { font-size: clamp(1.42rem, 5vw, 1.78rem); letter-spacing: -.035em; line-height: 1.18; }
.auth-card p { margin-block: 10px 18px; color: var(--subtle); }
.auth-card form { display: grid; gap: 7px; }
.auth-card label { font-size: .87rem; font-weight: 680; }
.auth-card input, .search input {
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: 40px;
  border: 1px solid #c5d2e0;
  border-radius: 7px;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
}
.auth-card input { margin-bottom: 7px; }
.auth-card input:focus, .search input:focus { border-color: #5c7fba; }
.auth-card .button { margin-top: 4px; min-height: 44px; }
.claim-code {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  background: var(--blue-wash);
  border: 1px solid #d5e2fb;
  border-radius: 8px;
  color: var(--blue);
}
.claim-code span { font-size: .79rem; font-weight: 650; }
.claim-code strong { font-family: ui-monospace, monospace; overflow-wrap: anywhere; font-size: 1rem; }
.alert {
  border: 1px solid #dbaaa2;
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--red-wash);
  color: var(--red);
  overflow-wrap: anywhere;
}
.auth-card .alert { color: var(--red); }
.dashboard-alert { margin-bottom: 14px; }

.dashboard { max-width: 1680px; margin-inline: auto; padding: 22px clamp(16px, 3vw, 42px) 36px; }
.workspace {
  display: grid;
  grid-template-columns: minmax(210px, .75fr) minmax(170px, .6fr) minmax(360px, 2fr);
  align-items: start;
  gap: 14px;
}
.pane {
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  overflow-wrap: anywhere;
  box-shadow: 0 1px 3px #182e4808;
}
.pane-header {
  min-height: 60px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--rule);
}
.pane-header h1, .pane-header h2 { font-size: 1rem; line-height: 1.3; letter-spacing: -.012em; }
.count {
  padding: 1px 8px;
  border-radius: 999px;
  background: #eaf0f6;
  color: #485e77;
  font-size: .76rem;
  font-weight: 690;
  font-variant-numeric: tabular-nums;
}
.search { padding: 12px 12px 4px; }
.search input::placeholder { color: #52657b; }
.list-pane { padding: 8px; max-height: min(760px, 68vh); overflow: auto; }
.list-group + .list-group { border-top: 1px solid var(--rule); margin-top: 8px; padding-top: 8px; }
.list-group h3 {
  padding: 6px 7px;
  color: var(--subtle);
  font-size: .75rem;
  font-weight: 710;
}
.list-items { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.list-button {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  min-height: 44px;
}
.list-button:hover { background: #f3f6fa; }
.list-button[aria-pressed="true"] { border-color: #adc5ef; background: var(--blue-wash); }
.list-button:focus-visible { outline-offset: -2px; }
.list-name { font-size: .9rem; font-weight: 680; line-height: 1.32; }
.list-meta { color: var(--subtle); font-size: .76rem; }
.list-button .badge { justify-self: start; margin-top: 1px; }
.empty { padding: 12px 8px; color: var(--subtle); font-size: .87rem; }
.pagination { border-top: 1px solid var(--rule); padding: 11px; }
.pagination .button { width: 100%; }

.history-header { padding-inline: 18px; }
.history-heading { display: grid; min-width: 0; gap: 3px; }
.history-heading p { color: var(--subtle); font-size: .78rem; }
.badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eaf0f6;
  color: #455970;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.35;
}
.badge[data-tone="green"] { background: var(--green-wash); color: var(--green); }
.badge[data-tone="amber"] { background: var(--amber-wash); color: var(--amber); }
.badge[data-tone="red"] { background: var(--red-wash); color: var(--red); }
.history-header .badge { align-self: center; }

.timeline { padding: 0 18px; }
.timeline > .empty { padding: 18px 0; }
.event { padding: 15px 0; }
.event + .event { border-top: 1px solid var(--rule); }
.event-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 9px;
}
.event-header h3 { font-size: .88rem; font-weight: 720; }
.event-header time { color: var(--subtle); font-size: .75rem; font-variant-numeric: tabular-nums; }
.event-content { display: grid; gap: 8px; }
.message {
  border-radius: 8px;
  border: 1px solid #dee5ee;
  background: #f5f7fa;
  padding: 9px 11px;
  min-width: 0;
}
.message-response { border-color: #d4e0f6; background: #edf3fd; }
.message-header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.message-label, .detail-label { color: #40546d; font-size: .74rem; font-weight: 720; }
.message p { margin-top: 4px; font-size: .91rem; white-space: pre-wrap; }
.message blockquote {
  margin: 5px 0;
  border-left: 2px solid #97add0;
  padding-left: 9px;
  color: var(--subtle);
  white-space: pre-wrap;
  font-size: .87rem;
}
.choices { display: flex; flex-wrap: wrap; gap: 5px; list-style: none; margin: 4px 0 0; padding: 0; }
.choices li { border: 1px solid #cbd9ee; background: #f4f7fc; border-radius: 6px; padding: 3px 7px; font-size: .8rem; }
.event-details { border: 1px solid var(--rule); border-radius: 8px; }
.event-details summary { padding: 7px 10px; cursor: pointer; color: var(--blue); font-size: .8rem; font-weight: 690; }
.event-details[open] summary { border-bottom: 1px solid var(--rule); }
.detail-content { display: grid; gap: 9px; padding: 10px; }
.detail-content pre, .event-errors pre {
  margin: 3px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: .78rem/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.event-errors { color: var(--red); background: var(--red-wash); border-radius: 8px; padding: 8px 10px; }
.event-errors .detail-label { color: inherit; }

@media (max-width: 960px) {
  .workspace { grid-template-columns: minmax(175px, .8fr) minmax(150px, .6fr) minmax(290px, 1.8fr); gap: 10px; }
  .pane-header { padding-inline: 12px; }
  .timeline { padding-inline: 12px; }
}

@media (max-width: 740px) {
  .workspace { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .history-pane { grid-column: 1 / -1; }
  .list-pane { max-height: 265px; }
}

@media (max-width: 480px) {
  .topbar-inner { flex-wrap: wrap; gap: 12px; }
  .topbar-actions { flex: 1 1 100%; gap: 5px; }
  .connection { flex: 1; margin-inline-end: 0; font-size: .74rem; }
  .topbar .button { min-height: 44px; padding-inline: 8px; font-size: .8rem; }
  .dashboard { padding-inline: 10px; padding-top: 12px; }
  .workspace { gap: 8px; }
  .pane-header { min-height: 48px; padding-inline: 8px; }
  .pane-header h1, .pane-header h2 { font-size: .9rem; }
  .history-header { padding-inline: 12px; }
  .search { padding: 8px 7px 2px; }
  .search input { min-block-size: 38px; padding-inline: 7px; font-size: 1rem; }
  .list-pane { padding: 6px; max-height: 218px; }
  .list-button { padding-inline: 5px; }
  .list-group h3 { padding-inline: 5px; }
  .pagination { padding: 7px; }
  .pagination .button { padding-inline: 5px; min-height: 44px; font-size: .78rem; }
}
