@font-face {
  font-family: "Sao Chingcha";
  src: url("assets/fonts/SaoChingcha-Regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Sao Chingcha";
  src: url("assets/fonts/SaoChingcha-Bold.otf") format("opentype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --emerald: #00744b;
  --emerald-dark: #004b36;
  --emerald-deep: #003d2f;
  --emerald-soft: #dceee6;
  --yellow: #ffda55;
  --yellow-soft: #ffefb5;
  --yellow-pale: #fff8d9;
  --cream: #f4f1e7;
  --paper: #fffef8;
  --white: #ffffff;
  --ink: #17362c;
  --muted: #53665f;
  --line: rgba(23, 54, 44, 0.16);
  --line-strong: rgba(23, 54, 44, 0.28);
  --danger: #a33d2c;
  --header-height: 72px;
  --shadow-sm: 0 3px 0 rgba(0, 75, 54, 0.08);
  --shadow-lg: 0 22px 60px rgba(0, 61, 47, 0.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: "Sao Chingcha", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.45;
}
body.layer-open, body.filters-open { overflow: hidden; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; width: 1.25em; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--paper);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--emerald-deep);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 16px;
  color: white;
  background: var(--emerald-deep);
  border-radius: 8px;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  padding: 8px clamp(18px, 4vw, 64px);
  background: rgba(255, 254, 248, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand, .footer-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--emerald-dark); font-size: 1.25rem; font-weight: 700; }
.brand img, .footer-brand img { object-fit: contain; }
.primary-nav { display: flex; align-items: center; gap: 6px; }
.primary-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 10px; font-weight: 700; }
.primary-nav a:hover, .primary-nav a:focus-visible { color: white; background: var(--emerald); }

.catalog-hero { position: relative; overflow: hidden; color: white; background: var(--emerald); }
.hero-inner { position: relative; z-index: 1; width: min(1600px, 100%); min-height: 270px; margin: 0 auto; padding: 34px clamp(18px, 4vw, 64px) 44px; }
.breadcrumb { display: flex; align-items: center; gap: 7px; margin-bottom: 35px; color: rgba(255, 255, 255, 0.9); font-size: 0.92rem; }
.breadcrumb a:hover { color: var(--yellow); text-decoration: underline; }
.breadcrumb svg { width: 16px; }
.eyebrow, .results-kicker { margin: 0 0 5px; font-size: 0.88rem; font-weight: 700; }
.eyebrow { color: var(--yellow-soft); }
.catalog-hero h1 { max-width: 900px; margin: 0; font-size: clamp(2rem, 4.5vw, 4rem); line-height: 1.05; text-wrap: balance; }

.catalog-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 26px; width: min(1600px, 100%); margin: 0 auto; padding: 32px clamp(18px, 4vw, 64px) 90px; }
.filter-panel {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  align-self: start;
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
  padding: 20px;
  color: white;
  background: var(--emerald-dark);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  scrollbar-width: thin;
  scrollbar-color: var(--yellow) transparent;
}
.filter-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.14); }
.filter-panel h2 { margin: 0; font-size: 1.25rem; line-height: 1.2; }
.filter-close { display: none !important; }
.filter-section { margin: 0 0 16px; padding: 0; border: 0; }
.filter-section > label, .filter-section legend { display: block; margin-bottom: 6px; color: rgba(255, 255, 255, 0.78); font-size: 0.82rem; font-weight: 700; }
select, input[type="search"] {
  width: 100%;
  min-height: 46px;
  color: var(--ink);
  background: white;
  border: 1px solid transparent;
  border-radius: 9px;
}
select { overflow: hidden; padding: 8px 34px 8px 11px; text-overflow: ellipsis; white-space: nowrap; }
input[type="search"] { padding: 8px 10px 8px 39px; }
.search-input { position: relative; }
.search-input svg { position: absolute; top: 50%; left: 12px; z-index: 1; color: var(--emerald); pointer-events: none; transform: translateY(-50%); }
.type-filter { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.type-filter legend { grid-column: 1 / -1; margin-bottom: 0; }
.type-filter label { display: flex; align-items: center; gap: 7px; min-height: 38px; margin: 0; padding: 6px 8px; color: white; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 7px; font-size: 0.8rem; line-height: 1.25; cursor: pointer; }
.type-filter label:hover { background: rgba(255, 255, 255, 0.1); }
.type-filter label:has(input:checked) { color: var(--emerald-deep); background: var(--yellow-soft); border-color: var(--yellow); }
.type-filter input { flex: 0 0 auto; width: 16px; height: 16px; margin: 0; accent-color: var(--emerald); }
.clear-filters { width: 100%; min-height: 42px; color: white; background: transparent; border: 1px solid rgba(255, 255, 255, 0.34); border-radius: 9px; font-weight: 700; }
.clear-filters:hover { color: var(--emerald-dark); background: var(--yellow); border-color: var(--yellow); }

.results-panel { min-width: 0; }
.results-heading { display: flex; align-items: end; justify-content: space-between; gap: 22px; margin-bottom: 18px; }
.results-kicker { color: var(--emerald); }
.results-heading h2 { margin: 0; font-size: clamp(1.65rem, 2.6vw, 2.4rem); line-height: 1.15; }
.results-summary { margin: 7px 0 0; color: var(--muted); }
.page-size { flex: 0 0 auto; color: var(--muted); font-size: 0.9rem; font-weight: 700; }
.page-size select { display: block; width: auto; min-width: 130px; margin-top: 5px; border-color: var(--line); }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 5px 10px; color: var(--emerald-dark); background: var(--emerald-soft); border: 1px solid rgba(0, 116, 75, 0.16); border-radius: 8px; }
.filter-chip:hover { background: white; }
.filter-chip svg { width: 14px; }

