:root {
  --bg: #0b0d12;
  --surface: #11141b;
  --surface-raised: #171b24;
  --border: #282d38;
  --border-strong: #3a4250;
  --text: #f4f6f9;
  --muted: #98a2b3;
  --accent: #7c5cff;
  --accent-hover: #9076ff;
  --success: #45d483;
  --danger: #ff6b7a;
  --radius: 12px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; font-size: 16px; line-height: 1.5; }
button, input { font: inherit; }
button { cursor: pointer; }

.skip-link {
  position: fixed;
  top: -80px;
  left: 16px;
  z-index: 100;
  padding: 12px 16px;
  color: var(--text);
  background: var(--accent);
  border-radius: 8px;
}
.skip-link:focus { top: 16px; }

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 13, 18, .92);
}
.eyebrow {
  margin: 0 0 2px;
  color: var(--accent-hover);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 22px; line-height: 1.2; }
h2 { margin-bottom: 4px; font-size: 18px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.status { display: inline-flex; align-items: center; gap: 8px; margin-right: 6px; color: var(--muted); font-size: 14px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 12px rgba(69, 212, 131, .5); }
.status.error .status-dot { background: var(--danger); box-shadow: none; }

.button, .icon-button {
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  color: var(--text);
  transition: background 180ms ease, border-color 180ms ease, transform 100ms ease;
}
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; font-weight: 650; }
.button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button-primary { border-color: var(--accent); background: var(--accent); }
.button-primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.button-secondary { background: var(--surface-raised); }
.button-secondary:hover { border-color: #566074; background: #202531; }
.button:active { transform: scale(.98); }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(124, 92, 255, .5); outline-offset: 2px; }

.workspace { display: grid; grid-template-columns: minmax(310px, 380px) 1fr; height: calc(100dvh - 88px); }
.inbox-panel { min-width: 0; border-right: 1px solid var(--border); background: var(--surface); overflow: auto; }
.panel-heading { position: sticky; top: 0; z-index: 2; padding: 22px 20px 16px; border-bottom: 1px solid var(--border); background: rgba(17, 20, 27, .96); }
.panel-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.message-list { padding: 8px; }
.message-card {
  width: 100%;
  min-height: 92px;
  display: block;
  margin: 0 0 6px;
  padding: 14px;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
}
.message-card:hover { background: var(--surface-raised); }
.message-card.selected { border-color: rgba(124, 92, 255, .7); background: rgba(124, 92, 255, .11); }
.message-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.message-card-path { overflow: hidden; color: #d9deea; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.message-card-bottom { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.method-badge {
  display: inline-flex;
  min-width: 46px;
  justify-content: center;
  padding: 3px 7px;
  border-radius: 5px;
  color: #cfc5ff;
  background: rgba(124, 92, 255, .16);
  font: 750 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.detail-panel { min-width: 0; overflow: auto; background: var(--bg); }
.empty-state { min-height: 100%; display: grid; align-content: center; justify-items: center; padding: 32px; text-align: center; color: var(--muted); }
.empty-state svg { width: 46px; margin-bottom: 18px; fill: none; stroke: var(--border-strong); stroke-width: 1.4; }
.empty-state h2 { color: var(--text); }
.empty-state p { max-width: 440px; }
.detail-content { padding: 28px clamp(20px, 4vw, 52px) 52px; }
.hidden { display: none; }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.detail-header h2 { margin: 10px 0 4px; font: 650 23px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.detail-header p { margin: 0; color: var(--muted); font-size: 13px; }
.metadata { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); gap: 1px; margin: 24px 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--border); }
.metadata div { min-width: 0; padding: 14px; background: var(--surface); }
.metadata dt { margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.metadata dd { margin: 0; overflow-wrap: anywhere; font-size: 14px; }

.tabs { display: flex; gap: 4px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.tabs button { min-height: 44px; padding: 0 14px; color: var(--muted); background: transparent; border: 0; border-bottom: 2px solid transparent; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
pre { min-height: 280px; margin: 0; padding: 20px; overflow: auto; color: #d7dced; background: #0d1016; border: 1px solid var(--border); border-radius: var(--radius); font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2; }

.list-state { padding: 40px 24px; text-align: center; color: var(--muted); }
.list-state strong { display: block; margin-bottom: 4px; color: var(--text); }

dialog { width: min(460px, calc(100% - 32px)); padding: 0; color: var(--text); background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 28px 80px rgba(0, 0, 0, .55); }
dialog::backdrop { background: rgba(0, 0, 0, .66); }
dialog form { padding: 24px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.dialog-heading h2 { margin: 0; font-size: 22px; }
.icon-button { width: 44px; padding: 0; color: var(--muted); background: transparent; font-size: 26px; }
label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 650; }
input { width: 100%; min-height: 46px; padding: 0 12px; color: var(--text); background: var(--bg); border: 1px solid var(--border-strong); border-radius: 8px; }
.helper { margin: 8px 0 24px; color: var(--muted); font-size: 12px; }
.helper code { color: #cfc5ff; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 760px) {
  .topbar { align-items: flex-start; padding: 14px 16px; }
  .status, #token-button { display: none; }
  .button { padding: 0 12px; }
  .workspace { display: block; height: auto; }
  .inbox-panel { min-height: calc(100dvh - 82px); border-right: 0; }
  .detail-panel { min-height: 100dvh; }
  .detail-header { flex-direction: column; }
  .metadata { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
