@layer reset, base, layout, components, responsive;
@layer reset {
  * { box-sizing: border-box; }
  body, h1, h2, h3, p { margin: 0; }
  button, input, select { font: inherit; }
  [hidden] { display: none !important; }
}
@layer base {
  :root { color-scheme: light; --ink: #182c2b; --muted: #586b67; --line: #dce4df; --paper: #f3f5f1; --surface: #fff; --accent: #235f4e; --soft: #edf4ee; --warn: #855b12; --error: #a52d30; }
  body { background: var(--paper); color: var(--ink); font: 14px/1.5 system-ui, sans-serif; }
  button, a, summary, input, select { -webkit-tap-highlight-color: transparent; }
  :where(button, a, summary, input, select, [tabindex]):focus-visible { outline: 3px solid #548b79; outline-offset: 3px; }
  button { min-height: 40px; padding: 8px 15px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: white; font-weight: 600; cursor: pointer; white-space: nowrap; }
  button:hover:not(:disabled) { filter: brightness(1.09); }
  button:disabled { opacity: .45; cursor: default; }
  input, select { min-height: 40px; padding: 8px 10px; border: 1px solid #abbdb2; border-radius: 6px; background: var(--surface); color: var(--ink); min-width: 0; width: 100%; }
  label { display: grid; gap: 5px; font-size: 12px; font-weight: 600; }
  h1, h2 { font-size: 23px; line-height: 1.25; letter-spacing: -.6px; font-weight: 600; }
  h3 { font-size: 14px; font-weight: 650; }
  code, pre, .numeric { font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; }
  code { overflow-wrap: anywhere; }
  .muted { color: var(--muted); }
  .eyebrow, .tag { font-size: 10px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; }
  .eyebrow { color: var(--accent); margin-bottom: 5px; }
  .secondary { background: var(--surface); color: var(--accent); border-color: #bacbc0; }
  .text-button { background: transparent; color: var(--accent); border-color: transparent; padding: 6px 8px; font-size: 12px; }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .skip-link { position: fixed; top: -100px; left: 15px; z-index: 20; padding: 10px; background: white; color: var(--accent); }
  .skip-link:focus { top: 8px; }
}
@layer layout {
  .app-header { height: 62px; display: flex; align-items: center; gap: 28px; padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--surface); }
  .brand { color: var(--ink); text-decoration: none; font-size: 23px; letter-spacing: -1px; font-weight: 700; white-space: nowrap; }
  .brand span { font-size: 9px; letter-spacing: 2px; margin-left: 12px; font-weight: 500; }
  .deployment { display: flex; align-items: center; gap: 12px; min-width: 0; }
  #deployment { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tag { color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 3px 7px; white-space: nowrap; }
  .connection { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
  .connection::before { content: ''; display: inline-block; width: 7px; height: 7px; background: currentColor; border-radius: 50%; margin-right: 7px; }
  .toolbar { display: flex; gap: 18px; align-items: end; padding: 14px 28px; border-bottom: 1px solid var(--line); }
  .tenant-control { width: clamp(230px, 27vw, 430px); }
  #lookup { display: flex; align-items: end; gap: 8px; }
  #lookup label { width: 175px; }
  .workspace { display: grid; grid-template-columns: minmax(380px, .88fr) minmax(0, 1.12fr); gap: 18px; max-width: 1800px; margin: auto; padding: 20px 28px; height: calc(100dvh - 161px); min-height: 480px; }
  .pane { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
  .browse { display: flex; flex-direction: column; }
  .detail { overflow-y: auto; scrollbar-gutter: stable; overscroll-behavior: contain; container-type: inline-size; }
  .pane-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 20px 10px; }
  #head { font-size: 11px; font-variant-numeric: tabular-nums; }
  .browse-note { font-size: 11px; padding: 0 20px; }
  .browse-feedback { min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 8px 20px; font-size: 12px; }
  .table-scroll { flex: 1; overflow: auto; min-height: 140px; scrollbar-gutter: stable; overscroll-behavior: contain; }
  .paging { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding: 12px 16px; font-size: 11px; }
  .paging button { padding-inline: 12px; }
  .detail-header { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); padding: 14px 22px; }
  .event-context { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11px; }
  #event-tenant { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .result-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
  .event-nav { display: flex; gap: 6px; }
  .event-nav button { width: 40px; padding: 0; }
  #event-summary { font-size: 12px; margin-top: 9px; }
  .event-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
  .event-actions button { font-size: 12px; }
  .detail-body { padding: 18px 22px 26px; }
  .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
  .columns { display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 18px; }
}
@layer components {
  table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; font-size: 12px; }
  th { position: sticky; top: 0; z-index: 1; background: #f6f8f4; color: var(--muted); font-weight: 500; font-size: 11px; white-space: nowrap; }
  th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
  td:first-child { border-left: 3px solid transparent; }
  tbody tr:hover { background: #f6f8f4; }
  tr[data-selected=true] { background: var(--soft); }
  tr[data-selected=true] td:first-child { border-left-color: var(--accent); }
  td a { display: inline-block; color: var(--accent); font-weight: 650; text-decoration: none; padding-block: 3px; min-width: 50px; }
  td a:hover { text-decoration: underline; }
  .row-type, .row-meta, .row-time { display: block; }
  .row-type { margin-top: 2px; font-size: 12px; }
  .row-meta { color: var(--muted); font-size: 10px; margin-top: 3px; }
  .row-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
  .empty-detail { display: grid; align-content: center; justify-items: center; text-align: center; min-height: 100%; padding: 36px; gap: 14px; }
  .empty-detail p { max-width: 320px; }
  .empty-symbol { font-size: 30px; color: var(--accent); background: var(--soft); border-radius: 50%; width: 64px; height: 64px; padding: 7px; }
  .empty-note { padding: 30px 20px; color: var(--muted); }
  .progress-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; min-height: 32px; font-size: 12px; }
  #elapsed { font-variant-numeric: tabular-nums; white-space: nowrap; margin-left: auto; }
  .notice { font-size: 12px; padding: 10px 12px; border-left: 3px solid #b38632; background: #fff9e9; margin-bottom: 14px; }
  .trail { display: grid; gap: 7px; }
  details > summary { cursor: pointer; }
  .check-card { border: 1px solid var(--line); border-radius: 6px; }
  .check-card summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; list-style: none; }
  .check-card summary::-webkit-details-marker { display: none; }
  .check-label { font-size: 12px; }
  .check-label::before { content: '›'; display: inline-block; width: 16px; color: var(--muted); }
  .check-card[open] .check-label::before { content: '⌄'; }
  .check-card p { color: var(--muted); font-size: 12px; padding: 0 12px 12px 28px; overflow-wrap: anywhere; }
  .badge { padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 650; background: #eef1ed; color: var(--muted); white-space: nowrap; }
  [data-state=verified], [data-state=finalized], [data-state=connected] { color: #235f4e; }
  .badge[data-state=verified], .badge[data-state=finalized] { background: #e7f3e9; }
  [data-state=failed], [data-state=unavailable] { color: var(--error); }
  .badge[data-state=failed], .badge[data-state=unavailable] { background: #faeded; }
  [data-state=pending], [data-state=included], [data-state=stale] { color: var(--warn); }
  .badge[data-state=pending], .badge[data-state=included], .badge[data-state=stale] { background: #faf2dc; }
  #freshness, #cache-status { font-size: 11px; margin-top: 8px; }
  #cache-status:empty { display: none; }
  .payload-section { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 16px; }
  #payload-note { font-size: 11px; margin-bottom: 10px; }
  pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #f3f6f0; padding: 14px; border: 1px solid #e4ebe0; border-radius: 6px; font-size: 12px; line-height: 1.7; max-height: 340px; overflow: auto; tab-size: 2; }
  .payload-section details { margin-top: 12px; font-size: 12px; }
  .payload-section details pre { margin-top: 10px; }
  .technical { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
  .technical summary { font-size: 13px; font-weight: 600; min-height: 30px; }
  .technical p { font-size: 12px; margin-block: 10px; }
  dl { display: grid; grid-template-columns: minmax(95px, .65fr) minmax(0, 1fr); gap: 10px 14px; margin: 12px 0 0; font-size: 12px; }
  dt { color: var(--muted); }
  .copy-field { display: block; min-height: 28px; padding: 2px 4px; margin-top: 4px; }
  dd { margin: 0; overflow-wrap: anywhere; font-family: ui-monospace, monospace; }
  .business-fields:empty { display: none; }
  .business-fields { margin-bottom: 14px; }
  .report-time { margin-top: 24px; font-size: 11px; }
  .trust-menu { position: relative; margin-left: auto; font-size: 12px; }
  .trust-menu summary { padding: 10px 4px; white-space: nowrap; }
  .trust-menu > div { position: absolute; right: 0; top: 44px; z-index: 10; width: min(360px, 85vw); padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 12px 40px #182c2b18; }
  .trust-menu p { margin-block: 10px; }
  [popover] { max-width: min(460px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); box-shadow: 0 15px 80px #182c2b33; }
  [popover] p { margin-block: 16px; }
  .toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 20; background: var(--ink); color: white; border-radius: 7px; padding: 10px 18px; max-width: 90vw; font-size: 12px; }
  .toast:empty { display: none; }
}
@layer responsive {
  @container (min-width: 700px) { .columns { grid-template-columns: 1fr 1fr; } }
  @container (max-width: 450px) { .detail-header { padding-inline: 16px; } .detail-body { padding-inline: 16px; } .event-actions { gap: 4px; } .event-actions button { padding-inline: 10px; } }
  @media (max-width: 1100px) {
    .workspace { grid-template-columns: 1fr; height: calc(100dvh - 161px); }
    .workspace[data-detail=false] .detail { display: none; }
    .workspace[data-detail=true] .browse { display: none; }
    .toolbar { gap: 10px; } .trust-menu { display: none; }
    .tenant-control { flex: 1; min-width: 180px; }
  }
  @media (max-width: 650px) {
    .app-header { padding-inline: 16px; height: 56px; gap: 14px; flex-wrap: wrap; }
    .brand span, .tag { display: none; } .brand { font-size: 21px; }
    .deployment { max-width: 40%; font-size: 12px; }
    .connection { font-size: 10px; }
    .toolbar { padding: 12px 16px; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
    .tenant-control { width: 100%; min-width: 0; }
    #lookup { grid-column: 1 / -1; grid-row: 2; } #lookup label { flex: 1; width: auto; }
    #refresh { font-size: 12px; padding-inline: 12px; }
    .workspace { padding: 12px; height: calc(100dvh - 222px); min-height: 380px; }
    .pane-heading { padding: 16px 14px 8px; }
    .browse-note, .browse-feedback { padding-inline: 14px; }
    th, td { padding-inline: 9px; } th:last-child, td:last-child { display: none; }
    .paging { padding: 10px; } .paging button { min-height: 44px; }
    .empty-detail { padding: 24px; }
  }
  @media (prefers-reduced-motion: no-preference) {
    .badge { transition: background-color .15s ease, color .15s ease; }
    [popover]:popover-open { animation: reveal .15s ease-out; }
    @keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
    ::view-transition-group(root) { animation-duration: .12s; }
  }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
}