.budget-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.budget-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 210px;
  overflow: hidden;
  color: var(--emerald-deep);
  background: var(--yellow);
  border: 1px solid rgba(0, 75, 54, 0.11);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.budget-card:nth-child(4n+2) { background: #ffe47d; }
.budget-card:nth-child(4n+3) { background: var(--yellow-soft); }
.budget-card:nth-child(4n) { background: #ffdf68; }
.budget-card:hover, .budget-card:focus-within { background: var(--paper); box-shadow: 0 14px 32px rgba(0, 61, 47, 0.13); transform: translateY(-4px); }
.card-detail { display: flex; flex: 1; flex-direction: column; width: 100%; padding: 17px 17px 12px; color: inherit; text-align: left; background: transparent; border: 0; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: rgba(0, 61, 47, 0.73); font-size: 0.78rem; font-weight: 700; }
.budget-type { display: inline-flex; align-items: center; min-height: 27px; padding: 3px 7px; background: rgba(255, 255, 255, 0.5); border-radius: 6px; }
.budget-card h3 { display: -webkit-box; margin: 17px 0 14px; overflow: hidden; font-size: 1.12rem; line-height: 1.22; text-wrap: pretty; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.budget-amount { margin: auto 0 0; font-size: 1.45rem; font-weight: 700; line-height: 1; white-space: nowrap; }
.budget-amount small { display: inline; margin-left: 5px; color: var(--muted); font-size: 0.72rem; font-weight: 400; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 47px; padding: 9px 12px 10px 17px; border-top: 1px solid rgba(0, 75, 54, 0.12); }
.group-label { min-width: 0; overflow: hidden; font-size: 0.78rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.bookmark-toggle { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; padding: 0; color: var(--emerald-dark); background: rgba(255, 255, 255, 0.58); border: 1px solid rgba(0, 75, 54, 0.18); border-radius: 8px; }
.bookmark-toggle.is-selected { color: white; background: var(--emerald); }

.skeleton-card { min-height: 210px; overflow: hidden; background: #e5e1d5; border-radius: 14px; }
.skeleton-card::after { display: block; width: 45%; height: 100%; content: ""; background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent); animation: shimmer 1.2s infinite; transform: skewX(-18deg); }
@keyframes shimmer { from { transform: translateX(-160%) skewX(-18deg); } to { transform: translateX(300%) skewX(-18deg); } }

.status-state { padding: 70px 24px; text-align: center; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; }
.status-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 13px; color: white; background: var(--emerald); border-radius: 50%; font-size: 1.5rem; font-weight: 700; }
.status-state h2 { margin: 0; }
.status-state p { margin: 8px 0 19px; color: var(--muted); }
.status-state button, .detail-source { min-height: 44px; padding: 8px 16px; color: white; background: var(--emerald-dark); border: 0; border-radius: 9px; font-weight: 700; }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 34px; }
.pagination button { min-width: 44px; min-height: 44px; padding: 7px 10px; color: var(--emerald-dark); background: white; border: 1px solid var(--line); border-radius: 8px; font-weight: 700; }
.pagination button:hover:not(:disabled), .pagination button[aria-current="page"] { color: white; background: var(--emerald); border-color: var(--emerald); }
.pagination button:disabled { cursor: not-allowed; opacity: 0.42; }
.pagination .page-word { padding-inline: 13px; }

.site-footer { padding: 42px 0; color: rgba(255, 255, 255, 0.76); background: var(--emerald-deep); }
.footer-inner { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(0, 1.45fr); align-items: start; width: min(calc(100% - 40px), 1180px); margin-inline: auto; gap: clamp(34px, 6vw, 84px); }
.footer-identity, .footer-content { min-width: 0; }
.footer-logos { display: flex; align-items: center; gap: 15px; }
.footer-logo-link { display: inline-flex; flex: 0 0 auto; border-radius: 8px; }
.footer-logo-link:focus-visible { outline: 3px solid var(--yellow); outline-offset: 4px; }
.footer-logo { width: auto; height: auto; object-fit: contain; }
.footer-logo-budget { width: clamp(92px, 9vw, 116px); }
.footer-logo-flashthink { width: clamp(74px, 7vw, 94px); }
.footer-logo-divider { width: 1px; height: 48px; flex: 0 0 auto; background: rgba(255, 255, 255, 0.28); }
.site-footer p { margin: 0; }
.footer-copyright { margin-top: 15px !important; color: rgba(255, 255, 255, 0.64); font-size: .8rem; }
.footer-content { max-width: 720px; margin-left: auto; text-align: right; }
.footer-disclaimer { color: rgba(255, 255, 255, 0.9); font-size: .9rem; line-height: 1.7; text-wrap: pretty; }
.footer-phrase { display: inline-block; }
.footer-contact { margin-top: 12px !important; font-size: .84rem; line-height: 1.6; }
.footer-contact a { color: var(--yellow); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }

.icon-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; color: currentColor; background: transparent; border: 1px solid currentColor; border-radius: 9px; }
.layer { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: flex-end; }
.layer-backdrop { position: absolute; inset: 0; width: 100%; padding: 0; background: rgba(0, 35, 25, 0.56); border: 0; backdrop-filter: blur(3px); }
.detail-drawer { position: relative; z-index: 1; width: min(540px, 100%); height: 100%; overflow-y: auto; padding: 24px; background: var(--paper); box-shadow: var(--shadow-lg); animation: drawer-in 220ms ease both; }
@keyframes drawer-in { from { opacity: 0; transform: translateX(40px); } }
.drawer-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.drawer-heading p { margin: 0; color: var(--emerald); font-size: 0.88rem; font-weight: 700; }
.drawer-heading h2 { margin: 2px 0 0; }
.detail-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 13px; color: var(--muted); }
.detail-code span:first-child { padding: 4px 8px; color: var(--emerald-dark); background: var(--emerald-soft); border-radius: 6px; font-weight: 700; }
.detail-drawer h2 { margin: 0; font-size: clamp(1.65rem, 4vw, 2.3rem); line-height: 1.15; }
.detail-amount { margin: 22px 0; padding: 18px; color: var(--emerald-deep); background: var(--yellow); border-radius: 12px; }
.detail-amount span { display: block; font-size: 0.85rem; }
.detail-amount strong { font-size: 2rem; line-height: 1.1; }
.detail-section { margin-top: 24px; }
.detail-section h3 { margin: 0 0 8px; font-size: 1rem; }
.detail-section p { margin: 0; color: var(--muted); }
.hierarchy-list, .raw-amount-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.hierarchy-list li { padding: 5px 8px; background: var(--emerald-soft); border-radius: 6px; font-size: 0.86rem; }
.raw-amount-list { display: grid; }
.raw-amount-list li { display: flex; justify-content: space-between; gap: 20px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.review-note { margin-top: 10px !important; padding: 10px 12px; color: #6d4314 !important; background: var(--yellow-pale); border-radius: 8px; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 28px; }
.detail-source { display: flex; align-items: center; justify-content: center; gap: 7px; }

.toast { position: fixed; right: 20px; bottom: 92px; z-index: 150; max-width: 360px; padding: 12px 16px; color: white; background: var(--emerald-deep); border-radius: 9px; box-shadow: var(--shadow-lg); }

.mobile-toolbar { position: sticky; top: var(--header-height); z-index: 30; display: none; padding: 10px 18px; background: var(--cream); border-bottom: 1px solid var(--line); }
.filter-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 46px; color: white; background: var(--emerald-dark); border: 0; border-radius: 9px; font-weight: 700; }
.filter-toggle span { display: grid; place-items: center; min-width: 23px; height: 23px; color: var(--emerald-dark); background: var(--yellow); border-radius: 50%; font-size: .75rem; }
.filter-backdrop { display: none; }

@media (max-width: 1180px) {
  .catalog-layout { grid-template-columns: 270px minmax(0, 1fr); }
  .budget-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .mobile-toolbar { display: block !important; }
  .catalog-layout { display: block; }
  .filter-panel { position: fixed; top: 0; bottom: 0; left: 0; z-index: 90; width: min(380px, calc(100% - 34px)); max-height: none; border-radius: 0 18px 18px 0; transform: translateX(-105%); transition: transform 220ms ease; }
  .filters-open .filter-panel { transform: translateX(0); }
  .filter-close { display: grid !important; }
  .filter-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(0,35,25,.54); }
  .filters-open .filter-backdrop { display: block !important; }
  .site-footer { padding-bottom: 100px; }
}

