/* =====================================================================
 * flyingmeatball.css | Dartboard Systems | Flying Meatballs costing demo
 * Page chrome (header, footer) stays Dartboard. Content accents take the
 * Flying Meatballs palette: San Marzano red, basil green, cream, charcoal.
 * Flat fills only. No gradients anywhere in this file.
 * ================================================================== */
:root {
    --fm-red: #B52A1F;
    --fm-red-deep: #8E1E15;
    --fm-red-tint: #F7E4E1;
    --fm-green: #3C6E3A;
    --fm-green-tint: #E4EFE2;
    --fm-amber: #B07A12;
    --fm-amber-tint: #F8EDD3;
    --fm-cream: #FBF7F0;
    --fm-paper: #FFFFFF;
    --fm-ink: #1E1A17;
    --fm-ink-soft: #5C544E;
    --fm-wheat: #E9DCC4;
    --fm-wheat-deep: #D5C3A3;
    --db-dark: #0C1418;
    --db-teal: #142B35;
    --db-gold: #B78D4A;
}

body {
    background: var(--fm-cream);
    color: var(--fm-ink);
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

h1, h2, h3, .fm-serif { font-family: Georgia, "Times New Roman", serif; }

.fm-page { max-width: 1440px; margin: 0 auto; padding: 8px 20px 48px; width: 100%; }
.fm-page-narrow { max-width: 1100px; }

.fm-title { font-size: 30px; font-weight: 400; color: var(--fm-ink); margin: 0; line-height: 1.15; }
.fm-title small { font-family: "Segoe UI", -apple-system, sans-serif; display: block; font-size: 14px; color: var(--fm-ink-soft); margin-top: 6px; }
.fm-titlebar { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 14px; margin: 10px 0 20px; }

/* Costing navigation strip */
.fm-nav { background: var(--fm-paper); border-bottom: 3px solid var(--fm-red); margin-top: -16px; }
.fm-nav-inner { max-width: 1440px; margin: 0 auto; display: flex; flex-wrap: wrap; padding: 0 12px; }
.fm-nav-link { display: flex; align-items: center; gap: 8px; padding: 12px 14px; color: var(--fm-ink-soft); text-decoration: none; font-size: 14px; font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -3px; }
.fm-nav-link i { color: var(--fm-red); font-size: 13px; }
.fm-nav-link:hover { color: var(--fm-ink); background: var(--fm-cream); }
.fm-nav-link.active { color: var(--fm-red-deep); border-bottom-color: var(--fm-red-deep); }

/* Cards */
.fm-card { background: var(--fm-paper); border: 1px solid var(--fm-wheat); border-radius: 10px; margin-bottom: 20px; }
.fm-card-head { padding: 14px 20px; border-bottom: 1px solid var(--fm-wheat); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.fm-card-head h3 { margin: 0; font-size: 18px; font-weight: 400; }
.fm-card-head h3 i { color: var(--fm-red); margin-right: 8px; font-size: 15px; }
.fm-card-body { padding: 18px 20px; }
.fm-card-dark .fm-card-head { background: var(--db-teal); color: #fff; border-bottom: none; border-radius: 10px 10px 0 0; }
.fm-card-dark .fm-card-head h3 i { color: var(--db-gold); }

/* KPI tiles */
.fm-kpi { background: var(--fm-paper); border: 1px solid var(--fm-wheat); border-left: 5px solid var(--fm-red); border-radius: 8px; padding: 14px 18px; height: 100%; }
.fm-kpi .k-label { font-size: 13px; color: var(--fm-ink-soft); }
.fm-kpi .k-value { font-family: Georgia, serif; font-size: 28px; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.fm-kpi .k-sub { font-size: 12.5px; color: var(--fm-ink-soft); margin-top: 6px; }
.fm-kpi.green { border-left-color: var(--fm-green); }
.fm-kpi.amber { border-left-color: var(--fm-amber); }
.fm-kpi.gold { border-left-color: var(--db-gold); }

/* Buttons */
.btn-fm { background: var(--fm-red); color: #fff; border: 1px solid var(--fm-red); font-weight: 600; border-radius: 7px; padding: 8px 16px; }
.btn-fm:hover, .btn-fm:focus { background: var(--fm-red-deep); border-color: var(--fm-red-deep); color: #fff; }
.btn-fm:disabled { opacity: 0.55; }
.btn-fm-outline { background: var(--fm-paper); color: var(--fm-red-deep); border: 1px solid var(--fm-red); font-weight: 600; border-radius: 7px; padding: 8px 16px; }
.btn-fm-outline:hover { background: var(--fm-red); color: #fff; }
.btn-fm-quiet { background: var(--fm-paper); color: var(--fm-ink); border: 1px solid var(--fm-wheat-deep); font-weight: 600; border-radius: 7px; padding: 8px 16px; }
.btn-fm-quiet:hover { background: var(--fm-cream); color: var(--fm-ink); }
.btn-fm-green { background: var(--fm-green); color: #fff; border: 1px solid var(--fm-green); font-weight: 600; border-radius: 7px; padding: 8px 16px; }
.btn-fm-green:hover { background: #2E5A2D; color: #fff; }
.btn-sm.btn-fm, .btn-sm.btn-fm-outline, .btn-sm.btn-fm-quiet, .btn-sm.btn-fm-green { padding: 4px 10px; font-size: 12.5px; }

/* Status pills */
.pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.pill-current, .pill-high, .pill-ok { background: var(--fm-green-tint); color: var(--fm-green); }
.pill-older, .pill-medium, .pill-warn { background: var(--fm-amber-tint); color: var(--fm-amber); }
.pill-partial, .pill-low, .pill-bad, .pill-none { background: var(--fm-red-tint); color: var(--fm-red-deep); }
.pill-neutral { background: var(--fm-wheat); color: var(--fm-ink-soft); }
.pill-sku { background: var(--db-teal); color: var(--db-gold); }
.pill-sub { background: #E8ECF1; color: #2F4858; }

/* Tables */
.fm-table { width: 100%; margin: 0; }
.fm-table thead th { background: var(--db-teal); color: #fff; font-size: 12px; font-weight: 600; padding: 10px 10px; border: none; white-space: nowrap; }
.fm-table thead th.sorting:after, .fm-table thead th.sorting_asc:after, .fm-table thead th.sorting_desc:after { color: var(--db-gold); }
.fm-table tbody td { padding: 9px 10px; vertical-align: middle; border-bottom: 1px solid #f0ebe2; font-size: 13.5px; }
.fm-table tbody tr:hover { background: var(--fm-cream); }
.fm-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fm-table thead th.num { text-align: right; }
table.dataTable { border-collapse: collapse !important; }
.dataTables_wrapper .dataTables_filter input { border: 1px solid var(--fm-wheat-deep); border-radius: 6px; padding: 5px 10px; }
.dataTables_wrapper .dataTables_length select { border: 1px solid var(--fm-wheat-deep); border-radius: 6px; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--fm-red) !important; color: #fff !important; border-color: var(--fm-red) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button:hover { background: var(--fm-cream) !important; color: var(--fm-ink) !important; border-color: var(--fm-wheat) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover { background: var(--fm-red-deep) !important; color: #fff !important; }

.delta-up { color: var(--fm-red-deep); font-weight: 700; }
.delta-down { color: var(--fm-green); font-weight: 700; }
.delta-flat { color: var(--fm-ink-soft); }

/* Forms */
.form-label { font-weight: 600; font-size: 13px; color: var(--fm-ink); margin-bottom: 4px; }
.form-control, .form-select { border: 1px solid var(--fm-wheat-deep); border-radius: 6px; }
.form-control:focus, .form-select:focus { border-color: var(--fm-red); box-shadow: 0 0 0 3px rgba(181, 42, 31, 0.15); }
.select2-container--default .select2-selection--single { border: 1px solid var(--fm-wheat-deep); border-radius: 6px; height: 38px; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 36px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--fm-red); }
.select2-dropdown { border: 1px solid var(--fm-wheat-deep); }

/* Callouts */
.fm-note { background: var(--fm-cream); border-left: 4px solid var(--db-gold); padding: 10px 14px; border-radius: 6px; font-size: 13.5px; }
.fm-note.red { border-left-color: var(--fm-red); background: var(--fm-red-tint); }
.fm-note.green { border-left-color: var(--fm-green); background: var(--fm-green-tint); }
.fm-note.amber { border-left-color: var(--fm-amber); background: var(--fm-amber-tint); }

/* Dropzone for the invoice import */
.dropzone { border: 2px dashed var(--fm-wheat-deep); border-radius: 12px; padding: 36px 20px; text-align: center; background: var(--fm-cream); cursor: pointer; }
.dropzone:hover, .dropzone.dragover { border-color: var(--fm-red); background: var(--fm-red-tint); }
.dropzone i { font-size: 36px; color: var(--fm-red); display: block; margin-bottom: 8px; }
.dropzone .hint { color: var(--fm-ink-soft); font-size: 13px; margin-top: 6px; }
.dropzone .filename { color: var(--fm-ink); font-weight: 600; margin-top: 8px; }

.ai-read { display: flex; gap: 8px; padding: 6px 10px; background: var(--fm-cream); border-left: 3px solid var(--db-gold); border-radius: 4px; margin-bottom: 6px; font-size: 12px; }
.ai-read .label { color: var(--db-gold); font-weight: 700; font-size: 10.5px; flex-shrink: 0; padding-top: 2px; }
.ai-read .text { color: var(--fm-ink); flex: 1; word-break: break-word; }
.ai-read .keywords { display: inline-block; margin-left: 6px; padding: 1px 7px; background: var(--db-teal); color: #fff; border-radius: 8px; font-size: 10px; font-weight: 600; }

.review-table td { vertical-align: top; }
.review-table .form-control, .review-table .form-select { font-size: 13px; }
.review-table .select2-container--default .select2-selection--single { height: 34px; }
.review-table .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 32px; font-size: 13px; }
.review-table .select2-container--default .select2-selection--single .select2-selection__arrow { height: 32px; }

/* Big number */
.fm-big { font-family: Georgia, serif; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.fm-big small { font-family: "Segoe UI", sans-serif; font-size: 13px; color: var(--fm-ink-soft); margin-left: 4px; }

/* Cost ribbon on the dashboard */
.fm-product-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.fm-product { background: var(--fm-paper); border: 1px solid var(--fm-wheat); border-radius: 10px; padding: 14px 16px; }
.fm-product .p-name { font-weight: 600; font-size: 14px; min-height: 38px; }
.fm-product .p-cost { font-family: Georgia, serif; font-size: 26px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.fm-product .p-cost small { font-family: "Segoe UI", sans-serif; font-size: 12px; color: var(--fm-ink-soft); }
.fm-product .p-margin { font-size: 13px; margin-top: 6px; }
.fm-product.below { border-top: 4px solid var(--fm-red); }
.fm-product.ok { border-top: 4px solid var(--fm-green); }

/* Ask chat */
.ask-thread { min-height: 320px; }
.ask-msg { display: flex; gap: 12px; margin-bottom: 16px; }
.ask-msg .who { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-weight: 700; font-size: 13px; }
.ask-msg.user .who { background: var(--fm-wheat); color: var(--fm-ink); }
.ask-msg.ai .who { background: var(--db-teal); color: var(--db-gold); }
.ask-msg .bubble { background: var(--fm-paper); border: 1px solid var(--fm-wheat); border-radius: 10px; padding: 12px 16px; max-width: 900px; font-size: 14px; line-height: 1.55; }
.ask-msg.user .bubble { background: var(--fm-cream); }
.ask-msg .bubble table { width: auto; margin: 8px 0; font-size: 13px; border-collapse: collapse; }
.ask-msg .bubble th, .ask-msg .bubble td { border: 1px solid var(--fm-wheat); padding: 4px 8px; }
.ask-msg .bubble th { background: var(--fm-cream); }
.ask-msg .bubble p:last-child { margin-bottom: 0; }
.ask-trace { font-size: 12px; color: var(--fm-ink-soft); margin-top: 8px; }
.ask-trace code { display: block; white-space: pre-wrap; background: var(--fm-cream); padding: 6px 8px; border-radius: 4px; color: var(--fm-ink); margin: 4px 0; font-size: 11.5px; }
.ask-chip { background: var(--fm-paper); border: 1px solid var(--fm-wheat-deep); color: var(--fm-ink); border-radius: 16px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.ask-chip:hover { border-color: var(--fm-red); color: var(--fm-red-deep); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--fm-cream); padding: 20px; }
.login-card { background: var(--fm-paper); border: 1px solid var(--fm-wheat); border-top: 6px solid var(--fm-red); border-radius: 12px; width: 100%; max-width: 460px; padding: 34px 36px 28px; }
.login-card h1 { font-size: 28px; margin: 0 0 4px; }
.login-card .sub { color: var(--fm-ink-soft); font-size: 14px; margin-bottom: 22px; }
.login-mark { display: flex; align-items: center; gap: 10px; color: var(--db-dark); font-weight: 700; letter-spacing: 1px; margin-bottom: 18px; font-size: 14px; }
.login-mark i { color: var(--fm-red); font-size: 20px; }
.login-foot { margin-top: 20px; font-size: 12px; color: var(--fm-ink-soft); border-top: 1px solid var(--fm-wheat); padding-top: 12px; }

.processing { text-align: center; padding: 36px 20px; }
.processing .spinner-border { color: var(--fm-red); width: 3rem; height: 3rem; }
.processing .label { font-weight: 600; margin-top: 14px; }
.processing .sub { color: var(--fm-ink-soft); font-size: 13px; margin-top: 4px; }

.sparkline { width: 110px; height: 28px; }
.muted { color: var(--fm-ink-soft); }
.tabular { font-variant-numeric: tabular-nums; }

@media (max-width: 768px) {
    .fm-nav-link span { display: none; }
    .fm-nav-link { padding: 12px 12px; }
    .fm-title { font-size: 24px; }
    .header-text { font-size: 16px !important; }
}
