/* ==========================================================================
   KF Toolbox — Design System
   Brand: Kolache Factory red + charcoal, script headers, warm tones
   ========================================================================== */

/* ---------- CSS Custom Properties ---------- */

:root {
    /* Brand colors */
    --kf-red: #C8102E;
    --kf-red-dark: #A00D24;
    --kf-red-light: #E8354A;
    --kf-charcoal: #1A1A1A;
    --kf-charcoal-light: #2D2D2D;
    --kf-purple: #4A2060;
    --kf-purple-light: #6B3A8A;
    --kf-teal: #2A9D8F;
    --kf-teal-dark: #21867A;
    --kf-teal-light: #3DB8A9;
    --kf-slate: #6B8EB5;
    --kf-slate-dark: #567AA1;
    --kf-slate-light: #8BA8C9;

    /* Neutrals */
    --kf-cream: #FDF8F0;
    --kf-warm-white: #FAFAF7;
    --kf-white: #FFFFFF;
    --kf-gray-light: #F2F2F2;
    --kf-gray-mid: #6B7280;
    --kf-gray-border: #E5E7EB;

    /* Semantic */
    --kf-success: #22c55e;
    --kf-warning: #f59e0b;
    --kf-error: #ef4444;

    /* Traffic Light — SSOT for all KPI status coloring
       One color ramp used everywhere: green → white → red
       trafficGradient() in components.js interpolates between these.
       trafficTextColor() returns white or dark text based on saturation. */
    --tl-good: #16a34a;            /* well under target (kelly green) */
    --tl-neutral: #ffffff;         /* on target */
    --tl-bad: #C8102E;             /* well over target (KF red) */
    --tl-good-text: #14532d;       /* dark green text for delta-pos */
    --tl-bad-text: #7f1d1d;        /* dark red text for delta-neg */

    /* Typography */
    --font-script: 'Dancing Script', cursive;
    --font-display: 'Oswald', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Sizing */
    --content-max: 1100px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --transition: 200ms ease;
}

/* ---------- Reset & Base ---------- */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--kf-charcoal);
    background: var(--kf-warm-white);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--kf-red);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--kf-red-dark);
}

/* Focus states — keyboard accessibility */
a:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.tool-card:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--kf-red);
    outline-offset: 2px;
}

img {
    max-width: 100%;
    height: auto;
}

/* ---------- Typography ---------- */

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    color: var(--kf-charcoal);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

/* Script headings — the KF signature style */
.page-title-script {
    font-family: var(--font-script);
    font-size: 2.5rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
    color: var(--kf-red);
}

.section-heading {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--kf-gray-mid);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
}

/* ---------- Header ---------- */

.app-header {
    background: var(--kf-charcoal);
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 10px var(--space-lg);
    display: flex;
    align-items: center;
    gap: 0;
}

.header-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

/* Brand mark — baker icon stacked above "KF Toolbox" */
.brand-mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.header-baker {
    height: 36px;
    width: auto;
    filter: brightness(0) invert(1);
}

.brand-name {
    display: flex;
    align-items: baseline;
    gap: 6px;
    line-height: 1;
}

.brand-kf {
    font-family: var(--font-script);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--kf-red-light);
    -webkit-text-stroke: 0.5px var(--kf-red-light);
}

.brand-label {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    line-height: 1;
}

/* Landing page — larger brand mark */
.brand-mark-lg {
    gap: 4px;
}

.landing-baker {
    height: 80px;
    width: auto;
}

.brand-kf-lg {
    font-size: 1.8rem;
    color: var(--kf-red);
}

.brand-label-lg {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    color: var(--kf-charcoal);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    flex-grow: 1;
    margin-left: var(--space-2xl);
    padding-left: var(--space-xl);
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-link {
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.45);
    padding: var(--space-xs) 0;
    border-bottom: none;
    transition: color var(--transition);
}

.nav-link:hover {
    color: rgba(255, 255, 255, 0.8);
}

.nav-link.active {
    color: rgba(255, 255, 255, 0.7);
}

.header-user {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-shrink: 0;
}

.user-email {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

/* ---------- Footer ---------- */

.app-footer {
    margin-top: auto;
    background: var(--kf-charcoal);
    border-top: none;
    padding: var(--space-md) var(--space-lg);
}

.footer-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.55);
}