@media (max-width: 820px) {
  .budget-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  :root { --header-height: 66px; }
  body { font-size: 16px; }
  .site-header { padding-inline: 15px; }
  .brand img { width: 44px; height: 44px; }
  .primary-nav a[href="../"] { display: none; }
  .hero-inner { min-height: 230px; padding-top: 25px; }
  .breadcrumb { margin-bottom: 26px; }
  .catalog-layout { padding-top: 22px; }
  .results-heading { align-items: start; }
  .budget-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { grid-template-columns: 1fr; width: min(calc(100% - 28px), 1180px); gap: 28px; }
  .footer-content { max-width: none; margin-left: 0; text-align: left; }
}

@media (max-width: 540px) {
  .catalog-hero h1 { max-width: calc(100% - 20px); }
  .catalog-layout { padding-inline: 14px; }
  .results-heading { display: block; }
  .page-size { display: flex; align-items: center; justify-content: space-between; margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); }
  .page-size select { margin: 0; }
  .budget-grid { grid-template-columns: 1fr; }
  .budget-card, .skeleton-card { min-height: 190px; }
  .pagination .page-word { min-width: auto; font-size: 0; }
  .pagination .page-word[data-kind="first"]::after { content: "«"; font-size: 1rem; }
  .pagination .page-word[data-kind="prev"]::after { content: "‹"; font-size: 1rem; }
  .pagination .page-word[data-kind="next"]::after { content: "›"; font-size: 1rem; }
  .pagination .page-word[data-kind="last"]::after { content: "»"; font-size: 1rem; }
  .detail-drawer { padding: 18px; }
  .detail-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Budget evidence and review experience */
.hero-inner { min-height: 165px; padding-top: 26px; padding-bottom: 30px; }
.breadcrumb { margin-bottom: 20px; }
.catalog-hero h1 { font-size: clamp(2rem, 4vw, 3.45rem); }
.filter-help { margin: 7px 0 0; color: rgba(255, 255, 255, 0.72); font-size: 0.78rem; }

.results-tools { display: flex; align-items: flex-end; gap: 12px; }
.saved-items-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 7px 10px;
  color: var(--emerald-dark);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}
.saved-items-toggle svg { width: 19px; height: 19px; fill: none; stroke-width: 1.8; }
.saved-items-toggle strong { display: grid; place-items: center; min-width: 24px; height: 24px; padding-inline: 5px; color: white; background: var(--emerald); border-radius: 999px; font-size: 0.72rem; }
.saved-items-toggle:hover { background: var(--emerald-soft); border-color: var(--emerald); }
.saved-items-toggle.is-selected { color: white; background: var(--emerald-dark); border-color: var(--emerald-dark); }
.saved-items-toggle.is-selected svg { fill: currentColor; }
.saved-items-toggle.is-selected strong { color: var(--emerald-dark); background: var(--yellow); }
.view-toggle { display: inline-flex; gap: 2px; padding: 3px; background: rgba(0, 61, 47, 0.07); border: 1px solid var(--line); border-radius: 10px; }
.view-toggle button { position: relative; display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 7px; }
.view-toggle button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.view-toggle button[aria-pressed="true"] { color: white; background: var(--emerald); }
.view-button::after { position: absolute; bottom: calc(100% + 8px); left: 50%; z-index: 5; padding: 5px 8px; content: attr(data-tooltip); color: white; background: var(--emerald-deep); border-radius: 6px; font-size: 0.72rem; font-weight: 600; line-height: 1.2; white-space: nowrap; opacity: 0; pointer-events: none; transform: translate(-50%, 4px); transition: opacity 140ms ease, transform 140ms ease; }
.view-button:hover::after, .view-button:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }

