/* PumasokBa styles — PH flag accents, data-journalism neutral base, light mode default. */
:root {
  --blue: #0038A8;   /* PH flag blue — Top-6 accent */
  --red: #CE1126;    /* PH flag red — Bottom-6 accent */
  --yellow: #FCD116; /* PH flag yellow — tertiary / Passing */
  --green: #16A34A;  /* accessible green — Excellent */

  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #5f6368;
  --border: #e3e3e0;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --radius: 14px;

  --grade-excellent: var(--green);
  --grade-passing: #B7950B;   /* darkened yellow for text contrast */
  --grade-failing: var(--red);
}
[data-theme="dark"] {
  --bg: #15171a;
  --surface: #1f2226;
  --text: #ececec;
  --muted: #9aa0a6;
  --border: #2c3036;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --grade-passing: #FCD116;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--blue); }
[data-theme="dark"] a { color: #6ea8fe; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px 64px; }
.intro { color: var(--muted); font-size: .95rem; margin: 22px 0 -2px; }

/* Header */
header.site {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.header-inner { max-width: 880px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; flex-direction: column; }
.brand a { text-decoration: none; color: inherit; width: fit-content; }
.brand a:hover b { color: var(--blue); }
[data-theme="dark"] .brand a:hover b { color: #6ea8fe; }
.brand b { font-size: 1.15rem; letter-spacing: -.01em; }
.brand span { font-size: .8rem; color: var(--muted); }
.spacer { flex: 1; }
.toggle {
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 999px; padding: 7px 12px; cursor: pointer; font-size: .85rem;
}
.toggle:hover { border-color: var(--muted); }

/* Tabs */
nav.tabs { display: flex; gap: 4px; max-width: 880px; margin: 0 auto; padding: 0 16px; }
.tab {
  appearance: none; border: 0; background: none; color: var(--muted);
  padding: 12px 14px; font-size: .95rem; font-weight: 600; cursor: pointer;
  border-bottom: 3px solid transparent;
}
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--blue); }
.tab:disabled { cursor: default; opacity: .55; }
.tab .soon { font-size: .65rem; background: var(--border); color: var(--muted);
  border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: middle; }

/* Headline grade card */
.headline {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 24px; margin: 22px 0 16px; text-align: center;
}
.headline .pct { font-size: 3.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.headline .grade {
  display: inline-block; margin-top: 10px; padding: 6px 16px; border-radius: 999px;
  font-weight: 700; font-size: 1rem; color: #fff;
}
.grade-excellent { background: var(--grade-excellent); }
.grade-passing  { background: var(--grade-passing); color: #1a1a1a; }
.grade-failing  { background: var(--grade-failing); }
.headline .sub { color: var(--muted); margin-top: 12px; font-size: .92rem; }
.headline .asof { color: var(--muted); margin-top: 6px; font-size: .8rem; letter-spacing: .02em; text-transform: uppercase; opacity: .8; }

/* Grade legend */
.legend { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin: 4px 0 26px; font-size: .82rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.excellent { background: var(--grade-excellent); }
.dot.passing { background: var(--grade-passing); }
.dot.failing { background: var(--grade-failing); }

/* Two columns */
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .columns { grid-template-columns: 1fr; } }
.col h2 { font-size: .95rem; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.col h2 .bar { width: 4px; height: 18px; border-radius: 2px; }
.col.top h2 .bar { background: var(--blue); }
.col.bottom h2 .bar { background: var(--red); }
.col h2 small { color: var(--muted); font-weight: 500; }

/* Senator card */
/* top bar (freshness + share) shown on each tab */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 20px 0 0; flex-wrap: wrap; }
.topbar .freshness { margin: 0; }

.card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-left-width: 4px;
  border-radius: 12px; padding: 11px 13px; margin-bottom: 9px; box-shadow: var(--shadow);
  text-decoration: none; color: inherit;
}
.card:hover { border-color: var(--muted); }
a.allrow { text-decoration: none; color: inherit; }
a.allrow:hover { background: var(--bg); }
.col.top .card { border-left-color: var(--blue); }
.col.bottom .card { border-left-color: var(--red); }
.avatar {
  position: relative; width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  overflow: hidden; background: linear-gradient(135deg, #6b7280, #4b5563);
}
.avatar .ini {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 700; font-size: .9rem; color: #fff;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.avatar.sm { width: 28px; height: 28px; }
.avatar.sm .ini { font-size: .68rem; }
.card .meta { flex: 1; min-width: 0; }
.card .nm { font-weight: 650; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .role { font-size: .72rem; color: var(--muted); }
.card .fig { text-align: right; flex: 0 0 auto; }
.card .fig .p { font-weight: 800; font-size: 1.05rem; }
.card .fig .ratio { font-size: .72rem; color: var(--muted); }
.gchip { font-size: .64rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; color: #fff; }

/* See all */
details.seeall { margin-top: 18px; }
details.seeall > summary {
  cursor: pointer; font-weight: 650; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; list-style: none;
}
details.seeall > summary::-webkit-details-marker { display: none; }
details.seeall > summary::after { content: " ▾"; color: var(--muted); }
details.seeall[open] > summary::after { content: " ▴"; }
.allrows { margin-top: 10px; }
.allrow { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--border); }
.allrow .rank { width: 26px; color: var(--muted); font-size: .8rem; text-align: right; }
.allrow .nm { flex: 1; font-size: .92rem; }
.allrow .p { font-weight: 700; width: 56px; text-align: right; }

/* Sources */
.sources { margin-top: 30px; }
.sources h2 { font-size: .95rem; }
.sources p { color: var(--muted); font-size: .85rem; }
.sources ul { list-style: none; padding: 0; margin: 10px 0 0; }
.sources li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .9rem; display: flex; gap: 10px; flex-wrap: wrap; }
.sources li b { min-width: 92px; }

/* Note / caveat banner */
.note { background: color-mix(in srgb, var(--yellow) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--yellow) 45%, var(--border));
  color: var(--text); border-radius: 12px; padding: 11px 14px; font-size: .85rem; margin: 16px 0; }
[data-theme="dark"] .note { background: #2c2a18; }

/* Bills headline tweak (number-only) */
#panel-bills .headline .pct { font-size: 3.2rem; }

/* ---- Laws kanban ---- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
@media (max-width: 760px) {
  .kanban { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 78%;
    overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
  .kcol { scroll-snap-align: start; }
}
.kcol { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.khead { padding: 6px 6px 10px; border-bottom: 2px solid var(--border); margin-bottom: 8px; position: relative; }
.khead b { font-size: .9rem; }
.kdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted); vertical-align: middle; }
.kcount { float: right; font-size: .8rem; font-weight: 700; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; }
.kblurb { font-size: .72rem; color: var(--muted); margin-top: 4px; }
.stage-1 .kdot { background: var(--yellow); } .stage-1 .khead { border-bottom-color: var(--yellow); }
.stage-2 .kdot { background: var(--blue); }   .stage-2 .khead { border-bottom-color: var(--blue); }
.stage-3 .kdot { background: #6d28d9; }        .stage-3 .khead { border-bottom-color: #6d28d9; }
.stage-4 .kdot { background: var(--green); }   .stage-4 .khead { border-bottom-color: var(--green); }
.kbody { display: flex; flex-direction: column; gap: 8px; }
.kcard { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 11px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.kcard:hover { border-color: var(--muted); }
.kno { font-size: .72rem; font-weight: 700; color: var(--blue); }
[data-theme="dark"] .kno { color: #6ea8fe; }
.ktitle { font-size: .85rem; font-weight: 600; margin: 2px 0; line-height: 1.3; }
.kauthor { font-size: .74rem; color: var(--muted); }
.kempty { color: var(--muted); font-size: .82rem; text-align: center; padding: 16px 0; }

/* ---- Bill detail ---- */
.billdetail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px; margin: 22px 0; }
.billno { font-weight: 800; color: var(--blue); font-size: 1rem; }
[data-theme="dark"] .billno { color: #6ea8fe; }
.billdetail h1 { font-size: 1.5rem; margin: 8px 0 18px; line-height: 1.25; }
.billmeta { display: grid; gap: 8px; margin-bottom: 22px; }
.billmeta .k { display: inline-block; min-width: 80px; color: var(--muted); font-size: .8rem;
  text-transform: uppercase; letter-spacing: .03em; }
.authorlist { display: grid; gap: 9px; max-width: 360px; }
.source-link { margin-top: 22px; }
.stage-chip { color: #fff; vertical-align: middle; margin-left: 8px; }
.stage-chip.stage-1 { background: var(--grade-passing); color: #1a1a1a; }
.stage-chip.stage-2 { background: var(--blue); }
.stage-chip.stage-3 { background: #6d28d9; }
.stage-chip.stage-4 { background: var(--green); }

/* ---- Senators directory grid ---- */
.sgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
@media (max-width: 720px) { .sgrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .sgrid { grid-template-columns: 1fr; } }
.stile { display: flex; align-items: center; gap: 11px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 12px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.stile:hover { border-color: var(--muted); }
.stile .meta { flex: 1; min-width: 0; }
.stile .nm { font-weight: 650; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stile .stile-grade { flex: 0 0 auto; }

/* ---- Senator report card ---- */
.senhead { display: flex; align-items: center; gap: 16px; margin: 22px 0 18px; }
.avatar.lg { width: 80px; height: 80px; }
.avatar.lg .ini { font-size: 1.6rem; }
.senhead h1 { font-size: 1.55rem; margin: 0; }
.senrole { color: var(--muted); font-size: .9rem; margin-top: 2px; }

.reportcard, .contactcard { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 16px; }
.rchead { font-weight: 800; font-size: 1.05rem; margin-bottom: 6px; }
.rchead small { font-weight: 500; color: var(--muted); font-size: .8rem; }
details.rcrow { border-bottom: 1px solid var(--border); }
details.rcrow:last-child { border-bottom: 0; }
details.rcrow > summary { cursor: pointer; list-style: none; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; padding: 15px 0; }
details.rcrow > summary::-webkit-details-marker { display: none; }
details.rcrow > summary::after { content: "▾"; color: var(--muted); font-size: .8rem; }
details.rcrow[open] > summary::after { content: "▴"; }
.rcsub { font-weight: 650; font-size: .95rem; }
.rcval { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.rcnum { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }

/* freshness line + share button */
.freshness { color: var(--muted); font-size: .82rem; margin: 0 0 18px; }
.freshness b { color: var(--text); }
.sharebtn { border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 7px 13px; cursor: pointer; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.sharebtn:hover { border-color: var(--muted); }
.share-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 999px; font-size: .85rem; z-index: 50; box-shadow: var(--shadow); }

/* attendance calendar */
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0; font-size: .8rem; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.cal-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-top: 6px; }
.cal-month { }
.cal-mname { font-weight: 650; font-size: .85rem; margin-bottom: 6px; }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow span { text-align: center; font-size: .62rem; color: var(--muted); }
.cal-cell { aspect-ratio: 1; display: grid; place-items: center; font-size: .66rem; border-radius: 4px;
  background: var(--border); color: var(--muted); }
.cal-blank { background: transparent; }
.cal-none { background: #cfd2d6; color: #8a8f96; }
[data-theme="dark"] .cal-none { background: #34383e; color: #777c84; }
.cal-present, .cal-dot.cal-present { background: var(--green); color: #fff; }
.cal-absent, .cal-dot.cal-absent { background: var(--red); color: #fff; }
.cal-excused, .cal-dot.cal-excused { background: var(--yellow); color: #1a1a1a; }
.cal-dot.cal-none { background: #cfd2d6; }

/* bill list inside the report card */
.billlist { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.billrow { display: flex; gap: 10px; align-items: baseline; padding: 8px 11px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 9px; text-decoration: none; color: inherit; }
.billrow:hover { border-color: var(--muted); }
.billrow .bno { font-weight: 700; font-size: .74rem; color: var(--blue); flex: 0 0 auto; }
[data-theme="dark"] .billrow .bno { color: #6ea8fe; }
.billrow .btitle { font-size: .86rem; }
.grade-text-excellent { color: var(--grade-excellent); }
.grade-text-passing { color: var(--grade-passing); }
.grade-text-failing { color: var(--grade-failing); }
.rcnote { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.rankbadge { font-size: .78rem; font-weight: 700; background: color-mix(in srgb, var(--yellow) 22%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--yellow) 55%, var(--border)); color: var(--text);
  border-radius: 999px; padding: 3px 10px; }
[data-theme="dark"] .rankbadge { background: #322f18; }

/* ---- Contact block ---- */
.cwrow { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.cwrow:last-of-type { border-bottom: 0; }
.ck { flex: 0 0 92px; color: var(--muted); text-transform: uppercase; font-size: .72rem; letter-spacing: .03em; padding-top: 2px; }
.cv { flex: 1; min-width: 0; word-break: break-word; }

footer.site { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 40px; }
.skeleton { color: var(--muted); text-align: center; padding: 40px; }
.errbox { background: #fde8e8; color: #8a1c1c; border-radius: 12px; padding: 16px; margin: 20px 0; }
[data-theme="dark"] .errbox { background: #3a1c1c; color: #f4b4b4; }
