/* ═══════════════════════════════════════════════════════════════════════════
   AgriTrack — Application Styles
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --at-primary: #1a3a2a; /* dark navy */
    --at-accent: #2e7d32; /* forest green */
    --at-warning: #f9a825;
    --at-danger: #c62828;
    --at-header-h: 52px;
    --at-sidebar-w: 180px;
    --at-row-yellow: #ffffcc;
    --at-row-grey: #d0d0d0;
    --at-row-blue: #cceeff;
}

/* ── Reset / base ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    font-size: 13px;
    background: #f0f0f0;
}

/* ── Page shell ───────────────────────────────────────────────────────────── */
.page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.app-header {
    height: var(--at-header-h);
    background: var(--at-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    flex-shrink: 0;
    border-bottom: 2px solid var(--at-accent);
}

.brand-name {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.brand-sub {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.65);
    margin-left: 0.75rem;
}

/* header-center removed - Select Contract moved to toolbar */

/* Full-width layout — no sidebar */
.main-content-full {
    flex: 1;
    overflow: hidden;
    padding: 1rem 1rem 0 1rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: calc(100vh - var(--at-header-h));
    max-height: calc(100vh - var(--at-header-h));
}

/* ── Sidebar layout ───────────────────────────────────────────────────────── */
.sidebar-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.4rem;
    gap: 3px;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: auto; /* pushes to the bottom */
    padding-top: 0.5rem;
}

.sidebar-section-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.4);
    padding: 0.3rem 6px 0.1rem;
}

.sidebar-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: rgba(255,255,255,0.08);
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 3px;
    padding: 5px 10px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none !important;
}

    .sidebar-btn:hover,
    .sidebar-btn.active {
        background: #2e7d32;
        border-color: #388e3c;
        color: #fff !important;
    }

