/* ========================================
   CRUSH COSTING REPORT — plain like Ticket Status: one summary table, then Rika's
   CRUSH P/L blocks (Current | Future side by side), neutral colours, black-on-white print.
   ======================================== */

.cc-wrapper {
    width: 100%;
    height: calc(100vh - 60px);
    overflow: hidden;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    position: relative;
    color: var(--text-primary);
}

.cc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 28px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--surface);
}
.cc-title { margin: 0; font-size: 18px; font-weight: 700; }
.cc-subtitle { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted); }
.cc-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.cc-btn {
    border: 1px solid var(--border-secondary);
    background: var(--surface);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.cc-btn:hover:not(:disabled) { border-color: var(--text-primary); }
.cc-btn:disabled { opacity: .5; cursor: not-allowed; }
.cc-btn-main { background: var(--text-primary); border-color: var(--text-primary); color: var(--surface); }

.cc-container { flex: 1; overflow-y: auto; }
.cc-content { padding: 18px 28px 50px; max-width: 1600px; margin: 0 auto; }

.cc-loading {
    position: absolute; top: 70px; right: 28px; z-index: 5;
    font-size: 12.5px; color: var(--text-muted);
    background: var(--surface); border: 1px solid var(--border-primary); border-radius: 6px; padding: 5px 10px;
}

/* Filters */
.cc-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
    padding: 14px 16px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--surface);
    margin-bottom: 16px;
}
.cc-field { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.cc-field input, .cc-field select {
    background: var(--surface);
    border: 1px solid var(--border-secondary);
    border-radius: 6px;
    padding: 6px 9px;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 400;
}
.cc-field select { min-width: 240px; max-width: 100%; }
.cc-num input { width: 130px; text-align: right; }
.cc-field input:focus, .cc-field select:focus { outline: 2px solid var(--text-primary); outline-offset: 0; }
.cc-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cc-saved { font-size: 12.5px; color: var(--text-secondary); align-self: center; }

/* Headings + messages */
.cc-h2 { font-size: 15px; font-weight: 700; margin: 22px 0 8px; }
.cc-hint { font-size: 12px; font-weight: 400; color: var(--text-muted); margin-left: 8px; }
.cc-message { font-size: 13.5px; color: var(--text-secondary); }
.cc-error { color: #b42318; }
.cc-source { font-size: 12.5px; color: var(--text-secondary); margin: 0 0 8px; }
.cc-warnings { font-size: 12.5px; color: var(--text-secondary); margin: 0 0 8px; padding-left: 18px; }
.cc-warnings li { margin: 2px 0; }
.cc-note { font-size: 12px; color: var(--text-muted); margin: 6px 0 0; }
.cc-foot { font-size: 12px; color: var(--text-muted); margin-top: 22px; line-height: 1.5; }
.cc-printhead { display: none; }

/* Tables */
.cc-table-wrap { overflow-x: auto; }
.cc-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface); }
.cc-table th {
    text-align: right;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 7px 10px;
    border-bottom: 2px solid var(--text-primary);
    white-space: nowrap;
}
.cc-table td {
    text-align: right;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.cc-table th.l, .cc-table td.l { text-align: left; }
.cc-small { font-size: 12px; color: var(--text-secondary); }
.cc-neg { color: #b42318; }
.cc-fallback { font-style: italic; }

.cc-summary tfoot td { font-weight: 700; border-top: 2px solid var(--text-primary); border-bottom: 0; }

.cc-block { margin-bottom: 18px; }
.cc-pl .cc-group th { border-bottom: 1px solid var(--border-secondary); font-size: 12.5px; color: var(--text-primary); }
.cc-pl .cc-group th.l { font-size: 14px; }
.cc-pl .cc-side { text-align: center; border-left: 2px solid var(--border-secondary); }
.cc-pl .cc-first { border-left: 2px solid var(--border-secondary); }
.cc-crush { font-weight: 400; font-size: 12px; color: var(--text-muted); margin-left: 10px; }
.cc-pl .cc-gp td { font-weight: 700; border-top: 1px solid var(--text-primary); }
.cc-pl .cc-nett td { font-weight: 700; border-top: 1px solid var(--text-primary); border-bottom: 2px solid var(--text-primary); }

/* Actual yields: the report's own yields stand out; a total over 100% is bold */
.cc-actual .cc-report td { font-weight: 700; border-top: 1px solid var(--text-primary); }
.cc-actual .cc-over { font-weight: 700; }

@media (max-width: 760px) {
    .cc-header, .cc-content { padding-left: 12px; padding-right: 12px; }
    .cc-field select { min-width: 0; width: 100%; }
    .cc-field { flex: 1 1 100%; }
    .cc-num input { width: 100%; }
}

/* Print: black on white, no controls. Scoped to this page (every page's CSS is loaded by _Host),
   with its own named page box so other pages' print margins are left alone. */
@media print {
    body:has(.cc-wrapper) .sidebar, body:has(.cc-wrapper) .navbar, body:has(.cc-wrapper) .top-row,
    body:has(.cc-wrapper) header, body:has(.cc-wrapper) nav, .cc-noprint { display: none !important; }
    body:has(.cc-wrapper) .ml-wrapper, body:has(.cc-wrapper) .ml-wrapper > *, body:has(.cc-wrapper) main {
        height: auto !important; min-height: 0 !important; overflow: visible !important; padding-top: 0 !important; margin-top: 0 !important;
    }
    .cc-wrapper { page: cc; }
    .cc-wrapper, .cc-container { height: auto !important; overflow: visible !important; background: #fff !important; }
    .cc-content { padding: 0 !important; max-width: none; }
    .cc-wrapper, .cc-table, .cc-table td, .cc-table th, .cc-h2, .cc-note, .cc-foot, .cc-source, .cc-warnings, .cc-small, .cc-neg { color: #000 !important; background: #fff !important; }
    .cc-printhead { display: flex; justify-content: space-between; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 10px; font-size: 12pt; }
    .cc-table { font-size: 8.5pt; }
    .cc-table th { border-bottom: 1.5px solid #000; }
    .cc-table td { border-bottom: 1px solid #bbb; padding: 3px 5px; }
    .cc-table-wrap { overflow: visible; }
    .cc-block, .cc-table tr { break-inside: avoid; }
    @page cc { size: A4 landscape; margin: 10mm; }
}
