/* ============================================================
   1. Reset & base
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Montserrat:wght@400;500;600;700&display=swap');

:root {
    color-scheme: light;
    font-family: 'Montserrat', Helvetica, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #f5f9f2;
    color: #1f3d1f;
}

/* ============================================================
   2. Layout primitives
   ============================================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

/* ============================================================
   3. Navbar
   ============================================================ */

/* Scoped to `body > header` so the sticky navbar rule only hits
   the actual navbar, not any nested <header> (e.g. the
   `<header class="admin-header">` inside `.admin-page`). Without
   this scoping, every inner <header> becomes sticky at top: 0
   and stacks on top of the navbar — which is exactly what made
   /admin/users render the page title over the navbar. */
body > header {
    position: sticky;
    top: 0;
    /* High enough that injected utility classes (Tailwind v4, third-
       party widgets) can't out-stack the navbar. The Drive picker
       dialog also lives below this value. */
    z-index: 2147483000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding: 1rem 2rem;
    background-color: #fff;
    color: #2E7D32;
    border-bottom: 2px solid #FFB343;
    /* Solid background guarantees the navbar paints over any
       underlying content during scroll. Without this, even with
       z-index set, a translucent body could show through if any
       child element paints during scroll. */
    background-clip: padding-box;
}

/* Belt-and-braces: a Tailwind v4 utility or an ancestor `transform`
   can demote sticky to static (sticky is computed against the nearest
   scroll container — if a parent sets `transform`, `filter`, or
   `will-change`, that parent becomes the container). Keep <body>
   and <html> clean so the navbar pins regardless of injected
   utility classes from Vite. */
html, body {
    overflow-x: clip;
}

body {
    /* `isolation: isolate` creates a new stacking context without
       introducing the `transform` / `filter` family that breaks
       sticky. Keeps the navbar's z-index relative to the page only. */
    isolation: isolate;
}