.sidebar-divider {
    border-color: rgba(255,255,255,0.2);
    margin: 0.3rem 0;
}

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-page {
    background: var(--at-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-wrap {
    width: 100%;
    max-width: 380px;
    padding: 1rem;
}

.login-card {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--at-primary);
    letter-spacing: 0.05em;
}

.login-subtitle {
    font-size: 0.8rem;
    color: #666;
}

/* ── Cards / panels ───────────────────────────────────────────────────────── */
.panel {
    border: 1px solid #bbb;
    border-radius: 3px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.panel-header {
    background: var(--at-primary);
    color: #fff;
    padding: 4px 8px;
    font-weight: 600;
    font-size: 0.7rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.panel-body {
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
    min-height: 0;
    height: 0;
}

/* ── Contract header bar ──────────────────────────────────────────────────── */
.contract-info-bar {
    display: grid;
    grid-template-columns: 200px 1fr 1fr 240px;
    gap: 0;
    background: #e8e8e8;
    border: 2px solid #888;
    border-radius: 3px;
    margin-bottom: 6px;
    font-size: 0.7rem;
}

.contract-info-col {
    padding: 6px 10px;
}

    .contract-info-col:not(:last-child) {
        border-right: 2px solid #888;
    }

/* Vertical separator between fert metrics and billed metrics in totals table */
.totals-table .t-separator {
    border-left: 2px solid #888;
    padding-left: 10px;
}

.info-label {
    color: #555;
    font-weight: 500;
}

.info-value {
    font-weight: 600;
    color: #000;
}

.info-blue {
    color: #2d6a1f;
    font-weight: 700;
}

.info-red {
    color: #cc0000;
    font-weight: 700;
}

.info-green {
    color: #006600;
    font-weight: 700;
}

/* ── Summary totals table ─────────────────────────────────────────────────── */
.totals-table {
    font-size: 0.8rem;
    width: 100%;
    border-collapse: collapse;
}

    .totals-table td {
        padding: 1px 6px;
    }

    .totals-table .t-label {
        color: #444;
        white-space: nowrap;
    }

    .totals-table .t-val {
        text-align: right;
        font-weight: 700;
        color: #2d6a1f;
        min-width: 70px;
    }

/* ── Fert radio buttons ───────────────────────────────────────────────────── */
.fert-selector {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 8px;
}

.fert-radio {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    cursor: pointer;
}

    .fert-radio input {
        margin: 0;
        cursor: pointer;
    }

/* ── Main grid layout: fert selector + grids ─────────────────────────────── */
.main-grid {
    display: grid;
    grid-template-columns: 140px minmax(0,1fr) minmax(0,1fr);
    gap: 4px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.fert-col {
    grid-column: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.stands-col {
    grid-column: 2;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tickets-col {
    grid-column: 3;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.fert-col {
    grid-column: 1;
    grid-row: 1 / 3;
}

.stands-col {
    grid-column: 2;
    grid-row: 1 / 3;
}

.tickets-col {
    grid-column: 3;
    grid-row: 1 / 3;
}

/* ── Stand / ticket tables ────────────────────────────────────────────────── */
.grid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

    .grid-table th {
        background: #c8c8c8;
        border: 1px solid #aaa;
        padding: 2px 4px;
        text-align: center;
        white-space: nowrap;
        position: sticky;
        top: 0;
        z-index: 1;
    }

    .grid-table td {
        border: 1px solid #ddd;
        padding: 1px 4px;
        white-space: nowrap;
        text-align: center;
    }

/* Stand row colors matching FoxPro original */
.row-incomplete {
    background: var(--at-row-yellow);
}

.row-complete {
    background: #ccffcc;
}

.row-billed {
    background: var(--at-row-grey);
    color: #666;
}

/* Ticket row colors */
.row-unbilled {
    background: #ccffff;
}

.row-tkt-billed {
    background: var(--at-row-grey);
    color: #666;
}

.row-last {
    background: var(--at-row-blue);
}

/* Checkbox column */
.chk-col {
    width: 22px;
    text-align: center;
    cursor: pointer;
}

/* ── Action toolbar ───────────────────────────────────────────────────────── */
.action-toolbar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    padding: 4px 0;
    margin-bottom: 4px;
}

    .action-toolbar .btn {
        font-size: 0.78rem;
        padding: 2px 10px;
    }

    /* sidebar-btn inside toolbar needs dark text on light background */
    .action-toolbar .sidebar-btn {
        background: #fff;
        color: #1a3a2a !important;
        border: 1px solid #bbb;
        border-radius: 4px;
        padding: 2px 10px;
        font-size: 0.78rem;
        width: auto;
        display: inline-block;
        text-align: center;
    }

        .action-toolbar .sidebar-btn:hover {
            background: #e8f5e9;
            border-color: #2e7d32;
            color: #2e7d32 !important;
        }

/* ── Modal / dialog ───────────────────────────────────────────────────────── */
.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.dialog {
    background: #fff;
    border-radius: 4px;
    padding: 1.25rem;
    min-width: 300px;
    max-width: 520px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

    .dialog h6 {
        margin-bottom: 0.75rem;
        font-weight: 600;
    }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.btn-xs {
    padding: 1px 6px !important;
    font-size: 0.72rem !important;
}

.text-blue {
    color: #2d6a1f;
}

.text-red {
    color: #cc0000;
}

/* ── Blazor error UI ──────────────────────────────────────────────────────── */
#blazor-error-ui {
    background: #ffe0e0;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 1rem;
    position: fixed;
    display: none;
    z-index: 9999;
}

/* ── Select Contract Modal ────────────────────────────────────────────────── */

.select-contract-modal {
    background: #fff;
    border-radius: 6px;
    width: 900px;
    max-width: 96vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    overflow: hidden;
}

.select-contract-header {
    background: var(--at-primary);
    color: #fff;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

    .modal-close-btn:hover {
        color: #fff;
    }

.select-contract-list {
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
}

/* Table layout for contract list */
.select-contract-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
}

    .select-contract-table thead tr {
        background: #e8eaf0;
        position: sticky;
        top: 0;
        z-index: 1;
    }

    .select-contract-table th {
        padding: 7px 10px;
        text-align: left;
        font-weight: 600;
        color: #333;
        border-bottom: 2px solid #ccc;
        white-space: nowrap;
    }

.select-contract-row {
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid #eee;
}

    .select-contract-row:hover {
        background: #e8f5e9;
    }

    .select-contract-row:last-child {
        border-bottom: none;
    }

.select-contract-table td {
    padding: 7px 10px;
    vertical-align: middle;
    white-space: nowrap;
}

.contract-closed {
    opacity: 0.55;
}

.select-contract-footer {
    padding: 10px 16px;
    border-top: 1px solid #eee;
    background: #f8f8f8;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* ── Shared modal styles (at-modal) ──────────────────────────────────────── */

.at-modal {
    background: #fff;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    overflow: hidden;
    width: 100%;
}

.at-modal-header {
    background: var(--at-primary);
    color: #fff;
    padding: 9px 14px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.at-modal-body {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

.at-modal-footer {
    padding: 8px 14px;
    border-top: 1px solid #e0e0e0;
    background: #f8f8f8;
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* ── Inline grid select (AID dropdown in maps grid) ──────────────────────── */
.grid-select {
    font-size: 0.75rem;
    padding: 1px 2px;
    height: auto;
    border: 1px solid #ccc;
    border-radius: 2px;
    background: #fff;
    min-width: 52px;
}

/* ── Left panel maintenance submenu ──────────────────────────────────────── */

.left-maint-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 3px;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 3px 8px;
    width: 100%;
    text-align: center;
    letter-spacing: 0.03em;
}

    .left-maint-btn:hover {
        background: rgba(255,255,255,0.25);
        color: #fff;
    }

.left-submenu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0 2px;
}

.left-sub-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 3px;
    color: #fff;
    font-size: 0.74rem;
    padding: 3px 8px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background 0.1s;
}

    .left-sub-btn:hover {
        background: rgba(255,255,255,0.2);
    }

.left-section-label {
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255,255,255,0.45);
    padding: 0 2px 2px;
}

/* old maint-dropdown styles removed */

/* ── Blazor dropdown menu (no Bootstrap JS required) ─────────────────────── */

.at-dropdown-wrap {
    position: relative;
    display: inline-block;
}

.at-dropdown-menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    z-index: 1040;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    min-width: 190px;
    padding: 4px 0;
}

.at-dropdown-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
    padding: 6px 14px 3px;
}

.at-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 6px 14px;
    font-size: 0.7rem;
    color: #222;
    cursor: pointer;
    transition: background 0.1s;
}

    .at-dropdown-item:hover {
        background: #e8f5e9;
        color: #2e7d32;
    }

.at-dropdown-divider {
    border-top: 1px solid #e0e0e0;
    margin: 4px 0;
}

/* ── Pay Table form panel ─────────────────────────────────────────────────── */

.paytable-form-panel {
    border-top: 3px solid #1a3a2a;
    background: #f8fafc;
    flex-shrink: 0;
}

.paytable-form-edit {
    border-top-color: #2e7d32;
    background: #f1f8f1;
}

.paytable-form-add {
    border-top-color: #2e7d32;
    background: #f4fbf4;
}

.paytable-form-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px 6px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #444;
    border-bottom: 1px solid #e0e0e0;
}

.paytable-form-icon {
    font-size: 1rem;
    color: #1a3a2a;
}

.paytable-form-edit .paytable-form-icon {
    color: #2e7d32;
}

.paytable-form-add .paytable-form-icon {
    color: #2e7d32;
}

.paytable-form-body {
    padding: 14px 16px 12px;
}

.paytable-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.paytable-unit {
    font-weight: 400;
    color: #888;
    font-size: 0.75rem;
}

/* ── Compact grid wrap — centered with border for small list modals ────────── */
.compact-grid-wrap {
    padding: 10px 14px;
    display: flex;
    justify-content: center;
}

    .compact-grid-wrap .grid-table {
        border: 2px solid var(--at-primary);
        border-radius: 3px;
        overflow: hidden;
        width: auto;
        min-width: 160px;
    }

        .compact-grid-wrap .grid-table th,
        .compact-grid-wrap .grid-table td {
            padding: 4px 12px;
        }

/* ── Form group card — grouped fields with border separation ──────────────── */

.form-group-card {
    border: 1px solid #d0d8e8;
    border-radius: 5px;
    padding: 14px 14px 14px;
    background: #fafbfd;
}

/* ── Dashboard layout ─────────────────────────────────────────────────────── */

.dashboard-top {
    flex-shrink: 0; /* never shrinks — always takes its natural height */
}

/* Sidebar also needs to scroll internally if airport list is long */
.sidebar {
    overflow-y: auto;
}

/* ── Dashboard wrapper — fills main-content, prevents page scroll ─────────── */
.dashboard-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding-bottom: 8px;
}

.dashboard-top {
    flex-shrink: 0;
}

/* ── Header buttons and username — explicit white, no browser override ─────── */
.header-btn {
    color: #fff !important;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 4px;
    padding: 3px 12px;
    font-size: 0.7rem;
    text-decoration: none !important;
    transition: background 0.15s, border-color 0.15s;
    cursor: pointer;
}

    .header-btn:hover {
        background: rgba(255,255,255,0.15);
        border-color: #fff;
        color: #fff !important;
    }

.header-username {
    color: rgba(255,255,255,0.85);
    font-size: 0.7rem;
}

/* ── Billing Preview Card ─────────────────────────────────────────────────── */
.billing-preview-card {
    border: 1px solid #ccc;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.billing-preview-error {
    border-color: #dc3545;
}

.billing-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a3a2a;
    color: #fff;
    padding: 8px 12px;
}

