/* CLC HealthCheckup - Bootstrap 5 theme layer (light + dark). */
:root,
[data-bs-theme="light"] {
    --hc-brand: #e86909;          /* the original title orange */
    --hc-brand-2: #1f4e99;        /* SAIL blue */
    --hc-bg: #f4f6fb;
    --hc-surface: #ffffff;
    --hc-surface-2: #f8fafc;
    --hc-border: rgba(15, 23, 42, .08);
    --hc-text-muted: #64748b;
    --hc-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 24px -8px rgba(15, 23, 42, .12);
    --hc-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --hc-fresh: #0ea5e9;
    --hc-fresh-bg: rgba(14, 165, 233, .12);
    --hc-review: #8b5cf6;
    --hc-review-bg: rgba(139, 92, 246, .12);
    --hc-thead: #0f172a;
    --hc-thead-text: #f8fafc;
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-bg: var(--hc-bg);
    --bs-border-radius: .6rem;
}
[data-bs-theme="dark"] {
    --hc-bg: #0b1120;
    --hc-surface: #111827;
    --hc-surface-2: #0f172a;
    --hc-border: rgba(148, 163, 184, .14);
    --hc-text-muted: #94a3b8;
    --hc-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -12px rgba(0, 0, 0, .6);
    --hc-shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --hc-fresh-bg: rgba(14, 165, 233, .18);
    --hc-review-bg: rgba(139, 92, 246, .2);
    --hc-thead: #1e293b;
    --hc-thead-text: #e2e8f0;
    --bs-body-bg: var(--hc-bg);
}

html { position: relative; min-height: 100%; font-size: 15px; }
@media (min-width: 768px) { html { font-size: 15.5px; } }
body {
    font-family: var(--bs-body-font-family);
    background: var(--hc-bg);
    -webkit-font-smoothing: antialiased;
    display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1 0 auto; }
.container-xl { max-width: 1320px; }

/* ---------- Header ---------- */
.hc-header {
    background: color-mix(in srgb, var(--hc-surface) 85%, transparent);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--hc-border);
    box-shadow: var(--hc-shadow-sm);
}
.hc-header .navbar { padding-block: .55rem; }
.hc-brand-logo {
    height: 42px; padding: 4px 8px; border-radius: 10px; display: grid; place-items: center;
    background: #fff; box-shadow: var(--hc-shadow-sm); border: 1px solid var(--hc-border);
}
.hc-brand-logo img { height: 32px; width: auto; }
@media (max-width: 575.98px) {
    .hc-brand-logo img { height: 20px; } .hc-brand-logo { height: 32px; padding: 4px 6px; }
    .hc-brand-title { font-size: .92rem; } .hc-brand-sub { display: none; }
    .hc-header .navbar-brand { margin-right: .25rem; gap: .4rem !important; min-width: 0; }
    .hc-header .navbar-toggler { padding: .25rem .4rem; }
    .hc-header .container-xl > .d-flex { gap: .3rem !important; }
    .hc-icon-btn { width: 34px; height: 34px; }
}
.hc-brand-title { font-weight: 800; letter-spacing: -.01em; font-size: 1.05rem; color: var(--bs-body-color); }
.hc-brand-sub { font-size: .72rem; color: var(--hc-text-muted); margin-top: 3px; }
.hc-header .nav-link { font-weight: 500; border-radius: .5rem; padding: .4rem .75rem !important; color: var(--hc-text-muted); }
.hc-header .nav-link.active, .hc-header .nav-link:hover { color: var(--hc-brand); background: rgba(232, 105, 9, .08); }
.hc-icon-btn {
    width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; padding: 0;
    border: 1px solid var(--hc-border); background: var(--hc-surface); color: var(--bs-body-color); font-size: 1.15rem;
}
.hc-icon-btn:hover { color: var(--hc-brand); border-color: var(--hc-brand); }