.footer-brand {
    font-family: var(--font-script);
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ---------- Main Content ---------- */

.main-content {
    flex-grow: 1;
}

.page-container {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
    overflow-x: hidden;
}
.page-container.page-wide { max-width: 1400px; }

.page-header {
    margin-bottom: var(--space-2xl);
}

/* Inline page header — title, subtitle, info-tip in one row */
.page-header-inline {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-2xl);
}
.page-header-inline .page-title-script { margin: 0; }
.page-header-inline .page-subtitle { margin: 0; }
.page-header-inline .info-tip { flex-shrink: 0; }

.page-subtitle {
    font-size: 1rem;
    color: var(--kf-gray-mid);
    margin-top: var(--space-xs);
}

/* KPI value color modifiers */
.kpi-value-good { color: var(--tl-good); }
.kpi-value-bad { color: var(--tl-bad); }
.kpi-value-muted { color: var(--kf-gray-mid); }

/* Semantic status — text color */
.is-good { color: var(--tl-good); }
.is-bad { color: var(--tl-bad); }
.is-neutral { color: var(--kf-gray-mid); }

/* Semantic status — background */
.bg-good { background: var(--tl-good); color: white; }
.bg-bad { background: var(--tl-bad); color: white; }
.bg-neutral { background: var(--kf-gray-light); }

/* Text alignment utility */
.text-right { text-align: right; }

/* ---------- Buttons ---------- */

.btn {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 24px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    text-decoration: none;
    line-height: 1.2;
}

.btn-primary {
    background: var(--kf-red);
    color: var(--kf-white);
    border-color: var(--kf-red);
}

.btn-primary:hover {
    background: var(--kf-red-dark);
    border-color: var(--kf-red-dark);
    color: var(--kf-white);
}

.btn-outline {
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    border-color: rgba(255, 255, 255, 0.15);
    font-weight: 400;
}

.btn-outline:hover {
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-sm {
    font-size: 0.75rem;
    padding: 5px 14px;
}

.btn-full {
    width: 100%;
}

.btn-cancel {
    color: var(--kf-gray-mid);
}
.btn-cancel:hover {
    color: var(--kf-charcoal);
}

/* ---------- Forms ---------- */

.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--kf-gray-mid);
    margin-bottom: var(--space-sm);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--kf-charcoal);
    background: var(--kf-white);
    border: 1px solid var(--kf-gray-border);
    border-radius: var(--radius);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--kf-red);
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.1);
}

.form-group input::placeholder {
    color: #B0B0B0;
}

/* ---------- Cards ---------- */

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.tool-card {
    background: var(--kf-white);
    border: 1px solid var(--kf-gray-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: all var(--transition);
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}

.tool-card:hover {
    border-color: var(--kf-red);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: inherit;
}

.tool-card-empty {
    border-style: dashed;
    border-color: var(--kf-gray-border);
    cursor: default;
    opacity: 0.6;
}

.tool-card-empty:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--kf-gray-border);
}

.tool-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: var(--kf-cream);
    color: var(--kf-red);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
}

.tool-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-sm);
}

.tool-desc {
    font-size: 0.9rem;
    color: var(--kf-gray-mid);
    line-height: 1.5;
}

/* ---------- Status Section ---------- */

.status-section {
    border-top: 1px solid var(--kf-gray-border);
    padding-top: var(--space-xl);
}

.status-grid {
    display: flex;
    gap: var(--space-xl);
}

.status-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--kf-gray-mid);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-ok {
    background: var(--kf-success);
    box-shadow: 0 0 4px rgba(34, 197, 94, 0.4);
}

.status-error {
    background: var(--kf-error);
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}

.status-checking {
    background: var(--kf-warning);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ---------- Flash Messages ---------- */

.flash-container {
    max-width: var(--content-max);
    margin: var(--space-md) auto;
    padding: 0 var(--space-lg);
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
}

.flash-error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.flash-success {
    background: #F0FDF4;
    color: #166534;
    border: 1px solid #BBF7D0;
}

.flash-warning {
    background: #FFFBEB;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.flash-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
    padding: 0 4px;
    line-height: 1;
}

.flash-close:hover {
    opacity: 1;
}

/* ---------- Landing Page ---------- */

.landing-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--kf-charcoal);
    /* Subtle texture */
    background-image:
        radial-gradient(ellipse at 30% 20%, rgba(200, 16, 46, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(74, 32, 96, 0.06) 0%, transparent 60%);
}

.landing-hero {
    width: 100%;
    max-width: 420px;
    padding: var(--space-xl);
}