.billing-preview-fert {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.billing-preview-invoice {
    font-size: 0.7rem;
    opacity: 0.85;
}

.billing-preview-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-bottom: 1px solid #e0e0e0;
}

.billing-metric {
    padding: 10px 14px;
    border-right: 1px solid #e0e0e0;
    text-align: center;
}

    .billing-metric:last-child,
    .billing-metric:nth-child(3) {
        border-right: none;
    }

    .billing-metric:nth-child(4),
    .billing-metric:nth-child(5),
    .billing-metric:nth-child(6) {
        border-top: 1px solid #e0e0e0;
    }

.billing-metric-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    margin-bottom: 2px;
}

.billing-metric-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a3a2a;
}

.billing-preview-warnings {
    padding: 8px 12px;
    background: #fffbea;
}

.billing-preview-warn {
    font-size: 0.7rem;
    padding: 3px 0;
}

.warn-yellow {
    color: #856404;
}

.warn-red {
    color: #dc3545;
}

/* ── Applicator Dashboard ─────────────────────────────────────────────────── */
.appl-contract-card {
    border: 2px solid #b0bec5;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.07);
}

.appl-contract-header {
    display: flex;
    align-items: center;
    background: #1a3a2a;
    color: #fff;
    padding: 8px 16px;
    gap: 16px;
}

