/* Major Ex Commissions — Enterprise Financial Design System */

:root {
    --canvas: #f8fafc;
    --panel: #ffffff;
    --line: #e2e8f0;
    --line-subtle: #f1f5f9;
    --ink: #0f172a;
    --ink-secondary: #334155;
    --muted: #526276;
    --muted-light: #94a3b8;
    
    --brand: #0f766e;
    --brand-hover: #115e59;
    --brand-soft: #f0fdf4;
    --brand-border: #bbf7d0;

    --rose: #dc2626;
    --rose-soft: #fef2f2;
    --rose-border: #fecaca;

    --amber: #b45309;
    --amber-soft: #fffbeb;
    --amber-border: #fde68a;

    --blue: #0284c7;
    --blue-soft: #f0f9ff;
    --blue-border: #bae6fd;

    --nav-bg: #0f172a;
    --nav-border: #1e293b;
    --nav-hover: #1e293b;
    --nav-active: #134e4a;
    --nav-text: #94a3b8;
    --nav-text-active: #ffffff;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--canvas);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Accessibility */
:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    background: var(--brand);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    z-index: 9999;
    text-decoration: none;
    transition: top 0.15s ease;
}
.skip-link:focus {
    top: 12px;
}

/* App Shell */
.app-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--nav-bg);
    border-right: 1px solid var(--nav-border);
    display: flex;
    flex-direction: column;
    z-index: 40;
}

.brand-container {
    padding: 16px 18px;
    border-bottom: 1px solid var(--nav-border);
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #ffffff;
}

.brand-logo {
    max-height: 28px;
    width: auto;
    object-fit: contain;
}

.brand-fallback-text {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #1e293b;
    color: #38bdf8;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #334155;
}

.side-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-caption {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 12px 10px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    color: var(--nav-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item i {
    font-size: 15px;
    color: #64748b;
}

.nav-item:hover {
    color: #ffffff;
    background: var(--nav-hover);
}
.nav-item:hover i {
    color: #94a3b8;
}

.nav-item.active {
    color: var(--nav-text-active);
    background: var(--nav-active);
    font-weight: 600;
}
.nav-item.active i {
    color: #2dd4bf;
}

.period-status-box {
    margin: 4px 6px 8px;
    padding: 8px 10px;
    background: #1e293b;
    border-radius: 6px;
    border: 1px solid #334155;
}

.period-status-dates {
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.period-status-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
}
.period-status-pill.preparation { background: #064e3b; color: #6ee7b7; }
.period-status-pill.validation { background: #78350f; color: #fde68a; }
.period-status-pill.closed { background: #334155; color: #cbd5e1; }

.sidebar-foot {
    border-top: 1px solid var(--nav-border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #090d16;
}

.user-block {
    display: flex;
    flex-direction: column;
}
.user-name {
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
}
.user-role {
    color: #64748b;
    font-size: 11px;
}

.logout-btn {
    color: #64748b;
    font-size: 15px;
    text-decoration: none;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s;
}
.logout-btn:hover {
    color: #f87171;
}

/* App Main & Topbar */
.app-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    height: 52px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar-btn {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: var(--ink-secondary);
}

.mobile-menu {
    display: none;
}

.topbar-search {
    position: relative;
    width: 320px;
    display: flex;
    align-items: center;
}
.topbar-search i {
    position: absolute;
    left: 10px;
    color: #94a3b8;
    font-size: 13px;
    pointer-events: none;
}
.topbar-search input {
    width: 100%;
    height: 32px;
    padding: 0 10px 0 32px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 12px;
    color: var(--ink);
    outline: none;
    transition: border-color 0.15s, background-color 0.15s;
}
.topbar-search input:focus {
    background: #ffffff;
    border-color: var(--brand);
    box-shadow: 0 0 0 1px var(--brand);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--line);
    background: #f8fafc;
    color: var(--ink-secondary);
}
.status-badge.success {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: var(--brand-border);
}
.status-badge.warning {
    background: var(--amber-soft);
    color: var(--amber);
    border-color: var(--amber-border);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.badge-dot.success { background: #059669; }
.badge-dot.warning { background: #d97706; }
.badge-dot.neutral { background: #64748b; }

/* Content Area */
.app-content {
    padding: 24px 32px;
    flex: 1;
}

/* Alert Notifications */
.message-container {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.alert-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid transparent;
}
.alert-banner.info {
    background: var(--blue-soft);
    border-color: var(--blue-border);
    color: #0369a1;
}
.alert-banner.success {
    background: var(--brand-soft);
    border-color: var(--brand-border);
    color: #15803d;
}
.alert-banner.error {
    background: var(--rose-soft);
    border-color: var(--rose-border);
    color: #b91c1c;
}
.alert-banner.warning {
    background: var(--amber-soft);
    border-color: var(--amber-border);
    color: #b45309;
}

/* Period View Header */
.period-view-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.header-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 4px;
}
.header-breadcrumbs a {
    color: var(--muted);
    text-decoration: none;
}
.header-breadcrumbs a:hover {
    color: var(--ink);
    text-decoration: underline;
}
.breadcrumb-separator {
    color: var(--muted-light);
}
.breadcrumb-current {
    font-size: 18px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.header-meta {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.header-meta strong {
    color: var(--ink-secondary);
}
.bullet {
    color: #cbd5e1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.15s, border-color 0.15s;
    line-height: 1.4;
}

.btn-primary {
    background: var(--brand);
    color: #ffffff;
    border-color: var(--brand);
}
.btn-primary:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    color: #ffffff;
}

.btn-secondary {
    background: #ffffff;
    color: var(--ink-secondary);
    border-color: var(--line);
}
.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--ink);
}

.btn-ghost {
    background: transparent;
    color: var(--brand);
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--brand-soft);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}
.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
}

.btn-alert {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: inherit;
    font-weight: 600;
}
.btn-alert:hover {
    background: rgba(255, 255, 255, 0.9);
}

/* Action Alert Bar */
.action-alert-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}
.action-alert-bar.warning {
    background: var(--amber-soft);
    border-color: var(--amber-border);
    color: #92400e;
}
.action-alert-bar.danger {
    background: var(--rose-soft);
    border-color: var(--rose-border);
    color: #991b1b;
}
.action-alert-bar.info {
    background: var(--blue-soft);
    border-color: var(--blue-border);
    color: #075985;
}
.action-alert-bar.success {
    background: var(--brand-soft);
    border-color: var(--brand-border);
    color: #166534;
}
.alert-icon {
    font-size: 16px;
}
.alert-message {
    flex: 1;
}
.alert-action {
    margin-left: auto;
}

/* Financial KPI Strip */
.kpi-ledger-bar {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 20px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
}

.kpi-cell {
    padding: 14px 18px;
    border-right: 1px solid var(--line);
}
.kpi-cell:last-child {
    border-right: 0;
}

.kpi-cell-total {
    background: #f8fafc;
}
.kpi-cell-total.kpi-stale {
    background: #fffbeb;
}

.kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
    margin-bottom: 2px;
}
.kpi-highlight {
    color: var(--brand);
}
.kpi-unit {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.kpi-subtext {
    font-size: 11px;
    color: #94a3b8;
}

.tabular {
    font-variant-numeric: tabular-nums;
}

/* Subnav Tabs */
.subnav-tabs-bar {
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
}

.subnav-tabs {
    display: flex;
    gap: 20px;
}

.subnav-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 4px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.subnav-tab:hover {
    color: var(--ink);
}

.subnav-tab.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
    font-weight: 600;
}

.tab-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 999px;
}
.tab-badge.danger { background: var(--rose-soft); color: var(--rose); border: 1px solid var(--rose-border); }
.tab-badge.warning { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-border); }

/* Table Container & Enterprise Table */
.table-container {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
}

.table-toolbar {
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.toolbar-title { min-width: 0; flex: 1 1 300px; }

.toolbar-title h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: var(--ink);
    overflow-wrap: anywhere;
}
.toolbar-count {
    display: block;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.enterprise-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.enterprise-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.enterprise-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line-subtle);
    color: var(--ink-secondary);
    vertical-align: middle;
}