.landing-card {
    background: var(--kf-white);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.landing-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.landing-logo {
    height: 100px;
    width: auto;
}

.landing-subtitle {
    font-size: 0.9rem;
    color: var(--kf-gray-mid);
    margin-bottom: var(--space-xl);
}

.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    text-decoration: none;
}

.btn-google .google-icon {
    flex-shrink: 0;
}

.landing-note {
    font-size: 0.75rem;
    color: var(--kf-gray-mid);
    margin-top: var(--space-lg);
}

/* ==========================================================================
   Page-Specific Styles
   Scoped by .page-* class on the page content wrapper.
   ========================================================================== */

/* ---------- Deposits Dashboard ---------- */

.deposit-grid-scroll {
    border: 1px solid var(--kf-gray-border);
    border-radius: var(--radius-lg);
    background: var(--kf-white);
}

.compliance-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.compliance-grid th,
.compliance-grid td {
    padding: 6px 4px;
    text-align: center;
    border-bottom: 1px solid var(--kf-gray-border);
}

.compliance-grid thead th {
    background: var(--kf-charcoal);
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--font-display);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.7rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Frozen columns: Store, RD, Total — explicit opaque backgrounds for all states */
.compliance-grid .col-store {
    text-align: left;
    padding-left: var(--space-md);
    white-space: nowrap;
    min-width: 160px;
    position: sticky;
    left: 0;
    z-index: 5;
}

.compliance-grid .col-rd {
    text-align: left;
    padding-left: var(--space-md);
    white-space: nowrap;
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    position: sticky;
    left: 160px;
    z-index: 5;
}

.compliance-grid tbody .col-store,
.compliance-grid tbody .col-rd,
.compliance-grid tbody td.col-total { background: var(--kf-white); }

.compliance-grid tbody tr:nth-child(even) .col-store,
.compliance-grid tbody tr:nth-child(even) .col-rd,
.compliance-grid tbody tr:nth-child(even) td.col-total { background: var(--kf-warm-white); }

.compliance-grid tbody tr:hover .col-store,
.compliance-grid tbody tr:hover .col-rd,
.compliance-grid tbody tr:hover td.col-total { background: var(--kf-cream); }

.compliance-grid thead th.col-store,
.compliance-grid thead th.col-rd,
.compliance-grid thead th.col-total { background: var(--kf-charcoal); z-index: 15; }

.compliance-grid thead .day-summary-row th.col-store,
.compliance-grid thead .day-summary-row th.col-rd,
.compliance-grid thead .day-summary-row th.col-total { background: var(--kf-charcoal-light); }

.compliance-grid tbody tr:hover { background: var(--kf-cream); }
.compliance-grid tbody tr:nth-child(even) { background: var(--kf-warm-white); }
.compliance-grid tbody tr:nth-child(even):hover { background: var(--kf-cream); }
.compliance-grid tbody tr.rd-break td { border-top: 2px solid var(--kf-gray-mid); }
.compliance-grid .col-day { min-width: 28px; max-width: 32px; }
.compliance-grid tbody td.day-cell { border-left: 1px solid var(--kf-gray-border); }

.day-summary-row th { background: var(--kf-charcoal-light); padding: 3px 4px; }
.day-summary-row .col-store { font-weight: 400; font-size: 0.65rem; letter-spacing: 0; }

.day-count { display: inline-block; font-family: var(--font-body); font-size: 0.65rem; font-weight: 600; min-width: 16px; line-height: 16px; border-radius: 8px; text-align: center; }
.day-count-ok { color: var(--kf-success); }
.day-count-miss { background: var(--kf-error); color: var(--kf-white); text-decoration: none; }
.day-count-miss:hover { background: var(--tl-bad-deep); color: var(--kf-white); }

.amount-cell { font-family: 'SF Mono', 'Menlo', monospace; font-size: 0.6rem; color: var(--kf-charcoal); white-space: nowrap; text-align: right; display: block; }
.amount-cell.amount-miss { color: var(--kf-error); font-family: var(--font-body); font-weight: 600; text-align: center; }

.compliance-grid th.col-total,
.compliance-grid td.col-total {
    min-width: 80px; font-family: 'SF Mono', 'Menlo', monospace; font-size: 0.7rem;
    text-align: right; padding-right: var(--space-md); white-space: nowrap;
    border-right: 2px solid var(--kf-gray-mid); position: sticky; left: 300px; z-index: 5;
}
.compliance-grid thead th.col-total { border-right-color: rgba(255, 255, 255, 0.2); }

