:root {
  --portal-ink: #17211d;
  --portal-muted: #63716b;
  --portal-line: #dce5e1;
  --portal-bg: #f4f7f5;
  --portal-surface: #fff;
  --portal-green: #08715a;
  --portal-green-dark: #075b47;
  --portal-green-soft: #e8f5f0;
  --portal-danger: #b42318;
  --portal-warning: #9a6700;
  --portal-radius: 16px;
  --portal-shadow: 0 1px 2px rgb(15 23 42 / .05), 0 8px 24px rgb(15 23 42 / .04);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body.portal-body { margin: 0; min-height: 100vh; background: var(--portal-bg); color: var(--portal-ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
.portal-icon { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; fill: currentColor; }
.portal-header { color: #fff; background: linear-gradient(120deg, #075b47, #08715a 64%, #0b8065); box-shadow: 0 2px 14px rgb(6 78 59 / .2); }
.portal-header__inner, .portal-nav__inner, .portal-main { width: min(100% - 2rem, 1280px); margin-inline: auto; }
.portal-header__inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.portal-brand { display: inline-flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; }
.portal-brand__mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: var(--portal-green-dark); background: #dff5eb; }
.portal-brand__mark .portal-icon { width: 25px; height: 25px; }
.portal-brand strong, .portal-brand small { display: block; line-height: 1.15; }
.portal-brand strong { font-size: 1.08rem; letter-spacing: -.01em; }
.portal-brand small { margin-top: .2rem; color: #c9e9de; font-size: .72rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.portal-account { display: flex; align-items: center; gap: 1rem; font-size: .85rem; }
.portal-account__workspace, .portal-account__name { display: inline-flex; align-items: center; gap: .45rem; }
.portal-account__workspace { color: #dff5eb; font-weight: 700; text-decoration: none; }
.portal-account__name { max-width: 240px; color: #fff; font-weight: 650; }
.portal-account__name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-account__logout { margin: 0; }
.portal-nav { border-top: 1px solid rgb(255 255 255 / .12); background: rgb(4 66 51 / .22); }
.portal-nav__inner { display: flex; align-items: stretch; gap: .1rem; overflow-x: auto; scrollbar-width: thin; }
.portal-nav a { position: relative; display: inline-flex; align-items: center; gap: .42rem; min-height: 48px; padding: 0 .68rem; color: #d9eee7; font-size: .82rem; font-weight: 650; text-decoration: none; white-space: nowrap; }
.portal-nav a:hover { color: #fff; background: rgb(255 255 255 / .08); }
.portal-nav a[aria-current="page"] { color: #fff; background: rgb(255 255 255 / .1); }
.portal-nav a[aria-current="page"]::after { position: absolute; right: .65rem; bottom: 0; left: .65rem; height: 3px; border-radius: 3px 3px 0 0; background: #8fe0c3; content: ""; }
.portal-nav__separator { width: 1px; min-width: 1px; height: 24px; margin: 12px .4rem; background: rgb(255 255 255 / .2); }
.portal-main { min-height: calc(100vh - 190px); padding-block: 2rem 3.5rem; }
.portal-footer { padding: 1.6rem 1rem; border-top: 1px solid var(--portal-line); color: var(--portal-muted); font-size: .82rem; text-align: center; }

.portal-page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.25rem; margin-bottom: 1.5rem; }
.portal-eyebrow { margin: 0 0 .3rem; color: var(--portal-green); font-size: .76rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.portal-page-title { margin: 0; color: #10231c; font-size: clamp(1.65rem, 3vw, 2.35rem); font-weight: 780; letter-spacing: -.035em; line-height: 1.12; }
.portal-page-subtitle { margin: .55rem 0 0; color: var(--portal-muted); font-size: .94rem; }
.portal-heading-actions { display: flex; align-items: center; gap: .75rem; }
.portal-citizen-form p > label { display: block; margin-bottom: .4rem; }
.portal-citizen-form p > input, .portal-citizen-form p > select { width: 100%; }
.portal-period-form { display: flex; align-items: center; gap: .65rem; }
.portal-period-form label { color: var(--portal-muted); font-size: .78rem; font-weight: 700; }
.portal-period-form select { min-width: 104px; border: 1px solid #bfcec8; border-radius: 10px; padding: .55rem 2rem .55rem .7rem; background: #fff; color: var(--portal-ink); font-weight: 750; }

.portal-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.portal-metric { min-width: 0; padding: 1.15rem 1.2rem; border: 1px solid var(--portal-line); border-radius: var(--portal-radius); background: var(--portal-surface); box-shadow: var(--portal-shadow); }
.portal-metric__top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.portal-metric__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--portal-green); background: var(--portal-green-soft); }
.portal-metric__label { margin: 0; color: var(--portal-muted); font-size: .78rem; font-weight: 700; }
.portal-metric__value { margin: .85rem 0 .18rem; color: #13251e; font-size: clamp(1.55rem, 3vw, 2rem); font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.portal-metric__note { margin: 0; color: #77837e; font-size: .74rem; }

.portal-grid { display: grid; gap: 1rem; margin-top: 1rem; }
.portal-grid--charts { grid-template-columns: minmax(0, 1.75fr) minmax(300px, .75fr); }
.portal-grid--work { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.portal-collection-section { margin-top: 2rem; }
.portal-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: .85rem; }
.portal-section-title { margin: 0; color: #10231c; font-size: clamp(1.25rem, 2.4vw, 1.65rem); font-weight: 780; letter-spacing: -.025em; }
.portal-callout { margin-bottom: 1rem; border: 1px solid #cbded7; border-radius: 12px; padding: .75rem 1rem; color: #385b4e; background: #f1f8f5; font-size: .78rem; line-height: 1.5; }
.portal-collection-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.portal-card.portal-collection-card { border-top: 4px solid var(--collection-accent); }
.portal-collection-card__header { align-items: center; }
.portal-collection-table-wrap { border-top: 1px solid var(--portal-line); }
.portal-collection-table { width: 100%; min-width: 0; table-layout: fixed; }
.portal-collection-table th:first-child, .portal-collection-table td:first-child { width: 42px; text-align: center; }
.portal-collection-table th:nth-child(2) { width: 46%; }
.portal-collection-table th:nth-child(3) { width: auto; }
.portal-collection-table td { vertical-align: top; overflow-wrap: anywhere; }
.portal-rank { color: var(--portal-muted); font-weight: 800; font-variant-numeric: tabular-nums; }
.portal-cell-title { display: block; color: #20352d; font-size: .8rem; font-weight: 750; text-decoration: none; }
a.portal-cell-title:hover { color: var(--portal-green); text-decoration: underline; }
.portal-weight { display: block; color: #10231c; font-size: .92rem; font-variant-numeric: tabular-nums; }
.portal-correction-note { color: #865d08 !important; font-weight: 700; }
.portal-bin-details { margin-top: .35rem; color: var(--portal-muted); font-size: .7rem; }
.portal-bin-details summary { width: fit-content; color: #476b60; font-weight: 700; cursor: pointer; }
.portal-bin-details small { overflow-wrap: anywhere; }
.portal-result-cell > .portal-badge { margin-top: .35rem; }
.portal-comparison { display: grid; gap: .15rem; margin-top: .48rem; padding-top: .42rem; border-top: 1px solid #e5ece9; }
.portal-comparison small { margin-top: 0; }
.portal-correction-link { margin-top: .42rem; }
@media (min-width: 1100px) { .portal-collection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.portal-card { min-width: 0; overflow: hidden; border: 1px solid var(--portal-line); border-radius: var(--portal-radius); background: var(--portal-surface); box-shadow: var(--portal-shadow); }
.portal-card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.25rem .85rem; }
.portal-card__title { margin: 0; color: #183128; font-size: 1rem; font-weight: 780; letter-spacing: -.01em; }
.portal-card__subtitle { margin: .28rem 0 0; color: var(--portal-muted); font-size: .78rem; line-height: 1.45; }
.portal-card__body { padding: 0 1.25rem 1.25rem; }
.portal-card__body--flush { padding-inline: 0; }
.portal-chart { position: relative; min-height: 300px; }
.portal-chart--donut { min-height: 220px; }

.portal-button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 40px; border: 1px solid transparent; border-radius: 10px; padding: .55rem .9rem; font: inherit; font-size: .82rem; font-weight: 750; line-height: 1.1; text-decoration: none; cursor: pointer; }
.portal-button--primary { color: #fff; background: var(--portal-green); }
.portal-button--primary:hover { background: var(--portal-green-dark); }
.portal-button--secondary { border-color: #b9cbc4; color: var(--portal-green-dark); background: #fff; }
.portal-button--light { border-color: rgb(255 255 255 / .5); color: var(--portal-green-dark); background: #fff; }
.portal-button--small { min-height: 34px; padding: .42rem .7rem; font-size: .76rem; }
.portal-text-link { display: inline-flex; align-items: center; gap: .3rem; color: var(--portal-green); font-size: .79rem; font-weight: 750; text-decoration: none; white-space: nowrap; }
.portal-text-link:hover { text-decoration: underline; }
.portal-text-link .portal-icon { width: .95rem; height: .95rem; }

.portal-status-list, .portal-activity-list { margin: 0; padding: 0; list-style: none; }
.portal-status-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .62rem 0; border-bottom: 1px solid #edf1ef; font-size: .8rem; }
.portal-status-row:last-child { border-bottom: 0; }
.portal-status-row__label { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.portal-swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--swatch); }
.portal-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: .23rem .52rem; color: #39534a; background: #edf2f0; font-size: .68rem; font-weight: 800; white-space: nowrap; }
.portal-badge--success { color: #086747; background: #dff5eb; }
.portal-badge--warning { color: #825500; background: #fff3cd; }
.portal-badge--danger { color: #a31d14; background: #fee9e7; }
.portal-activity-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: .85rem 1.25rem; border-top: 1px solid #edf1ef; }
.portal-activity-item__main { min-width: 0; }
.portal-activity-item__title { overflow: hidden; margin: 0; color: #20352d; font-size: .82rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.portal-activity-item__meta { margin: .25rem 0 0; color: var(--portal-muted); font-size: .72rem; }
.portal-empty { padding: 1.5rem 1.25rem; color: var(--portal-muted); font-size: .82rem; text-align: center; }

.portal-attention { border-color: #ead7aa; background: #fffdf7; }
.portal-attention__heading { display: flex; align-items: center; gap: .55rem; }
.portal-attention__heading .portal-icon { color: var(--portal-warning); }
.portal-task { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .75rem 0; border-top: 1px solid #efe7d4; }
.portal-task__title { margin: 0; color: #3e3726; font-size: .8rem; font-weight: 750; }
.portal-task__meta { margin: .15rem 0 0; color: #766c55; font-size: .7rem; }
.portal-alert { margin-bottom: .75rem; border: 1px solid; border-radius: 10px; padding: .75rem 1rem; font-size: .85rem; transition: opacity .2s ease, transform .2s ease; }
.portal-alert--success { border-color: #b7dfcf; color: #075b47; background: #e9f7f1; }
.portal-alert--warning { border-color: #ead39b; color: #775000; background: #fff8e5; }
.portal-alert--danger { border-color: #f0b7b2; color: #991b1b; background: #fff0ef; }
.portal-alert.is-dismissing { opacity: 0; transform: translateY(-.35rem); }
.portal-table-wrap { width: 100%; overflow-x: auto; }
.portal-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.portal-table th { padding: .7rem .8rem; color: var(--portal-muted); background: #f7f9f8; font-size: .72rem; text-align: left; }
.portal-table td { padding: .75rem .8rem; border-top: 1px solid var(--portal-line); }
.table-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem 1.25rem; margin: 1rem 0; font-size: .85rem; color: var(--portal-muted); }
.table-toolbar label { display: inline-flex; align-items: center; gap: .5rem; }
.table-toolbar [data-export-for] { margin-left: auto; }
.portal-table-wrap .dt-container { padding: 1rem; font-size: .85rem; }
.portal-table small { display: block; margin-top: .3rem; color: var(--portal-muted); font-size: .73rem; }
.table-actions { display: flex; align-items: flex-start; flex-wrap: wrap; gap: .45rem .75rem; min-width: 8rem; }
.table-link, .table-button { display: inline-flex; align-items: center; color: var(--portal-green); font-weight: 700; font-size: .8rem; text-decoration: none; }
.table-link:hover, .table-button:hover { text-decoration: underline; }
.table-link-secondary { color: #476b60; }
.table-actions form { margin: 0; }
.table-button-danger { color: var(--portal-danger); }
.portal-table small.table-badge { color: #825500; white-space: nowrap; }
.portal-table small.table-badge-danger { color: var(--portal-danger); white-space: normal; }
.portal-table .dt-body-right { font-variant-numeric: tabular-nums; }
.portal-table-wrap .dt-search input { min-width: 12rem; }
@media (max-width: 680px) { .table-toolbar [data-export-for] { margin-left: 0; } .portal-table-wrap .dt-container { padding: .7rem; } }
.portal-data-details { margin-top: .65rem; border-top: 1px solid var(--portal-line); padding-top: .8rem; }
.portal-data-details summary { width: fit-content; color: var(--portal-green); font-size: .78rem; font-weight: 750; cursor: pointer; }
.portal-data-details .portal-table-wrap { margin-top: .75rem; border: 1px solid var(--portal-line); border-radius: 10px; }
.portal-data-details .portal-card__subtitle { margin-top: .65rem; }

main input:not([type=hidden]):not([type=checkbox]):not([type=radio]), main select, main textarea { max-width: 100%; border: 1px solid #cbd5e1; border-radius: .5rem; padding: .55rem .75rem; background: #fff; }
main form p { margin: .7rem 0; }
main form label { font-weight: 650; }
main .helptext { display: block; margin-top: .25rem; color: #64748b; font-size: .8rem; }
main .errorlist { color: #b91c1c; font-size: .9rem; }

@media (max-width: 960px) {
  .portal-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-grid--charts { grid-template-columns: 1fr; }
  .portal-account__workspace span, .portal-account__name span { display: none; }
}
@media (max-width: 680px) {
  .portal-header__inner, .portal-nav__inner, .portal-main { width: min(100% - 1.2rem, 1280px); }
  .portal-header__inner { min-height: 64px; }
  .portal-account { gap: .5rem; }
  .portal-account__name { display: none; }
  .portal-nav__inner { width: 100%; padding-inline: .3rem; }
  .portal-nav a { min-height: 44px; padding-inline: .62rem; }
  .portal-nav__separator { display: none; }
  .portal-main { padding-block: 1.35rem 2.5rem; }
  .portal-page-heading { align-items: flex-start; flex-direction: column; }
  .portal-heading-actions, .portal-section-heading { width: 100%; align-items: flex-start; flex-direction: column; }
  .portal-period-form { width: 100%; justify-content: space-between; }
  .portal-metric-grid, .portal-grid--work { grid-template-columns: 1fr; }
  .portal-metric-grid { gap: .65rem; }
  .portal-metric { padding: 1rem; }
  .portal-chart { min-height: 255px; }
  .portal-activity-item { padding-inline: 1rem; }
}