.appl-header-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-shrink: 0;
    gap: 4px;
}

.appl-header-center {
    display: flex;
    align-items: center;
}

.appl-btn-menu {
    display: flex;
    gap: 8px;
    align-items: center;
}

.appl-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    white-space: nowrap;
}

.appl-header-closed {
    background: #607d8b;
}

.appl-contract-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.appl-contract-name {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.appl-title-sep {
    color: rgba(255,255,255,0.4);
    font-size: 0.85rem;
    font-weight: 400;
}

.appl-contract-meta {
    font-size: 0.82rem;
    opacity: 0.75;
    font-weight: 400;
}

.appl-contract-area {
    font-size: 0.8rem;
    opacity: 0.75;
    font-weight: 400;
}

.appl-contract-period {
    font-size: 0.8rem;
    opacity: 0.75;
}

.appl-sub-name {
    font-size: 0.7rem;
    opacity: 0.9;
    margin-right: 6px;
}

.appl-open-btn {
    background: #5dade2;
    color: #1a3a2a;
    font-weight: 700;
    font-size: 0.7rem;
    border: 1px solid rgba(26, 58, 92, 0.25);
    padding: 4px 12px;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: background 0.15s, transform 0.1s;
}

    .appl-open-btn:hover {
        background: #7ec8e3;
        color: #1a3a2a;
        transform: translateY(-1px);
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
    }

.appl-bill-btn {
    background: #5dade2;
    color: #1a3a2a;
    font-weight: 700;
    font-size: 0.7rem;
    border: 1px solid rgba(26, 58, 92, 0.25);
    padding: 4px 12px;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: background 0.15s, transform 0.1s;
}

    .appl-bill-btn:hover {
        background: #7ec8e3;
        color: #1a3a2a;
        transform: translateY(-1px);
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
    }

.appl-reprint-btn {
    background: #5dade2;
    color: #1a3a2a;
    font-weight: 700;
    font-size: 0.7rem;
    border: 1px solid rgba(26, 58, 92, 0.25);
    padding: 4px 12px;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: background 0.15s, transform 0.1s;
}

    .appl-reprint-btn:hover {
        background: #7ec8e3;
        color: #1a3a2a;
        transform: translateY(-1px);
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
    }

/* Progress bar */
.appl-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 3px 14px;
    background: #f0f6f0;
    border-bottom: 1px solid #dde4ec;
}