.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.dot-ok { background: var(--kf-success); box-shadow: 0 0 3px rgba(34, 197, 94, 0.3); }
.dot-miss { background: var(--kf-error); box-shadow: 0 0 3px rgba(239, 68, 68, 0.3); }
.dot-closed { background: var(--kf-gray-border); }
.dot-future { background: transparent; }

.day-cell { position: relative; cursor: pointer; }
.day-cell:hover .dot-ok, .day-cell:hover .dot-miss { transform: scale(1.3); transition: transform 0.15s ease; }
.day-cell .tooltip { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--kf-charcoal); color: var(--kf-white); padding: 4px 8px; border-radius: 4px; font-size: 0.7rem; white-space: nowrap; z-index: 20; pointer-events: none; }
.day-cell:hover .tooltip { display: block; }

.grid-legend { display: flex; gap: var(--space-lg); padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--kf-gray-border); font-size: 0.8rem; color: var(--kf-gray-mid); }
.legend-item { display: flex; align-items: center; gap: var(--space-xs); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ---------- Deposits Daily ---------- */

.noncompliant-section { border-left: 3px solid var(--kf-error); padding-left: var(--space-md); margin-bottom: var(--space-xl); }

/* ---------- Payroll Scorecard ---------- */

.sc-scroll { max-height: calc(100vh - 340px); }
.sc-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; background: var(--kf-white); }
.sc-table thead th {
    position: sticky; top: 0; z-index: 10;
    background: var(--kf-charcoal); color: var(--kf-white);
    font-family: var(--font-display); font-size: 0.68rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 8px;
    text-align: left; white-space: nowrap; cursor: pointer; user-select: none;
}
.sc-table thead th.r { text-align: right; }
.sc-table thead th:hover { color: var(--kf-red-light); }

th.tw-col { background: var(--kf-charcoal) !important; }
th.tw-first, td.tw-first { border-left: 2px solid var(--kf-gray-mid); }
th.tw-last, td.tw-last { border-right: 2px solid var(--kf-gray-mid); }

.sc-table td { padding: 5px 8px; border-bottom: 1px solid var(--kf-gray-border); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sc-table td.r { text-align: right; }
.sc-table tbody tr { cursor: pointer; }
.sc-table tbody tr:hover { background: var(--kf-cream); }

.ta { font-size: 0.65rem; margin-left: 3px; vertical-align: middle; }
.ta-d { color: var(--tl-good); }
.ta-u { color: var(--tl-bad); }
.ta-f { color: var(--kf-gray-border); }

td.col-pct { font-weight: 600; }

/* ---------- Payroll Store Detail ---------- */

.yoy-row td { border-top: 2px solid var(--kf-charcoal); }
.footer-note { font-size: 0.75rem; color: var(--kf-gray-mid); margin-top: var(--space-sm); }

/* ---------- Payroll Settings ---------- */

.numeric-setting { display: flex; align-items: center; gap: var(--space-lg); padding: var(--space-md) 0; border-bottom: 1px solid var(--kf-gray-border); }
.numeric-setting:last-child { border-bottom: none; }
.numeric-setting .setting-name { flex: 0 0 200px; }
.numeric-setting .setting-input { flex: 0 0 120px; }

.base-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.base-table th { font-family: var(--font-display); font-size: 0.65rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 10px; text-align: left; background: var(--kf-gray-light); border-bottom: 1px solid var(--kf-gray-border); }
.base-table td { padding: 6px 10px; border-bottom: 1px solid var(--kf-gray-border); }
.base-table input { width: 80px; padding: 4px 8px; font-size: 0.82rem; border: 1px solid var(--kf-gray-border); border-radius: var(--radius); text-align: right; }
.base-table .btn-save { padding: 3px 10px; font-size: 0.75rem; }

/* ---------- Admin Stores ---------- */

.store-admin-scroll { border: 1px solid var(--kf-gray-border); background: var(--kf-white); }
.store-admin-table { width: 100%; border-collapse: collapse; }
.store-admin-table th, .store-admin-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--kf-gray-border); font-size: 0.85rem; }
.store-admin-table thead th {
    background: var(--kf-charcoal); color: rgba(255, 255, 255, 0.85);
    font-family: var(--font-display); font-weight: 500; text-transform: uppercase;
    letter-spacing: 0.06em; font-size: 0.75rem; position: sticky; top: 0; z-index: 10;
}
.store-admin-table tbody tr:hover { background: var(--kf-cream); }
.store-admin-table tbody tr:nth-child(even) { background: var(--kf-warm-white); }
.store-admin-table tbody tr:nth-child(even):hover { background: var(--kf-cream); }
.store-admin-table .col-id { width: 60px; font-family: 'SF Mono', 'Menlo', monospace; font-weight: 600; }
.store-admin-table .col-name { min-width: 140px; }
.store-admin-table .col-rd { min-width: 120px; color: var(--kf-gray-mid); }
.store-admin-table input[type="text"] { width: 100%; padding: 5px 8px; font-family: var(--font-body); font-size: 0.85rem; border: 1px solid var(--kf-gray-border); border-radius: 4px; background: var(--kf-white); color: var(--kf-charcoal); transition: border-color var(--transition); }
.store-admin-table input[type="text"]:focus { outline: none; border-color: var(--kf-red); box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.1); }
.store-admin-table .col-bank { min-width: 180px; }
.store-admin-table .col-last4 { width: 100px; }
.store-admin-table .col-last4 input { text-align: center; letter-spacing: 0.15em; font-family: 'SF Mono', 'Menlo', monospace; }
.store-admin-table input[list] { padding-right: 24px; }
.admin-actions { display: flex; align-items: center; justify-content: space-between; padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--kf-gray-border); }
.admin-hint { font-size: 0.8rem; color: var(--kf-gray-mid); }

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .header-inner {
        padding: var(--space-sm) var(--space-md);
        gap: var(--space-md);
    }

    .header-logo {
        height: 30px;
    }

    .header-nav .nav-link:not(:first-child) {
        display: none;
    }

    .header-user .user-email {
        display: none;
    }

    .page-container {
        padding: var(--space-lg) var(--space-sm);
    }

    .tool-grid {
        grid-template-columns: 1fr;
    }

    .page-title-script {
        font-size: 1.6rem;
    }

    .page-subtitle {
        font-size: 0.75rem;
    }

    .status-grid {
        flex-direction: column;
        gap: var(--space-md);
    }
}