header h1,
.navbar-logo {
    margin: 0;
    font-size: 1.6rem;
    font-weight: bold;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

img.navbar-logo-image {
    width: 42px;
    height: 42px;
    max-width: 100%;
    display: block;
    object-fit: contain;
    border-radius: 8px;
    background: transparent;
}

nav {
    display: flex;
    justify-content: flex-end;
}

nav ul {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    list-style: none;
    gap: 1rem;
    margin: 0;
    padding: 0;
}

nav li {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

nav a {
    color: #2E7D32;
    text-decoration: none;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
}

nav a:hover {
    color: #ddd;
}

nav a[href="/login"] {
    background-color: #2E7D32;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 700;
}

/* Admin navbar dropdown — `.navbar-dropdown` replaces the four flat
   public-page links for admin-tier users with a single trigger that
   reveals the same four pages on hover / focus. Mirrors the structure
   of `.public-export-dropdown` (lines 2636-2703) but with the menu
   opening below the trigger rather than to the side, so it matches
   the navbar's horizontal rhythm.

   No JS: reveal is driven by `:hover` on the parent <li> and
   `:focus-within` so keyboard users tabbing into the menu still see
   the options. The trigger is a real <a href> pointing at the
   default page (Physical Targets), so no-JS / non-hover devices
   still get to one of the four pages by clicking the label. */
.navbar-dropdown {
    position: relative;
}

.navbar-dropdown__trigger {
    cursor: pointer;
    gap: 4px;
}

.navbar-dropdown__caret {
    font-size: 0.75em;
    line-height: 1;
    margin-left: 2px;
    display: inline-block;
    transition: transform 0.15s ease;
}

.navbar-dropdown:hover .navbar-dropdown__caret,
.navbar-dropdown:focus-within .navbar-dropdown__caret {
    transform: translateY(1px);
}

.navbar-dropdown__menu {
    position: absolute;
    /* Sit flush against the trigger's bottom edge so the cursor never
       leaves the parent <li>'s :hover zone while travelling down
       into the menu. Earlier versions had a calc(100% + 8px) gap that
       closed the menu as soon as the cursor crossed the 8px bridge;
       the menu's own padding + shadow now provide visual breathing
       room without breaking the hover chain. */
    top: 100%;
    left: 0;
    min-width: 200px;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    background: #ffffff;
    border: 1px solid #d6e2cf;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    gap: 0;
    z-index: 2147483001;
    /* One notch above the navbar's z-index (2147483000) so the menu
       always paints over the page below the navbar. */
}

.navbar-dropdown__menu li {
    margin: 0;
    padding: 0;
    display: block;
    white-space: nowrap;
}

.navbar-dropdown__menu a {
    display: block;
    padding: 8px 16px;
    color: #1f3b1f;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
}

.navbar-dropdown__menu a:hover,
.navbar-dropdown__menu a:focus-visible {
    background: #f1f8f3;
    color: #2e7d32;
    outline: none;
}

.navbar-dropdown:hover > .navbar-dropdown__menu,
.navbar-dropdown:focus-within > .navbar-dropdown__menu {
    display: flex;
}

/* On the earthy-admin overlay the menu keeps the same leaf palette
   but lifts the background to var(--earth-surface) so it picks up
   the admin theme. */
body.earthy-admin .navbar-dropdown__menu {
    background: var(--earth-surface, #ffffff);
    border-color: var(--earth-line, #d6e2cf);
}

body.earthy-admin .navbar-dropdown__menu a {
    color: var(--earth-ink, #1f3b1f);
}

body.earthy-admin .navbar-dropdown__menu a:hover,
body.earthy-admin .navbar-dropdown__menu a:focus-visible {
    background: var(--earth-leaf-soft, #f1f8f3);
    color: var(--earth-leaf, #2e7d32);
}

/* ============================================================
   4. AMEFIP page banner + body
   ============================================================ */

.machineries-page {
    background: #f0f0e0;
    min-height: calc(100vh - 90px);
    padding: 18px 22px 28px;
    display: grid;
    gap: 14px;
}

.mach-banner {
    background: #dcedc8;
    border: 1px solid #c5e1a5;
    border-radius: 4px;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 22px;
}

.mach-logo {
    flex: 0 0 130px;
    width: 170px;
    height: 150px;
    object-fit: contain;
    object-position: center;
    background: #dcedc8;
    border-radius: 2px;
}

.mach-banner-text {
    flex: 1 1 auto;
}

.mach-agency {
    margin: 0;
    font-weight: 700;
    color: #1f1f1f;
    font-size: 0.95rem;
    line-height: 1.35;
    letter-spacing: 0.01em;
}

.mach-banner h1 {
    margin: 10px 0 4px;
    font-size: 2rem;
    font-weight: 800;
    color: #111;
    letter-spacing: 0.01em;
}

.mach-banner h2 {
    margin: 0;
    font-size: 1.7rem;
    font-weight: 800;
    color: #111;
}

.mach-accent {
    color: #c62828;
}

/* ============================================================
   5. Cards & stat blocks (dashboard summary + AMEFIP stat cards)
   ============================================================ */

.cards {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    margin-top: 24px;
    overflow-x: auto;
}

.stat-card {
    background: white;
    padding: 10px 12px;
    border-bottom: 2px solid #FFB343;
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
    min-height: 78px;
    max-width: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.stat-cards {
    display: grid;
    justify-content: left;
    grid-template-columns: repeat(4, 200px);
    gap: 12px;
    margin: 24px 0;
}

.stat-card h2 {
    margin-top: 0;
    font-size: 1.1rem;
}

.stat-card p {
    margin-bottom: 0;
    color: #028b2b;
    line-height: 1.6;
}

.stat-card__subtitle {
    display: block;
    margin-top: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #c62828;
}

.mach-stats {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.mach-stat-card {
    background: #ffffff;
    border: 1px solid #b6cba9;
    border-radius: 6px;
    padding: 10px 18px;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.mach-stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #555;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.mach-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f1f1f;
}

/* ============================================================
   6. Chart cards + chart-level filters
   ============================================================ */

.chart-section {
    margin-top: 24px;
}

/* Cap the chart-card width so the MFO chart's canvas doesn't blow
   up to 1500px wide on big screens — a wide canvas with Chart.js's
   default aspect ratio produces a chart where bars fill the whole
   height and the percentage line gets pinned to the bottom. */
.chart-card {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

/* Full-width variant for charts that should span the whole chart-
   section width rather than sitting in the 1200px cap. The MFOs
   chart uses this so the percentage pills and bars get the same
   breathing room they had before the 2-up / 3-up layouts. */
.chart-card--full {
    max-width: none;
    margin-top: 16px;
}

/* Targets page chart-row: side-by-side pair of cards (Monthly +
   Beneficiaries) sitting under the full-width MFOs chart card.
   Each child is a flex item that grows to share the row width
   equally and is allowed to shrink below its content size —
   without `min-width: 0` the inline canvas widths would force
   the row wider than the viewport. `align-items: flex-start`
   lets each card take its natural height rather than stretching
   to match its sibling — the Monthly chart needs more vertical
   room than the Beneficiaries chart. */
.chart-row {
    display: flex;
    gap: 20px;
    margin-top: 16px;
    width: 100%;
    align-items: flex-start;
}

.chart-row > .chart-card {
    flex: 1 1 0;
    min-width: 0;
}

/* Compact variant for the row under the MFOs chart on /targets.
   Stretches the row to fill the chart-section width (was capped,
   which left a big empty band on the right). Per-card flex
   ratios below split that width — Monthly gets ~60%, Beneficiaries
   gets ~40%. The selectors match the base `.chart-row > .chart-card`
   rule's specificity (one class + one class via `>`) so the
   cascade order is what makes these win — they live below the
   base rule in the file. */
.chart-row--compact {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

.chart-card--compact {
    max-width: none;
    padding: 10px 12px;
    box-shadow: none;
    border: 1px solid #e6efe6;
}

/* Per-card widths inside the compact row. flex-basis: 0 plus
   grow ratios (6:4 ≈ 60/40) means the cards ignore their
   intrinsic content width and share the row by ratio. */
.chart-row > .chart-card--monthly {
    flex: 6 1 0;
    min-width: 0;
}

.chart-row > .chart-card--beneficiaries {
    flex: 4 1 0;
    min-width: 0;
}

.chart-card--compact h3 {
    /* 1rem matches the standard section heading size used
       elsewhere on the page (e.g. .mach-table-header h3). */
    font-size: 1rem;
    margin: 0 0 6px 0;
    color: #1f3d1f;
    font-weight: 700;
}

/* The Beneficiaries card needs a taller minimum than the chart
   canvas's intrinsic height so the legend + 2-bar dataset fit
   without compressing. Without this the card sits at ~180px and
   the "GROUP" / "Individual" legend gets pushed off the right
   edge. */
.chart-card--beneficiaries {
    min-height: 360px;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

/* Stack successive chart grids with the same gap an inline
   `margin-top: 20px` was producing. Keeps the visual rhythm when
   a page has multiple grids back-to-back. */
.chart-grid + .chart-grid {
    margin-top: 20px;
}

.chart-box {
    background: white;
    padding: 20px;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.chart-box h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.chart-empty {
    margin: 0;
    padding: 48px 16px;
    text-align: center;
    color: #999;
}

/* Header row inside a chart card: title on the left, checklist
   filter widget on the right. The filter widget is the AMEFIP
   `.mach-filter` component reused so behaviour matches /infra and
   /machineries. */
.chart-box-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.chart-box-canvas {
    max-height:300px;
}
.chart-box-header h3 {
    margin: 0;
    flex: 0 1 auto;
}

.chart-box-header .mach-filter {
    margin-left: auto;
}

/* ============================================================
   /targets filter strip — six cascading checklists that
   narrow both the MFO chart and the MFO list table.
   ============================================================ */

.targets-filters {
    background: white;
    border-radius: 16px;
    border: 1px solid #d7e7d1;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.04);
    padding: 20px 15px;
    margin-top: 24px;
}

.targets-filters h2 {
    margin: 0 0 4px 0;
    color: #1b5e20;
    font-size: 1.1rem;
    font-weight: 700;
}

.targets-filters__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 10px 0;
}

.targets-filters__hint {
    margin: 0;
    color: #45654a;
    font-size: 0.9rem;
    flex: 1 1 auto;
}

.targets-filters__reset {
    flex: 0 0 auto;
    font-size: 0.85rem;
    color: #2e7d32;
    margin: 0;
}

@media (max-width: 700px) {
    .targets-filters__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

.targets-filters__grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
}

.targets-filters__grid .mach-filter {
    width: 100%;
}

/* Inside the targets filter strip the button must fill its grid
   cell so the six widgets sit flush side-by-side. Without this the
   `.mach-filter` wrapper's inline-block default shrinks the button
   to its label width, leaving trailing whitespace that makes the
   strip look spread out. */
.targets-filters__grid .mach-filter__button {
    width: 100%;
}

/* The expanded panel needs to overlay the next row instead of pushing
   the grid down (otherwise 6 panels stacked = page jumps). Absolute
   positioning keeps the layout stable when a filter is opened. */
.targets-filters__grid .mach-filter__panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: auto;
    z-index: 20;
    min-width: 240px;
    max-width: 320px;
}

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

@media (max-width: 560px) {
    .targets-filters__grid {
        grid-template-columns: 1fr;
    }
}

.sheet-attribution {
    margin-top: 12px;
    font-size: 0.95rem;
    color: #45654a;
}

/* ============================================================
   7. Tables (allocation + summary)
   ============================================================ */

.table-wrap {
    overflow-x: auto;
    background: white;
    border-radius: 16px;
    border: 1px solid #d7e7d1;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.04);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 100%;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #e0f2e9;
}

.data-table th {
    background: #f1f8ee;
    color: #2e7d32;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.82rem;
    letter-spacing: 0.05em;
}

.data-table tbody tr:hover {
    background: #f7fff4;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Subtotal / "Total" rows from the operator's pivot sheet sit
 * inside the Allocation List as visual separators between banner
 * groups. We render them (so the operator can see what's been
 * tallied) but style them distinctly so they don't read as
 * regular activity rows. */
.data-table tbody tr.is-subtotal {
    background: #f3efe7;
    color: #6b5e3c;
    font-style: italic;
}

.data-table tbody tr.is-subtotal td {
    border-bottom-color: #d9d1bf;
}

.data-table tbody tr.is-subtotal:hover {
    background: #ece6d3;
}

/* Per-table sort strip + buttons. Each `.mfo-sort` group is wired
   independently to its own table + sort state in the page's JS. */
.mfo-sort {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.mfo-sort__label {
    font-weight: 600;
    color: #1f3d1f;
    font-size: 14px;
}

.mfo-sort__btn {
    padding: 6px 14px;
    border: 1px solid #2e7d32;
    background: #ffffff;
    color: #1f3d1f;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.mfo-sort__btn:hover,
.mfo-sort__btn:focus-visible {
    background: #f1f7ee;
    outline: none;
}

.mfo-sort__btn.is-active {
    background: #2e7d32;
    color: #ffffff;
}

.mfo-sort__btn.is-active:hover {
    background: #256628;
}

.mfo-sort__caret {
    font-size: 11px;
    line-height: 1;
}

/* ============================================================
   8. AMEFIP body, table, chart placeholder
   ============================================================ */

/* `infra` and `machineries` always use `mach-body--no-sidebar`
   which collapses to a single column. The base `.mach-body`
   selector is kept for future variants that may want a sidebar
   alongside the content. */
.mach-body {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

@media (max-width: 900px) {
    .mach-body {
        grid-template-columns: minmax(0, 1fr);
    }
}

.mach-body--no-sidebar {
    grid-template-columns: minmax(0, 1fr);
}

.mach-content {
    display: grid;
    gap: 14px;
}

.mach-content--full {
    width: 100%;
}

.mach-table-wrap {
    background: #ffffff;
    border: 1px solid #b6cba9;
    border-radius: 6px;
    overflow: hidden;
}
/* Narrow-viewport only: let wide tables scroll, and force a min-width
   so they consistently overflow below ~600px. Desktop (>=720px) keeps
   the natural table width. */
@media (max-width: 720px) {
    .mach-table-wrap {
        overflow-x: auto;
    }
    .mach-table-wrap > table {
        min-width: 600px;
    }
}

.mach-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.mach-table thead th {
    background: #ffffff;
    color: #1f1f1f;
    font-weight: 700;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #d7e7d1;
    letter-spacing: 0.04em;
    font-size: 0.78rem;
    white-space: nowrap;
}

.mach-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid #ecf3e6;
    color: #1f1f1f;
    vertical-align: middle;
}

.mach-table tbody tr:nth-child(even) {
    background: #f6fbf2;
}

.mach-table tbody tr:hover {
    background: #eef7e6;
}

.mach-col-num {
    text-align: center;
    white-space: nowrap;
}

/* Activity descriptions run long. Cap the column so the table doesn't
   push the other columns off-screen and force horizontal scroll —
   ellipsis signals the truncated text without hiding it. */
.mach-cell-activity {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mach-table-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 0 0 10px;
}

.mach-table-header h3 {
    margin: 0;
    color: #1f3d1f;
    font-size: 1rem;
    flex: 1 1 100%;
}

/* Compact pill toggle button used in `.mach-table-header` to switch
   between the default 1:1 sheet view and a rolled-up "compiled" view
   on the MFO list. The pressed state styles the dot green and tints
   the label so users can see at a glance whether the rollup is on. */
.mach-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid #b6cba9;
    border-radius: 999px;
    color: #1f3d1f;
    font-size: 0.85rem;
    padding: 4px 12px;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease;
}
.mach-toggle:hover,
.mach-toggle:focus-visible {
    border-color: #2e7d32;
    outline: none;
}
.mach-toggle__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #b6cba9;
    transition: background-color 120ms ease;
}
.mach-toggle[aria-pressed="true"] {
    background: #e8f5e9;
    border-color: #2e7d32;
}
.mach-toggle[aria-pressed="true"] .mach-toggle__dot {
    background: #2e7d32;
}

/* Section headers on /targets — colored green so the eye groups
   "Targets vs Accomplishment", "Monthly Accomplishment",
   "Beneficiaries", and "MFO List" as one family of chart blocks.
   Lives below the base `.mach-table-header h3` rule so it wins the
   cascade at the same specificity. The chart-section h2 covers the
   full-width "Targets vs Accomplishment" header above the MFO chart;
   the compact h3 covers the Monthly/Beneficiaries subheaders and the
   MFO List header. */
.chart-section > h2,
.chart-card--compact h3,
.mach-table-header h3 {
    color: #2e7d32;
}

.infra-chart-box {
    background: #ffffff;
    border: 1px solid #b6cba9;
    border-radius: 6px;
    padding: 14px 16px;
}

.infra-chart-box h3 {
    margin: 0 0 12px;
    color: #1f3d1f;
    font-size: 1rem;
}

.mach-chart-empty {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b6b6b;
    font-size: 0.9rem;
    font-style: italic;
}

/* ============================================================
   9. AMEFIP filter widgets (multi-select dropdown)
   ============================================================ */

.mach-filter-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 0 1 auto;
}

/* The /allocation filter card sits above the doughnut charts so the
   widgets are visible without scrolling. The .chart-box wrapper gives
   it a card frame; the override below loosens its header so the strip
   breathes a bit. */
.allocation-filter-card .chart-box-header {
    margin-bottom: 6px;
}

.mach-filter {
    position: relative;
    display: inline-block;
}

.mach-filter__button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid #b6cba9;
    border-radius: 999px;
    color: #1f3d1f;
    font-size: 0.85rem;
    padding: 4px 12px;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease;
}

.mach-filter__button:hover,
.mach-filter__button:focus-visible {
    border-color: #2e7d32;
    background: #f1f7ee;
    outline: none;
}

.mach-filter__button[aria-expanded="true"] {
    border-color: #2e7d32;
    background: #f1f7ee;
}

.mach-filter__label {
    color: #6b6b6b;
    font-weight: 600;
    margin-right: 2px;
}

.mach-filter__value {
    color: #1f3d1f;
    font-weight: 600;
}

.mach-filter__value--all {
    color: #2e7d32;
}

.mach-filter__value--partial {
    color: #c62828;
}

.mach-filter__value--none {
    color: #c62828;
    font-style: italic;
}

.mach-filter__caret {
    font-size: 0.7rem;
    line-height: 1;
}

.mach-filter__panel {
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    background: #ffffff;
    border: 1px solid #b6cba9;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(31, 61, 31, 0.12);
    z-index: 20;
    padding: 8px 0 6px;
}

.mach-filter__actions {
    display: flex;
    gap: 8px;
    padding: 0 12px 6px;
    border-bottom: 1px solid #e3eedd;
    margin-bottom: 4px;
}

.mach-filter__action {
    background: none;
    border: none;
    color: #2e7d32;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0;
}

.mach-filter__action:hover,
.mach-filter__action:focus-visible {
    text-decoration: underline;
    outline: none;
}

.mach-filter__list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
}

.mach-filter__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    font-size: 0.85rem;
    color: #1f3d1f;
    cursor: pointer;
}

.mach-filter__item:hover {
    background: #f1f7ee;
}

.mach-filter__item input[type="checkbox"] {
    accent-color: #2e7d32;
    cursor: pointer;
}

.mach-filter__empty {
    padding: 8px 12px;
    color: #6b6b6b;
    font-size: 0.82rem;
}

/* ============================================================
 * Homepage welcome banner
 * ------------------------------------------------------------
 * Public landing block on `home.blade.php`. Two-column layout
 * (copy + DA-CAR logo) on a flat green background. Underneath
 * sits a row of five stat cards (FY 2026 Targets, Total
 * Allocation, etc.) that pull live numbers from the dashboard
 * data service.
 * ============================================================ */
.welcome-banner {
    background: #1f5d2e;
    padding: 56px 22px 64px;
}

.welcome-banner__seal{
    background: transparent;
}

.welcome-banner__inner {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 28px;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.welcome-banner__copy {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.welcome-banner__eyebrow {
    color: #c8e6c9;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    margin: 0;
}

.welcome-banner__title {
    color: #ffffff;
    font-size: clamp(1.9rem, 4vw, 3rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: 0.005em;
    margin: 0;
    text-transform: uppercase;
}

.welcome-banner__subhead {
    color: #c8e6c9;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
}

.welcome-banner__lede {
    color: #e8f1e3;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
    max-width: 56ch;
}

.welcome-banner__cta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    padding-right: 10px;
}

.welcome-banner__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid transparent;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.welcome-banner__btn:hover,
.welcome-banner__btn:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
    outline: none;
}

.welcome-banner__btn--primary {
    background: #ffffff;
    color: #1f5d2e;
    border-color: #ffffff;
}

.welcome-banner__btn--primary:hover,
.welcome-banner__btn--primary:focus-visible {
    background: #f1f7ee;
    border-color: #f1f7ee;
}

.welcome-banner__btn--secondary {
    background: transparent;
    color: #ffffff;
    border-color: #ffffff;
}

.welcome-banner__btn--secondary:hover,
.welcome-banner__btn--secondary:focus-visible {
    background: rgba(255, 255, 255, 0.12);
}

.welcome-banner__btn-icon {
    font-size: 1rem;
    line-height: 1;
}

.welcome-banner__art {
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-banner__seal {
    width: clamp(160px, 22vw, 240px);
    height: auto;
    object-fit: contain;
    /* The DA-CAR logo is dark on transparent — give it a soft
       white halo so it reads against the green background. */
    background: #ffffff;
    padding: 14px;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

/* Stat-card row underneath the welcome banner. */
.home-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    max-width: 1200px;
    margin: -32px auto 28px;
    padding: 0 22px;
    position: relative;
    z-index: 2;
}

.home-stat {
    background: #ffffff;
    border: 1px solid #d6e1cd;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 14px rgba(31, 61, 31, 0.08);
}

.home-stat__icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #2e7d32;
    background: #eaf3e4;
}

.home-stat__body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.home-stat__label {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 1000;
    color: #6b6b6b;
    letter-spacing: 0.04em;
}

.home-stat__value {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 800;
    color: #1f1f1f;
    line-height: 1.1;
}

.home-stat__value--sm {
    font-size: 1rem;
}

.home-stat__sub {
    margin: 0;
    font-size: 0.75rem;
    color: #444343;
}

@media (max-width: 960px) {
    .welcome-banner__inner {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .welcome-banner__art {
        order: -1;
    }

    .home-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: -20px;
    }
}

@media (max-width: 520px) {
    .home-stats {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
 * Homepage — sections below the welcome banner + stat row.
 * ------------------------------------------------------------
 * The welcome banner keeps its own dark-green backdrop; every
 * section after it sits on a cream backdrop shared with the
 * inner pages (`#f0f0e0`). Each section is a white card on
 * cream with a 14px radius and a soft shadow, mirroring the
 * `.chart-box` look the inner pages use.
 * ============================================================ */
.home-page {
    background: #f0f0e0;
    padding: 36px 0 0;
}

.home-section {
    max-width: 1200px;
    margin: 0 auto 28px;
    padding: 0 22px;
}

.home-section__title {
    text-align: center;
    color: #1b5e20;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin: 0 0 18px;
    position: relative;
    padding-bottom: 10px;
}

.home-section__title::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 56px;
    height: 3px;
    background: #2e7d32;
    border-radius: 2px;
}

/* ---------- About (FOD + Vision / Mission / Role) ---------- */
.home-about {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 22px;
    align-items: stretch;
}

.home-about__copy,
.home-about__tagline,
.home-about__vm-card,
.home-footer-cards__about,
.home-footer-cards__contact,
.home-coverage__box {
    background: #ffffff;
    border-radius: 14px;
    padding: 22px 24px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    border: 1px solid #e6ead7;
}

.home-about__title {
    color: #2e7d32;
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0 0 14px;
}

.home-about__copy p {
    color: #2c2c2c;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 12px;
}

.home-about__copy p:last-child {
    margin-bottom: 0;
}

.home-about__right {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.home-about__vision-mission {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.home-about__vm-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px;
}

.home-about__vm-icon {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.home-about__vm-card--vision .home-about__vm-icon {
    background: #e8f5e9;
    color: #2e7d32;
}

.home-about__vm-card--mission .home-about__vm-icon {
    background: #fff4e0;
    color: #d18a1f;
}

.home-about__vm-title {
    color: #2e7d32;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 6px;
}

.home-about__vm-text {
    color: #2c2c2c;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.home-about__tagline-title {
    color: #2e7d32;
    font-size: 1rem;
    font-weight: 800;
    margin: 0 0 8px;
}

.home-about__tagline p {
    color: #2c2c2c;
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.6;
    margin: 0;
}

/* ---------- Explore the Dashboard (4 cards) ---------- */
.home-explore {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.home-explore-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 22px 22px 20px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    border: 1px solid #e6ead7;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.home-explore-card:hover,
.home-explore-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.1);
    outline: none;
}

.home-explore-card__icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.home-explore-card--targets .home-explore-card__icon {
    background: #e6f4ea;
    color: #2e7d32;
}

.home-explore-card--allocation .home-explore-card__icon {
    background: #fff4e0;
    color: #c47a17;
}

.home-explore-card--infra .home-explore-card__icon {
    background: #e3effb;
    color: #2f5fa6;
}

.home-explore-card--machineries .home-explore-card__icon {
    background: #efe6f7;
    color: #6a3aa1;
}

.home-explore-card__title {
    color: #1b5e20;
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
}

.home-explore-card__subtitle {
    color: #6b6b6b;
    font-size: 0.78rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.04em;
}

.home-explore-card__desc {
    color: #2c2c2c;
    font-size: 0.88rem;
    line-height: 1.5;
    margin: 6px 0 14px;
    flex: 1 1 auto;
}

.home-explore-card__cta {
    color: #2e7d32;
    font-size: 0.92rem;
    font-weight: 800;
    margin-top: auto;
}

/* ---------- Coverage (3 boxes) ---------- */
.home-coverage {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.home-coverage__box {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 14px;
    align-items: start;
}

.home-coverage__icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e8f5e9;
    color: #2e7d32;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.home-coverage__heading {
    color: #1b5e20;
    font-size: 1.05rem;
    font-weight: 800;
    margin: 4px 0 8px;
}

.home-coverage__text {
    color: #2c2c2c;
    width: 400px;
    display: flex;
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 0;
}

/* ---------- Footer-cards (About + Contact) ---------- */
.home-footer-cards {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 22px;
    align-items: stretch;
}

.home-footer-cards__about p {
    color: #2c2c2c;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 12px;
}

.home-footer-cards__about p:last-child {
    margin-bottom: 0;
}

.home-footer-cards__contact-agency {
    color: #2c2c2c;
    font-size: 0.92rem;
    line-height: 1.5;
    margin: 0 0 14px;
}

.home-meta-row {
    display: grid;
    grid-template-columns: 22px auto 1fr;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-top: 1px solid #eef0e6;
}

.home-meta-row:first-of-type {
    border-top: none;
    padding-top: 0;
}

.home-meta-row__icon {
    color: #2e7d32;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.home-meta-row__label {
    color: #6b6b6b;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

.home-meta-row__value {
    color: #1f1f1f;
    font-size: 0.92rem;
    text-align: right;
}

.home-cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.home-cta-row__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.home-cta-row__btn--primary {
    background: #2e7d32;
    color: #ffffff;
    border-color: #2e7d32;
}

.home-cta-row__btn--primary:hover,
.home-cta-row__btn--primary:focus-visible {
    background: #1b5e20;
    border-color: #1b5e20;
    outline: none;
}

.home-cta-row__btn--secondary {
    background: #ffffff;
    color: #2e7d32;
    border-color: #2e7d32;
}

.home-cta-row__btn--secondary:hover,
.home-cta-row__btn--secondary:focus-visible {
    background: #eaf3e4;
    outline: none;
}

/* ---------- Data Notice ---------- */
.home-data-notice {
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 14px;
    align-items: start;
    background: #fff7e6;
    border: 1px solid #f3d28a;
    border-radius: 12px;
    padding: 18px 22px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.home-data-notice__icon {
    color: #c47a17;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.home-data-notice__title {
    color: #8a5500;
    font-size: 1rem;
    font-weight: 800;
    margin: 0 0 6px;
}

.home-data-notice__body {
    color: #5a4317;
    font-size: 0.9rem;
    line-height: 1.55;
    margin: 0;
}

/* ---------- Site footer ---------- */
.site-footer {
    background: #1f5d2e;
    color: #ffffff;
    margin-top: 36px;
}

.site-footer__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 22px 22px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;
}

.site-footer__agency {
    color: #c8e6c9;
    font-size: 0.85rem;
    line-height: 1.5;
}

.site-footer__agency strong {
    color: #ffffff;
    font-size: 0.95rem;
}

.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    color: #c8e6c9;
    font-size: 0.85rem;
}

.site-footer__links a {
    color: #c8e6c9;
    text-decoration: none;
}

.site-footer__links a:hover,
.site-footer__links a:focus-visible {
    color: #ffffff;
    text-decoration: underline;
    outline: none;
}

.site-footer__copyright {
    color: #c8e6c9;
    font-size: 0.85rem;
    text-align: right;
}

/* ---------- Homepage responsive ---------- */

/* ---------- Contact Us (4 tiles) ---------- */
.home-contact-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.home-contact-card {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 14px;
    align-items: start;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #eef0e6;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.home-contact-card:hover,
.home-contact-card:focus-visible {
    border-color: #2e7d32;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.12);
    transform: translateY(-1px);
    outline: none;
}

.home-contact-card__icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e8f5e9;
    color: #2e7d32;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.home-contact-card__label {
    color: #1b5e20;
    font-size: 1.05rem;
    font-weight: 800;
    margin: 4px 0 6px;
}

.home-contact-card__value {
    color: #2c2c2c;
    font-size: 0.92rem;
    width: 400px;
    line-height: 1.5;
    margin: 0;
    word-break: break-word;
}

@media (max-width: 960px) {
    .home-about,
    .home-footer-cards {
        grid-template-columns: 1fr;
    }

    .home-about__vision-mission {
        grid-template-columns: 1fr 1fr;
    }

    .home-explore {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-coverage {
        grid-template-columns: 1fr;
    }

    .home-contact-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .site-footer__inner {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .site-footer__copyright,
    .site-footer__agency {
        text-align: center;
    }
}

@media (max-width: 520px) {
    .home-about__vision-mission {
        grid-template-columns: 1fr;
    }

    .home-explore {
        grid-template-columns: 1fr;
    }

    .home-contact-grid {
        grid-template-columns: 1fr;
    }

    .home-cta-row__btn {
        flex: 1 1 100%;
        text-align: center;
    }
}

/* ============================================================
   Admin section (Users + Activity Log tabs).
   Section-header + tab nav + panel pattern shared by every
   admin page. Pages inside the .admin-panel slot are page-local.
   ============================================================ */

.admin-page {
    max-width: 1100px;
    margin: 32px auto;
    padding: 0 24px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.admin-header {
    margin-bottom: 16px;
}

.admin-header h1 {
    margin: 0 0 4px;
    color: #2e7d32;
}

.admin-page__lede {
    margin: 0 0 18px;
    color: #4f5d4f;
    font-size: 0.95rem;
    line-height: 1.5;
}

.admin-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #eef3ed;
    margin-bottom: 20px;
    /* Pin the section tabs below the navbar so switching between
       Users / Activity Log / Downloads is one click away while
       scrolling a long table. Sits under the navbar's z-index
       so the navbar still wins the top strip. */
    position: sticky;
    top: 73px;
    /* 73px ≈ the rendered height of the navbar + its 2px border.
       Hard-coded because the navbar's height is fixed by the
       header's flex padding (1rem 2rem + 1.6rem font line). */
    z-index: 999;
    background: #f5f9f2;
}

.admin-tab {
    padding: 10px 18px;
    text-decoration: none;
    color: #4f5d4f;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px 8px 0 0;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.admin-tab:hover,
.admin-tab:focus-visible {
    background: #f1f8f3;
    color: #2e7d32;
    outline: none;
}

.admin-tab--active {
    color: #2e7d32;
    border-bottom-color: #2e7d32;
    background: #f1f8f3;
}

.admin-flash {
    background: #e6f4ea;
    color: #1b5e20;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.admin-panel {
    background: transparent;
}

.admin-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.admin-back {
    display: inline-block;
    margin-bottom: 12px;
    color: #2e7d32;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.admin-back:hover,
.admin-back:focus-visible {
    text-decoration: underline;
    outline: none;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eef3ed;
    font-size: 0.92rem;
}

.admin-table th {
    background: #f4f9f3;
    color: #2e7d32;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-table tbody tr:last-child td {
    border-bottom: 0;
}

.admin-sheet-cell {
    font-size: 0.9rem;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-muted {
    color: #888;
    font-style: italic;
}

.admin-badge {
    display: inline-block;
    background: #2e7d32;
    color: white;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: middle;
}

.admin-role {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-role--super {
    background: #1b5e20;
    color: #ffffff;
}

.admin-role--admin {
    background: #c8e6c9;
    color: #1b5e20;
}

.admin-role--editor {
    background: #eef3ed;
    color: #4f5d4f;
}

.admin-button {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.admin-button--primary {
    background: #2e7d32;
    color: white;
}

.admin-button--primary:hover,
.admin-button--primary:focus-visible {
    background: #1b5e20;
    outline: none;
}

.admin-button--small {
    background: #f1f8f3;
    color: #2e7d32;
    padding: 6px 12px;
    font-size: 0.85rem;
}

.admin-button--small:hover,
.admin-button--small:focus-visible {
    background: #eaf3e4;
    outline: none;
}

.admin-button--danger {
    background: #c62828;
    color: white;
}

.admin-button--danger:hover,
.admin-button--danger:focus-visible {
    background: #a12020;
    outline: none;
}

.admin-pagination {
    margin-top: 20px;
}

.admin-errors {
    background: #fde8e8;
    color: #b42318;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.admin-errors p {
    margin: 0;
}

.admin-form {
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.admin-field {
    margin-bottom: 20px;
}

.admin-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.admin-field input[type=text],
.admin-field input[type=email],
.admin-field input[type=password],
.admin-field input[type=url],
.admin-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c8e6c9;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 0.95rem;
    background: white;
    font-family: inherit;
}

.admin-field input:disabled,
.admin-field select:disabled {
    background: #f4f9f3;
    color: #6b6b6b;
    cursor: not-allowed;
}

.admin-optional {
    color: #888;
    font-weight: 400;
    font-size: 0.85rem;
}

.admin-hint {
    color: #666;
    font-size: 0.85rem;
    margin: 6px 0 0;
}

.admin-hint code {
    background: #eef3ed;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.85em;
}

.admin-field-error {
    color: #b42318;
    font-size: 0.85rem;
    margin: 6px 0 0;
}

.admin-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 24px;
}

.admin-danger-zone {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #eef3ed;
}

.admin-locked-note {
    margin-top: 32px;
    padding: 12px 16px;
    background: #f4f9f3;
    border-radius: 6px;
    color: #555;
    font-size: 0.9rem;
}

.admin-locked-note code {
    background: #eef3ed;
    padding: 1px 6px;
    border-radius: 3px;
}

.activity-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #eef3ed;
    border-radius: 8px;
}

.activity-filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4f5d4f;
}

.activity-filters input,
.activity-filters select {
    padding: 6px 10px;
    border: 1px solid #c8e6c9;
    border-radius: 6px;
    font-size: 0.9rem;
    min-width: 180px;
}

.activity-filters button {
    align-self: end;
    padding: 8px 14px;
    background: #2e7d32;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.activity-filters__reset {
    align-self: end;
    font-size: 0.85rem;
    color: #4f5d4f;
}

.activity-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    font-size: 0.85rem;
}

.activity-table th,
.activity-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #eef3ed;
    vertical-align: top;
}

.activity-table th {
    background: #f4f9f3;
    color: #2e7d32;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.activity-table code {
    background: #eef3ed;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
}

.activity-table summary {
    cursor: pointer;
    color: #2e7d32;
    font-weight: 600;
}

.activity-table pre {
    margin-top: 6px;
    padding: 8px;
    background: #f8fbf6;
    border-radius: 4px;
    font-size: 0.75rem;
    max-width: 420px;
    overflow: auto;
}

.activity-empty {
    text-align: center;
    padding: 24px;
    color: #6b6b6b;
    font-style: italic;
}

.activity-pagination {
    margin-top: 20px;
}

@media (max-width: 720px) {
    .admin-page {
        padding: 0 14px;
    }

    .admin-tabs {
        overflow-x: auto;
    }

    .activity-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .activity-filters input,
    .activity-filters select {
        min-width: 0;
    }
}

/* ---------------------------------------------------------------
 * Editor section — Phase 2 §C.
 *
 * Mirrors the `.admin-*` BEM discipline: `--kebab-case` blocks,
 * `__element` parts, `--modifier` variants. Reuses the same colour
 * and spacing tokens the admin module relies on so the two panels
 * feel like the same product.
 * ------------------------------------------------------------- */

.editor-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.editor-header {
    margin: 24px 0 8px;
}

.editor-page__lede {
    color: #5d6066;
    margin: 4px 0 16px;
}

.editor-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e3e6ea;
    margin-bottom: 16px;
}

.editor-tab {
    padding: 8px 14px;
    border: 1px solid #e3e6ea;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: #f6f7f9;
    color: #1d2330;
    text-decoration: none;
    font-weight: 500;
}

.editor-tab:hover {
    background: #eef0f3;
}

.editor-tab--active {
    background: #ffffff;
    border-color: #1f6feb;
    color: #1f6feb;
}

.editor-needs-attention-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #d83a3a;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
}

.editor-flash {
    background: #e8f5ec;
    border: 1px solid #b6dec0;
    color: #1f5132;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 14px;
}

.editor-panel {
    background: #ffffff;
    border: 1px solid #e3e6ea;
    border-radius: 0 6px 6px 6px;
    padding: 18px;
}

.editor-dashboard p {
    color: #4b4f56;
    line-height: 1.5;
}

.editor-placeholder {
    background: #fff8e1;
    border: 1px solid #f0d479;
    color: #5e4a17;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.editor-sheet-ops {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #eef0f3;
}

.editor-sheet-ops__heading {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px;
    color: #1d2330;
}

.editor-sheet-ops__row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.editor-sheet-ops__form {
    background: #f6f7f9;
    border: 1px solid #eef0f3;
    border-radius: 6px;
    padding: 12px 14px;
}

.editor-sheet-ops__form .editor-form__label {
    font-weight: 500;
    margin-bottom: 8px;
}

.editor-table-wrap {
    overflow-x: auto;
}

.editor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.editor-table th,
.editor-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eef0f3;
    text-align: left;
    vertical-align: top;
}

.editor-table thead th {
    background: #f6f7f9;
    font-weight: 600;
    color: #1d2330;
}

/* ============================================================
   Member area — /member hub + three subpages.
   Phase 5: the styles that used to live inline in
   resources/views/member.blade.php live here now so the four
   subpages can share them without duplicating <style> blocks.
   ============================================================ */

.member-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f4f9f3;
}

.member-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 28px;
    background: white;
    border-bottom: 1px solid #d6e8d4;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    flex-wrap: wrap;
}

.member-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.member-back-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    background: transparent;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
    text-decoration: none;
    transition: transform 0.05s ease, box-shadow 0.15s ease;
}

.member-back-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.member-back-button:focus-visible {
    outline: 2px solid #2e7d32;
    outline-offset: 2px;
}

.member-header h1 {
    margin: 0;
    color: #2e7d32;
    font-size: 1.35rem;
}

.member-header .welcome {
    color: #666;
    margin: 0;
    font-size: 0.9rem;
}

.member-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.member-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    text-decoration: none;
    font-size: 0.95rem;
    transition: transform 0.05s ease, box-shadow 0.15s ease;
}

.member-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.member-button--primary {
    background: #2e7d32;
    color: white;
}

.member-button--ghost {
    background: transparent;
    color: #b42318;
    border: 1px solid #f4c7c3;
}

.member-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/*
 * Member-area main stage. The sidebar was dropped once the sub-tab
 * strip started pointing at the same four member-wrapped URLs — leaving
 * the body as a single centred column.
 */
.member-body {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

/*
 * Public-page export button. Shown next to the page title or above the
 * filters depending on which page it lives on. Hidden when the user is
 * not logged in (the partial uses @auth/@guest).
 */
.public-export-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.05s ease, box-shadow 0.15s ease;
}

.public-export-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.public-export-button--primary {
    background: #2e7d32;
    color: white;
}

/*
 * On `/targets` the Filters section uses a `.targets-filters__header`
 * flex container so the button can sit to the right of the title.
 */
.targets-filters__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.targets-filters__header h2 {
    margin: 0;
}

.mach-banner-export {
    margin: 12px 0 0;
}

/*
 * `/allocation` puts the export button in its own strip directly below
 * the welcome banner and above the chart grid, so it reads as a single
 * CTA (not competing with the filter row on the list pages).
 */
.public-export-button-row {
    display: flex;
    justify-content: center;
    margin: -4px 0 18px;
}

.public-export-button-row .public-export-button {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/*
 * On `/infra` and `/machineries` the export button sits in the same
 * `.mach-table-header` flex row as the filter pills so it doesn't take
 * up its own full-width line. Margin-left:auto pins it to the right
 * edge of the row.
 */
.mach-table-header .public-export-button {
    margin-left: auto;
}

.mach-table-header .public-export-button {
    padding: 8px 14px;
    font-size: 0.9rem;
}

/*
 * Dropdown variant — shown on `/targets` and `/allocation` once each
 * page got per-format exports. Anchor sits in the same spot as the
 * single-link version so callers don't need to know which mode
 * they're getting; the menu pops below, right-aligned.
 */
.public-export-dropdown {
    position: relative;
    display: inline-block;
}

.public-export-button__caret {
    margin-left: 4px;
    font-size: 0.8em;
    line-height: 1;
}

/*
 * Tab strip — opens directly under the green Download CSV button.
 * Styled like the bottom tab bar of LibreOffice Calc / Excel: dark
 * background, white text, underline on the active tab. Operators are
 * used to this layout, so it lowers the cognitive load of picking a
 * format. Each tab is a direct download link — click triggers the
 * browser's download flow and the strip closes immediately.
 */
.public-export-tabs {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    display: flex;
    gap: 0;
    margin: 0;
    padding: 0;
    background: #1f3b1f;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    z-index: 50;
    /* Drop the strip onto its own line if the dropdown is narrower
       than the tab row so 6-tab allocation doesn't push it off-screen. */
    flex-wrap: wrap;
    justify-content: flex-end;
}

.public-export-tab {
    display: inline-block;
    padding: 9px 14px;
    color: #ffffff;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.public-export-tab:hover,
.public-export-tab:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.public-export-tab--active {
    background: rgba(255, 255, 255, 0.04);
    border-bottom-color: #7cc47f;
}

/* xlsx entry sits at the tail of the strip and is visually set apart
   with a left border so the user can tell it produces a different
   format (multi-tab workbook) from the per-section CSVs. */
.public-export-tab--xlsx {
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    color: #cfe6d0;
}

/* Narrow-viewport body padding. Sidebar dropped alongside its mobile rules. */
@media (max-width: 720px) {
    .member-body {
        padding: 16px;
    }
}

/*
 * Hub landing card grid — three up on desktop, one per row on
 * mobile. Each card is a click target that links to a subpage.
 */
.member-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    padding: 24px;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

.member-hub-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 24px;
    background: white;
    border: 1px solid #d6e8d4;
    border-radius: 12px;
    text-decoration: none;
    color: #1f3d1f;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.member-hub-card:hover,
.member-hub-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
    border-color: #2e7d32;
    outline: none;
}

.member-hub-card--disabled,
.member-hub-card--disabled:hover,
.member-hub-card--disabled:focus-visible {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    border-color: #d6e8d4;
}

.member-hub-card__icon {
    font-size: 1.8rem;
    line-height: 1;
}

.member-hub-card__title {
    margin: 4px 0 0 0;
    color: #2e7d32;
    font-size: 1.05rem;
}

.member-hub-card__desc {
    margin: 0;
    color: #4f5d4f;
    font-size: 0.9rem;
    line-height: 1.45;
}

.member-hub-card__cta {
    margin-top: 8px;
    color: #2e7d32;
    font-weight: 700;
    font-size: 0.9rem;
}

.member-hub-card--disabled .member-hub-card__cta {
    color: #8a6c6a;
}

/*
 * Warning / flash banner — surfaced at the top of the stage when
 * EnsureUserHasSheetUrl bounced the user back. Reuses the green
 * palette so it fits the member-header hue without feeling like
 * an error.
 */
.member-warning {
    max-width: 1280px;
    margin: 16px auto 0;
    padding: 12px 16px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    color: #6b4f00;
    font-size: 0.92rem;
    line-height: 1.4;
}

/*
 * Stage — used by `/member/sheets`, `/member/dashboard`, and
 * `/member/exports` as the `<main>` container. Padding matches
 * the hub's `.member-hub-grid` so the four pages line up.
 */
.member-stage {
    flex: 1;
    padding: 24px;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

.member-section {
    background: white;
    border-radius: 12px;
    border: 1px solid #d6e8d4;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.member-section h2 {
    margin: 0 0 4px 0;
    color: #2e7d32;
    font-size: 1.2rem;
}

.member-section__meta {
    margin: 0 0 16px 0;
    color: #6a7a6a;
    font-size: 0.85rem;
}

.member-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.member-kpi {
    background: #f4f9f3;
    border-radius: 8px;
    padding: 12px 16px;
    border: 1px solid #d6e8d4;
}

.member-kpi__label {
    display: block;
    color: #6a7a6a;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 700;
}

.member-kpi__value {
    display: block;
    color: #1b5e20;
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 4px;
}

.member-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.member-table th,
.member-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #e7eee7;
    text-align: left;
    vertical-align: top;
}

.member-table th {
    background: #f4f9f3;
    color: #1b5e20;
    font-weight: 700;
}

.member-table tr.is-subtotal {
    background: #f7fbf7;
    font-weight: 600;
}

.member-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.member-table-wrap {
    overflow-x: auto;
    border: 1px solid #e7eee7;
    border-radius: 8px;
    margin-bottom: 16px;
}

.member-empty {
    padding: 24px;
    text-align: center;
    color: #999;
    background: #fafdfa;
    border-radius: 8px;
    border: 1px dashed #d6e8d4;
    margin-bottom: 16px;
}

/*
 * Sheets subpage — full-viewport iframe card.
 */
.sheet-frame {
    width: 100%;
    height: calc(100vh - 140px);
    min-height: 480px;
    border: 1px solid #d6e8d4;
    border-radius: 12px;
    background: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.sheet-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.sheet-empty {
    padding: 40px 24px;
    text-align: center;
    color: #555;
    background: #fafdfa;
    border-radius: 12px;
    border: 1px dashed #d6e8d4;
}

/* Card below the iframe that explains the fallback CTA. Previously
   unstyled, so the h2/p/button rendered as a flush left-aligned block. */
.sheet-card {
    max-width: 960px;
    margin: 28px auto 0;
    padding: 20px 24px;
    background: #ffffff;
    border: 1px solid #d6e8d4;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.sheet-card h2 {
    margin: 0 0 8px;
    color: #2e7d32;
    font-size: 1.1rem;
}

.sheet-card p {
    margin: 0 0 14px;
    color: #555;
    line-height: 1.55;
}

.sheet-card .member-button {
    display: inline-flex;
    align-items: center;
}

.sheet-empty h2 {
    margin: 0 0 8px 0;
    color: #2e7d32;
}

.sheet-empty p {
    margin: 0 auto 16px;
    max-width: 480px;
    line-height: 1.5;
}

.sheet-empty code {
    background: #f4f9f3;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

/*
 * Logout confirmation modal — shared across all four subpages.
 * Lives once at the bottom of the layout so any "Logout" button
 * can open it without duplicating the markup.
 */
.logout-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 30, 18, 0.55);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

body.modal-open .logout-modal {
    opacity: 1;
    pointer-events: auto;
}

.logout-modal-card {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 16px;
    padding: 28px 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    transform: translateY(8px);
    transition: transform 0.15s ease;
}

body.modal-open .logout-modal-card {
    transform: translateY(0);
}

.logout-modal-card h2 {
    margin: 0 0 8px 0;
    color: #2e7d32;
    font-size: 1.5rem;
}

.logout-modal-card p {
    margin: 0 0 20px 0;
    color: #555;
    line-height: 1.5;
}

.logout-modal-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.logout-modal-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 140px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: transform 0.05s ease, box-shadow 0.15s ease;
}

.logout-modal-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.logout-modal-button--primary {
    background: #2e7d32;
    color: white;
}

.logout-modal-button--ghost {
    background: transparent;
    color: #555;
    border: 1px solid #ddd;
}

.logout-modal-button:focus-visible {
    outline: 2px solid #2e7d32;
    outline-offset: 2px;
}

.editor-table__num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.editor-table__flag {
    width: 70px;
    text-align: center;
}

/* Phase 3 — CSV export form. One section per public page; one
   multi-select <select> per filterable column. Auto-submits on
   change so the URL stays in sync with the on-screen widgets. */
.csv-export {
    margin: 24px 0;
    padding: 16px 18px;
    background: #fafbfc;
    border: 1px solid #eef0f3;
    border-radius: 6px;
}

.csv-export__title {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1d2330;
}

.csv-export__hint {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #5a6376;
}

.csv-export__form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 16px;
    align-items: start;
}

.csv-export__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.csv-export__label {
    font-size: 12px;
    font-weight: 600;
    color: #1d2330;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.csv-export__select {
    width: 100%;
    min-height: 120px;
    padding: 6px;
    border: 1px solid #d8dbe0;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    background: #fff;
}

.csv-export__button {
    align-self: end;
    padding: 8px 14px;
    background: #1f6feb;
    color: #fff;
    border: 0;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.csv-export__button:hover {
    background: #1a5fcc;
}

.editor-table__actions {
    width: 80px;
    text-align: right;
}

.editor-button--small {
    padding: 4px 10px;
    font-size: 12px;
    background: #ffffff;
    color: #1f6feb;
    border-color: #1f6feb;
}

.editor-button--small:hover {
    background: #eef3fb;
}

.editor-table__empty {
    text-align: center;
    color: #6b6b6b;
    font-style: italic;
    padding: 24px;
}

.editor-table__row--dirty {
    background: #fff8e1;
}

.editor-table__row--error {
    background: #fdecec;
}

.editor-action-row {
    margin: 16px 0 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.editor-button {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
}

.editor-button--primary {
    background: #1f6feb;
    color: #ffffff;
    border-color: #1f6feb;
}

.editor-button--primary:hover {
    background: #1859c2;
    border-color: #1859c2;
}

.editor-button--danger {
    background: #d83a3a;
    color: #ffffff;
    border-color: #d83a3a;
}

.editor-button--danger:hover {
    background: #b62a2a;
    border-color: #b62a2a;
}

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 720px;
}

.editor-form--danger {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #e3e6ea;
}

.editor-form__divider {
    border: none;
    border-top: 1px solid #e3e6ea;
    margin: 24px 0;
}

.editor-form__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.editor-form__field--split {
    flex-direction: row;
    gap: 18px;
}

.editor-form__field--split > div {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.editor-form__label {
    font-weight: 600;
    font-size: 13px;
    color: #1d2330;
}

.editor-form__input {
    padding: 8px 10px;
    border: 1px solid #cccfd4;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

.editor-form__input:focus {
    outline: 2px solid #1f6feb;
    outline-offset: 1px;
}

.editor-form__error {
    color: #b62a2a;
    font-size: 12px;
    margin: 4px 0 0;
}

.editor-form__actions {
    display: flex;
    gap: 8px;
    margin: 8px 0 0;
    flex-wrap: wrap;
}

.editor-form__warning {
    background: #fdecec;
    border: 1px solid #f0b9b9;
    color: #6c1b1b;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin: 0 0 10px;
}

@media (max-width: 720px) {
    .editor-page {
        padding: 0 14px;
    }

    .editor-tabs {
        overflow-x: auto;
    }

    .editor-table {
        font-size: 13px;
    }

    .editor-form__field--split {
        flex-direction: column;
    }
}

/* ============================================================
   Phase 6 — per-program filtering UI bits
   ============================================================ */

/* Subtle "showing rows for program X" indicator above the four
   sections on `/member/dashboard` and `/member/exports`. Intentionally
   green-not-warning — the user is supposed to be filtered to their
   program, this just makes it visible. */
.member-program-banner {
    background: #eef5ed;
    border: 1px solid #c6dec1;
    border-radius: 6px;
    padding: 0.6rem 1rem;
    margin: 0 0 1rem;
    color: #2D6B43;
    font-size: 0.95rem;
}
.member-program-banner strong {
    font-weight: 600;
}

/* Yellow-ish callout that explains why admin/operations users see
   an empty dataset on `/member/dashboard`. Renders above the hub
   card grid. */
.member-callout {
    background: #fff7e6;
    border: 1px solid #f3d28a;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin: 0 0 1.5rem;
    color: #5a4317;
}
.member-callout strong {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
}
.member-callout p {
    margin: 0;
    line-height: 1.5;
}

/* ============================================================
   Member tabs + Extract subpage
   ============================================================ */

/* Top tab strip — sits below the header, above the warning
   banner. Active tab uses the same green as the page title. */
.member-tabs {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    margin: 0;
    border-bottom: 1px solid #d6e8d4;
    background: #f7fbf6;
}
.member-tabs__link {
    padding: 10px 18px;
    color: #4a6b4a;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}
.member-tabs__link:hover {
    color: #2e7d32;
}
.member-tabs__link--active {
    color: #2e7d32;
    border-bottom-color: #2e7d32;
}

/* Sub-section strip — anchored links inside the dashboard view
   (Physical / Allocation / Infra / Machineries). Visually slightly
   inset so users see it as a child of the top strip. */
.member-subtabs {
    display: flex;
    gap: 4px;
    padding: 0 36px;
    margin: 0;
    border-bottom: 1px solid #d6e8d4;
    background: white;
    justify-content: flex-end;
}
.member-subtabs__link {
    padding: 8px 14px;
    color: #6a8a6a;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.member-subtabs__link:hover {
    color: #2e7d32;
}
.member-subtabs__link--active {
    color: #2e7d32;
    border-bottom-color: #2e7d32;
}

/* Extract subpage — one section per export endpoint. Each
   section hosts one form per endpoint with two submit buttons
   (CSV + xlsx) that flip the action via `formaction`. */
.member-extract-section {
    margin-bottom: 24px;
}
.member-extract-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: #fafdfa;
    border: 1px solid #d6e8d4;
    border-radius: 10px;
    margin-top: 16px;
}
.member-extract-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.member-extract-fieldset {
    border: 1px solid #d6e8d4;
    border-radius: 8px;
    padding: 8px 12px 10px;
    margin: 0;
    background: white;
}
.member-extract-fieldset legend {
    padding: 0 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a6b4a;
    text-transform: capitalize;
}
.member-extract-checks {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 4px 12px;
    max-height: 160px;
    overflow-y: auto;
}
.member-extract-checks label {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 0.85rem;
    color: #1f3d1f;
}
.member-extract-checks input[type="checkbox"] {
    margin: 0;
}
.member-extract-actions {
    display: flex;
    justify-content: flex-end;
}
.member-extract-checks__all {
    grid-column: 1 / -1;
    border-bottom: 1px solid #d6e8d4;
    margin-bottom: 4px;
    padding-bottom: 4px;
}
.member-extract-checks__all label {
    font-weight: 600;
    color: #4a6b4a;
}

/*
 * Member area on tablet/phone. 720px matches the existing editor/admin
 * tab-strip patterns — keep this consistent if a future task needs to
 * retune the breakpoint.
 */
@media (max-width: 720px) {
    .member-header {
        padding: 12px 16px;
        gap: 10px;
    }
    .member-header-left {
        gap: 10px;
    }
    .member-header h1 {
        font-size: 1.1rem;
    }
    .member-header .welcome {
        font-size: 0.82rem;
    }
    .member-actions {
        margin-left: auto;
    }
    .member-button {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    /* Top + sub tab strips scroll horizontally on narrow viewports.
       Same shape as `.editor-tabs { overflow-x: auto }` further up. */
    .member-tabs,
    .member-subtabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    .member-tabs__link,
    .member-subtabs__link {
        white-space: nowrap;
        flex-shrink: 0;
    }
    /* Sub-tab strip is right-aligned on desktop; left-align on phone
       so the active tab is visible without scrolling first. */
    .member-subtabs {
        justify-content: flex-start;
    }
}