.enterprise-table tr:hover td {
    background-color: #f8fafc;
}

.enterprise-table tr:last-child td {
    border-bottom: 0;
}
.email-contact-entry { min-width: 0; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.email-contact-entry > p { margin: 0 0 12px; }
.email-contact-form { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(220px, 1.4fr) minmax(150px, 1fr) auto; align-items: end; gap: 10px; min-width: 0; }
.email-contact-form .field { min-width: 0; }
.email-contact-form button { min-height: 38px; white-space: nowrap; }
.optional-label { color: var(--muted); font-weight: 500; }
.payroll-email-notice { margin-bottom: 24px; }
.admin-email-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.admin-email-flow > div { display: grid; gap: 5px; padding: 16px 18px; border-right: 1px solid var(--line); }
.admin-email-flow > div:last-child { border-right: 0; }
.admin-email-flow strong { color: var(--ink); font-size: 13px; }
.admin-email-flow span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.email-sender-entry { min-width: 0; padding: 16px 18px; display: grid; grid-template-columns: minmax(240px, 1fr) minmax(300px, 1.4fr); align-items: end; gap: 20px; }
.email-sender-copy { min-width: 0; }
.email-sender-copy strong { display: block; color: var(--ink); font-size: 15px; overflow-wrap: anywhere; }
.email-sender-copy p { margin: 5px 0 0; max-width: 62ch; }
.email-sender-form { display: grid; grid-template-columns: minmax(200px, 1fr) auto; align-items: end; gap: 10px; }
.email-sender-form button { min-height: 38px; white-space: nowrap; }
.email-contact-empty-hint { margin: 10px 0 0; }
.smtp-settings-body { min-width: 0; padding: 18px; }
.smtp-settings-body > p { margin: 0 0 18px; max-width: 90ch; overflow-wrap: anywhere; }
.smtp-settings-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; min-width: 0; }
.smtp-settings-form .field { min-width: 0; }
.smtp-settings-form input:not([type="checkbox"]), .smtp-settings-form select { width: 100%; min-width: 0; }
.smtp-form-wide { grid-column: 1 / -1; }
.smtp-enable-field label { display: flex; align-items: center; gap: 8px; }
.smtp-enable-field input[type="checkbox"] { width: 16px; height: 16px; min-height: 16px; padding: 0; flex: 0 0 16px; margin: 0; accent-color: var(--brand); }
.smtp-settings-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.smtp-verification { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 18px; padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--line); }
.smtp-verification > form { flex: 0 0 auto; }
.smtp-verification > div { min-width: 0; flex: 1 1 320px; }
.smtp-verification p { margin: 5px 0 0; }
.field-errors { color: var(--danger, #b42318); font-size: 13px; }
@media (max-width: 600px) { .smtp-settings-form { grid-template-columns: 1fr; } .smtp-verification { flex-direction: column; } }
.export-actions { display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; }
.payroll-send-panel { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(300px, 1.3fr); align-items: center; gap: 20px; padding: 18px; }
.payroll-send-copy h2 { margin: 0 0 5px; font-size: 15px; }
.payroll-send-copy p { margin: 0; }
.payroll-send-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.payroll-send-form .field { min-width: 0; }
.payroll-send-form select { width: 100%; min-height: 40px; }
.payroll-send-form button { min-height: 40px; white-space: nowrap; }
.payroll-send-form button:disabled { opacity: .55; cursor: not-allowed; }
.payroll-send-unavailable { grid-column: 1 / -1; margin: 0; }
.payroll-station-actions { min-width: 210px; }
.payroll-stations-table { min-width: 0; }
.payroll-stations-table th:first-child, .payroll-stations-table td:first-child { position: sticky; left: 0; z-index: 1; min-width: 150px; background: var(--panel); }
.payroll-stations-table th:last-child, .payroll-stations-table td:last-child { position: sticky; right: 0; z-index: 1; background: var(--panel); border-left: 1px solid var(--line); }
.payroll-stations-table th:first-child, .payroll-stations-table th:last-child { background: var(--canvas); }
.payroll-commission-summary { display: grid; gap: 8px; }
.payroll-commission-summary > span { display: flex; justify-content: space-between; align-items: baseline; min-width: 0; gap: 12px; }
.payroll-commission-summary small { display: grid; gap: 2px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.payroll-commission-summary small em { color: var(--muted); font-size: 11px; font-style: normal; font-variant-numeric: tabular-nums; white-space: nowrap; }
.payroll-commission-summary strong { color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; white-space: nowrap; }
.payroll-export-actions { justify-content: flex-start; margin-top: 6px; }
.payroll-export-actions form { display: inline-flex; }
.payroll-export-actions .btn { white-space: nowrap; }
@media (max-width: 1100px) { .payroll-send-panel { grid-template-columns: 1fr; gap: 14px; } }
@media (max-width: 520px) {
    .payroll-send-form { grid-template-columns: 1fr; }
    .payroll-send-form button { width: 100%; }
    .payroll-stations-table, .payroll-stations-table tbody { display: block; min-width: 0; }
    .payroll-stations-table thead { display: none; }
    .payroll-stations-table tr { display: grid; grid-template-columns: 1fr 1fr; padding: 12px; border-bottom: 1px solid var(--line); }
    .payroll-stations-table td { min-width: 0; padding: 8px; border: 0; white-space: normal; text-align: left; overflow-wrap: anywhere; }
    .payroll-stations-table td:first-child, .payroll-stations-table td:last-child { position: static; min-width: 0; border: 0; }
    .payroll-stations-table td::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
    .payroll-stations-table td:first-child, .payroll-stations-table .payroll-station-actions, .payroll-stations-table .empty-row { grid-column: 1 / -1; }
    .payroll-stations-table td:first-child a { font-size: 14px; }
    .payroll-stations-table .payroll-commission-summary { display: grid; grid-template-columns: 1fr; }
    .payroll-stations-table td[data-label="Commissions"] { grid-column: 1 / -1; }
    .payroll-stations-table .payroll-export-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .payroll-stations-table .payroll-export-actions form { min-width: 0; }
    .payroll-stations-table .payroll-export-actions button { width: 100%; min-height: 40px; }
}
@media (max-width: 1100px) { .email-contact-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .email-contact-form button { width: 100%; } }
@media (max-width: 900px) { .email-sender-entry { grid-template-columns: 1fr; gap: 14px; } }
@media (max-width: 900px) { .admin-email-flow { grid-template-columns: 1fr; } .admin-email-flow > div { border-right: 0; border-bottom: 1px solid var(--line); } .admin-email-flow > div:last-child { border-bottom: 0; } }
@media (max-width: 600px) { .smtp-settings-actions { align-items: stretch; flex-direction: column; } .smtp-settings-actions .btn { width: 100%; } }
@media (max-width: 520px) { .email-contact-form, .email-sender-form { grid-template-columns: 1fr; } .email-contact-form button, .email-sender-form button { width: 100%; } .export-actions { display: flex; flex-direction: column; align-items: stretch; } }

.station-row-link {
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}
.station-row-link:hover {
    color: var(--brand);
    text-decoration: underline;
}

.total-col {
    color: var(--brand);
    font-weight: 700;
}

.sub-amt {
    font-size: 11px;
    color: var(--muted-light);
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.text-muted { color: var(--muted); }
.text-red { color: var(--rose); font-weight: 600; }
.text-amber { color: var(--amber); font-weight: 600; }

.empty-row {
    text-align: center;
    padding: 36px 16px;
    color: var(--muted);
    font-size: 13px;
}

/* Tags & Status Pills */
.status-tag {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-block;
}
.status-tag.preparation { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.status-tag.validation { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.status-tag.closed { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

.tag-final {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    background: #0f172a;
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
}
.tag-provisional {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    background: #f8fafc;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 2px 6px;
    border-radius: 4px;
}

.tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 4px;
}
.tag-success { background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand-border); }
.tag-warning { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-border); }
.tag-danger { background: var(--rose-soft); color: var(--rose); border: 1px solid var(--rose-border); }
.tag-neutral { background: #f1f5f9; color: #475569; border: 1px solid var(--line); }

/* Period Footer Card */
.period-footer-card {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.footer-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 2px;
}
.footer-desc {
    font-size: 12px;
    color: var(--muted);
}
.footer-card-right {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 10px;
}

.period-close-form {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    max-width: 380px;
}

.period-close-form > label:first-of-type { align-self: flex-start; font-size: 12px; font-weight: 600; }
.period-close-form > input { width: 100%; }

.period-close-confirm {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: #991b1b;
    font-size: 12px;
    line-height: 1.45;
    cursor: pointer;
}

.period-close-confirm input { margin-top: 2px; flex: none; }

.form-input-sm {
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 12px;
    outline: none;
}
.form-input-sm:focus {
    border-color: var(--brand);
}

.scope-accordion {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 12px;
    margin-bottom: 20px;
}
.scope-accordion summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--muted);
}
.scope-accordion summary:hover {
    color: var(--ink);
}
.scope-form-inline {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line-subtle);
    display: flex;
    align-items: flex-end;
    gap: 12px;
}
.scope-field label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 4px;
}
.scope-field input, .scope-field textarea {
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 12px;
}
.scope-field.grow {
    flex: 1;
}
.scope-field.grow textarea {
    height: 32px;
    width: 100%;
}

/* Backwards-compatibility helpers for other views */
.panel {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 20px;
}
.panel-heading {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-heading h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}
.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}
.page-heading h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 4px;
}
.page-heading p {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
}
.count-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 4px;
}
.count-badge.danger {
    background: var(--rose-soft);
    color: var(--rose);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line-subtle);
}
.data-table tr:hover td {
    background-color: #f8fafc;
}
.money-cell {
    font-variant-numeric: tabular-nums;
    text-align: right;
    font-family: inherit;
}
.money-cell.strong {
    font-weight: 700;
    color: var(--brand);
}
.mono {
    font-variant-numeric: tabular-nums;
}
.button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
}
.button.primary { background: var(--brand); color: #ffffff; }
.button.ghost { background: #ffffff; border-color: var(--line); color: var(--ink-secondary); }
.button.small { padding: 4px 8px; font-size: 12px; }

/* Responsive adjustments */
@media (max-width: 1024px) {
    .kpi-ledger-bar {
        grid-template-columns: repeat(2, 1fr);
    }
    .kpi-cell {
        border-bottom: 1px solid var(--line);
    }
}

@media (max-width: 768px) {
    .app-shell {
        display: block;
    }
    .app-sidebar {
        position: fixed;
        left: -245px;
        width: 240px;
        transition: left 0.2s ease;
    }
    .app-sidebar.open {
        left: 0;
    }
    .mobile-menu {
        display: grid !important;
    }
    .app-content {
        padding: 16px;
    }
    .kpi-ledger-bar {
        grid-template-columns: 1fr;
    }
    .period-view-header {
        flex-direction: column;
    }
    .period-footer-card {
        flex-direction: column;
        align-items: stretch;
    }
    .footer-card-right, .period-close-form { width: 100%; align-items: stretch; }
    .footer-card-right .inline-form { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
    .footer-card-right .inline-form input { flex: 1 1 180px; min-width: 0; }
}

/* Filter Toolbar & Anomaly Helpers */
.filter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 12px;
}
.filter-title {
    color: var(--ink-secondary);
}
.filter-title strong {
    color: var(--ink);
}
.filter-form {
    display: flex;
    align-items: center;
    gap: 8px;
}
.filter-label {
    color: var(--muted);
    font-weight: 500;
}
.form-select-sm {
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 12px;
    color: var(--ink);
    background: #ffffff;
    outline: none;
}
.form-select-sm:focus {
    border-color: var(--brand);
}
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding: 12px;
}
.pagination-info {
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* Shared application components used by operational forms and ledgers */
.page-heading, .panel-heading, .heading-actions, .form-actions, .filter-actions,
.pagination, .content-grid, .metric-grid {
    display: flex;
    align-items: center;
}
.page-heading { justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-heading h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.02em; }
.page-heading p, .panel-heading p { margin: 0; color: var(--muted); }
.heading-actions, .form-actions, .filter-actions { gap: 8px; }
.panel {
    min-width: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.panel-heading { justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; font-size: 15px; }
.panel-heading.compact { padding: 10px 14px; }
.section-gap { margin-top: 20px; }
.content-grid { align-items: stretch; gap: 20px; }
.content-grid.two > * { flex: 1 1 0; }
.button {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink-secondary);
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}
.button:hover { background: #f8fafc; border-color: #cbd5e1; }
.button.primary { color: #fff; background: var(--brand); border-color: var(--brand); }
.button.primary:hover { background: var(--brand-hover); }
.button.secondary, .button.ghost { background: #fff; }
.button.small { min-height: 30px; padding: 5px 9px; font-size: 12px; }
.stack-form { padding: 18px; display: grid; gap: 14px; }
.compact-form { padding-top: 14px; }
.form-grid, .filter-grid, .search-form-large { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filter-grid { grid-template-columns: repeat(5, minmax(150px, 1fr)) auto; align-items: end; width: 100%; }
.compact-filter { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.search-form-large { grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(150px, 1fr)) auto; align-items: end; padding: 18px; }
.field { min-width: 0; display: grid; gap: 5px; }
.field.grow { min-width: 240px; }
.field label, .filter-label { color: var(--ink-secondary); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.field input, .field select, .field textarea, .form-select-sm, .filter-form input, .filter-form select {
    width: 100%;
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .form-select-sm:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
.input-with-icon { position: relative; }
.input-with-icon i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-with-icon input { padding-left: 34px; }
.upload-form { padding: 18px; }
.source-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.source-drop { min-width: 0; min-height: 118px; display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px dashed #94a3b8; border-radius: 8px; background: #f8fafc; cursor: pointer; overflow: hidden; }
.source-drop:hover { border-color: var(--brand); background: #f0fdfa; }
.source-drop > span:nth-child(2) { min-width: 0; flex: 1 1 auto; display: grid; gap: 4px; }
.source-drop small { color: var(--muted); }
.source-drop input[type="file"] { width: 100%; min-width: 0; max-width: 100%; margin-top: auto; font-size: 11px; }
.source-icon { color: var(--brand); font-size: 18px; }
.upload-form .form-actions { justify-content: space-between; margin-top: 14px; }
.form-hint { color: var(--muted); }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { min-width: 860px; }
.data-table th, .data-table td { vertical-align: top; }
.money-cell { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.expense-note { display: block; margin-top: 3px; font-size: 11px; font-weight: 400; white-space: normal; }
.station-message-panel { border-color: var(--brand); }
.message-meta { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 12px; color: var(--muted); }
.station-message-panel textarea[readonly], .station-message-panel input[readonly] { background: #f8fafc; }
.comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.comparison-grid > div { display: grid; gap: 5px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.comparison-grid small, .comparison-grid span { color: var(--muted); }
.comparison-grid strong { font-size: 15px; color: var(--ink); }
.confirmation-check { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; line-height: 1.5; }
.confirmation-check input { flex: none; margin-top: 4px; }
@media (max-width: 768px) { .comparison-grid { grid-template-columns: 1fr; } }
.tracking-link { color: var(--brand); font-weight: 700; text-decoration: none; white-space: nowrap; }
.tracking-link:hover { text-decoration: underline; }
.actions { text-align: right; white-space: nowrap; }
.empty-cell, .empty-state { padding: 28px; color: var(--muted); text-align: center; }
.count-badge { display: inline-flex; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.status-pill, .ok-label { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: 11px; font-weight: 600; white-space: nowrap; }
.status-pill.preparation, .ok-label { background: var(--brand-soft); color: var(--brand); }
.status-pill.validation { background: var(--amber-soft); color: var(--amber); }
.danger-text { color: var(--rose) !important; }
.strong { font-weight: 700; }
.muted { color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.metric-card { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.metric-card span, .metric-card small { color: var(--muted); }
.metric-card strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.metric-card.danger strong { color: var(--rose); }
.folder-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin: 16px 0;
}
.folder-tabs a {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    color: var(--muted);
    text-decoration: none;
}
.folder-tabs a:hover {
    border-color: #94a3b8;
    color: var(--ink);
}
.folder-tabs a:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}
.folder-tabs a.active {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand);
}
.folder-tabs a > i {
    flex: 0 0 auto;
    font-size: 16px;
}
.folder-tabs a > span {
    display: grid;
    min-width: 0;
    gap: 2px;
}
.folder-tabs small {
    color: inherit;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.folder-tabs strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.folder-tabs a.active strong { color: var(--brand); }
.adjustment-sections { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.settlement-rules { padding: 0 16px 16px; line-height: 1.5; }
.settlement-rules p { margin: 10px 0; }
.settlement-entry { padding: 18px; border-top: 1px solid var(--line); }
.settlement-entry h3 { margin: 4px 0; font-size: 16px; }
.settlement-entry p { margin: 7px 0; }
.settlement-entry-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.settlement-amount { display: grid; grid-template-columns: auto auto; gap: 3px 12px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.settlement-amount span { color: var(--muted); }
.settlement-direction { color: var(--brand); font-weight: 700; }
.settlement-action, .settlement-history { margin-top: 12px; border: 1px solid var(--line); border-radius: 7px; }
.settlement-action summary, .settlement-history summary { padding: 11px 13px; cursor: pointer; font-weight: 700; }
.settlement-action form { padding: 12px; border-top: 1px solid var(--line); }
.settlement-history-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 12px; border-top: 1px solid var(--line); }
.settlement-reversal { display: flex; flex-wrap: wrap; gap: 7px; }
.settlement-reversal input { min-width: 130px; flex: 1 1 150px; }
@media (max-width: 768px) { .adjustment-sections { display: flex; overflow-x: auto; } .adjustment-sections a { flex: 0 0 175px; } .settlement-entry-head { flex-direction: column; } .settlement-amount { text-align: left; } }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.detail-grid > div { padding: 12px 16px; border-bottom: 1px solid var(--line-subtle); }
.detail-grid dt { color: var(--muted); font-size: 11px; font-weight: 700; }
.detail-grid dd { margin: 3px 0 0; }
.source-provenance { padding: 14px 18px; display: grid; gap: 10px; }
.source-provenance article { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; }
.source-provenance article > div { display: grid; gap: 3px; }
.source-provenance small, .source-provenance span { color: var(--muted); }
.filter-toolbar { align-items: stretch; flex-direction: column; }
.filter-form { width: 100%; }
.pagination { justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line); }
.anomaly-group { margin-bottom: 14px; }
.reason-cell span { display: block; max-width: 520px; }

@media (max-width: 1200px) {
    .source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .search-form-large, .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .app-content { padding: 18px 14px; }
    .page-heading, .period-view-header { flex-direction: column; align-items: stretch; }
    .content-grid.two, .form-grid.two, .source-grid, .search-form-large, .filter-grid, .metric-grid, .detail-grid { grid-template-columns: 1fr; }
    .content-grid { display: grid; }
    .subnav-tabs, .folder-tabs { overflow-x: auto; padding-bottom: 2px; }
    .folder-tabs { display: flex; scrollbar-width: thin; }
    .folder-tabs a { flex: 0 0 150px; }
    .subnav-tab { white-space: nowrap; }
    .upload-form .form-actions { align-items: stretch; flex-direction: column; }
    .button, .btn { min-height: 40px; }
}
.anomaly-group {
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    overflow: hidden;
}
.panel-heading.compact {
    padding: 8px 14px;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-heading.compact h2 {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.carry-forward-notice {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 18px 0;
    padding: 16px 18px;
    border: 1px solid #f5c26b;
    border-radius: 10px;
    background: #fff8e8;
    color: #713f12;
}

.carry-forward-notice p { margin: 5px 0 10px; color: #854d0e; }
.notice-panel-icon { font-size: 20px; color: #b45309; }
.carry-forward-panel { overflow: hidden; }
.carry-forward-table .carry-code-list { display: flex; flex-wrap: wrap; gap: 4px; }
.carry-forward-table .tag { white-space: nowrap; }
.anomaly-table th {
    background: #f8fafc;
    font-size: 11px;
    padding: 8px 12px;
}
.anomaly-table td {
    padding: 8px 12px;
    font-size: 12px;
}
.tracking-link {
    font-family: inherit;
    font-weight: 600;
    color: var(--brand);
    text-decoration: none;
}
.tracking-link:hover {
    text-decoration: underline;
}
.reason-cell span {
    display: block;
    color: var(--ink-secondary);
}

/* Parcel detail components: keep the audit trail readable at every width. */
.mono-title { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(22px, 3vw, 32px); letter-spacing: -.04em; }
.parcel-accounting-state { overflow: hidden; }
.parcel-accounting-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; }
.parcel-accounting-grid > div { min-width: 0; padding: 16px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.parcel-accounting-grid > div:last-child { border-right: 0; }
.parcel-accounting-grid small, .parcel-accounting-grid strong, .parcel-accounting-grid span { display: block; overflow-wrap: anywhere; }
.parcel-accounting-grid small { color: var(--muted); font-size: 11px; }
.parcel-accounting-grid strong { margin-top: 5px; font-size: 18px; font-variant-numeric: tabular-nums; }
.parcel-accounting-grid span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.parcel-next-action { padding: 15px 18px; line-height: 1.5; background: #f8fafc; border-bottom: 1px solid var(--line); }
.parcel-next-action strong { color: var(--ink); }
.parcel-quick-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.parcel-quick-actions .button { min-height: 40px; }
#parcel-weight-resolution, #parcel-source-evidence, #parcel-correction { scroll-margin-top: 72px; }
.parcel-recalculate-form { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 14px 18px; }
.parcel-recalculate-form span, .parcel-last-run { color: var(--muted); font-size: 11px; }
.parcel-last-run { margin: 0; padding: 0 18px 14px; }
.parcel-queue-navigation { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.queue-position { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.queue-position::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.queue-navigation-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.queue-navigation-actions .button { min-width: 126px; min-height: 36px; white-space: nowrap; }
.queue-navigation-actions .button i { flex: 0 0 auto; font-size: 14px; line-height: 1; }
.queue-end-label { color: var(--muted); font-size: 12px; }
.parcel-event-list { padding: 8px 18px 16px; }
.parcel-event-list article { padding: 10px 0; border-bottom: 1px solid var(--line); }
.parcel-event-list article:last-child { border-bottom: 0; }
.parcel-event-list article > div { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.parcel-event-list strong { font-size: 12px; }
.parcel-event-list span, .parcel-event-list p { color: var(--muted); font-size: 11px; }
.parcel-event-list p { margin: 5px 0 0; overflow-wrap: anywhere; }
.anomaly-summary { overflow: hidden; }
.anomaly-list { padding: 14px 17px; display: grid; gap: 8px; }
.anomaly-list article { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid #f0c9d1; background: #fff6f7; color: #8b2035; border-radius: 9px; }
.anomaly-list article > i { flex: 0 0 auto; margin-top: 2px; }
.anomaly-list strong, .anomaly-list span { display: block; overflow-wrap: anywhere; }
.anomaly-list strong { font-size: 10px; letter-spacing: .03em; }
.anomaly-list span { margin-top: 2px; font-size: 12px; line-height: 1.45; }
.notice { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 12px 16px; border: 1px solid var(--blue-border); border-radius: 7px; background: var(--blue-soft); color: var(--ink-secondary); line-height: 1.5; }
.notice > i { flex: 0 0 auto; color: var(--blue); font-size: 16px; line-height: 1.3; }
.notice > div { min-width: 0; }
.notice strong, .notice span { display: block; overflow-wrap: anywhere; }
.notice strong { color: var(--ink); font-size: 12px; }
.notice span { margin-top: 3px; font-size: 12px; }
.notice.warning { border-color: var(--amber-border); background: var(--amber-soft); }
.notice.warning > i { color: var(--amber); }
.notice.danger { border-color: var(--rose-border); background: var(--rose-soft); }
.notice.danger > i { color: var(--rose); }
.overweight-exception-panel > .notice { margin: 14px 18px 0; }
.source-provenance article { min-width: 0; }
.source-provenance article strong, .source-provenance article span { overflow-wrap: anywhere; }
.source-provenance article > div, .comparison-grid > div { min-width: 0; }
.comparison-grid strong, .comparison-grid span, .detail-grid dd { overflow-wrap: anywhere; }
.locked-panel { padding: 22px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.structural-warning { display: flex; gap: 10px; align-items: flex-start; border-top: 1px solid #f0c9d1; background: #fff7ed; color: #9a3412; }
.structural-warning i { margin-top: 2px; }
.structural-warning strong, .structural-warning span { display: block; }
.structural-warning span { margin-top: 3px; }
.approval-explanation { display: flex; gap: 12px; padding: 17px 17px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.approval-explanation i { color: var(--brand); font-size: 22px; flex: 0 0 auto; }
.approval-explanation p { margin: 0; }
.approve-button { background: var(--brand); color: #fff; border-color: var(--brand); }
.audit-panel { overflow: hidden; }
@media (max-width: 900px) {
    .parcel-accounting-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .parcel-accounting-grid > div:nth-child(2) { border-right: 0; }
}
@media (max-width: 520px) {
    .parcel-accounting-grid > div { padding: 12px; }
    .parcel-accounting-grid strong { font-size: 16px; }
    .parcel-quick-actions .button { width: 100%; }
    .parcel-queue-navigation { align-items: stretch; }
    .queue-navigation-actions { width: 100%; }
    .queue-navigation-actions .button { flex: 1 1 0; justify-content: center; }
}
@media (max-width: 350px) {
    .parcel-accounting-grid { grid-template-columns: 1fr; }
    .parcel-accounting-grid > div { border-right: 0; }
}
.timeline { padding: 18px; }
.timeline > article { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; position: relative; padding-bottom: 14px; }
.timeline > article::before { content: ""; position: absolute; left: 7px; top: 17px; bottom: -1px; width: 2px; background: #e2e7ec; }
.timeline > article:last-of-type::before { display: none; }
.timeline-dot { width: 15px; height: 15px; border-radius: 50%; background: var(--violet); border: 4px solid #eeebff; margin-top: 3px; z-index: 1; }
.timeline-dot.approved { background: var(--brand); border-color: var(--brand-soft); }
.timeline-card { min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; }
.timeline-head { display: flex; justify-content: space-between; gap: 15px; }
.timeline-head strong { font-size: 11px; }
.timeline-head time { color: var(--muted); font-size: 9px; white-space: nowrap; }
.timeline-card p { color: var(--muted); font-size: 11px; margin: 7px 0; overflow-wrap: anywhere; }
.change-list { display: grid; gap: 4px; }
.change-list span { display: flex; align-items: center; gap: 7px; font-size: 10px; flex-wrap: wrap; }
.change-list strong { min-width: 120px; }
.change-list del { color: var(--rose); }
.change-list ins { color: var(--brand); font-weight: 800; text-decoration: none; }
.station-folder-table th:first-child, .station-folder-table td:first-child { position: sticky; left: 0; z-index: 2; background: var(--panel); }
.station-folder-table thead th { position: sticky; top: 0; z-index: 3; background: #f8fafc; }
.station-folder .table-scroll { max-height: 65vh; overflow: auto; }

@media (max-width: 760px) {
    .timeline-head { align-items: flex-start; flex-direction: column; gap: 3px; }
    .timeline-head time { white-space: normal; }
    .change-list strong { min-width: 100%; }
    .station-folder .table-scroll { max-height: none; }
    .station-folder-table { min-width: 980px; }
}

/* Operational refinements retain the existing brand and mobile breakpoints. */
.header-breadcrumbs h1.breadcrumb-current { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 650; }
.ledger-component { display: block; margin-top: 3px; }
.ledger-component small { display: block; color: var(--muted); }
.row-disclosure { margin-top: 6px; font-size: 12px; }
.row-disclosure summary, .operational-disclosure > summary { cursor: pointer; color: var(--brand); }
.row-disclosure summary { display: flex; align-items: center; gap: 6px; padding: 4px 0; list-style: none; font-weight: 600; }
.row-disclosure summary::-webkit-details-marker { display: none; }
.row-disclosure summary::before { content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 3px 0 1px; border-right: 1.5px solid currentColor; border-top: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .15s ease; }
.row-disclosure[open] summary::before { transform: rotate(135deg); }
.row-breakdown { display: grid; gap: 6px; margin: 8px 0 0; padding: 8px 0; border-top: 1px solid var(--line); }
.row-breakdown > div { display: flex; justify-content: space-between; gap: 12px; min-width: 0; margin: 0; padding: 3px 0; }
.row-breakdown dt { color: var(--muted); font-size: 10px; line-height: 1.2; }
.row-breakdown dd { margin: 0; text-align: right; font-size: 11px; line-height: 1.3; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.operational-disclosure { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.operational-disclosure > summary { padding: 14px 18px; font-weight: 600; }
.operational-disclosure > .content-grid { padding: 0 18px 18px; }
.operational-disclosure > .table-container { border: 0; margin: 0; box-shadow: none; }
.local-section-links, .parcel-workflow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 12px 0; }
.local-section-links a, .parcel-workflow a { color: var(--brand); text-underline-offset: 3px; }
.parcel-workflow a { padding: 5px 0; }
.payroll-send-preview { grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--line); }
.payroll-send-preview p { margin: 0; font-size: 12px; }
.payroll-send-preview dl { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 0 0 8px; }
.payroll-send-preview dl[hidden] { display: none; }
.payroll-send-preview dt { color: var(--muted); font-size: 11px; }
.payroll-send-preview dd { margin: 3px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.topbar-right { flex-wrap: wrap; gap: 8px; }
.btn:disabled, .button:disabled { opacity: .55; cursor: not-allowed; }
.anomaly-list small { display: block; }

@media (min-width: 768px) {
    .nav-caption.workflow-caption { margin-top: 12px; font-size: 11px; text-transform: none; letter-spacing: 0; }
    .user-role { color: #a8b8cc; }
    .operational-table { min-width: 0; width: 100%; table-layout: fixed; }
    .operational-table th { white-space: normal; padding: 10px 12px; letter-spacing: .02em; }
    .operational-table td { padding: 12px; overflow-wrap: anywhere; vertical-align: top; }
    .operational-table .btn, .operational-table .button { min-height: 36px; white-space: normal; }
    .operational-table td:first-child, .operational-table th:first-child { min-width: 0; }
    .station-summary-table th:nth-child(1) { width: 29%; }
    .station-summary-table th:nth-child(2) { width: 26%; }
    .station-summary-table th:nth-child(3) { width: 13%; }
    .station-summary-table th:nth-child(4) { width: 18%; }
    .station-summary-table th:nth-child(5) { width: 14%; }
    .anomaly-table th:nth-child(1) { width: 23%; }
    .anomaly-table th:nth-child(2) { width: 42%; }
    .anomaly-table th:nth-child(3) { width: 15%; }
    .anomaly-table th:nth-child(4) { width: 20%; }
    .payroll-stations-table.operational-table { min-width: 0; }
    .payroll-stations-table.operational-table th:first-child, .payroll-stations-table.operational-table td:first-child,
    .payroll-stations-table.operational-table th:last-child, .payroll-stations-table.operational-table td:last-child { position: static; min-width: 0; border-left: 0; }
    .payroll-stations-table.operational-table th:nth-child(1) { width: 22%; }
    .payroll-stations-table.operational-table th:nth-child(2) { width: 28%; }
    .payroll-stations-table.operational-table th:nth-child(3) { width: 12%; }
    .payroll-stations-table.operational-table th:nth-child(4) { width: 16%; }
    .payroll-stations-table.operational-table th:nth-child(5) { width: 22%; }
    .payroll-stations-table.operational-table .payroll-station-actions { min-width: 0; }
    .station-parcels-table th:first-child { width: 23%; }
    .station-parcels-table td .reason-cell { white-space: normal; }
    .parcel-accounting-grid > div { padding: 10px 16px; }
    .parcel-accounting-grid strong { font-size: 16px; }
    .parcel-next-action { padding: 10px 16px; }
    .parcel-resolution-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
    .parcel-decision-column > .section-gap:first-child { margin-top: 0; }
    .parcel-resolution-layout .form-panel { min-width: 0; }
    .parcel-decision-column { min-width: 0; }
    .parcel-recalculate-form { padding: 12px 16px; }
    .source-drop small { font-size: 12px; }
    .compact-anomaly-summary .panel-heading { padding: 8px 16px; }
    .compact-anomaly-summary .panel-heading h2 { font-size: 12px; }
    .compact-anomaly-summary .anomaly-list { padding: 8px 16px; }
    .compact-anomaly-summary .anomaly-list article { padding: 6px 10px; }
    .compact-anomaly-summary .anomaly-list strong { font-size: 12px; letter-spacing: 0; }
    .parcel-workflow.section-gap { margin-top: 8px; padding: 6px 0; }
    .parcel-accounting-state .panel-heading { padding: 10px 16px; }
    .parcel-accounting-state .panel-heading p { margin-top: 3px; }
    .parcel-accounting-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .content-grid.two.parcel-weight-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    .parcel-weight-options .stack-form { padding: 12px; }
    .parcel-weight-options .overweight-exception-panel > .notice { margin: 10px 12px 0; }
    .parcel-weight-options .panel-heading { padding: 12px; }
    .parcel-heading { flex-direction: row; align-items: start; }
    .parcel-heading .heading-actions { flex-shrink: 0; align-self: start; }
    .parcel-heading .heading-actions .button { min-height: 36px; }
    .parcel-heading p { max-width: 65ch; }
    .nav-caption.workflow-caption { margin-top: 8px; }
    .side-nav .nav-item { padding-top: 8px; padding-bottom: 8px; }
}
@media (min-width: 768px) and (max-width: 1199px) {
    .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-grid .filter-actions { align-self: end; }
}

/* Release contract: calm hierarchy, exact amounts, scoped scrolling. */
::selection { background: #ccfbf1; color: #134e4a; }
input, textarea { caret-color: var(--brand); }
* { scrollbar-color: #94a3b8 #f1f5f9; scrollbar-width: thin; }
.side-nav { scrollbar-color: #475569 var(--nav-bg); }
a { text-underline-offset: 3px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.app-content { padding: 28px 24px; }
.header-main { min-width: 0; }
.header-main h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.25; letter-spacing: -.02em; }
.header-breadcrumbs, .header-meta, .header-actions, .heading-actions, .form-actions { flex-wrap: wrap; }
.header-desc { max-width: 75ch; }
.panel, .table-container { box-shadow: none; }
.enterprise-table .total-col { white-space: nowrap; font-size: 14px; }
.field-span-2 { grid-column: 1 / -1; }
.station-policy-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.station-policy-form .field-span-2 { grid-column: span 2; }
.station-policy-form input, .station-policy-form select { min-height: 40px; }
.help-disclosure { margin-bottom: 16px; }
.help-disclosure > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 8px 0; color: var(--muted); }
.help-disclosure > .notice { margin-top: 8px; }
.local-section-links { gap: 8px 24px; padding: 12px 0 16px; }
.local-section-links a { padding: 6px 0; font-weight: 600; text-decoration: none; border-bottom: 2px solid transparent; }
.local-section-links a:hover, .local-section-links a:focus-visible { border-bottom-color: var(--brand); }
.payroll-station-actions > form { margin-bottom: 6px; }
.payroll-station-actions > form > .btn { width: 100%; }
.payroll-export-actions { flex-wrap: wrap; gap: 6px; }
.payroll-send-panel { margin-bottom: 16px; }
.table-responsive { overscroll-behavior-x: contain; }
.table-responsive:focus-visible { outline-offset: -2px; }
.row-disclosure[open] .stack-form { min-width: 200px; }
.action-alert-bar .alert-message small { display: none; }
@media (min-width: 768px) and (max-width: 1100px) {
    .parcel-accounting-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .payroll-commission-summary > span { display: grid; gap: 2px; }
    .payroll-commission-summary small { display: flex; flex-wrap: wrap; gap: 4px; }
    .payroll-stations-table .total-col { font-size: 13px; }
}
@media (max-width: 767px) {
    .app-content { padding: 20px 14px; }
    .app-topbar { height: auto; min-height: 56px; flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
    .topbar-search { flex: 1; min-width: 0; }
    .topbar-right { width: 100%; margin-left: 0; }
    .header-breadcrumbs h1.breadcrumb-current { font-size: 22px; }
    .station-policy-form { grid-template-columns: 1fr; }
    .station-policy-form .field-span-2 { grid-column: auto; }
    .payroll-stations-table .total-col { white-space: normal; }
    .panel-heading { flex-wrap: wrap; }
    .field.grow { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