/* ==========================================================================
   Shared Components — Reusable across all tools
   KPI cards, data grids, toolbars, heroes, comparison tables, charts
   ========================================================================== */

/* ---------- KPI Card Grid ---------- */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}
.kpi-card {
    background: var(--kf-charcoal);
    color: var(--kf-white);
    border-radius: var(--radius);
    padding: var(--space-lg);
    border-left: 12px solid var(--kf-charcoal);  /* default: blends in (no status) */
}
.kpi-card-good { border-left-color: var(--tl-good); }
.kpi-card-bad { border-left-color: var(--tl-bad); }
.kpi-label {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: var(--space-xs);
}
.kpi-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.1;
}
.kpi-sub {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: var(--space-xs);
}

/* ---------- Toolbar ---------- */

.tool-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: var(--kf-white);
    border: 1px solid var(--kf-gray-border);
    border-radius: var(--radius);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}
.toolbar-filter {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.toolbar-filter-label {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--kf-gray-mid);
}
.toolbar-filter select {
    padding: 5px 10px;
    font-family: var(--font-body);
    font-size: 0.8rem;
    border: 1px solid var(--kf-gray-border);
    border-radius: var(--radius);
    background: var(--kf-warm-white);
}
.toolbar-sep {
    width: 1px;
    height: 24px;
    background: var(--kf-gray-border);
    flex-shrink: 0;
}
.toolbar-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--kf-gray-mid);
}
.toolbar-toggle input { cursor: pointer; }
.toolbar-end { margin-left: auto; }
.toolbar-end a { font-size: 0.8rem; color: var(--kf-gray-mid); }

/* Radio toggle group (View: Summary / Trend) */
.toolbar-radio-group { gap: var(--space-sm); }
.toolbar-radio {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--kf-gray-mid);
}
.toolbar-radio input {
    accent-color: var(--kf-red);
    width: 14px;
    height: 14px;
    margin: 0;
}

/* ---------- Toolbar Month Nav ---------- */

.toolbar-month {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.toolbar-month a {
    font-size: 0.85rem;
    color: var(--kf-gray-mid);
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: all var(--transition);
}
.toolbar-month a:hover {
    background: var(--kf-gray-light);
    color: var(--kf-charcoal);
}
.toolbar-month-label {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 160px;
    text-align: center;
}

/* ---------- Data Grid ---------- */

.data-grid {
    width: auto;
    border-collapse: collapse;
    font-size: 0.75rem;
    background: var(--kf-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.data-grid thead {
    background: var(--kf-charcoal);
    color: var(--kf-white);
    position: sticky;
    top: 0;
    z-index: 10;
}
.data-grid thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--kf-charcoal);
}
.data-grid th {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 6px 8px;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.data-grid th:hover { color: var(--kf-red-light); }
.data-grid th.sort-active { color: var(--kf-red-light); }
.data-grid th.text-right,
.data-grid td.text-right { text-align: right; font-variant-numeric: tabular-nums; }
.data-grid td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--kf-gray-border);
    white-space: nowrap;
}
.data-grid tbody tr:hover { background: var(--kf-cream); }
.data-grid tbody tr.clickable { cursor: pointer; }