/* ---------- Cards ---------- */
.hc-card {
    background: var(--hc-surface); border: 1px solid var(--hc-border);
    border-radius: 1rem; box-shadow: var(--hc-shadow);
}
.hc-toolbar .card-body { padding: .75rem 1rem; }
.hc-date-group { width: auto; flex-wrap: nowrap; }
.hc-date-group .input-group-text { background: var(--hc-surface-2); border-color: var(--hc-border); font-size: .9rem; }
.hc-date-input {
    max-width: 130px; font-weight: 600; text-align: center; cursor: pointer;
    background: var(--hc-surface) !important; border-color: var(--hc-border);
}
.hc-uploaded { background: var(--hc-thead) !important; color: var(--hc-thead-text) !important; font-style: italic; }

/* ---------- Hero ---------- */
.hc-hero { position: relative; overflow: hidden; }
.hc-hero::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
    background: linear-gradient(90deg, var(--hc-brand-2), var(--hc-brand));
}
.hc-hero-logo { height: 72px; width: auto; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .12)); }
[data-bs-theme="dark"] .hc-hero-logo { background: #fff; border-radius: 12px; padding: 6px; height: 80px; }
.hc-title { color: var(--hc-brand); font-weight: 700; font-size: clamp(1rem, 2.2vw, 1.3rem); letter-spacing: -.01em; }

.hc-kpi {
    display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; height: 100%;
    border-radius: .9rem; background: var(--hc-surface-2); border: 1px solid var(--hc-border);
    transition: transform .15s ease, box-shadow .15s ease;
}
.hc-kpi:hover { transform: translateY(-2px); box-shadow: var(--hc-shadow); }
.hc-kpi > i { font-size: 1.5rem; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.hc-kpi > div { min-width: 0; }
.hc-kpi-label { font-size: .75rem; color: var(--hc-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.hc-kpi-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hc-kpi-sm { font-size: 1.05rem; padding-top: .3rem; }
.hc-kpi-total > i { background: rgba(232, 105, 9, .12); color: var(--hc-brand); }
.hc-kpi-fresh > i { background: var(--hc-fresh-bg); color: var(--hc-fresh); }
.hc-kpi-review > i { background: var(--hc-review-bg); color: var(--hc-review); }
.hc-kpi-upload > i { background: rgba(34, 197, 94, .12); color: #16a34a; }

.hc-seg { background: var(--hc-surface-2); border: 1px solid var(--hc-border); border-radius: .75rem; padding: 3px; gap: 3px; }
.hc-seg > .btn { border: 0 !important; border-radius: .6rem !important; font-weight: 600; font-size: .85rem; color: var(--hc-text-muted); }
.hc-seg > .btn-check:checked + .btn { background: var(--hc-surface); color: var(--bs-body-color); box-shadow: var(--hc-shadow-sm); }
.hc-badge-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .35rem; }
.bg-fresh { background: var(--hc-fresh); }
.bg-review { background: var(--hc-review); }

.hc-chip {
    display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; border-radius: 999px;
    padding: .3rem .4rem .3rem .7rem; background: rgba(245, 158, 11, .12); color: #b45309; border: 1px solid rgba(245, 158, 11, .3);
}
[data-bs-theme="dark"] .hc-chip { color: #fbbf24; }
.hc-chip > span { background: #f59e0b; color: #fff; border-radius: 999px; padding: 0 .5rem; font-weight: 700; }
.hc-btn-search { font-weight: 600; border-radius: .75rem; box-shadow: 0 4px 14px -6px rgba(25, 135, 84, .7); }

/* ---------- Tickers (replace <marquee>) ---------- */
.hc-ticker {
    overflow: hidden; white-space: nowrap; border-radius: .75rem; padding: .5rem 0; font-size: .88rem; font-weight: 500;
    border: 1px solid var(--hc-border); background: var(--hc-surface);
}
.hc-ticker-track { display: inline-block; padding-left: 100%; animation: hc-scroll 28s linear infinite; }
.hc-ticker:hover .hc-ticker-track { animation-play-state: paused; }
.hc-ticker-success { color: #15803d; background: rgba(34, 197, 94, .07); }
.hc-ticker-danger { color: #b91c1c; background: rgba(239, 68, 68, .06); }
[data-bs-theme="dark"] .hc-ticker-success { color: #4ade80; }
[data-bs-theme="dark"] .hc-ticker-danger { color: #f87171; }
@keyframes hc-scroll { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
    .hc-ticker { white-space: normal; padding: .5rem .9rem; }
    .hc-ticker-track { animation: none; padding-left: 0; }
}

.hc-alert-params {
    background: rgba(245, 158, 11, .1); border: 1px solid rgba(245, 158, 11, .3); color: #92400e;
    border-radius: .9rem; font-size: .85rem;
}
[data-bs-theme="dark"] .hc-alert-params { color: #fcd34d; }

/* ---------- Tables / DataTables ---------- */
table.dtable { font-size: .82rem; margin-top: 0 !important; }
table.dtable td, table.dtable th { white-space: nowrap; vertical-align: middle; }
table.dtable thead th {
    background: var(--hc-thead) !important; color: var(--hc-thead-text) !important; font-weight: 600;
    font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; border-color: transparent !important;
}
table.dtable thead th:first-child { border-top-left-radius: .6rem; }
table.dtable thead th:last-child { border-top-right-radius: .6rem; }
table.dtable > tbody > tr:nth-of-type(even) > * { background: var(--hc-surface-2); }
table.dtable tbody td { border-color: var(--hc-border); }
.hc-link {
    border: 0; background: none; padding: 0; color: var(--hc-brand-2); font-weight: 600; text-align: left;
    text-decoration: underline; text-decoration-color: rgba(31, 78, 153, .3); text-underline-offset: 3px; cursor: pointer;
}
[data-bs-theme="dark"] .hc-link { color: #93c5fd; }
.hc-link:hover { color: var(--hc-brand); text-decoration-color: currentColor; }
.hc-status { font-weight: 600; font-size: .72rem; border-radius: 999px; padding: .35em .7em; }
.hc-status-fresh { background: var(--hc-fresh-bg); color: #0369a1; }
.hc-status-review { background: var(--hc-review-bg); color: #6d28d9; }
[data-bs-theme="dark"] .hc-status-fresh { color: #7dd3fc; }
[data-bs-theme="dark"] .hc-status-review { color: #c4b5fd; }

div.dataTables_wrapper div.dataTables_length select { min-width: 110px; border-radius: .6rem; }
div.dataTables_wrapper div.dataTables_filter input { border-radius: .6rem; min-width: 200px; margin-left: 0; }
div.dataTables_wrapper div.dataTables_info { font-size: .8rem; color: var(--hc-text-muted); padding-top: 0; }
.dt-buttons.btn-group .btn { background: var(--hc-surface-2); color: var(--bs-body-color); border: 1px solid var(--hc-border); font-weight: 500; }
.dt-buttons.btn-group .btn:hover { background: var(--hc-brand); border-color: var(--hc-brand); color: #fff; }
.page-link { border-radius: .5rem !important; margin: 0 2px; border-color: var(--hc-border); font-size: .8rem; }
.page-item.active .page-link { background: var(--hc-brand); border-color: var(--hc-brand); }
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before { background-color: var(--hc-brand); }
@media (max-width: 575.98px) {
    div.dataTables_wrapper div.dataTables_filter input { min-width: 0; width: 100%; }
    .hc-dt-top > * { width: 100%; }
    .hc-date-group { flex-wrap: wrap; }
    .hc-kpi { padding: .7rem; gap: .55rem; }
    .hc-kpi > i { width: 36px; height: 36px; font-size: 1.2rem; }
    .hc-kpi-label { font-size: .66rem; }
    .hc-kpi-value { font-size: 1.3rem; }
    .hc-kpi-sm { font-size: .9rem; }
    .hc-date-input { max-width: none; }
}

/* ---------- Modals ---------- */
.hc-modal { border: 1px solid var(--hc-border); border-radius: 1rem; box-shadow: 0 20px 60px -15px rgba(0, 0, 0, .35); }
.hc-modal .modal-header, .hc-modal .modal-footer { border-color: var(--hc-border); }

/* ---------- Date range picker ---------- */
.daterangepicker {
    font-family: var(--bs-body-font-family); border-radius: .9rem; border: 1px solid var(--hc-border);
    box-shadow: var(--hc-shadow); background: var(--hc-surface); color: var(--bs-body-color); padding: 4px;
}
.daterangepicker::before, .daterangepicker::after { display: none; }
.daterangepicker .calendar-table { background: var(--hc-surface); border-color: transparent; }
.daterangepicker td.available:hover, .daterangepicker th.available:hover { background: rgba(232, 105, 9, .12); }
.daterangepicker td.active, .daterangepicker td.active:hover { background: var(--hc-brand); }
.daterangepicker td.in-range:not(.active) { background: rgba(232, 105, 9, .1); color: inherit; }
.daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.disabled { background: transparent; color: var(--hc-text-muted); opacity: .55; }
.daterangepicker td { border-radius: .45rem !important; }
.daterangepicker .ranges li { border-radius: .5rem; margin: 2px 4px; font-size: .82rem; }
.daterangepicker .ranges li.active { background: var(--hc-brand); }
.daterangepicker .drp-buttons { border-color: var(--hc-border); }
.daterangepicker .drp-buttons .btn { border-radius: .5rem; }
.daterangepicker .applyBtn { background: var(--hc-brand); border-color: var(--hc-brand); }
.daterangepicker select.monthselect, .daterangepicker select.yearselect {
    background: var(--hc-surface-2); color: var(--bs-body-color); border: 1px solid var(--hc-border); border-radius: .4rem;
}
.daterangepicker .calendar-table .next span, .daterangepicker .calendar-table .prev span { border-color: var(--bs-body-color); }

/* ---------- Toasts ---------- */
#toast-container > div { border-radius: .8rem; box-shadow: var(--hc-shadow) !important; opacity: .97; font-family: var(--bs-body-font-family); }
#toast-container > div:hover { box-shadow: var(--hc-shadow) !important; }
.toast-info { background-color: #1f4e99; }
.toast-success { background-color: #16a34a; }

/* ---------- Footer ---------- */
.hc-footer {
    border-top: 1px solid var(--hc-border); background: var(--hc-surface); color: var(--hc-text-muted);
    font-size: .85rem; padding: 1rem 0;
}
.hc-footer a { color: var(--hc-brand); text-decoration: none; }

/* --- real-schema additions: vendor/gender tiles, location badges, generic CTYPE badge --- */
.hc-kpi-vendor > i { background: rgba(245, 158, 11, .14); color: #d97706; }
.hc-kpi-male > i { background: rgba(14, 165, 233, .12); color: #0284c7; }
.hc-kpi-female > i { background: rgba(236, 72, 153, .12); color: #db2777; }
.hc-status-other { background: var(--hc-surface-2); color: var(--bs-body-color); border: 1px solid var(--hc-border); }
.hc-loc { font-weight: 600; font-size: .72rem; border-radius: 999px; padding: .35em .7em; }
.hc-loc-skin { background: rgba(34, 197, 94, .14); color: #15803d; }
.hc-loc-casualty { background: rgba(239, 68, 68, .13); color: #b91c1c; }
.hc-loc-other { background: var(--hc-surface-2); color: var(--bs-body-color); }
[data-bs-theme="dark"] .hc-loc-skin { color: #86efac; }
[data-bs-theme="dark"] .hc-loc-casualty { color: #fca5a5; }
.hc-sno { font-variant-numeric: tabular-nums; color: var(--hc-text-muted); font-weight: 600; }
