/* Rupa tambahan: dimuat selepas site.css, hanya menambah kemasan (bayang, gradient, animasi lembut).
   Tiada susun atur, warna status atau logik diubah - semua page kekal sama, cuma lebih kemas dan selesa dipandang. */

:root {
    --glow-blue: rgba(75, 144, 192, 0.45);
    --card-top: #232629;
    --card-bottom: #1b1d20;
}

html { scrollbar-color: #3a4048 #151618; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: #151618; }
::-webkit-scrollbar-thumb { background: #3a4048; border-radius: 6px; border: 2px solid #151618; }
::-webkit-scrollbar-thumb:hover { background: #4a525c; }
::selection { background: var(--glow-blue); }
:focus-visible { outline: 2px solid #4b90c0; outline-offset: 2px; }

body {
    background: radial-gradient(1100px 420px at 50% -160px, rgba(62, 124, 166, 0.18), transparent 70%), var(--bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.topbar {
    background: linear-gradient(180deg, #18323f 0%, #12242f 100%);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}
.topbar-nav-link {
    border-radius: 8px;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.topbar-nav-link:hover { background: rgba(255, 255, 255, 0.09); }
.topbar-nav-link.is-active {
    background: linear-gradient(180deg, #3b73ec, #2563eb);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14) inset, 0 4px 14px rgba(37, 99, 235, 0.45);
}
.topbar-clock { font-variant-numeric: tabular-nums; }
.language-switcher { border-radius: 8px; transition: border-color 0.15s ease; }
.language-switcher:hover { border-color: #4b90c0; }

/* ---------- Page content: fades in softly, headings get an accent bar ---------- */
.page { animation: page-in 0.25s ease-out both; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.panel-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.panel-heading::before {
    content: "";
    width: 4px;
    height: 1.1em;
    border-radius: 2px;
    background: var(--amber);
    flex: none;
}

/* ---------- Cards ---------- */
.kpi-card,
.grid-card {
    background: linear-gradient(180deg, var(--card-top) 0%, var(--card-bottom) 100%);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.kpi-card {
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.kpi-value { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* ---------- Tables ---------- */
#scheduleTable tbody tr:nth-child(even) td,
#poTable tbody tr:nth-child(even) td,
#attentionTable tbody tr:nth-child(even) td,
#staffWorkloadTable tbody tr:nth-child(even) td { background-image: linear-gradient(rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.018)); }
#attentionTable tbody tr,
#staffWorkloadTable tbody tr { transition: background-color 0.12s ease; }
#attentionTable tbody tr:hover,
#staffWorkloadTable tbody tr:hover { background: var(--steel-tint); }
#scheduleTable td, #poTable td, #attentionTable td, #staffWorkloadTable td { font-variant-numeric: tabular-nums; }

/* ---------- Buttons, inputs, badges ---------- */
button, .btn, select, input, textarea { transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.08s ease; }
button:active:not(:disabled), .btn:active:not(:disabled) { transform: translateY(1px); }
.legend-chip, .risk-badge, .realtime-status { letter-spacing: 0.02em; }
.realtime-status-connected { box-shadow: 0 0 0 1px rgba(79, 190, 133, 0.3) inset; }

@media (prefers-reduced-motion: reduce) {
    .page { animation: none; }
    .kpi-card:hover { transform: none; }
}

/* =========================================================
   Gaya Jira: lozenge status, avatar, penapis cepat, carian global, ringkasan status
   (digerakkan oleh wwwroot/js/jira-ux.js - semua tambahan, tiada yang sedia ada diubah)
   ========================================================= */

/* ---------- Lozenge status (label kecil, huruf besar, sudut tajam sedikit) ---------- */
.status-badge,
.risk-badge {
    border-radius: 4px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.14rem 0.5rem;
    line-height: 1.5;
}

/* ---------- Bar beban kerja ---------- */
td.workload-cell {
    background-image: linear-gradient(90deg, rgba(75, 144, 192, 0.35), rgba(75, 144, 192, 0.12));
    background-repeat: no-repeat;
    background-size: var(--bar, 0%) 70%;
    background-position: left center;
    font-weight: 600;
}

/* ---------- Ringkasan status (Dashboard) ---------- */
.status-overview {
    background: linear-gradient(180deg, var(--card-top) 0%, var(--card-bottom) 100%);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    margin: -6px 0 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.status-overview-title {
    font-family: 'Oswald', sans-serif;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ink-muted);
    margin-bottom: 0.5rem;
}
.status-overview-bar {
    display: flex;
    height: 10px;
    border-radius: 6px;
    overflow: hidden;
    background: #0e0f11;
    gap: 2px;
}
.status-overview-bar .seg { display: block; height: 100%; transition: width 0.4s ease; }
.seg-completed { background: var(--status-green); }
.seg-active { background: var(--status-red); }
.seg-empty { background: var(--status-gray); }
.status-overview-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.2rem;
    margin-top: 0.55rem;
    font-size: 0.8rem;
    color: var(--ink-muted);
}
.status-overview-legend b { color: var(--ink); font-variant-numeric: tabular-nums; margin-left: 0.2rem; }
.status-overview-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 0.4rem; }
.status-overview-total { margin-left: auto; color: var(--ink); font-weight: 600; }

/* ---------- Penapis cepat (Schedule) ---------- */
.quick-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0;
}
.quick-filters-label {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-right: 0.3rem;
}
.quick-chip {
    background: var(--surface-sunken);
    color: var(--ink-muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.18rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}
.quick-chip:hover { color: var(--ink); border-color: #4a525c; }
.quick-chip.is-on { background: var(--steel-tint); color: #fff; border-color: #4b90c0; }
.quick-filters-count { font-size: 0.75rem; color: var(--ink-muted); margin-left: 0.4rem; }

/* ---------- Butang + panel carian global ---------- */
.gs-button {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.07);
    color: #cfdbe3;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    padding: 0.28rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
}
.gs-button:hover { background: rgba(255, 255, 255, 0.13); color: #fff; }
.gs-button kbd, .gs-foot kbd {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 4px;
    padding: 0 0.3rem;
    color: inherit;
}
.gs-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    background: rgba(5, 8, 10, 0.62);
    backdrop-filter: blur(3px);
}
.gs-overlay.is-open { display: flex; }
.gs-box {
    width: min(640px, 92vw);
    background: #1c1f23;
    border: 1px solid #3a4048;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: page-in 0.15s ease-out both;
}
.gs-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid #2c3138;
    color: #fff;
    font-size: 1.05rem;
    padding: 0.95rem 1.1rem;
    outline: none;
}
.gs-results { max-height: 52vh; overflow-y: auto; padding: 0.3rem 0.4rem; }
.gs-group {
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
    padding: 0.6rem 0.7rem 0.25rem;
}
.gs-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    cursor: pointer;
}
.gs-item.is-active, .gs-item:hover { background: var(--steel-tint); }
.gs-main { font-weight: 600; color: #fff; font-size: 0.9rem; }
.gs-sub { font-size: 0.76rem; color: var(--ink-muted); }
.gs-tag {
    flex: none;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    background: var(--status-gray-tint);
    color: var(--ink-muted);
}
.gs-hint { padding: 1rem; color: var(--ink-muted); font-size: 0.85rem; }
.gs-foot {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid #2c3138;
    font-size: 0.72rem;
    color: var(--ink-muted);
}
@media print { .gs-button, .gs-overlay, .quick-filters { display: none !important; } }

/* =========================================================
   Tema gaya Jira (palet gelap Atlassian, fon sans-serif bersih, tajuk huruf biasa, nav bergaris bawah, jadual lega)
   ========================================================= */
:root {
    --bg: #1D2125;
    --surface: #22272B;
    --surface-sunken: #1B1F23;
    --ink: #D2DAE3;
    --ink-muted: #8C9BAB;
    --line: #38414A;
    --steel: #579DFF;
    --steel-dark: #1D2125;
    --steel-tint: rgba(87, 157, 255, 0.14);
    --brand-blue: #0C66E4;
    --card-top: #22272B;
    --card-bottom: #22272B;
}

html { font-size: 16px; }
body {
    background: var(--bg);
    font-family: 'IBM Plex Sans', -apple-system, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ---------- Tajuk: huruf biasa, tegas, tanpa Oswald besar ---------- */
.panel-heading {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.005em;
    text-transform: none;
    color: var(--ink);
    margin: 1rem 0 0.7rem;
}
.panel-heading::before { display: none; }
.kpi-label, .status-overview-title {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
}
.kpi-value { font-family: 'IBM Plex Sans', sans-serif; font-size: 2rem; font-weight: 700; }

/* ---------- Kad rata gaya Jira ---------- */
.kpi-card, .grid-card, .status-overview {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(3, 4, 4, 0.5);
}
.kpi-card { border-left-width: 4px; }
.kpi-card:hover { transform: none; box-shadow: 0 4px 10px rgba(3, 4, 4, 0.45); }

/* ---------- Jadual lega, kepala kecil kelabu ---------- */
#scheduleTable, #poTable, #attentionTable, #staffWorkloadTable { font-size: 0.9rem; }
#scheduleTable thead th, #poTable thead th, #attentionTable thead th, #staffWorkloadTable thead th {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-muted);
    background: #1D2125;
    border-color: var(--line);
    border-bottom: 2px solid #38414A;
    padding: 0.7rem 0.75rem;
}
#scheduleTable tbody td, #poTable tbody td, #attentionTable tbody td, #staffWorkloadTable tbody td {
    padding: 0.7rem 0.75rem;
    border-color: #2C333A;
}
#scheduleTable tbody tr:hover, #poTable tbody tr:hover,
#attentionTable tbody tr:hover, #staffWorkloadTable tbody tr:hover { background: rgba(87, 157, 255, 0.1); }

/* ---------- Tab ---------- */
.schedule-tab {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

/* ---------- Butang: biru Jira, butang kedua rata ---------- */
.btn-schedule { font-size: 0.88rem; border-radius: 4px; padding: 0.5rem 0.9rem; }
.btn-primary-steel { background: #0C66E4; color: #fff; }
.btn-primary-steel:hover { background: #0055CC; filter: none; }
.btn-ghost { background: rgba(255, 255, 255, 0.06); color: #B6C2CF; border-color: transparent; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); color: #fff; filter: none; }

/* ---------- Input: fokus biru dua piksel ---------- */
input[type="text"], input[type="date"], input[type="number"], select, textarea, #searchBox {
    border-radius: 4px;
}
input:focus, select:focus, textarea:focus, #searchBox:focus {
    border-color: #579DFF;
    box-shadow: 0 0 0 2px rgba(87, 157, 255, 0.45);
    outline: none;
}

/* ---------- Lozenge & chip lebih jelas ---------- */
.status-badge, .risk-badge { font-size: 0.72rem; padding: 0.15rem 0.5rem; }
.quick-chip { font-size: 0.82rem; padding: 0.3rem 0.8rem; border-radius: 4px; }
.quick-chip.is-on { background: rgba(87, 157, 255, 0.2); border-color: #579DFF; color: #CFE1FF; }
.legend-chip { font-size: 0.78rem; }
.gs-button { border-radius: 4px; }

/* Jadual Schedule ada 15 lajur: padding sedikit lebih rapat supaya baris tak terlalu tinggi. */
#scheduleTable tbody td { padding: 0.5rem 0.65rem; }
#scheduleTable thead th { padding: 0.6rem 0.65rem; }

/* =========================================================
   Schedule ringkas: jarak kecil, satu baris satu projek
   ========================================================= */
.page { padding-top: 0.35rem; }
.panel-heading { margin: 0.2rem 0 0.2rem; }
.legend { margin: 0; gap: 0.35rem; }
.legend-chip { padding: 0.1rem 0.5rem; }
#scheduleTypeTabs.schedule-tabs { margin: 0 0 4px; }
.schedule-tab { padding: 6px 12px; }
.btn-schedule { padding: 0.38rem 0.8rem; }
#searchBox { padding: 0.35rem 0.7rem; }
.grid-card .quick-filters { margin-right: 0.3rem; }

/* Label status tak patah dua baris (punca baris jadi tinggi) */
.status-badge, .risk-badge { white-space: nowrap; }

#scheduleTable { font-size: 0.84rem; line-height: 1.3; }
#scheduleTable thead th { padding: 0.4rem 0.55rem; font-size: 0.7rem; }
#scheduleTable tbody td { padding: 0.28rem 0.55rem; }
#scheduleTable .col-date { font-size: 0.78rem; white-space: nowrap; }
#scheduleTable .col-projectno { white-space: nowrap; }
.table-scroll { max-height: 74vh; }

/* =========================================================
   Semua jadual ikut gaya Schedule: ringkas, satu baris satu rekod
   ("html body" menaikkan keutamaan supaya menang atas CSS khas setiap page yang dimuat kemudian)
   ========================================================= */
html body #poTable, html body #attentionTable, html body #staffWorkloadTable, html body #phaseDurationTable,
html body #anomalyTable, html body #summaryStatusProject, html body #summaryTable, html body #monthlyBreakdownTable,
html body #leadTimeSummaryTable, html body #supplierPerformanceTable, html body #documentTable, html body #safetyChecklistTable {
    font-size: 0.84rem;
    line-height: 1.3;
}
html body #poTable thead th, html body #attentionTable thead th, html body #staffWorkloadTable thead th, html body #phaseDurationTable thead th,
html body #anomalyTable thead th, html body #summaryStatusProject thead th, html body #summaryTable thead th, html body #monthlyBreakdownTable thead th,
html body #leadTimeSummaryTable thead th, html body #supplierPerformanceTable thead th, html body #documentTable thead th, html body #safetyChecklistTable thead th {
    padding: 0.4rem 0.55rem;
    font-size: 0.7rem;
}
html body #poTable tbody td, html body #attentionTable tbody td, html body #staffWorkloadTable tbody td, html body #phaseDurationTable tbody td,
html body #anomalyTable tbody td, html body #summaryStatusProject tbody td, html body #summaryTable tbody td, html body #monthlyBreakdownTable tbody td,
html body #leadTimeSummaryTable tbody td, html body #supplierPerformanceTable tbody td, html body #documentTable tbody td, html body #safetyChecklistTable tbody td {
    padding: 0.28rem 0.55rem;
}

/* Page lain: jarak atas, kad dan kotak alat selari dengan Schedule */
.grid-toolbar { padding: 0.5rem 0.8rem 0.2rem; }
.kpi-row { margin: 10px 0 12px; }
.kpi-card { padding: 0.65rem 0.9rem; }
.kpi-value { font-size: 1.7rem; }
.table-scroll-attention, .table-scroll-workload { max-height: 380px; }

/* =========================================================
   Saiz tulisan seragam: isi jadual 0.84rem di mana-mana (dulu tarikh dan Project No lebih kecil, 0.78rem)
   ========================================================= */
html body .col-projectno, html body .col-date, html body #scheduleTable .col-date { font-size: 0.84rem; }
html body .po-detail-inner { font-size: 0.84rem; }
html body .status-badge, html body .risk-badge { font-size: 0.76rem; }
html body table thead th { font-size: 0.72rem; }

/* =========================================================
   Bulk edit (page Purchase)
   ========================================================= */
.po-pick, .po-pick-all { margin-right: 0.45rem; width: 15px; height: 15px; vertical-align: middle; accent-color: #579DFF; cursor: pointer; }
#poTable tbody tr.is-picked td { box-shadow: inset 0 0 0 9999px rgba(87, 157, 255, 0.16); }
#btnBulkEdit.is-on { background: rgba(87, 157, 255, 0.2); color: #CFE1FF; }
.bulk-bar {
    position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 1500;
    display: none; align-items: center; flex-wrap: wrap; gap: 0.5rem;
    width: min(1180px, 96vw); padding: 0.6rem 0.9rem;
    background: #1c1f23; border: 1px solid #579DFF; border-radius: 10px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
}
.bulk-count { font-weight: 700; color: #fff; min-width: 5.5rem; }
.bulk-quick { font-size: 0.8rem; color: var(--ink-muted); display: inline-flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.bulk-quick button, .bulk-close {
    background: rgba(255, 255, 255, 0.07); color: #cfdbe3; border: 1px solid transparent; border-radius: 4px;
    padding: 0.15rem 0.5rem; font-size: 0.78rem; cursor: pointer;
}
.bulk-quick button:hover, .bulk-close:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
.bulk-bar input[type="text"] {
    background: var(--surface-sunken); color: #fff; border: 1px solid var(--line); border-radius: 4px;
    padding: 0.3rem 0.5rem; font-size: 0.85rem; flex: 1 1 150px; min-width: 120px;
}
.bulk-apply { background: #0C66E4; color: #fff; border: none; border-radius: 4px; padding: 0.4rem 0.9rem; font-weight: 600; cursor: pointer; }
.bulk-apply:hover:not(:disabled) { background: #0055CC; }
.bulk-apply:disabled { opacity: 0.45; cursor: not-allowed; }
.bulk-hint { flex-basis: 100%; font-size: 0.72rem; color: var(--ink-muted); }
body.po-bulk-on .page { padding-bottom: 7rem; }
@media print { .bulk-bar { display: none !important; } }

/* =========================================================
   Page Cost
   ========================================================= */
.cost-note { font-size: 0.82rem; color: var(--ink-muted); margin: 0.3rem 0 0.6rem; }
.cost-locked { background: var(--surface); border: 1px dashed var(--line); border-radius: 8px; padding: 2rem; text-align: center; color: var(--ink-muted); margin-top: 0.6rem; }
.cost-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 0.4rem 0 0.8rem; }
.cost-kpi { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid #579DFF; border-radius: 8px; padding: 0.6rem 0.9rem; }
.cost-kpi-label { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-muted); }
.cost-kpi-value { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 0.1rem; }
@media (max-width: 1100px) { .cost-kpis { grid-template-columns: repeat(2, 1fr); } }
#costTable { width: 100%; border-collapse: collapse; }
#costTable th, #costTable td { border: 1px solid var(--line); }
html body #costTable { font-size: 0.84rem; line-height: 1.3; }
html body #costTable thead th {
    position: sticky; top: 0; z-index: 2; background: #1D2125; color: var(--ink-muted);
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    padding: 0.4rem 0.55rem; text-align: left; border-bottom: 2px solid #38414A;
}
html body #costTable tbody td { padding: 0.28rem 0.55rem; vertical-align: middle; }
#costTable tbody tr:hover { background: rgba(87, 157, 255, 0.1); }
#costTable .num { text-align: right; font-variant-numeric: tabular-nums; }
#costTable thead th.num { text-align: right; }
.cost-good { color: var(--status-green); font-weight: 600; }
.cost-warn { color: var(--status-yellow); font-weight: 600; }
.cost-bad { color: var(--status-red); font-weight: 700; }
.cost-muted { color: var(--ink-muted); font-size: 0.78rem; }
.cost-price-input {
    width: 130px; text-align: right; background: var(--surface-sunken); color: #fff;
    border: 1px solid var(--line); border-radius: 4px; padding: 0.2rem 0.4rem; font-size: 0.84rem; font-variant-numeric: tabular-nums;
}
.cost-price-input:hover { border-color: #4a525c; }
.cost-bar { width: 140px; height: 8px; background: #0e0f11; border-radius: 4px; overflow: hidden; }
.cost-bar i { display: block; height: 100%; border-radius: 4px; }
.cost-bar i.ok { background: var(--status-green); }
.cost-bar i.near { background: var(--status-yellow); }
.cost-bar i.over { background: var(--status-red); }

/* =========================================================
   Cost: baris boleh dibuka (senarai barang), kotak harga, kilatan "tersimpan"
   ========================================================= */
tr.cost-row { cursor: pointer; }
.cost-chevron { display: inline-block; width: 1rem; margin-right: 0.25rem; color: var(--ink-muted); transition: transform 0.15s ease; }
tr.cost-row.is-open { background: rgba(87, 157, 255, 0.1); }
tr.cost-row.is-open .cost-chevron { transform: rotate(90deg); color: #579DFF; }
tr.cost-row.is-open td:first-child { box-shadow: inset 3px 0 0 #579DFF; }
.cost-price-input { transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.3s ease; }
.cost-price-input:focus { border-color: #579DFF; box-shadow: 0 0 0 2px rgba(87, 157, 255, 0.45); outline: none; }
.cost-price-input.is-saving { opacity: 0.6; }
.cost-price-input.is-saved { background: rgba(79, 190, 133, 0.22); border-color: var(--status-green); }
html body #costTable td.col-projectno { white-space: nowrap; }

html body #costTable tr.cost-items-row > td { padding: 0; background: rgba(0, 0, 0, 0.22); }
table.cost-items { width: calc(100% - 1.6rem); margin: 0.5rem 0.8rem 0.7rem; border-collapse: collapse; font-size: 0.82rem; }
table.cost-items th {
    background: transparent; color: var(--ink-muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
    text-transform: uppercase; text-align: left; padding: 0.3rem 0.5rem; border: none; border-bottom: 1px solid var(--line);
    position: static;
}
table.cost-items td { padding: 0.25rem 0.5rem; border: none; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
table.cost-items .num, table.cost-items th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.cost-items tr.is-cancelled td { color: var(--ink-muted); text-decoration: line-through; opacity: 0.65; }
table.cost-items tfoot td { padding: 0.4rem 0.5rem; font-weight: 700; color: #fff; border-top: 2px solid #38414A; border-bottom: none; background: rgba(87, 157, 255, 0.08); }

/* =========================================================
   Jadual ringkasan & butiran (Purchase): hilangkan biru terang, kemaskan butiran
   ========================================================= */
html body .po-detail-footer td { background: rgba(87, 157, 255, 0.14); border-top: 2px solid #579DFF; color: #fff; }
html body .po-detail-row td { background: rgba(0, 0, 0, 0.2); }
html body .po-detail-inner th { background: #1D2125; color: var(--ink-muted); font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase; }
html body .po-detail-inner td, html body .po-detail-inner th { border-color: #2C333A; padding: 0.3rem 0.6rem; }
html body .po-detail-inner tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.025); }
html body .po-detail-inner tbody tr:hover td { background: rgba(87, 157, 255, 0.1); }
tr.is-expanded > td { background: rgba(87, 157, 255, 0.1); }
tr.is-expanded > td:first-child { box-shadow: inset 3px 0 0 #579DFF; }
html body #summaryTable tbody tr, html body #monthlyBreakdownTable tbody tr { cursor: pointer; }
html body #summaryTable tbody tr:hover, html body #monthlyBreakdownTable tbody tr:hover { background: rgba(87, 157, 255, 0.1); }
html body #summaryTable tbody tr:nth-child(even), html body #monthlyBreakdownTable tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }

/* Tab status / jenis / bulan: lebih jelas yang aktif */
.po-tab, .schedule-tab { border-radius: 4px 4px 0 0; transition: background-color 0.12s ease, opacity 0.12s ease; }
.po-tab:hover, .schedule-tab:hover { background: rgba(255, 255, 255, 0.05); }
.po-tab.active, .schedule-tab.active { background: rgba(87, 157, 255, 0.12); }

/* Kad dan bahagian: jarak antara bahagian lebih seragam */
.grid-card { margin-bottom: 0.9rem; }
.grid-card > .panel-heading, .analytics-card > .panel-heading { padding: 0.5rem 0.9rem 0; }

/* "RM" di depan kotak harga project (Cost) */
.cost-price-wrap { position: relative; display: inline-block; }
.cost-price-wrap::before {
    content: "RM";
    position: absolute; left: 0.55rem; top: 50%; transform: translateY(-50%);
    font-size: 0.74rem; font-weight: 700; letter-spacing: 0.03em; color: var(--ink-muted); pointer-events: none;
}
.cost-price-wrap .cost-price-input { padding-left: 2.1rem; width: 150px; }
.cost-price-wrap:focus-within::before { color: #579DFF; }

/* =========================================================
   Dashboard: Company status (satu pandangan: okay atau tidak, apa lambat, apa akan datang)
   ========================================================= */
.company-status {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.3fr);
    gap: 1.2rem;
    margin: 0 0 14px;
    padding: 0.9rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 5px solid var(--status-green);
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(3, 4, 4, 0.5);
}
.company-status.level-watch { border-left-color: var(--status-yellow); }
.company-status.level-critical { border-left-color: var(--status-red); }
@media (max-width: 1000px) { .company-status { grid-template-columns: 1fr; } }

.cs-head { display: flex; align-items: center; gap: 0.55rem; cursor: help; }
.cs-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--status-green); box-shadow: 0 0 0 4px rgba(79, 190, 133, 0.2); }
.level-watch .cs-dot { background: var(--status-yellow); box-shadow: 0 0 0 4px rgba(201, 162, 58, 0.22); }
.level-critical .cs-dot { background: var(--status-red); box-shadow: 0 0 0 4px rgba(229, 105, 95, 0.22); animation: cs-pulse 2s ease-in-out infinite; }
@keyframes cs-pulse { 50% { box-shadow: 0 0 0 7px rgba(229, 105, 95, 0.08); } }
.cs-title { font-size: 1.25rem; font-weight: 700; color: #fff; }
.cs-summary { margin: 0.2rem 0 0.5rem; color: var(--ink); font-size: 0.95rem; }
.cs-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.18rem; font-size: 0.84rem; color: var(--ink-muted); }
.cs-facts li::before { content: "•"; margin-right: 0.5rem; color: #4a525c; }
.cs-facts li.tone-bad { color: var(--status-red); }
.cs-facts li.tone-warn { color: var(--status-yellow); }
.cs-suppliers { margin-top: 0.6rem; font-size: 0.8rem; color: var(--ink); }
.cs-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-muted); }

.cs-coming { border-left: 1px solid var(--line); padding-left: 1.2rem; display: grid; gap: 0.6rem; align-content: start; }
@media (max-width: 1000px) { .cs-coming { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 0.7rem; } }
.cs-coming-title { font-size: 1.05rem; font-weight: 700; color: #fff; }
.cs-block { display: grid; gap: 0.15rem; }
.cs-line { display: grid; grid-template-columns: 7.5rem 1fr auto; gap: 0.6rem; align-items: baseline; font-size: 0.84rem; padding: 0.12rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.cs-line b { color: #fff; }
.cs-line-name { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-line-when { color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs-line-when.tone-warn { color: var(--status-yellow); }
.cs-empty, .cs-more { font-size: 0.8rem; color: var(--ink-muted); }

/* =========================================================
   Carta: mesej "terkunci", kotak carta, kad Process Flow / Kanban
   ========================================================= */
.chart-box { position: relative; }
.chart-locked {
    position: absolute; inset: 0; z-index: 2;
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    gap: 0.25rem; padding: 1rem;
    background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 12px, transparent 12px 24px), rgba(29, 33, 37, 0.7);
    border: 1px dashed var(--line); border-radius: 8px;
    color: var(--ink); font-size: 1rem; font-weight: 600;
}
.chart-locked span { font-size: 0.84rem; font-weight: 400; color: var(--ink-muted); }
.analytics-card { padding-bottom: 0.9rem; }
.analytics-subtitle { color: var(--ink-muted); font-size: 0.84rem; }
.analytics-card .panel-heading { padding-left: 0; }
.analytics-card .analytics-subtitle, .analytics-card .d-flex, .analytics-card .chart-box, .analytics-card .table-scroll-analytics { margin-left: 0.9rem; margin-right: 0.9rem; }
.analytics-chart-box { min-height: 280px; }

.flow-stage, .kanban-column, .kanban-card {
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.flow-stage:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35); }
.kanban-card { border-radius: 6px; }
.kanban-card:hover { transform: translateY(-1px); border-color: #579DFF; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); background: rgba(87, 157, 255, 0.08); }
.kanban-column { border-radius: 8px; }
.kanban-column-header { font-weight: 700; }
.kanban-column-count { border-radius: 999px; }

/* =========================================================
   Kestabilan susun atur (CLS): ruang disimpan sebelum data sampai, supaya halaman tak "melompat"
   ========================================================= */
/* Jadual Schedule / Purchase: tinggi minimum tetap, jadi borang di bawah tak terdorong turun bila baris tiba */
.table-scroll:has(#scheduleTable), .table-scroll:has(#poTable) { min-height: 60vh; position: relative; }
.table-scroll:has(#scheduleTable):not(:has(tbody tr))::after,
.table-scroll:has(#poTable):not(:has(tbody tr))::after {
    content: "Loading data…";
    position: absolute; left: 0; right: 0; top: 4.5rem; text-align: center;
    color: var(--ink-muted); font-size: 0.95rem; letter-spacing: 0.02em;
    animation: loading-pulse 1.2s ease-in-out infinite;
}
@keyframes loading-pulse { 50% { opacity: 0.35; } }

/* Dashboard: kad yang diisi oleh JS sudah ada ruangnya dari awal */
.company-status.is-placeholder, .status-overview.is-placeholder { border-color: transparent; background: transparent; box-shadow: none; }
.company-status.is-placeholder { min-height: 236px; border-left-color: transparent; }
.status-overview.is-placeholder { min-height: 92px; }

/* Bar atas: menu tak patah baris (punca anjakan bila fon / butang dimuat); lebih padat pada skrin sempit */
.topbar-nav-link { white-space: nowrap; }
.topbar-title { white-space: nowrap; }
.gs-button { white-space: nowrap; flex: none; }
@media (max-width: 1500px) {
    .topbar-inner { gap: 0.5rem; }
    .topbar-nav-link { padding: 0.42rem 0.55rem; font-size: 0.74rem; }
    .topbar-title { font-size: 1rem; }
    .topbar-subtitle { font-size: 0.7rem; }
    .gs-button kbd { display: none; }
}
@media (max-width: 1250px) {
    .topbar-nav-link { padding: 0.4rem 0.42rem; font-size: 0.7rem; }
    .topbar-clock { font-size: 0.78rem; }
    .realtime-status { display: none; }
}

/* Tab jenis project pada page Cost (gaya sama dengan tab di page Purchase) */
.cost-type-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--steel-tint); margin: 8px 0 12px; }
.cost-type-tabs .po-tab {
    background: transparent; border: none; border-bottom: 3px solid transparent; padding: 8px 14px; cursor: pointer;
    font-family: 'Oswald', sans-serif; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em;
    color: var(--ink); opacity: 0.65;
}
.cost-type-tabs .po-tab:hover { opacity: 1; }
.cost-type-tabs .po-tab.active { opacity: 1; color: #fff; border-bottom-color: var(--steel); font-weight: 600; }

/* =========================================================
   Page Activity: cantik dan mudah difahami
   ========================================================= */
.act-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem 1rem; margin: 0.2rem 0 0.7rem; }
.act-title { margin: 0.1rem 0 0.1rem; }
.act-subtitle { margin: 0; color: var(--ink-muted); font-size: 0.92rem; }
.act-new { font-size: 0.95rem; padding: 0.55rem 1.1rem; }

/* Cara guna: tiga langkah */
.act-help { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; background: linear-gradient(90deg, rgba(87, 157, 255, 0.12), rgba(87, 157, 255, 0.04)); border: 1px solid rgba(87, 157, 255, 0.35); border-radius: 10px; padding: 0.8rem 2.4rem 0.8rem 1rem; margin-bottom: 0.9rem; }
@media (max-width: 900px) { .act-help { grid-template-columns: 1fr; } }
.act-step { display: flex; align-items: flex-start; gap: 0.65rem; }
.act-step-no { flex: none; width: 26px; height: 26px; border-radius: 50%; background: #0C66E4; color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 0.85rem; }
.act-step b { display: block; color: #fff; font-size: 0.92rem; }
.act-step span:not(.act-step-no) { display: block; color: var(--ink); font-size: 0.82rem; opacity: 0.85; }
.act-help-close { position: absolute; top: 0.4rem; right: 0.5rem; background: none; border: none; color: var(--ink-muted); cursor: pointer; font-size: 0.95rem; padding: 0.2rem 0.4rem; border-radius: 4px; }
.act-help-close:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* Kad "Today" */
.act-today { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem 1.1rem; margin-bottom: 0.9rem; box-shadow: 0 1px 1px rgba(3, 4, 4, 0.5); }
.act-today-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
.act-today-kicker { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #579DFF; }
.act-today-date { font-size: 1.3rem; font-weight: 700; color: #fff; }
.act-today-msg { font-size: 0.95rem; font-weight: 600; border-radius: 999px; padding: 0.25rem 0.9rem; }
.act-today-msg.tone-todo { background: rgba(87, 157, 255, 0.18); color: #CFE1FF; }
.act-today-msg.tone-good { background: rgba(79, 190, 133, 0.18); color: var(--status-green); }
.act-today-msg.tone-calm { background: rgba(255, 255, 255, 0.06); color: var(--ink-muted); }
.act-today-late { margin-left: auto; color: var(--status-red); font-weight: 600; font-size: 0.88rem; text-decoration: none; }
.act-today-late:hover { text-decoration: underline; }
.act-today-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0.55rem; margin-top: 0.75rem; }

/* Penapis staff (pil) */
.act-staff { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.8rem; margin-bottom: 0.7rem; }
.act-staff-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-muted); }
.act-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.act-pill { display: inline-flex; align-items: center; gap: 0.45rem; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.85rem; font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: background-color 0.12s ease, border-color 0.12s ease; }
.act-pill:hover { border-color: #579DFF; }
.act-pill.is-on { background: #0C66E4; border-color: #0C66E4; color: #fff; }
.act-pill-count { background: rgba(229, 105, 95, 0.9); color: #fff; border-radius: 999px; font-size: 0.7rem; font-weight: 700; padding: 0 0.45rem; min-width: 1.3rem; text-align: center; }
.act-pill.is-on .act-pill-count { background: #fff; color: #0C66E4; }

/* Bar alat */
.act-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.7rem 1.4rem; margin: 0 0 0.9rem; }
.rem-view { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.rem-view-btn { background: var(--surface-sunken); color: var(--ink-muted); border: none; padding: 0.45rem 1.2rem; font-weight: 600; cursor: pointer; }
.rem-view-btn + .rem-view-btn { border-left: 1px solid var(--line); }
.rem-view-btn.active { background: #0C66E4; color: #fff; }
.rem-nav { display: flex; align-items: center; gap: 0.35rem; }
.act-navbtn { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; height: 34px; min-width: 34px; font-size: 1.1rem; cursor: pointer; }
.act-navbtn:hover { border-color: #579DFF; color: #fff; }
.act-navbtn-wide { padding: 0 0.9rem; font-size: 0.88rem; font-weight: 600; }
.rem-range { margin-left: 0.6rem; font-weight: 700; color: #fff; font-size: 1.08rem; }
.act-progress { display: flex; align-items: center; gap: 0.7rem; margin-left: auto; }
.act-progress-text { display: grid; line-height: 1.2; }
.act-progress-text b { color: #fff; font-size: 1rem; }
.act-progress-text span { color: var(--ink-muted); font-size: 0.8rem; }

/* Lewat */
.rem-overdue { background: rgba(229, 105, 95, 0.08); border: 1px solid rgba(229, 105, 95, 0.5); border-radius: 10px; padding: 0.75rem 0.95rem; margin-bottom: 1rem; scroll-margin-top: 5rem; }
.rem-overdue-title { font-weight: 700; color: var(--status-red); margin-bottom: 0.55rem; font-size: 1rem; }
.rem-overdue-grid, .rem-week-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.5rem; }

/* Papan minggu */
.rem-board.rem-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.55rem; align-items: start; }
@media (max-width: 1300px) { .rem-board.rem-week { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 800px) { .rem-board.rem-week { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rem-col { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.55rem; min-height: 200px; display: grid; gap: 0.45rem; align-content: start; }
.rem-col.is-today { border-color: #579DFF; background: linear-gradient(180deg, rgba(87, 157, 255, 0.1), var(--surface) 60%); }
.rem-col.is-past:not(.is-today) { opacity: 0.8; }
.rem-col-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.2rem 0.45rem; padding: 0 0.1rem 0.4rem; border-bottom: 1px solid var(--line); }
.rem-col-day { font-weight: 700; color: #fff; font-size: 1rem; }
.rem-col-date { color: var(--ink-muted); font-size: 0.8rem; }
.rem-col-count { margin-left: auto; font-size: 0.72rem; font-weight: 700; background: var(--steel-tint); color: #CFE1FF; border-radius: 999px; padding: 0 0.5rem; }
.rem-col-today { margin-left: auto; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; background: #0C66E4; color: #fff; border-radius: 4px; padding: 0.05rem 0.45rem; }
.rem-col.is-today .rem-col-day { color: #579DFF; }
.rem-empty { color: var(--ink-muted); font-size: 0.82rem; text-align: center; padding: 0.7rem 0; opacity: 0.65; }

/* Papan bulan */
.rem-board.rem-month { display: grid; gap: 0.8rem; }
.rem-week { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.65rem 0.85rem; }
.rem-week.is-current { border-color: #579DFF; }
.rem-week-title { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; color: #fff; margin-bottom: 0.5rem; }

/* Kad aktiviti */
.rem-card { display: flex; align-items: flex-start; gap: 0.6rem; background: #1b1f23; border: 1px solid #2c333a; border-left: 4px solid #579DFF; border-radius: 8px; padding: 0.55rem 0.65rem; transition: background-color 0.12s ease, opacity 0.12s ease, transform 0.12s ease; }
.rem-card:hover { background: #20252a; }
.rem-card.freq-weekly { border-left-color: #579DFF; }
.rem-card.freq-monthly { border-left-color: #B191D4; }
.rem-card.freq-once { border-left-color: #E0954C; }
.rem-card input[type="checkbox"] { width: 20px; height: 20px; margin-top: 0.05rem; accent-color: #4FBE85; cursor: pointer; flex: none; }
.rem-card.is-big { padding: 0.7rem 0.8rem; }
.rem-card.is-big .rem-card-title { font-size: 1rem; }
.rem-card-main { min-width: 0; flex: 1; }
.rem-card-title { font-weight: 600; font-size: 0.9rem; line-height: 1.3; color: #fff; cursor: pointer; word-break: break-word; }
.rem-card-title:hover { text-decoration: underline; }
.rem-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem 0.5rem; font-size: 0.76rem; color: var(--ink-muted); margin-top: 0.25rem; }
.rem-tag { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; border-radius: 4px; padding: 0.05rem 0.4rem; }
.rem-tag.tag-weekly { background: rgba(87, 157, 255, 0.18); color: #8DBBFF; }
.rem-tag.tag-monthly { background: rgba(177, 145, 212, 0.2); color: #C9AEE6; }
.rem-tag.tag-once { background: rgba(224, 149, 76, 0.2); color: #EDB57B; }
.rem-owner { color: var(--ink); font-weight: 600; }
.rem-when { color: var(--ink-muted); }
.rem-late { color: #fff; background: var(--status-red); border-radius: 4px; font-size: 0.68rem; font-weight: 700; padding: 0.02rem 0.4rem; }
.rem-card-notes { font-size: 0.76rem; color: var(--ink-muted); margin-top: 0.3rem; font-style: italic; }
.rem-edit { background: none; border: none; color: var(--ink-muted); cursor: pointer; padding: 0 0.25rem; opacity: 0.35; transition: opacity 0.12s ease; font-size: 1rem; }
.rem-card:hover .rem-edit, .rem-edit:focus { opacity: 1; color: #fff; }
.rem-card.is-overdue { background: rgba(229, 105, 95, 0.08); border-left-color: var(--status-red); }
.rem-card.is-done { background: rgba(79, 190, 133, 0.12); border-color: rgba(79, 190, 133, 0.45); border-left-color: #4FBE85; }
.rem-card.is-done:hover { background: rgba(79, 190, 133, 0.18); }
.rem-card.is-done .rem-card-title { color: #fff; }
.rem-done-line { display: flex; align-items: center; flex-wrap: wrap; gap: 0.2rem 0.5rem; margin-top: 0.3rem; font-size: 0.76rem; }
.rem-done-badge { background: #4FBE85; color: #0b2a1b; border-radius: 4px; font-size: 0.68rem; font-weight: 700; padding: 0.02rem 0.45rem; }
.rem-done-when { color: #8fd9b3; }
.rem-photo-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.rem-photo-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; border: 1px solid #2c333a; cursor: zoom-in; }
.rem-photo-btn { background: none; border: 1px dashed #3b444c; color: var(--ink-muted); border-radius: 6px; font-size: 0.72rem; padding: 0.15rem 0.5rem; cursor: pointer; }
.rem-photo-btn:hover { border-color: #579DFF; color: #fff; }
.act-pill-done { font-size: 0.72rem; font-weight: 700; color: #8DBBFF; }
.act-pill-done.is-all { color: #4FBE85; }
.act-pill.is-on .act-pill-done, .act-pill.is-on .act-pill-done.is-all { color: #fff; }
.rem-done { margin-top: 1rem; background: #1b1f23; border: 1px solid #2c333a; border-radius: 10px; padding: 0.7rem 0.9rem; }
.rem-done-title { font-weight: 700; color: #4FBE85; margin-bottom: 0.5rem; }
.rem-done-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.2rem 0.8rem; padding: 0.35rem 0; border-top: 1px solid #2c333a; font-size: 0.85rem; }
.rem-done-row:first-child { border-top: none; }
.rem-done-who { min-width: 6.5rem; font-weight: 700; color: #fff; }
.rem-done-task { flex: 1; color: var(--ink); cursor: pointer; }
.rem-done-task:hover { text-decoration: underline; }
.rem-done-photo { background: none; border: 1px solid #3b444c; color: #8DBBFF; border-radius: 6px; font-size: 0.74rem; padding: 0.1rem 0.5rem; cursor: pointer; }
.sr-panel { margin-top: 1.2rem; background: #1b1f23; border: 1px solid #2c333a; border-radius: 10px; padding: 0.9rem 1rem; }
.sr-search { flex: 0 1 22rem; min-width: 12rem; }
.sr-count { color: var(--ink-muted); font-size: 0.84rem; margin-top: 0.6rem; }
.sr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.7rem; margin-top: 0.6rem; }
.sr-card { background: #20252a; border: 1px solid #2c333a; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, border-color .15s, box-shadow .15s; }
.sr-card:hover { transform: translateY(-2px); border-color: #579DFF; box-shadow: 0 6px 16px rgba(0,0,0,.35); }
.sr-card img { width: 100%; height: 130px; object-fit: cover; cursor: zoom-in; background: #000; }
.sr-nopreview { height: 130px; display: flex; align-items: center; justify-content: center; background: #2c333a; color: var(--ink-muted); font-size: 0.8rem; }
.sr-info { padding: 0.45rem 0.6rem 0.6rem; display: flex; flex-direction: column; gap: 0.1rem; }
.sr-place { font-weight: 700; color: #fff; word-break: break-word; }
.sr-title { font-size: 0.82rem; color: var(--ink); word-break: break-word; }
.sr-meta { font-size: 0.74rem; color: var(--ink-muted); }
.sr-save { margin-top: 0.4rem; align-self: flex-start; font-size: 0.78rem; font-weight: 700; color: #8DBBFF; background: rgba(87,157,255,.14); border-radius: 999px; padding: 0.15rem 0.7rem; text-decoration: none; }
.sr-save:hover { text-decoration: underline; }
.sr-more { margin-top: 0.7rem; }
.rem-form-photos { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.4rem; }
.rem-form-photo { position: relative; width: 64px; height: 64px; }
.rem-form-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; border: 1px solid #2c333a; }
.rem-form-photo.is-new img { border-color: #579DFF; }
.rem-form-photo-name { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 0.6rem; word-break: break-all; text-align: center; background: #2c333a; border-radius: 6px; color: var(--ink); padding: 2px; overflow: hidden; }
.rem-form-photo-x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: none; background: #8a2e28; color: #fff; font-size: 0.65rem; line-height: 1; cursor: pointer; }
.ot-panel { margin-top: 1.2rem; background: #1b1f23; border: 1px solid #2c333a; border-radius: 10px; padding: 0.9rem 1rem; }
.ot-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.8rem 1.2rem; justify-content: space-between; }
.ot-title { margin: 0; font-size: 1.05rem; font-weight: 700; color: #fff; }
.ot-summary { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.9rem; }
.ot-stat { display: flex; flex-direction: column; background: linear-gradient(135deg, #232a31, #1e2429); border: 1px solid #2c333a; border-radius: 10px; padding: 0.5rem 1rem; min-width: 7rem; }
.ot-stat-value { color: #EDB57B; font-weight: 800; font-size: 1.35rem; line-height: 1.2; }
.ot-stat-label { color: var(--ink-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.ot-list { margin-top: 0.8rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 0.8rem; align-items: start; }
.ot-person { background: #20252a; border: 1px solid #2c333a; border-radius: 12px; overflow: hidden; }
.ot-person-head { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.9rem; background: #252b31; border-bottom: 1px solid #2c333a; }
.ot-avatar { width: 2.2rem; height: 2.2rem; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #0C66E4; color: #fff; font-weight: 800; }
.ot-person-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ot-person-who b { color: #fff; word-break: break-word; }
.ot-person-detail { color: var(--ink-muted); font-size: 0.72rem; }
.ot-person-total { color: #EDB57B; font-weight: 800; font-size: 1.25rem; }
.ot-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.9rem; border-top: 1px solid #2c333a; font-size: 0.86rem; }
.ot-person-head + .ot-row { border-top: none; }
.ot-row:hover { background: rgba(255, 255, 255, 0.03); }
.ot-date { width: 3.4rem; flex: none; display: flex; flex-direction: column; align-items: center; line-height: 1.15; color: var(--ink-muted); font-size: 0.68rem; background: #1b1f23; border: 1px solid #2c333a; border-radius: 8px; padding: 0.2rem 0; }
.ot-date b { color: #fff; font-size: 1.05rem; }
.ot-hours { min-width: 3.2rem; font-weight: 800; color: #EDB57B; }
.ot-notes { flex: 1; min-width: 0; color: var(--ink-muted); font-style: italic; word-break: break-word; }
.ot-tag { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; border-radius: 4px; padding: 0.05rem 0.45rem; }
.ot-tag.rate-single { background: rgba(87, 157, 255, 0.18); color: #8DBBFF; }
.ot-tag.rate-double { background: rgba(224, 149, 76, 0.2); color: #EDB57B; }
.ot-tag.rate-triple { background: rgba(229, 105, 95, 0.2); color: #F0948C; }
@media (max-width: 420px) { .ot-list { grid-template-columns: 1fr; } }
.ot-quick { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.ot-quick button { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.7rem; font-size: 0.8rem; cursor: pointer; }
.ot-quick button:hover { border-color: #579DFF; }
.ot-rates { display: flex; gap: 0.5rem; }
.ot-rate { flex: 1; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem; font-weight: 700; cursor: pointer; }
.ot-rate.is-on { background: #0C66E4; border-color: #0C66E4; color: #fff; }
.rem-lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.8); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 1rem; }
.rem-lightbox-box { max-width: 92vw; max-height: 92vh; display: flex; flex-direction: column; gap: 0.6rem; }
.rem-lightbox-box img { max-width: 92vw; max-height: 78vh; object-fit: contain; border-radius: 8px; background: #000; }
.rem-lightbox-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.rem-lightbox-title { flex: 1; color: #fff; font-weight: 600; }
.rem-lightbox-btn { background: #2c333a; color: #fff; border: none; border-radius: 6px; padding: 0.35rem 0.8rem; font-size: 0.85rem; cursor: pointer; text-decoration: none; }
.rem-lightbox-btn:hover { background: #3b444c; }
.rem-lightbox-btn.is-danger { background: #8a2e28; }
.rem-hint { color: var(--ink-muted); font-size: 0.82rem; margin: 0.9rem 0; }

/* Skrin kosong */
.act-empty { text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 2.4rem 1.2rem; margin-top: 0.4rem; }
.act-empty-icon { font-size: 3rem; line-height: 1; margin-bottom: 0.4rem; }
.act-empty h3 { font-size: 1.3rem; font-weight: 700; color: #fff; margin: 0 0 0.4rem; }
.act-empty p { max-width: 520px; margin: 0 auto 1.1rem; color: var(--ink); }
.act-empty-examples { margin-top: 1.1rem; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.5rem; color: var(--ink-muted); font-size: 0.84rem; }
.act-empty-examples button { background: var(--surface-sunken); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 0.25rem 0.8rem; cursor: pointer; }
.act-empty-examples button:hover { border-color: #579DFF; color: #fff; }

/* Borang */
.rem-modal { position: fixed; inset: 0; z-index: 2100; display: flex; align-items: center; justify-content: center; background: rgba(5, 8, 10, 0.65); backdrop-filter: blur(3px); padding: 1rem; }
.rem-modal-box { width: min(580px, 100%); max-height: 92vh; overflow-y: auto; background: #1c1f23; border: 1px solid #3a4048; border-radius: 14px; padding: 1.2rem 1.3rem; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); }
.rem-modal-box h3 { font-size: 1.25rem; font-weight: 700; color: #fff; margin: 0 0 0.4rem; }
.rem-label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--ink); margin: 0.85rem 0 0.3rem; }
.act-optional { font-weight: 400; color: var(--ink-muted); }
.rem-modal-box input[type="text"], .rem-modal-box input[type="number"], .rem-modal-box input[type="date"], .rem-modal-box select, .rem-modal-box textarea {
    width: 100%; background: var(--surface-sunken); color: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 0.5rem 0.65rem; font-size: 0.95rem;
}
.rem-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.act-templates { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0.4rem 0 0.2rem; }
.act-templates-label { font-size: 0.8rem; color: var(--ink-muted); }
.act-templates button { background: var(--surface-sunken); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.7rem; font-size: 0.8rem; cursor: pointer; }
.act-templates button:hover { border-color: #579DFF; color: #fff; }
.act-preview { margin-top: 0.7rem; background: rgba(87, 157, 255, 0.1); border: 1px solid rgba(87, 157, 255, 0.3); border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.88rem; color: #CFE1FF; }
.rem-modal-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 1.1rem; }
@media print { .rem-edit, .rem-modal, .act-help, .act-new { display: none !important; } }

/* Nota di bawah carta: terangkan jumlah supaya boleh dipadankan dengan page lain */
.chart-note { color: var(--ink-muted); font-size: 0.82rem; margin: 0.5rem 0.2rem 0.8rem; }

/* =========================================================
   Page Spending (ke mana wang pergi) + sejarah perubahan
   ========================================================= */
.sp-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--steel-tint); margin: 0.4rem 0 0.9rem; }
.sp-tab { background: transparent; border: none; border-bottom: 3px solid transparent; color: var(--ink); opacity: 0.7; padding: 0.55rem 1rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem; }
.sp-tab:hover { opacity: 1; background: rgba(255, 255, 255, 0.05); }
.sp-tab.active { opacity: 1; color: #fff; border-bottom-color: #579DFF; background: rgba(87, 157, 255, 0.1); }
.sp-badge { font-size: 0.7rem; font-weight: 700; border-radius: 999px; padding: 0 0.5rem; min-width: 1.3rem; text-align: center; background: rgba(255, 255, 255, 0.1); color: var(--ink-muted); }
.sp-badge:empty { display: none; }
.sp-badge.is-on { background: var(--status-red); color: #fff; }

.sp-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 0.9rem; }
@media (max-width: 1500px) { .sp-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px) { .sp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sp-kpi { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid #579DFF; border-radius: 8px; padding: 0.6rem 0.85rem; }
.sp-kpi.good { border-left-color: var(--status-green); }
.sp-kpi.bad { border-left-color: var(--status-red); }
.sp-kpi-label { font-size: 0.74rem; font-weight: 600; color: var(--ink-muted); }
.sp-kpi-value { font-size: 1.3rem; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; margin: 0.1rem 0; }
.sp-kpi.bad .sp-kpi-value { color: var(--status-red); }
.sp-kpi-sub { font-size: 0.74rem; color: var(--ink-muted); }

.sp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
@media (max-width: 1100px) { .sp-grid { grid-template-columns: 1fr; } }
.sp-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 1rem; }
.sp-card h3 { font-size: 1rem; font-weight: 700; color: #fff; margin: 0 0 0.6rem; }
.sp-bar-row { padding: 0.35rem 0.4rem; border-radius: 6px; }
.sp-bar-row.is-click { cursor: pointer; }
.sp-bar-row.is-click:hover { background: rgba(87, 157, 255, 0.1); }
.sp-bar-top { display: flex; justify-content: space-between; gap: 0.8rem; font-size: 0.88rem; }
.sp-bar-name { font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-bar-amount { font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.sp-bar { height: 7px; background: #0e0f11; border-radius: 4px; overflow: hidden; margin: 0.25rem 0 0.15rem; }
.sp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #0C66E4, #579DFF); border-radius: 4px; }
.sp-bar-pct { font-size: 0.72rem; color: var(--ink-muted); }
.sp-more, .sp-empty { color: var(--ink-muted); font-size: 0.85rem; padding: 0.7rem; text-align: center; }

.sp-filterbar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem 0.9rem; margin-bottom: 0.7rem; }
.sp-filterbar-hint { color: var(--ink-muted); font-size: 0.85rem; margin-left: auto; }
.sp-table { width: 100%; border-collapse: collapse; }
html body .sp-table { font-size: 0.84rem; line-height: 1.3; }
.sp-table th, .sp-table td { border: 1px solid var(--line); }
html body .sp-table thead th { position: sticky; top: 0; z-index: 2; background: #1D2125; color: var(--ink-muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.4rem 0.55rem; text-align: left; border-bottom: 2px solid #38414A; }
html body .sp-table tbody td { padding: 0.3rem 0.55rem; }
.sp-table .num, .sp-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.sp-table tbody tr:hover { background: rgba(87, 157, 255, 0.1); }
.sp-table tr.is-click { cursor: pointer; }
.sp-table tr.sp-showall td { text-align: center; color: #579DFF; cursor: pointer; font-weight: 600; }
.sp-table tfoot td { font-weight: 700; color: #fff; background: rgba(87, 157, 255, 0.08); padding: 0.35rem 0.55rem; }
.sp-bad { color: var(--status-red); font-weight: 600; }

.sp-check { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 0.8rem; }
.sp-check > summary { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 1rem; cursor: pointer; list-style: none; }
.sp-check > summary::-webkit-details-marker { display: none; }
.sp-check > summary::before { content: "▸"; color: var(--ink-muted); transition: transform 0.15s ease; }
.sp-check[open] > summary::before { transform: rotate(90deg); }
.sp-check-title { font-weight: 700; color: #fff; font-size: 1rem; }
.sp-check-why { margin: 0 1rem 0.6rem; color: var(--ink-muted); font-size: 0.84rem; }
.sp-check-table { max-height: 340px; margin: 0 1rem 0.9rem; border-radius: 6px; }

.sp-hist-summary { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.7rem; }
.sp-chip { display: inline-flex; align-items: baseline; gap: 0.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.8rem; font-size: 0.86rem; }
.sp-chip b { color: #fff; }
.sp-chip span { font-variant-numeric: tabular-nums; color: var(--ink); }
.sp-chip.bad span { color: var(--status-red); font-weight: 700; }
.sp-chip.good span { color: var(--status-green); font-weight: 700; }
.sp-action { font-weight: 700; font-size: 0.74rem; letter-spacing: 0.04em; text-transform: uppercase; }
.action-created { color: var(--status-green); }
.action-status { color: #579DFF; }
.action-price { color: var(--status-yellow); }
.action-project { color: #B191D4; }
.action-deleted { color: var(--status-red); }
.action-bomupload { color: var(--ink-muted); }