/* Scroll container — fixed height, sticky header, body scrolls */
.grid-scroll-container {
    max-height: calc(100vh - 320px);
    overflow: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 100%;
}

/* Primary column — visually dominant */
.data-grid td.col-primary {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    border-left: 2px solid var(--kf-gray-border);
    border-right: 2px solid var(--kf-gray-border);
}
.data-grid th.col-primary-hdr {
    border-left: 2px solid rgba(255,255,255,0.15);
    border-right: 2px solid rgba(255,255,255,0.15);
    color: var(--kf-white) !important;
    font-size: 0.65rem !important;
}

/* Delta column — subordinate */
.data-grid td.col-delta { font-size: 0.7rem; }

/* Sort arrows */
.sort-arrow { font-size: 0.6rem; margin-left: 3px; opacity: 0.5; }
.sort-active .sort-arrow { opacity: 1; }

/* Fleet/summary row */
.data-grid .fleet-row { background: var(--kf-gray-light); font-weight: 600; }
.data-grid .fleet-row td { border-top: 2px solid var(--kf-charcoal); }

/* ---------- Delta Colors ---------- */

.delta-pos { color: var(--tl-good-text); }
.delta-neg { color: var(--tl-bad-text); }

/* ---------- Trend Arrows ---------- */

.trend-arrow { font-size: 0.7rem; margin-left: 4px; vertical-align: middle; }
.trend-arrow.up-good { color: var(--tl-good); }       /* ▲ green — up is good (sales) */
.trend-arrow.up-bad { color: var(--tl-bad); }          /* ▲ red — up is bad (payroll, hours) */
.trend-arrow.down-good { color: var(--tl-good); }     /* ▼ green — down is good (payroll, hours) */
.trend-arrow.down-bad { color: var(--tl-bad); }        /* ▼ red — down is bad (sales) */
.trend-arrow.flat { color: var(--kf-gray-mid); }       /* · flat */

/* ---------- Hero Section ---------- */

.metric-hero {
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-2xl);
    text-align: center;
    margin-bottom: var(--space-xl);
    /* Background color and text color set by JS via trafficGradient('hero') */
}

.hero-store {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-xs);
}
.hero-label {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: var(--space-md);
}
.hero-kpis {
    display: flex;
    justify-content: center;
    gap: var(--space-2xl);
}
.hero-kpi {
    text-align: center;
}
.hero-kpi-value {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.1;
}
.hero-kpi-label {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: var(--space-xs);
    opacity: 0.8;
}

/* ---------- Gradient Key ---------- */

.gradient-key {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: calc(-1 * var(--space-sm));
    margin-bottom: var(--space-xl);
    padding: 0 var(--space-md);
}
.gradient-bar {
    width: 100%;
    max-width: 480px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--tl-good), var(--tl-neutral) 50%, var(--tl-bad));
    border: 1px solid var(--kf-gray-border);
}
.gradient-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 480px;
    margin-top: 4px;
}
.gradient-label {
    font-family: var(--font-body);
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--kf-gray-mid);
    text-align: center;
}
.gradient-label strong {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--kf-charcoal);
}

/* ---------- Stat Cards ---------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}
.stats-grid.stats-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-card {
    background: var(--kf-white);
    border: 1px solid var(--kf-gray-border);
    border-radius: var(--radius);
    padding: var(--space-lg);
    text-align: center;
}
.stat-label {
    font-family: var(--font-display);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--kf-gray-mid);
    margin-bottom: var(--space-xs);
}
.stat-value {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--kf-charcoal);
}
.stat-sub {
    font-size: 0.75rem;
    color: var(--kf-gray-mid);
    margin-top: 2px;
}

/* ---------- Chart Container ---------- */

.chart-container {
    background: var(--kf-white);
    border: 1px solid var(--kf-gray-border);
    border-radius: var(--radius);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}
.chart-title {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--kf-charcoal);
    margin-bottom: var(--space-md);
}

