/* Capitol Ledger Modern Stylesheet */
:root {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #273549;
  --border-color: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-emerald: #10b981;
  --accent-blue: #38bdf8;
  --accent-indigo: #818cf8;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Content visibility containment for 60fps scrolling */
.data-container {
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}

@supports not (content-visibility: auto) {
  .data-container {
    contain: layout style paint;
  }
}

/* Responsive Table with Container Queries */
.table-wrapper {
  overflow-x: auto;
  max-inline-size: 100%;
  max-block-size: 75vh;
  container-type: inline-size;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 10;
  background-color: #0b1120;
  border-bottom: 2px solid var(--border-color);
}

thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid rgba(51, 65, 85, 0.6);
  transition: background-color 0.15s ease-in-out;
  cursor: pointer;
}

tbody tr:hover {
  background-color: var(--bg-card-hover);
}

tbody td {
  padding: 0.875rem 1rem;
  color: var(--text-primary);
  vertical-align: middle;
}

tbody td.numeric {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Stacked Mobile Table Layout */
@container (width < 640px) {
  table, thead, tbody, tr, th, td {
    display: block;
  }

  thead {
    display: none;
  }

  tbody tr {
    margin: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-card);
  }

  tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  tbody td:last-child {
    border-bottom: none;
  }

  tbody td::before {
    content: attr(data-label);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-right: 1rem;
  }
}

/* Drawer / Dialog Modal */
dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 100vw;
  max-height: 100vh;
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  color: var(--text-primary);
  width: min(650px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #090d16;
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}