.appl-progress-bar {
    flex: 1;
    height: 5px;
    background: #c8dfc8;
    border-radius: 4px;
    overflow: hidden;
}

.appl-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2e7d32, #43a047);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.appl-progress-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1a3a2a;
    min-width: 80px;
    text-align: right;
}

/* Metrics table */
.appl-metrics-table-wrap {
    overflow-x: auto;
}

.appl-metrics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

    .appl-metrics-table th {
        background: #eef7ee;
        color: #1a3a2a;
        padding: 6px 12px;
        font-size: 0.73rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        text-align: center;
        border-bottom: 2px solid #c0cedf;
        border-right: 1px solid #d8e2ee;
        white-space: nowrap;
    }

        .appl-metrics-table th.text-left {
            text-align: left;
        }

        .appl-metrics-table th:last-child,
        .appl-metrics-table td:last-child {
            border-right: none;
        }

    .appl-metrics-table td {
        padding: 6px 12px;
        text-align: center;
        border-bottom: 1px solid #edf0f4;
        border-right: 1px solid #edf0f4;
        white-space: nowrap;
    }

.appl-fert-col {
    text-align: left !important;
    font-weight: 700;
    color: #1a3a2a;
}

.appl-row-even {
    background: #f8fafc;
}

.appl-row-odd {
    background: #ffffff;
}

.appl-metrics-table tbody tr:hover {
    background: #eef8ee !important;
}

.appl-remaining {
    color: #1a3a2a;
    font-weight: 500;
}

.appl-positive {
    color: #1a3a2a;
    font-weight: 500;
}

.appl-total-val {
    color: #1a3a2a;
    font-weight: 700;
}

.appl-warn {
    color: #c0392b;
    font-weight: 600;
}

.appl-metrics-total td {
    background: #e8f5e8;
    border-top: 2px solid #1a3a2a;
    border-right: 1px solid #c0cedf;
    padding: 6px 12px;
    text-align: center;
}

    .appl-metrics-total td.text-left {
        text-align: left;
    }

.appl-no-data {
    padding: 12px 14px;
    font-size: 0.7rem;
    color: #90a4ae;
    font-style: italic;
}

/* ── Contract Map ────────────────────────────────────────────────────────── */
/* Ensure modal header and footer sit above the Leaflet map canvas (z-index 400) */
.at-modal-fullscreen .at-modal-header {
    position: relative;
    z-index: 1000;
    flex-shrink: 0;
}

.at-modal-fullscreen .at-modal-footer {
    position: relative;
    z-index: 1000;
    flex-shrink: 0;
}

.contract-map-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contract-map-container {
    flex: 1 1 0; /* grow to fill whatever the wrap div has */
    min-height: 0;
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--bs-border-color, #dee2e6);
}

.at-modal-fullscreen {
    /* Resizable map modal */
    width: 92vw;
    max-width: 92vw !important;
    height: 85vh;
    min-width: 480px;
    min-height: 400px;
    max-height: none !important;
    resize: both;
    overflow: hidden;
    /* Must be flex-column so children can stretch */
    display: flex;
    flex-direction: column;
}