/* ---------- Table Scroll Container ---------- */
/* Wrap any table that needs horizontal scroll on mobile */
.table-scroll {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: var(--space-xl);
    max-width: 100%;
}
.table-scroll > table {
    margin-bottom: 0;  /* parent handles spacing */
    box-shadow: none;   /* parent handles shadow */
}
.table-scroll-short { max-height: 400px; }

/* ---------- Grouped Table Headers ---------- */
/* Spanning header row above sub-columns. Lightweight label, not a heavy cell. */

.thead-group th {
    font-family: var(--font-body);
    font-size: 0.6rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    padding: 6px 8px 2px;
    border-bottom: none;
}
.thead-group th.col-group-label {
    text-align: center;
    border-bottom: 2px solid var(--kf-red);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

/* ---------- Column Width Constraints ---------- */
/* Fixed-width numeric columns for dense data tables */

.col-num { width: 70px; min-width: 70px; text-align: right; }
.col-store-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-rd-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-id { width: 45px; }

/* ---------- Comparison Table ---------- */

.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    background: var(--kf-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: var(--space-xl);
}
.compare-table thead {
    background: var(--kf-charcoal);
    color: var(--kf-white);
}
.compare-table th {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 14px;
    text-align: right;
}
.compare-table th:first-child { text-align: left; }
.compare-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--kf-gray-border);
    text-align: right;
}
.compare-table td:first-child {
    text-align: left;
    font-weight: 500;
    color: var(--kf-gray-mid);
}

/* ---------- Info Tip ---------- */

.info-tip {
    cursor: help;
    font-size: 1.1rem;
    color: var(--kf-gray-mid);
}
.info-tip:hover { color: var(--kf-red); }

/* ---------- Back Link ---------- */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--kf-gray-mid);
    margin-bottom: var(--space-lg);
}
.back-link:hover { color: var(--kf-red); }

/* ---------- Settings Section ---------- */

.settings-section {
    background: var(--kf-white);
    border: 1px solid var(--kf-gray-border);
    border-radius: var(--radius);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    max-width: 600px;
}
.settings-title {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--kf-charcoal);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--kf-red);
}

/* Setting rows — shared layout for settings pages */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--kf-gray-border);
}
.setting-row:last-child { border-bottom: none; }
.setting-info { flex: 1; }
.setting-name {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.setting-desc {
    font-size: 0.8rem;
    color: var(--kf-gray-mid);
    margin-top: 2px;
}

/* Block-level description below a settings title */
.settings-desc {
    font-size: 0.8rem;
    color: var(--kf-gray-mid);
    margin-bottom: var(--space-md);
}

/* Toggle switch */
.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--kf-gray-border);
    border-radius: 24px;
    transition: background var(--transition);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--kf-white);
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider {
    background: var(--kf-success);
}
.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Settings input field */
.setting-input {
    width: 250px;
    padding: 8px 12px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    border: 1px solid var(--kf-gray-border);
    border-radius: var(--radius);
}
.setting-input:focus {
    outline: none;
    border-color: var(--kf-red);
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.1);
}
.setting-input-narrow { width: 120px; }

/* Settings actions */
.settings-actions {
    margin-top: var(--space-xl);
    display: flex;
    gap: var(--space-md);
}

/* ---------- Heatmap Grid ---------- */