.quality-banner { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 13px; margin: 0 0 18px; padding: 14px 16px; background: var(--yellow-pale); border: 1px solid rgba(157, 102, 18, 0.3); border-radius: 13px; }
.quality-banner .quality-mark { display: grid; place-items: center; width: 38px; height: 38px; color: white; background: #9d6612; border-radius: 50%; font-weight: 700; }
.quality-banner p { margin: 0; color: #62491f; font-size: 0.9rem; }
.quality-banner a { color: var(--emerald-deep); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.quality-banner a:hover { color: var(--emerald); }

.budget-grid { align-items: stretch; }
.budget-card, .shelf-card { --group-accent: #26745f; --group-accent-soft: #e9f3ef; --group-accent-ink: #1f5f50; }
.budget-card,
.budget-card:nth-child(4n+2),
.budget-card:nth-child(4n+3),
.budget-card:nth-child(4n) {
  min-height: 260px;
  color: var(--ink);
  background: var(--paper);
  border-color: rgba(0, 61, 47, 0.16);
}
.budget-card::before { position: absolute; inset: 0 0 auto; height: 5px; content: ""; background: var(--group-accent); }
.budget-card:hover, .budget-card:focus-within { color: var(--ink); background: var(--group-accent-soft); border-color: var(--group-accent); transform: translateY(-3px); }
.budget-card > .card-topline { flex: 0 0 auto; align-items: flex-start; padding: 13px 14px 0; color: var(--muted); }
.budget-code { color: var(--emerald-deep); font-size: 0.88rem; font-weight: 700; letter-spacing: 0.02em; }
.budget-card .card-detail { flex: 0 0 auto; padding: 8px 14px 9px; }
.budget-card .budget-type { align-self: flex-start; min-height: 24px; padding: 2px 9px; color: #31576a; background: #e8f1f5; border: 1px solid #c9dce5; border-radius: 999px; font-size: 0.7rem; font-weight: 700; line-height: 1.2; cursor: pointer; transition: color 140ms ease, background 140ms ease, border-color 140ms ease; }
.budget-card[data-budget-category="personnel"] .budget-type { color: #604576; background: #f1ebf6; border-color: #ddcfe8; }
.budget-card[data-budget-category="operations"] .budget-type { color: #31576a; background: #e8f1f5; border-color: #c9dce5; }
.budget-card[data-budget-category="investment"] .budget-type { color: #795413; background: #fbf0d9; border-color: #ead5a9; }
.budget-card[data-budget-category="subsidy"] .budget-type { color: #276052; background: #e5f1ed; border-color: #c6ded6; }
.budget-card[data-budget-category="other"] .budget-type { color: #754a45; background: #f6eae8; border-color: #e7cfcb; }
.budget-card .budget-type:hover, .budget-card .budget-type[aria-pressed="true"] { color: white; background: var(--emerald); border-color: var(--emerald); }
.budget-card .budget-type:focus-visible { outline: 3px solid rgba(0, 116, 75, 0.24); outline-offset: 2px; }
.budget-card h3 { margin: 6px 0 8px; padding-block: 0.18em 0.12em; color: var(--ink); line-height: 1.5; -webkit-line-clamp: 3; }
.allocation-target-summary { display: flex; gap: 5px; align-items: baseline; min-width: 0; margin: 0 0 8px; color: var(--emerald-dark); font-size: 0.72rem; line-height: 1.3; }
.allocation-target-summary span { flex: 0 0 auto; color: var(--muted); font-weight: 400; }
.allocation-target-summary strong { min-width: 0; overflow: hidden; font-size: inherit; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.allocation-target-summary small { flex: 0 0 auto; color: var(--emerald); font-size: 0.65rem; font-weight: 700; }
.budget-card .budget-amount { margin-top: 0; color: var(--emerald-deep); }
.budget-item-kind { margin: 7px 0 0; color: #7b817f; font-size: 0.68rem; font-weight: 400; line-height: 1.25; }
.card-group { display: -webkit-box; margin: 15px 0 0; padding-block: 0.12em; overflow: hidden; color: var(--muted); font-size: 0.8rem; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.card-group-kind { display: inline-block; margin-right: 5px; color: var(--emerald); font-weight: 700; }
.card-group-name { color: inherit; font-weight: 400; }
.card-group.card-group-top { max-width: 68%; margin: 0; color: var(--group-accent-ink); font-size: 0.72rem; line-height: 1.45; text-align: right; }
.card-group.card-group-top .card-group-kind { display: block; margin: 0; color: var(--group-accent); }
.card-group.card-group-top .card-group-name { display: block; }
.status-pill { display: inline-flex; align-items: center; min-height: 27px; padding: 3px 8px; color: #31564a; background: #e6eee9; border: 1px solid rgba(23, 54, 44, 0.13); border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.status-pill.status-matched, .status-pill.context-complete { color: #005c3d; background: #def1e8; border-color: rgba(0, 92, 61, 0.2); }
.status-pill.status-review, .status-pill.context-partial, .status-pill.context-review { color: #744509; background: #fff0c7; border-color: rgba(116, 69, 9, 0.2); }
.status-pill.status-unresolved, .status-pill.context-unavailable { color: #783024; background: #f9e4df; border-color: rgba(120, 48, 36, 0.2); }
.reviewed-pill { color: #273f77; background: #e8edfb; border-color: rgba(39, 63, 119, 0.2); }
.budget-card .card-footer { gap: 7px; margin-top: auto; padding: 8px 10px; background: #faf9f3; }
.open-detail-button, .budget-card .bookmark-toggle { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; height: auto; border-radius: 8px; font-weight: 700; }
.open-detail-button { color: white; background: var(--emerald-dark); border: 1px solid var(--emerald-dark); }
.open-detail-button { flex: 1 1 auto; padding: 7px 12px; font-size: 0.82rem; }
.budget-card .bookmark-toggle { position: relative; flex: 0 0 44px; width: 44px; padding: 0; color: var(--emerald-dark); background: white; border-color: rgba(0, 61, 47, 0.38); }
.budget-card .bookmark-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.budget-card .bookmark-toggle.is-selected { color: white; background: var(--emerald); border-color: var(--emerald); }
.budget-card .bookmark-toggle.is-selected svg { fill: currentColor; }
.budget-card .bookmark-toggle::after,
.shelf-bookmark::after {
  position: absolute;
  right: 0;
  bottom: calc(100% + 7px);
  z-index: 6;
  padding: 5px 8px;
  content: attr(data-tooltip);
  color: white;
  background: var(--emerald-deep);
  border-radius: 6px;
  font-size: 0.7rem;
  line-height: 1.2;
  white-space: nowrap;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}
.budget-card .bookmark-toggle:hover::after,
.budget-card .bookmark-toggle:focus-visible::after,
.shelf-bookmark:hover::after,
.shelf-bookmark:focus-visible::after { visibility: visible; opacity: 1; transform: translateY(0); }

.budget-grid.view-shelves { display: block; }
.budget-grid.view-tables { display: block; }
.document-table-card { margin-bottom: 16px; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 4px 0 rgba(0, 61, 47, 0.07); }
.budget-shelf + .budget-shelf { margin-top: 30px; }
.shelf-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.shelf-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.shelf-title h3 { margin: 0; padding-block: 0.12em; overflow: hidden; color: var(--emerald-deep); font-size: 1.12rem; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.shelf-title span { flex: 0 0 auto; color: var(--muted); font-size: 0.76rem; font-weight: 700; white-space: nowrap; }
.shelf-heading > button { flex: 0 0 auto; min-height: 36px; padding: 5px 10px; color: var(--emerald-dark); background: transparent; border: 1px solid rgba(0, 61, 47, 0.28); border-radius: 8px; font-size: 0.76rem; font-weight: 700; }
.shelf-heading > button:hover, .shelf-heading > button:focus-visible { color: white; background: var(--emerald-dark); border-color: var(--emerald-dark); }
.shelf-track { display: grid; grid-auto-columns: minmax(220px, 260px); grid-auto-flow: column; gap: 10px; overflow-x: auto; overscroll-behavior-inline: contain; padding: 2px 2px 12px; scroll-snap-type: inline proximity; scrollbar-color: var(--emerald) rgba(0, 61, 47, 0.08); scrollbar-width: thin; }
.shelf-card { position: relative; min-height: 160px; overflow: hidden; background: var(--paper); border: 1px solid rgba(0, 61, 47, 0.18); border-radius: 12px; box-shadow: 0 5px 13px rgba(0, 61, 47, 0.08); scroll-snap-align: start; transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
.shelf-card::before { position: absolute; inset: 0 0 auto; z-index: 2; height: 4px; content: ""; background: var(--group-accent); }
.shelf-card:hover, .shelf-card:focus-within { border-color: var(--group-accent); box-shadow: 0 10px 22px rgba(0, 61, 47, 0.14); transform: translateY(-2px); }
.shelf-card-main { display: flex; align-items: flex-start; flex-direction: column; width: 100%; min-height: 160px; padding: 14px 42px 13px 14px; color: var(--ink); background: transparent; border: 0; text-align: left; }
.shelf-card-code { color: var(--emerald); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; }
.shelf-card-type { margin-top: 7px; padding: 2px 6px; color: var(--emerald-deep); background: var(--yellow-pale); border: 1px solid rgba(181, 128, 0, 0.16); border-radius: 5px; font-size: 0.68rem; }
.shelf-card-name { display: -webkit-box; margin-top: 5px; padding-block: 0.18em 0.12em; overflow: hidden; font-size: 0.92rem; font-weight: 700; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.shelf-card .allocation-target-summary { width: 100%; margin: 5px 0 0; font-size: 0.66rem; }
.shelf-card-main > strong { margin-top: auto; padding-top: 8px; color: var(--emerald-deep); font-size: 1rem; line-height: 1; }
.shelf-card-main > strong small { color: var(--muted); font-size: 0.65rem; font-weight: 400; }
.shelf-card-kind { margin-top: 5px; color: #7b817f; font-size: 0.64rem; font-weight: 400; line-height: 1.2; }
.shelf-bookmark { position: absolute; top: 11px; right: 10px; z-index: 3; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; color: var(--emerald-dark); background: rgba(255, 255, 255, 0.9); border: 1px solid rgba(0, 61, 47, 0.2); border-radius: 8px; }
.shelf-bookmark svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.shelf-bookmark.is-selected { color: white; background: var(--emerald); border-color: var(--emerald); }
.shelf-bookmark.is-selected svg { fill: currentColor; }
.shelf-track::-webkit-scrollbar { height: 7px; }
.shelf-track::-webkit-scrollbar-track { background: rgba(0, 61, 47, 0.08); border-radius: 999px; }
.shelf-track::-webkit-scrollbar-thumb { background: var(--emerald); border-radius: 999px; }

.budget-grid.view-review { grid-template-columns: 1fr; gap: 8px; }
.budget-grid.view-review .budget-card { display: grid; grid-template-columns: 112px minmax(260px, 1fr) 210px; align-items: center; min-height: 0; overflow: visible; }
.budget-grid.view-review .budget-card::before { inset: 0 auto 0 0; width: 5px; height: auto; }
.budget-grid.view-review .card-topline { display: grid; gap: 3px; padding: 10px 7px 10px 15px; }
.budget-grid.view-review .card-detail { padding: 9px 11px; }
.budget-grid.view-review .budget-type { min-height: 22px; padding: 2px 7px; font-size: 0.66rem; }
.budget-grid.view-review h3 { margin: 2px 0; padding-block: 0.12em; font-size: 1rem; line-height: 1.4; -webkit-line-clamp: 2; }
.budget-grid.view-review .budget-amount { margin: 0; font-size: 1.05rem; }
.budget-grid.view-review .budget-amount small { display: inline; margin-left: 3px; }
.budget-grid.view-review .budget-item-kind { margin-top: 3px; font-size: 0.62rem; }
.budget-grid.view-review .card-group { position: relative; display: inline-block; width: max-content; max-width: 100%; margin-top: 2px; padding: 2px 3px; overflow: visible; cursor: help; -webkit-line-clamp: unset; }
.budget-grid.view-review .card-group-name { display: none; }
.budget-grid.view-review .card-group::after { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: max-content; max-width: min(360px, 70vw); padding: 7px 9px; content: attr(data-group-name); color: white; background: var(--emerald-deep); border-radius: 7px; box-shadow: 0 8px 22px rgba(0, 61, 47, 0.2); font-size: 0.76rem; font-weight: 400; line-height: 1.45; text-align: left; white-space: normal; visibility: hidden; opacity: 0; pointer-events: none; transform: translateY(-3px); transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease; }
.budget-grid.view-review .card-group:hover::after, .budget-grid.view-review .card-group:focus::after { visibility: visible; opacity: 1; transform: translateY(0); }
.budget-grid.view-review .card-group:focus-visible { outline: 2px solid var(--group-accent); outline-offset: 2px; border-radius: 4px; box-shadow: none; }
.budget-grid.view-review .budget-card:hover, .budget-grid.view-review .budget-card:focus-within { z-index: 3; }
.budget-grid.view-review .card-footer { align-self: stretch; gap: 6px; padding: 6px 8px; border-top: 0; border-left: 1px solid var(--line); }
.budget-grid.view-review .open-detail-button, .budget-grid.view-review .bookmark-toggle { font-size: 0.74rem; }

.detail-drawer { width: min(780px, 100%); padding: 0; }
.detail-drawer-heading { position: sticky; top: 0; z-index: 10; align-items: center; padding: 14px 22px; background: rgba(255, 254, 248, 0.97); backdrop-filter: blur(14px); }
.detail-navigation { display: flex; gap: 6px; margin-top: 5px; }
.detail-navigation button { min-height: 44px; padding: 4px 11px; color: var(--emerald-dark); background: white; border: 1px solid var(--line); border-radius: 7px; font-size: 0.78rem; font-weight: 700; }
.detail-navigation button:disabled { cursor: not-allowed; opacity: 0.42; }
.detail-review-layout { min-height: calc(100vh - 80px); }
.detail-primary { padding: 0 26px 28px; }
.outside-filter-note { margin: 18px 0 0; padding: 10px 12px; color: #70440c; background: var(--yellow-pale); border: 1px solid rgba(112, 68, 12, 0.16); border-radius: 9px; }
.outside-filter-note button { display: block; min-height: 44px; margin-top: 6px; padding: 4px 9px; color: var(--emerald-dark); background: white; border: 1px solid var(--emerald-dark); border-radius: 7px; font-weight: 700; }
.detail-status-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.source-accuracy-warning { display: grid; grid-template-columns: 28px minmax(0, 1fr) 44px; gap: 12px; align-items: start; margin: 20px 0 0; padding: 14px 12px 14px 15px; color: #633d17; background: #fff6e8; border: 1px solid #d7a35f; border-radius: 12px; }
.source-accuracy-warning-icon { width: 26px; height: 26px; margin-top: 1px; fill: #f3c66f; stroke: #80501d; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.source-accuracy-warning-copy { min-width: 0; }
.source-accuracy-warning-copy strong { display: block; color: #583411; font-size: 0.92rem; line-height: 1.35; }
.source-accuracy-warning-copy p { margin: 3px 0 0; color: #6a4c2d; font-size: 0.82rem; line-height: 1.55; }
.source-accuracy-warning-copy a { color: var(--emerald-dark); font-weight: 700; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; overflow-wrap: anywhere; }
.source-accuracy-warning-copy a:hover { color: var(--emerald); }
.source-accuracy-warning-close { display: grid; place-items: center; width: 44px; height: 44px; margin: -7px -5px 0 0; padding: 0; color: #633d17; background: transparent; border: 1px solid transparent; border-radius: 8px; }
.source-accuracy-warning-close svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.source-accuracy-warning-close:hover { background: rgba(128, 80, 29, 0.1); border-color: rgba(128, 80, 29, 0.2); }
.source-accuracy-warning-close:focus-visible { outline: 3px solid rgba(0, 116, 75, 0.28); outline-offset: 2px; }
.section-heading-with-source { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.section-heading-with-source > div > p { margin: 0 0 2px; color: var(--emerald); font-size: 0.78rem; font-weight: 700; }
.section-heading-with-source h3 { margin: 0; }
.understand-section { margin-top: 28px; padding: 19px; background: #f8f7f0; border: 1px solid var(--line); border-radius: 14px; }
.usage-details-section { padding: 19px; background: #f7faf8; border: 1px solid #b8d7ca; border-radius: 14px; }
.usage-details-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.usage-details-heading > div > p { margin: 0 0 2px; color: var(--emerald); font-size: 0.76rem; font-weight: 700; }
.usage-details-heading h3 { margin: 0; font-size: 1.08rem; }
.usage-details-heading > span { flex: 0 0 auto; padding: 3px 8px; color: var(--emerald-dark); background: var(--emerald-soft); border-radius: 999px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.usage-details-intro { margin: 7px 0 14px !important; font-size: 0.82rem; line-height: 1.45; }
.usage-detail-list { display: grid; gap: 8px; max-height: min(52vh, 520px); margin: 0; padding: 2px 4px 2px 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; scrollbar-gutter: stable; }
.usage-detail-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: flex-start; padding: 10px 11px; background: white; border: 1px solid var(--line); border-radius: 10px; }
.usage-detail-marker { display: grid; place-items: center; width: 28px; height: 28px; color: var(--emerald-dark); background: var(--emerald-soft); border-radius: 50%; font-size: 0.7rem; font-weight: 700; }
.usage-detail-kind { display: block; margin-bottom: 2px; color: var(--emerald); font-size: 0.67rem; font-weight: 700; }
.usage-detail-item p { margin: 0; color: var(--ink); font-size: 0.88rem; line-height: 1.45; }
.usage-detail-item.is-note { background: var(--yellow-pale); border-color: #e6cf7b; }
.usage-details-reference { margin: 14px 0 0 !important; padding-top: 9px; color: var(--muted); border-top: 1px solid var(--line); font-size: 0.7rem; font-weight: 400; }
.allocation-targets-section { padding: 19px; background: #fff9dc; border: 1px solid #dec76b; border-radius: 14px; }
.allocation-targets-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.allocation-targets-heading > div > p { margin: 0 0 2px; color: #80620a; font-size: 0.76rem; font-weight: 700; }
.allocation-targets-heading h3 { margin: 0; font-size: 1.08rem; }
.allocation-targets-heading > span { flex: 0 0 auto; padding: 3px 8px; color: #674e05; background: #f5df78; border-radius: 999px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.allocation-targets-intro { margin: 7px 0 14px !important; font-size: 0.82rem; line-height: 1.45; }
.allocation-target-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.allocation-target-list > li { padding: 10px 11px; background: white; border: 1px solid #e2d38e; border-radius: 10px; }
.allocation-target-name { display: grid; grid-template-columns: minmax(105px, auto) minmax(0, 1fr); gap: 2px 12px; align-items: baseline; }
.allocation-target-kind { color: #80620a; font-size: 0.68rem; font-weight: 700; }
.allocation-target-name strong { min-width: 0; color: var(--ink); font-size: 0.9rem; line-height: 1.4; overflow-wrap: anywhere; }
.allocation-target-dropdown { margin-top: 9px; border-top: 1px solid #eadca1; }
.allocation-target-dropdown summary { display: grid; grid-template-columns: minmax(0, 1fr) auto 20px; gap: 8px; align-items: center; min-height: 44px; padding: 7px 2px 0; color: #72570a; cursor: pointer; list-style: none; }
.allocation-target-dropdown summary::-webkit-details-marker { display: none; }
.allocation-target-dropdown summary > span { font-size: 0.78rem; font-weight: 700; }
.allocation-target-dropdown summary > strong { color: var(--emerald-deep); font-size: 0.74rem; white-space: nowrap; }
.allocation-target-dropdown summary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 160ms ease; }
.allocation-target-dropdown[open] summary svg { transform: rotate(180deg); }
.allocation-target-dropdown summary:focus-visible { outline: 3px solid rgba(128, 98, 10, 0.24); outline-offset: 2px; border-radius: 6px; }
.allocation-target-dropdown-content { padding: 8px 0 2px; }
.allocation-target-dropdown-content > p { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 8px !important; padding: 8px 10px; color: var(--muted); background: #fff9dc; border-radius: 7px; font-size: 0.73rem; }
.allocation-target-dropdown-content > p strong { color: var(--emerald-deep); white-space: nowrap; }
.allocation-target-dropdown-content > ul { display: grid; gap: 6px; max-height: min(46vh, 390px); margin: 0; padding: 0 3px 0 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; scrollbar-gutter: stable; }
.allocation-target-dropdown-content li { margin: 0; }
.allocation-related-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; min-height: 48px; padding: 8px 9px; color: var(--ink); background: #f9fbfa; border: 1px solid var(--line); border-radius: 8px; text-align: left; }
button.allocation-related-item { cursor: pointer; }
button.allocation-related-item:hover, button.allocation-related-item:focus-visible { background: var(--emerald-soft); border-color: var(--emerald); }
.allocation-related-item > span { display: grid; min-width: 0; }
.allocation-related-item small { color: var(--emerald); font-size: 0.65rem; font-weight: 700; }
.allocation-related-item > span strong { display: -webkit-box; overflow: hidden; font-size: 0.78rem; font-weight: 600; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.allocation-related-item > b { color: var(--emerald-deep); font-size: 0.74rem; white-space: nowrap; }
.allocation-related-item.is-current { position: relative; padding-bottom: 22px; background: var(--yellow-pale); border-color: #e2c55c; }
.allocation-related-item em { position: absolute; bottom: 5px; left: 9px; color: #80620a; font-size: 0.62rem; font-style: normal; font-weight: 700; }
.context-block { margin-top: 20px; }
.context-block h4 { margin: 0 0 7px; color: var(--emerald-deep); font-size: 0.96rem; }
.context-list { display: grid; gap: 7px; margin: 0; padding-left: 22px; }
.context-list li { padding-left: 3px; }
.context-list li::marker { color: var(--emerald); font-weight: 700; }
.context-list.is-single { list-style: none; padding-left: 0; }
.context-list.is-single li { display: grid; grid-template-columns: 16px minmax(0, 1fr); padding-left: 0; }
.context-list.is-single li::before { content: "–"; color: var(--emerald); font-weight: 700; }
.context-reference { margin: 22px 0 0; padding-top: 10px; color: var(--muted); border-top: 1px solid var(--line); font-size: 0.72rem; font-weight: 400; }
.context-empty { margin: 0 !important; padding: 9px 11px; color: var(--muted) !important; background: white; border: 1px dashed var(--line-strong); border-radius: 8px; font-size: 0.88rem; }
.context-empty.prominent { margin-top: 14px !important; color: #71430b !important; background: var(--yellow-pale); border-style: solid; }
.context-review-warning { padding: 11px 13px; color: #71430b; background: var(--yellow-pale); border: 1px solid #e7c75e; border-radius: 9px; }
.context-review-warning p { margin: 3px 0 0; font-size: 0.86rem; line-height: 1.45; }
.indicator-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
.indicator-table { width: 100%; min-width: 580px; border-collapse: collapse; background: white; font-size: 0.84rem; }
.indicator-table th, .indicator-table td { padding: 9px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.indicator-table th { color: var(--emerald-deep); background: #edf5f1; }
.indicator-table .is-focus-year { color: var(--emerald-deep); background: #e1f3e9; border-right: 2px solid var(--emerald); border-left: 2px solid var(--emerald); font-weight: 700; }
.indicator-table thead .is-focus-year { color: white; background: var(--emerald); border-top: 2px solid var(--emerald); }
.indicator-table tbody tr:last-child .is-focus-year { border-bottom: 2px solid var(--emerald); }
.indicator-table tr:last-child td { border-bottom: 0; }
.indicator-table tr:last-child th { border-bottom: 0; }
.indicator-context-source { margin: 0 0 10px !important; padding: 8px 10px; color: var(--emerald-deep); background: var(--emerald-soft); border-radius: 8px; font-size: 0.76rem; line-height: 1.45; }
.indicator-review-label { display: inline-block; margin-left: 7px; padding: 2px 6px; color: #71430b; background: var(--yellow-pale); border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.related-tables-section { padding: 18px; background: #f7faf8; border: 1px solid var(--line); border-radius: 14px; }
.related-table-heading { display: block; }
.related-table-heading p { margin: 0 0 2px !important; color: var(--emerald); font-size: 0.76rem; font-weight: 700; }
.related-table-heading h3 { margin: 0; }
.related-table-intro { margin: 7px 0 14px !important; color: var(--muted); font-size: 0.8rem; }
.related-table-list { display: grid; gap: 12px; }
.indicator-source-table-list { display: grid; gap: 10px; }
.source-budget-table { overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 10px; }
.source-table-heading { padding: 11px 12px; }
.source-table-heading h4 { margin: 0; font-size: 0.88rem; line-height: 1.35; }
.source-table-scroll { overflow-x: auto; border-block: 1px solid var(--line); }
.source-table-scroll table { width: 100%; min-width: max(680px, 100%); border-collapse: collapse; background: white; font-size: 0.78rem; }
.source-table-scroll th, .source-table-scroll td { padding: 8px 10px; text-align: right; vertical-align: top; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; }
.source-table-scroll th:first-child, .source-table-scroll td:first-child { min-width: 190px; text-align: left; white-space: normal; }
.source-table-scroll thead th { color: var(--emerald-deep); background: #eaf3ef; font-weight: 700; }
.source-table-scroll tbody th { color: var(--ink); background: #fafaf6; font-weight: 650; }
.source-table-scroll .is-focus-year { border-right: 2px solid var(--emerald); border-left: 2px solid var(--emerald); background: #effaf4; }
.source-table-scroll thead .is-focus-year { border-top: 2px solid var(--emerald); color: var(--emerald-dark); background: #dff4e8; }
.source-table-scroll tbody tr:last-child .is-focus-year { border-bottom: 2px solid var(--emerald); }
.source-table-scroll .is-focus-year-row > * { border-top: 2px solid var(--emerald); border-bottom: 2px solid var(--emerald); background: #effaf4; }
.source-table-scroll .is-focus-year-row > *:first-child { border-left: 2px solid var(--emerald); }
.source-table-scroll .is-focus-year-row > *:last-child { border-right: 2px solid var(--emerald); }
.source-table-scroll tr:last-child > * { border-bottom: 0; }
.source-table-scroll tr > *:last-child { border-right: 0; }
.document-table-card .source-budget-table { border: 0; }
.document-table-card .source-table-heading { padding: 0 0 12px; }
.hierarchy-path { display: grid; gap: 8px; margin: 0; }
.hierarchy-path > div { display: grid; grid-template-columns: 125px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.hierarchy-path dt { color: var(--emerald); font-size: 0.82rem; font-weight: 700; }
.hierarchy-path dd { margin: 0; }
.hierarchy-link { color: var(--emerald-dark); font-weight: 700; text-decoration: underline; text-decoration-color: rgba(0, 116, 75, 0.35); text-underline-offset: 3px; }
.hierarchy-link:hover { color: var(--emerald); text-decoration-color: currentColor; }
.budget-flow-section { padding: 18px; background: #f8f7f0; border: 1px solid var(--line); border-radius: 14px; }
.budget-flow-heading { margin-bottom: 16px; }
.budget-flow-heading > div > p { margin: 0 0 2px; color: var(--emerald); font-size: 0.76rem; font-weight: 700; }
.budget-flow-heading h3 { margin: 0; font-size: 1.08rem; }
.financial-summary { margin: 0 0 16px; padding: 12px; background: white; border: 1px solid var(--line); border-radius: 10px; }
.financial-summary h4 { margin: 0 0 9px; font-size: 0.86rem; }
.financial-summary .indicator-table { min-width: 500px; font-size: 0.78rem; }
.financial-summary .indicator-table th, .financial-summary .indicator-table td { padding: 7px 9px; }
.financial-note { margin: 8px 0 0 !important; color: var(--muted); font-size: 0.7rem; font-weight: 400; }
.budget-flow { margin: 0; padding: 0; list-style: none; }
.budget-flow-step { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding-bottom: 12px; }
.budget-flow-step:not(:last-child)::after { position: absolute; top: 27px; bottom: -1px; left: 13px; width: 2px; content: ""; background: #b9d9cd; }
.budget-flow-step:last-child { padding-bottom: 0; }
.budget-flow-marker { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; color: var(--emerald-dark); background: #dceee7; border: 2px solid white; border-radius: 50%; box-shadow: 0 0 0 1px #9dc8b8; font-size: 0.7rem; font-weight: 700; }
.budget-flow-node { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 66px; padding: 10px 12px; background: white; border: 1px solid var(--line); border-radius: 10px; }
.budget-flow-copy { display: flex; align-items: flex-start; flex-direction: column; min-width: 0; }
.budget-flow-level { color: var(--emerald); font-size: 0.68rem; font-weight: 700; }
.budget-flow-copy strong { margin-top: 2px; font-size: 0.86rem; line-height: 1.3; }
.budget-flow-amount { display: flex; align-items: flex-end; flex-direction: column; text-align: right; white-space: nowrap; }
.budget-flow-amount strong { color: var(--emerald-deep); font-size: 0.9rem; }
.budget-flow-amount small { margin-top: 2px; color: var(--muted); font-size: 0.65rem; }
.budget-flow-step.is-current .budget-flow-marker { color: var(--emerald-deep); background: var(--yellow); box-shadow: 0 0 0 1px #d5aa13; }
.budget-flow-step.is-current .budget-flow-node { background: var(--yellow-pale); border-color: #e2c55c; }
.budget-flow-step.is-allocation-target .budget-flow-marker { color: #72570a; background: #fff3ae; border-color: #d7b53d; }
.budget-flow-step.is-allocation-target .budget-flow-node { background: #fffaf0; border-color: #dec76b; }
.budget-flow-step.is-allocation-target .budget-flow-level { color: #80620a; }
.budget-flow-step.is-budget-breakdown .budget-flow-node { min-height: 58px; background: #f4faf7; border-color: #c8ddd5; }
.budget-flow-step.is-budget-breakdown .budget-flow-marker { background: #edf7f3; box-shadow: 0 0 0 1px #aacdc0; }
.budget-flow-step.is-budget-breakdown .budget-flow-copy strong { font-size: 0.83rem; }
.budget-flow-note { margin: 12px 0 0 !important; padding: 9px 10px; background: white; border: 1px dashed var(--line-strong); border-radius: 8px; font-size: 0.76rem; }
.budget-flow-reference { margin: 14px 0 0 !important; padding-top: 9px; border-top: 1px solid var(--line); font-size: 0.7rem; font-weight: 400; }
.amount-conflicts { margin-top: 18px; padding: 11px 13px; color: #70440c; background: var(--yellow-pale); border-radius: 9px; }
.amount-conflicts summary { cursor: pointer; font-weight: 700; }
.detail-actions-sticky { position: sticky; bottom: -1px; z-index: 5; display: flex; align-items: center; justify-content: center; gap: 10px; margin: 28px -26px -28px; padding: 12px 26px 17px; background: rgba(255, 254, 248, 0.97); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
.detail-action-icon { position: relative; display: grid; flex: 0 0 48px; place-items: center; width: 48px; height: 48px; min-height: 48px; padding: 0; color: var(--emerald-dark); background: white; border: 1px solid rgba(0, 61, 47, 0.34); border-radius: 10px; }
.detail-action-icon:hover, .detail-action-icon:focus-visible { color: white; background: var(--emerald-dark); border-color: var(--emerald-dark); }
.detail-action-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.google-search-mark { color: transparent; background: conic-gradient(from -45deg, #4285f4 0 25%, #34a853 0 44%, #fbbc05 0 68%, #ea4335 0 82%, #4285f4 0); background-clip: text; font-family: Arial, sans-serif; font-size: 1.45rem; font-weight: 700; line-height: 1; -webkit-background-clip: text; }
.detail-google-search:hover .google-search-mark, .detail-google-search:focus-visible .google-search-mark { color: white; background: none; -webkit-text-fill-color: white; }
.detail-action-icon.detail-bookmark.is-selected { color: white; background: var(--emerald); border-color: var(--emerald); }
.detail-action-icon.detail-bookmark.is-selected svg { fill: currentColor; }
.detail-action-icon::after { position: absolute; bottom: calc(100% + 9px); left: 50%; padding: 5px 8px; content: attr(data-tooltip); color: white; background: var(--emerald-deep); border-radius: 6px; font-size: 0.72rem; font-weight: 600; line-height: 1.2; white-space: nowrap; opacity: 0; pointer-events: none; transform: translate(-50%, 4px); transition: opacity 140ms ease, transform 140ms ease; }
.detail-action-icon:hover::after, .detail-action-icon:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }

.tray-item { width: auto; min-width: 62px; min-height: 44px; padding-inline: 8px; }

@media (max-width: 1239px) {
  .budget-grid:not(.view-review) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .budget-grid.view-review .budget-card { grid-template-columns: 96px minmax(220px, 1fr) 196px; }
}

@media (max-width: 960px) {
  .results-tools { align-items: stretch; flex-direction: column; }
  .saved-items-toggle { align-self: flex-end; }
  .view-toggle { align-self: flex-end; }
  .filter-panel { visibility: hidden; pointer-events: none; }
  .filters-open .filter-panel { visibility: visible; pointer-events: auto; }
  .budget-grid:not(.view-review) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .budget-grid.view-review .budget-card { grid-template-columns: 102px minmax(220px, 1fr) 200px; }
}

@media (max-width: 760px) {
  .hero-inner { min-height: 155px; }
  .results-tools { margin-top: 14px; }
  .saved-items-toggle { align-self: stretch; justify-content: center; }
  .view-toggle { align-self: stretch; }
  .view-toggle button { display: flex; flex: 1; gap: 6px; width: auto; padding-inline: 8px; }
  .view-button::after {
    position: static;
    padding: 0;
    color: inherit;
    background: transparent;
    border-radius: 0;
    font-size: 0.72rem;
    opacity: 1;
    transform: none;
  }
  .view-button:hover::after, .view-button:focus-visible::after { transform: none; }
  .budget-grid:not(.view-review) { grid-template-columns: 1fr; gap: 12px; }
  .budget-card,
  .budget-card:nth-child(4n+2),
  .budget-card:nth-child(4n+3),
  .budget-card:nth-child(4n) { min-height: 0; }
  .budget-card > .card-topline { gap: 12px; padding: 14px 16px 0; }
  .budget-code { flex: 0 0 auto; font-size: 0.9rem; white-space: nowrap; }
  .card-group.card-group-top { max-width: min(68%, 280px); font-size: 0.76rem; text-align: right; }
  .budget-card .card-detail { padding: 9px 16px 14px; }
  .budget-card h3 {
    margin-block: 8px 10px;
    overflow-wrap: anywhere;
    font-size: 1.15rem;
    line-height: 1.45;
    -webkit-line-clamp: 4;
  }
  .budget-card .budget-amount { font-size: clamp(1.45rem, 7vw, 1.8rem); line-height: 1.1; white-space: normal; }
  .budget-card .budget-amount small { font-size: 0.75rem; }
  .budget-item-kind { font-size: 0.74rem; line-height: 1.4; }
  .allocation-target-summary { flex-wrap: wrap; font-size: 0.76rem; }
  .allocation-target-summary strong { flex: 1 1 160px; white-space: normal; }
  .budget-card .card-footer { padding: 10px 12px 12px; }
  .open-detail-button { padding-inline: 12px; font-size: 0.9rem; }
  .shelf-track { grid-auto-columns: minmax(210px, 76vw); }
  .budget-grid.view-review .budget-card { display: block; }
  .budget-grid.view-review .card-topline { display: flex; padding: 15px 16px 0; }
  .budget-grid.view-review .card-detail { padding: 10px 16px 12px; }
  .budget-grid.view-review .card-footer { border-top: 1px solid var(--line); border-left: 0; }
  .detail-primary { padding-inline: 18px; }
  .detail-actions-sticky { margin-inline: -18px; padding-inline: 18px; }
  .filter-chip, .tray-item { min-height: 44px; }
  .hierarchy-path > div { grid-template-columns: 95px 1fr; }
}

@media (max-width: 540px) {
  .quality-banner { align-items: start; }
  .quality-banner p { font-size: 0.82rem; }
  .detail-drawer-heading { padding-inline: 16px; }
  .source-accuracy-warning { grid-template-columns: 24px minmax(0, 1fr) 44px; gap: 9px; padding-left: 12px; }
  .source-accuracy-warning-icon { width: 23px; height: 23px; }
  .source-accuracy-warning-copy p { font-size: 0.78rem; }
  .detail-actions-sticky { position: static; flex-direction: row; margin-bottom: 0; padding-bottom: 0; backdrop-filter: none; }
  .budget-flow-node { grid-template-columns: 1fr; gap: 7px; }
  .budget-flow-amount { align-items: flex-start; text-align: left; }
  .section-heading-with-source { align-items: stretch; flex-direction: column; }
  .usage-details-heading { align-items: stretch; flex-direction: column; }
  .usage-details-heading > span { align-self: flex-start; }
  .usage-detail-list { max-height: none; overflow: visible; }
  .allocation-targets-heading { align-items: stretch; flex-direction: column; }
  .allocation-targets-heading > span { align-self: flex-start; }
  .allocation-target-name { grid-template-columns: 1fr; }
  .allocation-target-dropdown-content > p { align-items: flex-start; flex-direction: column; }
  .allocation-related-item { grid-template-columns: 1fr; }
  .allocation-related-item > b { white-space: normal; }
}
