:root {
  --bg: #0f1419;
  --panel: #1a212b;
  --panel-2: #222b37;
  --border: #2c3744;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #4493f8;
  --accent-dim: #1f6feb33;

  --st-introduced: #4493f8;
  --st-engrossed: #a371f7;
  --st-enrolled: #2dd4bf;
  --st-passed: #3fb950;
  --st-vetoed: #f85149;
  --st-failed: #6e7681;
  --st-na: #6e7681;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.topbar h1 { margin: 0; font-size: 20px; }
.subtitle { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.sync { color: var(--muted); font-size: 12px; text-align: right; }

.topbtn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
}
.topbtn:hover { border-color: var(--accent); }
.count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--st-vetoed);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

/* Panels reuse the detail aside */
.panel-title { margin: 0 0 12px; font-size: 16px; }
.alert-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.alert-item.unread { border-left: 3px solid var(--accent); }
.alert-item .a-top { display: flex; justify-content: space-between; gap: 8px; }
.alert-item .a-num { font-weight: 600; color: var(--accent); }
.alert-item .a-kind { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.alert-item .a-title { font-size: 13px; margin: 6px 0 4px; line-height: 1.35; }
.alert-item .a-action { font-size: 12px; color: var(--muted); }
.panel-actions { margin-bottom: 14px; }
.panel-actions button, .watch-form button {
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 7px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
}
.watch-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.watch-form select, .watch-form input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 13px;
}
.watch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.watch-row .w-kind {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
}
.watch-row .w-del {
  background: none;
  border: none;
  color: var(--st-vetoed);
  cursor: pointer;
  font-size: 14px;
}

/* Meetings */
.meeting-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.meeting-item .m-when { color: var(--accent); font-weight: 600; font-size: 13px; }
.meeting-item .m-subject { margin: 4px 0; line-height: 1.35; }
.meeting-item .m-meta { color: var(--muted); font-size: 12px; }
.meeting-item .m-bills { margin-top: 6px; font-size: 12px; }
.meeting-item .m-bills .badge { background: var(--st-introduced); margin-right: 4px; }
.meeting-item a.legiscan { font-size: 12px; margin: 6px 0 0; }
.chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.chip.meeting { background: var(--st-enrolled); color: #0f1419; border: none; }

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 24px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 110px;
}
.card .num { font-size: 22px; font-weight: 700; }
.card .label { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card.total .num { color: var(--accent); }

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px 16px;
}
#search {
  flex: 1;
  max-width: 480px;
  padding: 9px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
#search:focus, #status-filter:focus { outline: none; border-color: var(--accent); }
#status-filter {
  padding: 9px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.result-count { color: var(--muted); font-size: 13px; }

.layout { display: flex; gap: 16px; padding: 0 24px 24px; align-items: flex-start; }
.table-wrap { flex: 1; min-width: 0; }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--accent-dim); }
tbody tr.active { background: var(--accent-dim); }
td.title { max-width: 460px; }
td.num { white-space: nowrap; font-weight: 600; color: var(--accent); }
td.date { white-space: nowrap; color: var(--muted); }
td.action { color: var(--muted); }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: #0f1419;
}
.badge.Introduced { background: var(--st-introduced); }
.badge.Engrossed  { background: var(--st-engrossed); }
.badge.Enrolled   { background: var(--st-enrolled); }
.badge.Passed     { background: var(--st-passed); }
.badge.Vetoed     { background: var(--st-vetoed); }
.badge.Failed     { background: var(--st-failed); color: var(--text); }
.badge.NA, .badge.Unknown { background: var(--st-na); color: var(--text); }

.pager {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 4px;
  color: var(--muted);
}
.pager button {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 12px;
  cursor: pointer;
}
.pager button:disabled { opacity: 0.4; cursor: default; }

.detail {
  width: 380px;
  flex-shrink: 0;
  position: sticky;
  top: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}
.detail .close {
  float: right;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}
.detail h2 { margin: 0 0 4px; font-size: 16px; color: var(--accent); }
.detail .d-title { color: var(--text); margin: 0 0 14px; line-height: 1.4; }
.detail a.legiscan {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}
.detail a.legiscan:hover { text-decoration: underline; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 16px 18px;
  border-left: 2px solid var(--border);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline .t-status { font-weight: 600; }
.timeline .t-action { color: var(--muted); font-size: 13px; margin-top: 2px; }
.timeline .t-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

.empty { padding: 40px; text-align: center; color: var(--muted); }