.map-modal-body {
    padding: 12px !important;
    flex: 1 1 0; /* grow to fill all remaining height inside the modal */
    min-height: 0; /* allow flex child to shrink below content size */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.map-controls-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.map-ctrl-label {
    font-size: 13px;
    color: #6c757d;
    margin: 0;
}

.map-mode-select {
    width: auto;
    min-width: 140px;
}

.map-reset-btn {
    font-size: 12px;
    padding: 2px 10px;
}

.map-stand-count {
    margin-left: auto;
}

.map-no-geo-warn {
    font-size: 12px;
}

.map-legend {
    position: absolute;
    bottom: 52px;
    right: 12px;
    background: rgba(255,255,255,0.92);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.8;
    pointer-events: none;
    z-index: 500;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── Leaflet attribution — keep legally required text but make it unobtrusive ── */
.leaflet-control-attribution {
    font-size: 9px !important;
    opacity: 0.5 !important;
    background: rgba(255,255,255,0.6) !important;
    padding: 1px 4px !important;
    transition: opacity 0.2s;
}

    .leaflet-control-attribution:hover {
        opacity: 1 !important;
        background: rgba(255,255,255,0.9) !important;
    }

/* ── Inline Map View ─────────────────────────────────────────────────────── */
/* Hide the floating legend — checkboxes in the toolbar are sufficient */
.map-view-col .map-legend {
    display: none !important;
}

.map-view-col {
    grid-column: 2 / -1; /* spans stands-col and tickets-col */
    grid-row: 1 / 3; /* same row span as the other cols */
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

    .map-view-col .contract-map-wrap {
        flex: 1 1 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .map-view-col .contract-map-container {
        flex: 1 1 0;
        min-height: 0;
        height: 100% !important;
        border-radius: 4px;
        border: 1px solid var(--bs-border-color, #dee2e6);
    }

    /* Override at-modal-fullscreen constraints when map is inline */
    .map-view-col .at-modal-fullscreen {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        resize: none !important;
    }

/* ── Map toggle buttons ──────────────────────────────────────────────────── */
.map-toggle-btn {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    border: 2px solid var(--btn-color, #888);
    background: transparent;
    color: #444;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    line-height: 1.6;
}

    .map-toggle-btn:hover {
        background: color-mix(in srgb, var(--btn-color, #888) 20%, transparent);
    }

    .map-toggle-btn.map-toggle-on {
        background: var(--btn-color, #888);
        color: #000;
    }
/* Yellow needs dark text; others are fine with black too */

/* Edit mode button — more distinct on/off states */
.map-edit-btn {
    display: inline-flex;
    align-items: center;
    padding: 2px 12px;
    border-radius: 4px;
    border: 2px solid #aaa;
    background: #f0f0f0;
    color: #666;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    line-height: 1.6;
}

    .map-edit-btn:hover {
        border-color: #FF3300;
        color: #FF3300;
    }

    .map-edit-btn.map-toggle-on {
        background: #FF3300;
        border-color: #FF3300;
        color: #fff;
        box-shadow: 0 0 0 2px rgba(255,51,0,0.3);
    }

/* ── Global button theme — Option A green tint ───────────────────────────── */
/* Applies to all Bootstrap btn variants used in toolbars, modals, and popups */
.btn-outline-secondary,
.btn-primary,
.btn-outline-primary,
.btn-secondary,
.btn-sm.btn-outline-secondary,
.btn-sm.btn-primary,
.btn-sm.btn-outline-primary,
.btn-sm.btn-secondary {
    background: #f0f5f1 !important;
    border: 1px solid #b0cbb5 !important;
    color: #1a3a2a !important;
}

    .btn-outline-secondary:hover,
    .btn-primary:hover,
    .btn-outline-primary:hover,
    .btn-secondary:hover,
    .btn-sm.btn-outline-secondary:hover,
    .btn-sm.btn-primary:hover,
    .btn-sm.btn-outline-primary:hover,
    .btn-sm.btn-secondary:hover {
        background: #e0ede3 !important;
        border-color: #8ab890 !important;
        color: #1a3a2a !important;
    }

    .btn-outline-secondary:disabled,
    .btn-primary:disabled,
    .btn-outline-primary:disabled,
    .btn-secondary:disabled {
        background: #f0f5f1 !important;
        border-color: #d0dfd2 !important;
        color: #7a9e82 !important;
        opacity: 0.65 !important;
    }

/* Keep danger buttons red — delete actions should stay visually distinct */
.btn-danger, .btn-outline-danger,
.btn-sm.btn-danger, .btn-sm.btn-outline-danger {
    background: #fff0f0 !important;
    border: 1px solid #f5c6cb !important;
    color: #842029 !important;
}

    .btn-danger:hover, .btn-outline-danger:hover,
    .btn-sm.btn-danger:hover, .btn-sm.btn-outline-danger:hover {
        background: #f8d7da !important;
        border-color: #f1aeb5 !important;
        color: #842029 !important;
    }

/* Keep success buttons for explicit positive confirm actions */
.btn-success, .btn-sm.btn-success {
    background: #f0f5f1 !important;
    border: 1px solid #b0cbb5 !important;
    color: #1a3a2a !important;
}

    .btn-success:hover, .btn-sm.btn-success:hover {
        background: #e0ede3 !important;
        border-color: #8ab890 !important;
        color: #1a3a2a !important;
    }

/* ── Applicator Dashboard scrollable content ─────────────────────────────── */
.appl-dashboard-scroll {
    height: calc(100vh - 56px); /* subtract navbar height */
    overflow-y: auto;
    overflow-x: hidden;
}

/* ── Dropdown click-outside overlay ─────────────────────────────────────── */
.at-dropdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: transparent;
}
.at-dropdown-wrap {
    position: relative;
    z-index: 1000;
}

/* ── Global button theme — Option A green tint ───────────────────────────── */
.btn-outline-secondary,
.btn-primary,
.btn-outline-primary,
.btn-secondary,
.btn-sm.btn-outline-secondary,
.btn-sm.btn-primary,
.btn-sm.btn-outline-primary,
.btn-sm.btn-secondary {
    background: #f0f5f1 !important;
    border: 1px solid #b0cbb5 !important;
    color: #1a3a2a !important;
}
.btn-outline-secondary:hover,
.btn-primary:hover,
.btn-outline-primary:hover,
.btn-secondary:hover,
.btn-sm.btn-outline-secondary:hover,
.btn-sm.btn-primary:hover,
.btn-sm.btn-outline-primary:hover,
.btn-sm.btn-secondary:hover {
    background: #e0ede3 !important;
    border-color: #8ab890 !important;
    color: #1a3a2a !important;
}
.btn-outline-secondary:disabled,
.btn-primary:disabled,
.btn-outline-primary:disabled,
.btn-secondary:disabled {
    background: #f0f5f1 !important;
    border-color: #d0dfd2 !important;
    color: #7a9e82 !important;
    opacity: 0.65 !important;
}
.btn-danger, .btn-outline-danger,
.btn-sm.btn-danger, .btn-sm.btn-outline-danger {
    background: #fff0f0 !important;
    border: 1px solid #f5c6cb !important;
    color: #842029 !important;
}
.btn-danger:hover, .btn-outline-danger:hover,
.btn-sm.btn-danger:hover, .btn-sm.btn-outline-danger:hover {
    background: #f8d7da !important;
    border-color: #f1aeb5 !important;
    color: #842029 !important;
}
.btn-success, .btn-sm.btn-success {
    background: #f0f5f1 !important;
    border: 1px solid #b0cbb5 !important;
    color: #1a3a2a !important;
}
.btn-success:hover, .btn-sm.btn-success:hover {
    background: #e0ede3 !important;
    border-color: #8ab890 !important;
    color: #1a3a2a !important;
}

/* ── Maintenance modal scrollable lists ──────────────────────────────────── */
.maint-list-scroll {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}
.maint-list-scroll-sm {
    max-height: 140px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

/* ── Airport AID labels on the contract map ────────────────────────────────
   Permanent Leaflet tooltips beside airport pins, shown only for AIDs the
   contract uses. Deliberately not yellow — yellow is Incomplete in the stand
   status palette and reusing it would muddle the legend. White on a dark
   outline reads on satellite imagery at any zoom. */
.leaflet-tooltip.airport-aid-label {
    background: rgba(255, 255, 255, 0.90);
    border: 1px solid #444;
    border-radius: 2px;
    color: #111;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.15;
    padding: 0 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
    pointer-events: none;   /* never blocks a click on the pin beneath */
}

/* Leaflet draws a little arrow on tooltips — not wanted for a compact label */
.leaflet-tooltip.airport-aid-label::before {
    display: none;
}