.heatmap-grid {
    width: auto;
    border-collapse: collapse;
    font-size: 0.72rem;
    background: var(--kf-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.heatmap-grid th {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 5px 6px;
    text-align: center;
    white-space: nowrap;
    background: var(--kf-charcoal);
    color: var(--kf-white);
}
.heatmap-grid th.col-store { text-align: left; min-width: 120px; }
.heatmap-grid td {
    padding: 3px 6px;
    text-align: center;
    border: 1px solid var(--kf-gray-border);
    font-weight: 600;
    font-size: 0.7rem;
}
.heatmap-grid td.col-store {
    text-align: left;
    font-weight: 500;
    padding: 3px 8px;
    background: var(--kf-white);
    border-right: 2px solid var(--kf-gray-border);
}

/* ---------- Responsive: Shared ---------- */

@media (max-width: 768px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .kpi-card { padding: var(--space-md); }
    .kpi-value { font-size: 1.5rem; }
    .kpi-sub { font-size: 0.68rem; }
    .col-hide-mobile { display: none; }

    /* Hero — tighter on mobile */
    .metric-hero { padding: var(--space-md) var(--space-sm); }
    .hero-store { font-size: 0.85rem; letter-spacing: 0.04em; }
    .hero-label { font-size: 0.65rem; margin-bottom: var(--space-sm); }
    .hero-kpis { gap: var(--space-lg); }
    .hero-kpi-value { font-size: 1.5rem; }
    .hero-kpi-label { font-size: 0.5rem; }

    .gradient-label { font-size: 0.5rem; }
    .gradient-label strong { font-size: 0.6rem; }

    /* Stat cards — stay 3-across on mobile, 4-col variant goes 2x2 */
    .stats-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-sm); }
    .stats-grid.stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .stat-card { padding: var(--space-sm) var(--space-xs); }
    .stat-value { font-size: 1rem; }
    .stat-label { font-size: 0.55rem; letter-spacing: 0.05em; }
    .stat-sub { font-size: 0.6rem; }

    /* Column constraints — tighter on mobile */
    .col-store-name { width: 110px; max-width: 110px; }
    .col-num { width: 55px; min-width: 55px; }

    /* Tables — scroll horizontally on narrow screens */
    .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .compare-table { font-size: 0.72rem; }
    .compare-table th, .compare-table td { padding: 6px 8px; white-space: nowrap; }

    /* Data grid */
    .data-grid { font-size: 0.72rem; }
    .data-grid th, .data-grid td { padding: 4px 6px; }

    /* Chart — compact legend */
    .chart-container { padding: var(--space-md) var(--space-sm); }
    .chart-title { font-size: 0.7rem; letter-spacing: 0.03em; }

    /* Toolbar — stacked on mobile with aligned dropdowns */
    .tool-toolbar {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: var(--space-xs) var(--space-sm);
        padding: var(--space-sm) var(--space-md);
        align-items: center;
    }
    .toolbar-sep { display: none; }
    .toolbar-filter {
        display: contents;  /* label and select become direct grid children */
    }
    .toolbar-filter select {
        padding: 4px 6px;
        font-size: 0.75rem;
        width: 100%;
    }
    .toolbar-filter-label {
        font-size: 0.6rem;
        text-align: right;
    }
    .toolbar-toggle {
        grid-column: 1 / -1;
        font-size: 0.75rem;
    }
    .toolbar-radio-group {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        gap: var(--space-sm);
    }
    .toolbar-radio { font-size: 0.75rem; }
    .toolbar-end {
        grid-column: 1 / -1;
        margin-left: 0;
        text-align: right;
    }
    .toolbar-month {
        grid-column: 1 / -1;
    }
    .toolbar-month-label {
        font-size: 0.9rem;
        min-width: 120px;
    }

    /* Scroll container for wide tables */
    .grid-scroll-container { -webkit-overflow-scrolling: touch; }

    /* Info tip — inline, not block */
    .info-tip { font-size: 0.85rem; }

    /* Footer note */
    .footer-note { font-size: 0.65rem; }

    /* Section heading */
    .section-heading { font-size: 0.8rem; }

    /* Deposits dashboard mobile */
    .compliance-grid { font-size: 0.7rem; }
    .dot { width: 10px; height: 10px; }

    /* Scorecard mobile */
    .hm { display: none; }
    .sc-table { font-size: 0.7rem; }
    .sc-table thead th { padding: 6px 6px; font-size: 0.6rem; }
    .sc-table td { padding: 4px 6px; }
}

/* ---------- Print: Shared ---------- */

@media print {
    .app-header,
    .app-footer,
    .flash-container,
    .no-print {
        display: none !important;
    }

    body {
        background: white;
    }

    .main-content {
        padding: 0;
    }

    .kpi-grid { gap: 8px; }
    .kpi-card {
        border: 1px solid #ccc;
        background: #fff !important;
        color: #000 !important;
        padding: 8px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .kpi-label { color: #666 !important; }
    .kpi-value { font-size: 1.2rem; }
    .kpi-sub { color: #666 !important; }

    .data-grid { box-shadow: none; }
    .data-grid thead {
        background: #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .metric-hero {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        padding: 16px;
    }
    .hero-kpi-value { font-size: 1.8rem; }

    .chart-container { page-break-inside: avoid; }

    .print-header { display: block !important; text-align: center; margin-bottom: 12px; }
    .print-header h2 { font-size: 1rem; margin: 0; }
    .print-header p { font-size: 0.8rem; color: #666; }

    /* Scorecard print */
    .sc-scroll { max-height: none; overflow: visible; }
    .sc-table thead th { background: #333 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
