/* Sistem Pengurusan Projek Pembinaan — gaya antara muka (mudah alih dahulu) */
:root {
  /* Tema: biru elektrik -> indigo -> hampir hitam */
  --blue: #0301e0;
  --blue-2: #0501ba;
  --deep: #040265;
  --night: #04032d;
  --abyss: #030325;
  --grad: linear-gradient(90deg, #0301e0 0%, #0501ba 25%, #040265 50%, #04032d 75%, #030325 100%);
  --navy: #040265;
  --navy-2: #1d1ad6;
  --accent: #00b4ff;
  --page: #90C9F7;
  --bg: #eef6fe;
  --surface: #ffffff;
  --ink: #1d2433;
  --ink-2: #4a5568;
  --muted: #6b7280;
  --line: #e2e6ec;
  --ok: #1f7a4d;
  --ok-bg: #e5f4ec;
  --warn: #9a5b00;
  --warn-bg: #fff4e0;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --info: #1d1ad6;
  --info-bg: #ebebff;
  --plan: #93a4bd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --nav-w: 232px;
  --top-h: 56px;
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Noto Sans Thai", "Sarabun", Tahoma, system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--page); color: var(--ink); line-height: 1.5; -webkit-text-size-adjust: 100%;
}
a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
code, .mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.small, small { font-size: .85rem; }
.big { font-size: 1.3rem; }
.d-block { display: block; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.strong { font-weight: 600; }
.text-danger { color: var(--danger); }
.text-warn { color: var(--warn); font-weight: 600; }
.mt { margin-top: 1rem; }
.center { justify-content: center; }

/* ---------- Susun atur ---------- */
.demo-banner { background: repeating-linear-gradient(45deg, #ffe08a, #ffe08a 12px, #ffd25e 12px, #ffd25e 24px); color: #4a3500; text-align: center; font-weight: 700; padding: 6px 12px; font-size: .9rem; position: relative; z-index: 60; }
.topbar { position: sticky; top: 0; z-index: 50; height: var(--top-h); background: var(--navy); color: #fff; display: flex; align-items: center; gap: .5rem; padding: 0 .75rem; box-shadow: var(--shadow); }
.topbar a { color: #fff; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; min-width: 0; text-decoration: none !important; }
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
.brand-mark { color: var(--accent); font-size: 1.2rem; }
.nav-toggle { background: transparent; color: #fff; border: 0; font-size: 1.4rem; padding: .25rem .5rem; cursor: pointer; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.lang-switch { display: inline-flex; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; overflow: hidden; }
.lang-switch a { padding: .2rem .6rem; font-size: .8rem; font-weight: 600; color: inherit; text-decoration: none; }
.lang-switch a.active { background: var(--accent); color: #fff; }
.auth-card .lang-switch { border-color: var(--line); display: flex; width: max-content; margin: 0 auto 1rem; }
.auth-card .lang-switch a { color: var(--ink-2); }
.auth-card .lang-switch a.active { color: #fff; }
.bell { position: relative; font-size: 1.15rem; text-decoration: none !important; padding: .25rem; }
.badge-count { position: absolute; top: -4px; right: -8px; background: var(--danger); color: #fff; font-size: .65rem; border-radius: 999px; padding: 0 5px; font-weight: 700; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .4rem; }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.uname { display: none; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu .menu { position: absolute; right: 0; top: 42px; background: var(--surface); color: var(--ink); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.15); min-width: 220px; padding: .5rem 0; z-index: 70; }
.user-menu .menu a, .user-menu .menu .linklike { display: block; padding: .5rem 1rem; color: var(--ink); width: 100%; text-align: left; }
.user-menu .menu a:hover, .user-menu .menu .linklike:hover { background: var(--bg); text-decoration: none; }
.menu-head { padding: .25rem 1rem .5rem; border-bottom: 1px solid var(--line); margin-bottom: .25rem; }

.sidebar { position: fixed; top: var(--top-h); bottom: 0; left: 0; width: var(--nav-w); background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: .75rem .5rem 2rem; transform: translateX(-100%); transition: transform .2s ease; z-index: 45; }
.demo-banner ~ .sidebar { top: calc(var(--top-h) + 32px); }
.sidebar a { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: 8px; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.sidebar a:hover { background: var(--bg); }
.sidebar a.active { background: #e7eef8; color: var(--navy); font-weight: 700; }
.sidebar .ico { width: 1.2rem; text-align: center; opacity: .8; }
.nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 1rem .75rem .25rem; font-weight: 700; }
.nav-overlay { display: none; }
body.nav-open .sidebar { transform: translateX(0); }
body.nav-open .nav-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 40; }
.main { padding: 1rem .75rem 2rem; max-width: 1400px; }
.main-anon { padding: 0; }
.footer { color: var(--muted); font-size: .75rem; padding: 1rem .75rem 2rem; }

@media (min-width: 1024px) {
  .nav-toggle { display: none; }
  .sidebar { transform: none; }
  .nav-overlay { display: none !important; }
  body.has-nav .main, body.has-nav .footer { margin-left: var(--nav-w); padding-left: 1.5rem; padding-right: 1.5rem; }
  .uname { display: inline; }
  .brand-text { max-width: none; }
}

/* ---------- Komponen ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem; margin: .25rem 0 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.crumbs { font-size: .8rem; color: var(--muted); margin-bottom: .5rem; display: flex; flex-wrap: wrap; gap: .3rem; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; border: 1px solid var(--line); }
.card.narrow { max-width: 480px; }
.card-warn { border-left: 4px solid var(--danger); }
.card-inner { margin-top: .75rem; padding: .75rem; background: var(--bg); border-radius: 8px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.section-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 1rem; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
.cards .card { margin: 0; color: inherit; text-decoration: none; transition: box-shadow .15s; }
.cards .card:hover { box-shadow: 0 6px 18px rgba(16,24,40,.12); text-decoration: none; }
.project-card h3 { margin: .35rem 0 .1rem; }
.card-top { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.code { font-family: Consolas, monospace; font-size: .8rem; color: var(--muted); }
.empty { text-align: center; padding: 2rem 1rem; }
.steps { text-align: left; max-width: 520px; margin: 1rem auto; }
.steps li { margin: .35rem 0; }
.error-page { text-align: center; max-width: 520px; margin: 3rem auto; }
.error-page h1 { font-size: 3rem; color: var(--navy); }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; display: flex; flex-direction: column; gap: .2rem; color: inherit; text-decoration: none !important; box-shadow: var(--shadow); }
a.kpi:hover { border-color: var(--navy-2); }
.kpi-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.kpi-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.kpi-value.small-value { font-size: 1.05rem; }
.kpi-warn { border-left: 4px solid var(--danger); }
.kpi-warn small { color: var(--danger); }
.kpi-info { border-left: 4px solid var(--accent); }
.small-kpis .kpi-value { font-size: 1.15rem; }

.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: .35rem .75rem; margin: 0; }
.kv dt { color: var(--muted); font-size: .85rem; }
.kv dd { margin: 0; word-break: break-word; }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .1rem .5rem; background: #eef1f5; color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.st-planning, .st-not_started, .st-draft, .st-pending { background: #eef1f5; color: #475467; }
.st-active, .st-in_progress, .st-ordered, .st-partial { background: var(--info-bg); color: var(--info); }
.st-on_hold, .st-delayed, .st-half_day, .st-leave { background: var(--warn-bg); color: var(--warn); }
.st-completed, .st-received, .st-verified, .st-present { background: var(--ok-bg); color: var(--ok); }
.st-cancelled, .st-rejected, .st-absent, .st-inactive { background: #f2f4f7; color: #667085; text-decoration: none; }
.st-upcoming { background: #f0e8fd; color: #6d28d9; }
.badge.risk { background: var(--danger-bg); color: var(--danger); }
.badge.on-img { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.6); color: #fff; }
.ph-before { background: #eef1f5; color: #344054; }
.ph-during { background: var(--info-bg); color: var(--info); }
.ph-after { background: var(--ok-bg); color: var(--ok); }
.pill { display: inline-block; min-width: 1.4rem; text-align: center; border-radius: 999px; background: #e7eef8; color: var(--navy); font-size: .72rem; font-weight: 700; padding: 0 .35rem; }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.stars { color: #d4a017; letter-spacing: 1px; white-space: nowrap; }

/* Bar kemajuan (sebenar + penanda dirancang) */
.bar { position: relative; height: 18px; background: #e9edf3; border-radius: 4px; overflow: visible; min-width: 90px; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--navy-2); border-radius: 4px; }
.bar.done .bar-fill { background: var(--ok); }
.bar.behind .bar-fill { background: #c2410c; }
.bar-plan { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .65; }
.bar-label { position: absolute; right: 6px; top: 0; font-size: .7rem; line-height: 18px; font-weight: 700; color: var(--ink); text-shadow: 0 0 2px #fff, 0 0 2px #fff; }
.w-bar { min-width: 140px; }

/* Carta bar mendatar (papan pemuka) */
.hbars { display: flex; flex-direction: column; gap: .5rem; }
.hbar-row { display: grid; grid-template-columns: minmax(70px, 22%) 1fr auto; align-items: center; gap: .5rem; color: inherit; text-decoration: none !important; padding: 2px 0; }
.hbar-row:hover { background: var(--bg); }
.hbar-label { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-row .bar { grid-column: 2 / 4; }
.hbar-val { min-width: 54px; text-align: right; color: var(--ink-2); }
.bbar { position: relative; height: 18px; background: transparent; }
.bbar-budget { position: absolute; left: 0; top: 0; height: 18px; background: #d5dde8; border-radius: 4px; }
.bbar-spend { position: absolute; left: 0; top: 4px; height: 10px; background: var(--navy-2); border-radius: 3px; }
.bbar-spend.over { background: var(--danger); }
.legend { display: flex; gap: 1rem; margin-bottom: .5rem; color: var(--ink-2); flex-wrap: wrap; }
.legend span, .gantt-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.lg { display: inline-block; width: 16px; height: 10px; border-radius: 2px; }
.lg-actual { background: var(--navy-2); }
.lg-planmark { width: 2px; height: 14px; background: var(--ink); }
.lg-budget { background: #d5dde8; }
.lg-spend { background: var(--navy-2); }
.lg-base { background: transparent; border: 2px dashed var(--plan); }
.lg-plan { background: #c9d6ea; }
.lg-fc { background: repeating-linear-gradient(45deg, #f6b4ab, #f6b4ab 3px, #fde3df 3px, #fde3df 6px); }
.lg-today { width: 2px; height: 14px; background: var(--accent); }
.dot-risk { color: var(--danger); }

/* Gantt */
.gantt-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .5rem; color: var(--ink-2); }
.gantt { border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.g-row { display: grid; grid-template-columns: minmax(130px, 26%) 1fr; border-bottom: 1px solid var(--line); min-width: 640px; }
.g-row:last-child { border-bottom: 0; }
.g-head { background: #f7f9fc; height: 28px; }
.g-label { padding: .4rem .6rem; font-size: .85rem; border-right: 1px solid var(--line); }
.g-track { position: relative; min-height: 46px; }
.g-head .g-track { min-height: 28px; }
.g-month { position: absolute; top: 5px; font-size: .7rem; color: var(--muted); border-left: 1px solid var(--line); padding-left: 3px; height: 100%; }
.g-bar { position: absolute; height: 12px; border-radius: 3px; }
.g-base { top: 8px; border: 2px dashed var(--plan); background: transparent; height: 10px; }
.g-plan { top: 22px; background: #c9d6ea; overflow: hidden; }
.g-prog { position: absolute; left: 0; top: 0; bottom: 0; background: var(--navy-2); }
.g-fc { top: 22px; background: repeating-linear-gradient(45deg, #f6b4ab, #f6b4ab 3px, #fde3df 3px, #fde3df 6px); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 2; }
.g-target { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dotted var(--danger); z-index: 1; }
.g-late .g-label a { color: var(--danger); }

/* Jadual */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -.25rem; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th, .table td { padding: .5rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #f8fafc; white-space: nowrap; }
.table tfoot th { background: #eef2f7; color: var(--ink); font-size: .85rem; text-transform: none; }
.table.compact th, .table.compact td { padding: .35rem .45rem; }
.table .num, .table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: #fafbfd; }
.row-warn { background: #fff7f5; }
.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.row-info td:first-child { box-shadow: inset 3px 0 0 #8b5cf6; }
.row-muted { opacity: .6; }
.row-selected { background: #f1f6fd; }
.report-table td { font-size: .82rem; }

/* Borang */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin-bottom: 1rem; }
.filters.card { padding: .75rem; }
.filters .field { margin: 0; min-width: 150px; flex: 1 1 150px; max-width: 280px; }
.filters input[type=search] { flex: 1 1 200px; max-width: 320px; }
.inline-label { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; color: var(--ink-2); }
input, select, textarea { font: inherit; color: inherit; background: #fff; border: 1px solid #cdd5df; border-radius: 8px; padding: .5rem .6rem; min-height: 40px; width: 100%; }
.filters > input, .filters > select { width: auto; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
input[type=range] { padding: 0; border: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9ec5fe; outline-offset: 0; border-color: var(--navy-2); }
input.tiny { width: 80px; display: inline-block; }
input.small-input { width: 110px; }
textarea { min-height: 70px; resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { font-weight: 700; color: var(--navy); margin-bottom: .5rem; font-size: 1rem; padding: 0; }
.grid-form { display: grid; grid-template-columns: 1fr; gap: .25rem 1rem; }
@media (min-width: 700px) { .grid-form { grid-template-columns: 1fr 1fr; } .grid-form .span-2 { grid-column: 1 / -1; } }
@media (min-width: 1100px) { .grid-form.compact { grid-template-columns: repeat(3, 1fr); } }
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .6rem; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field.check { flex-direction: row; align-items: center; }
.field.check label { font-weight: 500; display: flex; gap: .4rem; align-items: center; }
.req { color: var(--danger); }
.help { color: var(--muted); }
.error { color: var(--danger); font-weight: 600; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); background: #fffafa; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.stack > * + * { margin-top: .5rem; }
.range-row { display: flex; gap: .75rem; align-items: center; }
.range-row input[type=range] { flex: 1; }
.row-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.row-form input:not([type=checkbox]) { width: auto; flex: 1 1 140px; }
.row-form input.tiny, .row-form input.small-input { flex: 0 0 80px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.check-card { display: flex; align-items: center; gap: .5rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; flex-wrap: wrap; }
.check-card small { margin-left: auto; }
.quick-set { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .5rem; }
.seg { display: flex; flex-wrap: wrap; gap: .25rem; }
.seg-opt { display: inline-flex; }
.seg-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-opt span { border: 1px solid #cdd5df; border-radius: 6px; padding: .3rem .55rem; font-size: .8rem; cursor: pointer; background: #fff; white-space: nowrap; }
.seg-opt input:checked + span { background: var(--navy); color: #fff; border-color: var(--navy); }
.seg-opt input:focus-visible + span { outline: 2px solid #9ec5fe; }
.seg-opt input:disabled + span { opacity: .5; cursor: not-allowed; }
.att-table td { vertical-align: middle; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; font: inherit; font-weight: 600; font-size: .9rem; padding: .5rem .9rem; min-height: 40px; border-radius: 8px; border: 1px solid #cdd5df; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: #f5f7fa; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-danger { background: #fff; border-color: #f1aeb5; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: .3rem .6rem; min-height: 32px; font-size: .82rem; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; color: var(--navy-2); cursor: pointer; font: inherit; text-align: left; }
.linklike:hover { text-decoration: underline; }
.linklike.danger { color: var(--danger); }
form.inline { display: inline; }
details > summary { cursor: pointer; }
details > summary.btn { list-style: none; display: inline-flex; margin: .25rem 0; }
details > summary.btn::-webkit-details-marker { display: none; }
details[open] > summary.btn { background: #eef2f7; }
.inline-edit { display: inline-block; margin-left: .25rem; }
.inline-edit[open] { display: block; background: var(--bg); padding: .5rem; border-radius: 8px; margin: .35rem 0; }
.danger-zone { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.sensitive { margin-top: .75rem; background: #fffbea; border: 1px solid #f5e6a8; border-radius: 8px; padding: .5rem .75rem; }

.alert { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.alert-ok { background: var(--ok-bg); border-color: #b7e1c9; color: #145a37; }
.alert-error { background: var(--danger-bg); border-color: #f5c2c0; color: #8a1c12; }
.alert-info { background: var(--info-bg); border-color: #c3d4fb; color: #1e3a8a; }

.tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 1rem; scrollbar-width: thin; }
.tabs a { padding: .55rem .85rem; color: var(--ink-2); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; text-decoration: none !important; font-size: .9rem; }
.tabs a.active { color: var(--navy); border-bottom-color: var(--accent); }
.pager { display: flex; gap: .75rem; align-items: center; justify-content: center; margin-top: 1rem; font-size: .85rem; }

/* Galeri */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.small-gallery { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.thumb { margin: 0; position: relative; background: #f2f4f7; border-radius: 8px; overflow: hidden; display: block; }
.thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.thumb figcaption { padding: .35rem .45rem; font-size: .78rem; background: #fff; }
.file-chip { display: block; padding: 1rem .5rem; font-size: .75rem; text-align: center; word-break: break-all; }
.upload-box { margin-top: .75rem; }
.upload-box[open] { background: var(--bg); padding: .75rem; border-radius: 8px; }

.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.timeline-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.timeline-list li { padding: .4rem 0 .4rem .9rem; border-left: 2px solid var(--line); position: relative; }
.timeline-list li::before { content: ""; position: absolute; left: -5px; top: .8rem; width: 8px; height: 8px; border-radius: 50%; background: var(--navy-2); }
.work-mini { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.work-mini li { display: grid; grid-template-columns: 1fr; gap: .2rem; }
.work-mini li.is-late a { color: var(--danger); font-weight: 600; }
.update-feed { list-style: none; padding: 0; margin: 0; }
.update-feed > li { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.update-feed p { margin: .35rem 0; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li { border-bottom: 1px solid var(--line); padding: .6rem .25rem; }
.notif-list li.unread { background: #f4f8ff; font-weight: 600; }
.notif-type { font-size: .7rem; text-transform: uppercase; color: var(--muted); margin-right: .3rem; }
.report-card h3 { margin-top: 0; color: var(--navy); }

/* Log masuk */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: linear-gradient(135deg, #1f3a5f 0%, #2c5282 60%, #d9822b 160%); }
.auth-card { background: #fff; border-radius: 14px; padding: 1.5rem; width: 100%; max-width: 400px; box-shadow: 0 20px 40px rgba(0,0,0,.2); }
.auth-card.wide { max-width: 560px; }
.auth-card h1 { text-align: center; margin-bottom: 1rem; }
.auth-brand { display: flex; gap: .75rem; align-items: center; justify-content: center; margin-bottom: 1rem; text-align: left; }
.auth-brand .brand-mark { font-size: 2rem; }

@media print {
  .topbar, .sidebar, .nav-overlay, .filters, .actions, .danger-zone, .upload-box, .footer, .demo-banner, .tabs { display: none !important; }
  body.has-nav .main { margin: 0; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* Penambahbaikan kebolehbacaan */
.bar-label { background: rgba(255,255,255,.88); border-radius: 3px; padding: 0 3px; top: 2px; line-height: 14px; text-shadow: none; }
@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .kpi-value { font-size: 1.2rem; word-break: break-word; }
  .kpi-value.small-value { font-size: .95rem; }
  .kpi-label { font-size: .68rem; }
  h1 { font-size: 1.25rem; }
}
.report-table td:not(.num) { min-width: 96px; }
.report-table th { white-space: normal; min-width: 80px; }

/* Lembaran bahan (perbandingan lot) */
.material-sheet th, .material-sheet td { white-space: nowrap; }
.material-sheet td.sticky-col, .material-sheet th.sticky-col { position: sticky; left: 0; background: #fff; z-index: 1; white-space: normal; min-width: 220px; max-width: 340px; box-shadow: 1px 0 0 var(--line); }
.material-sheet thead th.sticky-col { background: #f8fafc; }
.material-sheet tfoot th.sticky-col { background: #eef2f7; }
.material-sheet .lot-head { text-align: center; border-left: 2px solid #cfd8e3; text-transform: none; font-size: .82rem; color: var(--navy); }
.material-sheet .lot-first { border-left: 2px solid #cfd8e3; }
.material-sheet .diff-row th { color: var(--danger); }
.compact-checks { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 0; }
.lot-picks { flex: 1 1 100% !important; max-width: none !important; }
input.needs-input { border-color: #f0b35a; background: #fffaf0; }

/* Kalendar tahun Buddha (พ.ศ.) */
.dp { position: relative; display: flex; gap: .25rem; align-items: stretch; width: 100%; }
.filters .dp { width: auto; }
.dp-text { flex: 1; min-width: 120px; }
.dp-btn { border: 1px solid #cdd5df; background: #fff; border-radius: 8px; padding: 0 .5rem; cursor: pointer; font-size: 1rem; }
.dp-pop { position: fixed; top: 0; left: 0; z-index: 1300; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.18); padding: .5rem; width: 290px; }
.dp-head { display: flex; gap: .25rem; align-items: center; margin-bottom: .35rem; }
.dp-head select { min-height: 32px; padding: .2rem .3rem; font-size: .85rem; }
.dp-head .dp-m { flex: 1.4; } .dp-head .dp-y { flex: 1; }
.dp-nav { border: 0; background: var(--bg); border-radius: 6px; width: 30px; height: 32px; cursor: pointer; font-size: 1.1rem; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; font-size: .72rem; color: var(--muted); font-weight: 700; padding: .2rem 0; }
.dp-day { border: 0; background: none; border-radius: 6px; height: 34px; cursor: pointer; font: inherit; font-size: .88rem; }
.dp-day:hover:not(:disabled) { background: #e7eef8; }
.dp-day:disabled { color: #c3c9d2; cursor: not-allowed; }
.dp-today { box-shadow: inset 0 0 0 1px var(--accent); }
.dp-sel { background: var(--navy) !important; color: #fff; }
.dp-foot { display: flex; justify-content: space-between; margin-top: .35rem; }
.dp-act { border: 0; background: none; color: var(--navy-2); font-weight: 600; cursor: pointer; padding: .3rem .4rem; font: inherit; font-size: .85rem; }
@media (max-width: 600px) { .dp-pop { position: fixed; left: 50%; top: auto; bottom: 12px; transform: translateX(-50%); width: min(320px, calc(100vw - 24px)); } }

/* Pesan bahan terpilih (tab Bahan bahagian kerja) */
.order-table th.chk, .order-table td.chk { width: 34px; text-align: center; }
.order-table input[type=checkbox] { width: 18px; height: 18px; }
.row-ordered { background: #eefaf1; }
.row-ordered td { color: #2b5d3a; }
.row-just-ordered { background: #d7f5df !important; box-shadow: inset 4px 0 0 #2e9e55; }
.order-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: flex-end; margin-top: 10px; padding: 10px 12px; background: var(--bg-soft, #f6f8fb); border-radius: 8px; position: sticky; bottom: 0; }
.order-bar .muted { margin-right: auto; }
.order-sel { white-space: nowrap; }
.order-done a { margin-right: 4px; }


/* ================= TEMA BIRU (gradien) ================= */
.topbar { background: var(--grad); box-shadow: 0 2px 12px rgba(3, 1, 80, .35); }
.brand-mark { color: var(--accent); text-shadow: 0 0 12px rgba(0, 180, 255, .6); }
.lang-switch { border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.06); }
.lang-switch a.active { background: #fff; color: var(--deep); }
.avatar { background: linear-gradient(135deg, #00b4ff, #0301e0); box-shadow: 0 0 0 2px rgba(255,255,255,.25); }

.sidebar { background: linear-gradient(180deg, #04032d 0%, #030325 100%); border-right: 0; box-shadow: 2px 0 16px rgba(3, 3, 37, .25); }
.sidebar a { color: #c9cbf3; }
.sidebar a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.active { background: linear-gradient(90deg, #0301e0, #0501ba); color: #fff; box-shadow: 0 4px 14px rgba(3, 1, 224, .45); }
.sidebar .ico { opacity: 1; }
.nav-group { color: #7f82c9; }
body.nav-open .nav-overlay { background: rgba(3, 3, 37, .55); }

.btn-primary { background: linear-gradient(135deg, #0301e0, #0501ba 60%, #040265); border-color: #0501ba; box-shadow: 0 2px 8px rgba(3, 1, 224, .25); }
.btn-primary:hover { background: linear-gradient(135deg, #2a28ff, #0301e0 60%, #0501ba); border-color: #0301e0; }
.btn-primary:disabled { background: #a9aad6; border-color: #a9aad6; box-shadow: none; }
.tabs a.active { color: var(--blue-2); border-bottom-color: var(--blue); }
.kpi { position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--grad); }
.kpi-warn::before, .kpi-danger::before, .kpi-info::before { display: none; }
.card h2, .page-head h1 { color: var(--night); }
.bar-fill, .g-prog, .bbar-spend, .lg-actual, .lg-spend { background: linear-gradient(90deg, #0301e0, #0501ba); }
.pill { background: #ebebff; color: var(--blue-2); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(3, 1, 224, .28); border-color: var(--blue); }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

/* ---------- Halaman log masuk / persediaan ---------- */
.auth-wrap {
  position: relative; overflow: hidden; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.25rem;
  background:
    radial-gradient(circle at 15% 20%, rgba(0, 180, 255, .35), transparent 38%),
    radial-gradient(circle at 85% 85%, rgba(3, 1, 224, .45), transparent 45%),
    linear-gradient(120deg, #0301e0 0%, #0501ba 22%, #040265 50%, #04032d 75%, #030325 100%);
}
/* corak "pelan biru" (blueprint) */
.auth-wrap::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  mask-image: linear-gradient(120deg, rgba(0,0,0,.9), rgba(0,0,0,.25));
}
.auth-shell { position: relative; z-index: 1; width: 100%; max-width: 980px; display: grid; grid-template-columns: 1fr; border-radius: 20px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 20, .55), 0 0 0 1px rgba(255,255,255,.08); }
.auth-hero { display: none; color: #fff; padding: 2.5rem 2.25rem; background: linear-gradient(160deg, rgba(3,1,224,.55), rgba(4,2,101,.55) 55%, rgba(3,3,37,.75)); backdrop-filter: blur(6px); position: relative; }
.auth-hero .hero-mark { font-size: 2.6rem; color: var(--accent); text-shadow: 0 0 22px rgba(0, 180, 255, .8); line-height: 1; }
.auth-hero .hero-company { margin-top: 1rem; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; color: #aeb6ff; font-weight: 700; }
.auth-hero h2 { font-size: 1.9rem; line-height: 1.2; margin: .4rem 0 .75rem; color: #fff; }
.auth-hero p { color: #d3d6ff; margin: 0 0 1.5rem; }
.hero-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.hero-list li { display: flex; gap: .7rem; align-items: flex-start; color: #e8eaff; font-size: .95rem; }
.hero-list .hi { flex: 0 0 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); }
.hero-foot { position: absolute; left: 2.25rem; bottom: 1.5rem; font-size: .75rem; color: #8f95e6; }
.auth-card { background: #fff; border-radius: 0; padding: 2rem 1.5rem; max-width: none; box-shadow: none; }
.auth-shell.single { max-width: 440px; }
.auth-shell.single .auth-card, .auth-wrap > .auth-card { border-radius: 20px; }
.auth-wrap > .auth-card { position: relative; z-index: 1; max-width: 440px; box-shadow: 0 30px 80px rgba(0, 0, 20, .55); }
.auth-wrap > .auth-card.wide { max-width: 580px; }
.auth-card h1 { color: var(--night); font-size: 1.5rem; margin: .25rem 0 1.25rem; text-align: left; }
.auth-card .auth-sub { color: var(--muted); margin: -1rem 0 1.25rem; font-size: .9rem; }
.auth-brand { justify-content: flex-start; margin-bottom: 1.25rem; }
.auth-brand .brand-mark { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--grad); color: var(--accent); font-size: 1.4rem; }
.auth-card .lang-switch { border-color: var(--line); background: #f4f5fb; margin: 0 0 1.25rem auto; }
.auth-card .lang-switch a { color: var(--ink-2); padding: .3rem .8rem; }
.auth-card .lang-switch a.active { background: var(--grad); color: #fff; }
.auth-top { display: flex; align-items: center; gap: .75rem; }
.auth-top .auth-brand { margin-bottom: 0; }
.auth-top .lang-switch { margin: 0 0 0 auto; }
.auth-card .field input { padding: .7rem .8rem; border-radius: 10px; background: #fafbff; }
.input-icon { position: relative; }
.input-icon .ii { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: #8b8fc7; pointer-events: none; font-size: .95rem; }
.auth-card .input-icon input { padding-left: 2.3rem; }
.auth-card .btn-block { padding: .75rem 1rem; font-size: 1rem; border-radius: 10px; letter-spacing: .02em; }
.auth-card .muted.small { margin-top: 1.25rem; text-align: center; }
@media (min-width: 860px) {
  .auth-shell { grid-template-columns: 1.1fr 1fr; }
  .auth-hero { display: block; }
  .auth-card { padding: 2.75rem 2.5rem; }
}
.auth-top { flex-wrap: wrap; }
.auth-top .auth-brand { min-width: 0; flex: 1 1 200px; }
.auth-top .lang-switch { flex-shrink: 0; }
.auth-card .lang-switch a { white-space: nowrap; }

/* Latar halaman biru muda (#90C9F7): teks yang terus di atas latar digelapkan supaya jelas */
.crumbs, .crumbs a { color: #0b2a4a; }
.crumbs a { font-weight: 600; }
.page-head h1, .page-head .muted, .page-head small { color: #071a33; }
.main > .muted, .main > p.muted, .main > .help { color: #12304f; }
.tabs { border-bottom-color: rgba(4, 2, 101, .25); }
.tabs a { color: #0b2a4a; }
.tabs a:hover { background: rgba(255,255,255,.35); border-radius: 8px 8px 0 0; }
.tabs a.active { color: #040265; background: rgba(255,255,255,.55); border-radius: 8px 8px 0 0; }
.footer { color: #12304f; }
.card, .kpi { box-shadow: 0 2px 10px rgba(4, 2, 101, .10); border-color: rgba(4, 2, 101, .08); }

/* Logo syarikat */
.brand-logo { height: 38px; width: auto; display: block; filter: drop-shadow(0 0 6px rgba(0, 180, 255, .35)); }
.brand-sep { width: 1px; height: 26px; background: rgba(255,255,255,.3); margin: 0 .35rem; display: none; }
.brand-text { font-weight: 600; font-size: .9rem; color: #cfd3ff; }
@media (max-width: 600px) { .brand-text { display: none; } .brand-logo { height: 32px; } }
@media (min-width: 601px) { .brand-sep { display: inline-block; } }
.hero-logo { width: 240px; max-width: 80%; height: auto; display: block; margin-bottom: 1.25rem; filter: drop-shadow(0 0 14px rgba(0, 180, 255, .45)); }
.auth-logo { height: 58px; width: auto; display: block; }
.auth-card.wide .auth-brand { justify-content: center; margin-bottom: .75rem; }

/* Pelan tapak (susun atur lot) — warna dikira automatik daripada kemajuan lot */
.plan-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.plan-tools label { font-weight: 600; font-size: .9rem; }
.plan-wrap { display: grid; grid-template-columns: minmax(0, 560px) minmax(220px, 1fr); gap: 1rem; align-items: start; }
.plan-card { padding: .75rem; }
.site-plan { display: block; width: 100%; height: auto; font-family: inherit; }
.pl-land { fill: #d4e4a8; }
.pl-road { fill: #ddd3d3; stroke: #6e5a5a; stroke-width: 2; stroke-linejoin: round; }
.pl-centre { stroke: #fff; stroke-width: 1.6; stroke-dasharray: 10 6; }
.pl-roadtxt { fill: #7a6b6b; font-size: 9px; font-weight: 700; letter-spacing: .08em; text-anchor: middle; }
.pl-blank { fill: #e2e5ec; stroke: #4a4a6a; stroke-width: 1; }
.pl-lot { fill: #f4f6fb; stroke: #4a4a6a; stroke-width: 1; }
.pl-part { fill: #c9ebcf; stroke: #4a4a6a; stroke-width: 1; }
.pl-fill { fill: #9cc8f5; pointer-events: none; }
.pl-code { font-size: 11.5px; font-weight: 700; fill: #1b1b2f; }
.pl-no { font-size: 10px; fill: #2d2d45; }
.pl-pct { font-size: 9.5px; font-weight: 700; fill: #0b4a8b; }
.pl-box text { pointer-events: none; }
a.pl-box:hover .pl-lot, a.pl-box:focus .pl-lot { stroke: #040265; stroke-width: 2.4; }
a.pl-box:focus { outline: none; }
.pl-box.st-done .pl-lot, .pl-box.st-done .pl-part { fill: #e53935; stroke: #8e1b18; }
.pl-box.st-done text, .pl-box.st-done .pl-code, .pl-box.st-done .pl-no, .pl-box.st-done .pl-pct { fill: #fff; }
.pl-box.st-none .pl-lot, .pl-box.st-none .pl-part { fill: #fff; stroke: #9a9ab0; stroke-dasharray: 4 3; }
.pl-box.st-none .pl-code, .pl-box.st-none .pl-no { fill: #8a8aa0; }
.pl-box.st-hidden .pl-lot { fill: #e8e8ee; }
.pl-box.st-hidden .pl-code, .pl-box.st-hidden .pl-no { fill: #77778a; }
.pl-box.st-cancelled .pl-lot { fill: #cfcfd6; }
.plan-legend { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .45rem; }
.plan-legend li { display: flex; align-items: center; gap: .55rem; }
.plan-legend li strong { margin-left: auto; }
.plan-legend .sw { width: 26px; height: 16px; border: 1px solid #4a4a6a; border-radius: 2px; flex: none; background: #f4f6fb; }
.plan-legend .sw.st-done { background: #e53935; border-color: #8e1b18; }
.plan-legend .sw.st-active { background: linear-gradient(90deg, #9cc8f5 55%, #f4f6fb 55%); }
.plan-legend .sw.st-none { background: #fff; border-style: dashed; border-color: #9a9ab0; }
.plan-total { margin: .25rem 0 .4rem; }
.plan-side .actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.plan-side form { margin: 0; }
@media (max-width: 860px) { .plan-wrap { grid-template-columns: 1fr; } }
@media print {
  .no-print { display: none !important; }
  .plan-wrap { grid-template-columns: 1fr; }
  .site-plan { max-height: 92vh; width: auto; margin: 0 auto; }
  .pl-land, .pl-road, .pl-lot, .pl-part, .pl-fill, .pl-blank, .plan-legend .sw { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.plan-tools select { width: auto; min-width: 240px; max-width: 100%; flex: 0 1 auto; }
.plan-tools .btn { flex: none; }

/* Pelan tapak — gambar dimuat naik (Cara 2) */
.plan-admin { display: grid; gap: .6rem; margin-bottom: .9rem; }
.plan-admin .plan-tools { margin-bottom: 0; }
.plan-upload > summary { list-style: none; display: inline-flex; cursor: pointer; }
.plan-upload > summary::-webkit-details-marker { display: none; }
.plan-upload[open] > summary { margin-bottom: .5rem; }
.plan-upload form { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .75rem; }
.plan-list { background: #fff; border-radius: 10px; }
.plan-list .row-actions { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; white-space: nowrap; }
.plan-list form { margin: 0; }
.badge.plan-on { background: #dcfce7; color: #166534; }
.plan-wrap-image { grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); }
.plan-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: 1rem; margin: 0 0 .5rem; }
.site-plan-img { background: #fff; border-radius: 6px; }
.pl-poly { fill: rgba(255, 255, 255, .28); stroke: #1d4ed8; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.pl-shape .pl-fill { fill: rgba(59, 130, 246, .5); }
.pl-shape text { pointer-events: none; font-weight: 700; paint-order: stroke; stroke: #fff; stroke-linejoin: round; fill: #111827; }
.pl-shape .pl-tpct { fill: #0b4a8b; font-weight: 700; }
.pl-shape.st-done .pl-tpct { fill: #fff; }
.pl-shape.st-done .pl-poly { fill: rgba(229, 57, 53, .78); stroke: #8e1b18; }
.pl-shape.st-done text { fill: #fff; stroke: #7f1d1d; }
.pl-shape.st-idle .pl-poly { fill: rgba(255, 255, 255, .35); }
.pl-shape.st-none .pl-poly { fill: none; stroke: #6b7280; stroke-dasharray: 6 4; }
.pl-shape.st-none text { fill: #6b7280; }
.pl-shape.st-hidden .pl-poly { fill: rgba(148, 163, 184, .35); stroke: #64748b; }
.pl-shape.st-cancelled .pl-poly { fill: rgba(100, 116, 139, .45); }
a.pl-shape:hover .pl-poly, a.pl-shape:focus .pl-poly { stroke: #040265; stroke-width: 3.5; }
@media (max-width: 860px) { .plan-wrap-image { grid-template-columns: 1fr; } }

/* Editor tanda lot */
.pe-bar { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: flex-end; padding: .7rem .8rem; margin-bottom: .75rem; position: sticky; top: 60px; z-index: 5; }
.pe-bar .field { margin: 0; }
.pe-name { min-width: 220px; flex: 1 1 220px; }
.pe-group { display: flex; gap: .3rem; align-items: center; }
.pe-group [aria-pressed="true"] { background: var(--navy-2, #1d4ed8); color: #fff; border-color: transparent; }
.pe-zoom { min-width: 3.2rem; text-align: center; font-size: .85rem; font-weight: 600; }
.pe-check { display: flex; gap: .35rem; align-items: center; font-size: .88rem; }
.pe-save { margin-left: auto; }
.pe-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: .75rem; align-items: start; }
.pe-canvas { padding: 0; overflow: auto; height: calc(100vh - 230px); min-height: 420px; background: #eef2f7; touch-action: none; }
.pe-svg { display: block; background: #fff; user-select: none; -webkit-user-select: none; }
.pe-svg[data-mode="rect"], .pe-svg[data-mode="poly"] { cursor: crosshair; }
.pe-svg[data-mode="select"] { cursor: grab; }
.pe-shape polygon { fill: rgba(37, 99, 235, .22); stroke: #1d4ed8; stroke-width: 2; vector-effect: non-scaling-stroke; }
.pe-svg[data-mode="select"] .pe-shape polygon { cursor: move; }
.pe-shape.new polygon { fill: rgba(245, 158, 11, .22); stroke: #b45309; stroke-dasharray: 6 4; }
.pe-shape.sel polygon { fill: rgba(229, 57, 53, .3); stroke: #dc2626; stroke-width: 3; }
.pe-shape text { pointer-events: none; font-weight: 700; paint-order: stroke; stroke: #fff; fill: #0f172a; }
#pe-handles circle { fill: #fff; stroke: #dc2626; cursor: pointer; }
#pe-temp rect, #pe-temp polyline { fill: rgba(220, 38, 38, .15); stroke: #dc2626; vector-effect: non-scaling-stroke; }
#pe-temp polyline { fill: none; }
#pe-temp circle { fill: #fff; stroke: #dc2626; }
.pe-side { position: sticky; top: 140px; max-height: calc(100vh - 160px); overflow: auto; }
.pe-side h2 { font-size: 1rem; margin: .8rem 0 .4rem; }
.pe-side h3 { font-size: .9rem; margin: .9rem 0 .35rem; }
.pe-sel-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.pe-note { margin-top: .6rem; padding: .5rem .6rem; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; font-size: .85rem; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip { border: 1px solid var(--line); background: #f8fafc; border-radius: 999px; padding: .1rem .55rem; font-size: .78rem; cursor: pointer; }
.chip:hover { background: #e0ecff; }
.pe-list { margin: 0; padding-left: 1.4rem; columns: 2; font-size: .85rem; }
.pe-list .strong { font-weight: 800; color: #dc2626; }
.pe-help { margin-top: .9rem; font-size: .88rem; }
.pe-help ul { padding-left: 1.1rem; }
@media (max-width: 900px) {
  .pe-layout { grid-template-columns: 1fr; }
  .pe-side { position: static; max-height: none; }
  .pe-bar { position: static; }
  .pe-canvas { height: 70vh; }
}
[hidden] { display: none !important; }

/* Lembaran bahan lot: anggaran vs sebenar */
.sheet-grid .grid-group th { text-align: center; font-size: .72rem; letter-spacing: .05em; border-bottom: 0; }
.sheet-grid th.grp-est { background: #eef2f7; }
.sheet-grid th.grp-act { background: #e0f2e9; color: #14532d; }
.sheet-grid td.grp-act-cell { background: rgba(220, 252, 231, .35); }
.sheet-grid input.act-follow, .act-legend { color: #6b7280; font-style: italic; background: #f8fafc; }
.act-legend { border: 1px dashed #cbd5e1; border-radius: 4px; padding: 0 .35rem; }
.diff-up { color: #b91c1c; font-weight: 600; }
.diff-down { color: #15803d; font-weight: 600; }
.material-sheet th.act-h { background: #dcfce7; color: #14532d; }
.material-sheet td.act-c { background: rgba(220, 252, 231, .35); }
.material-sheet td.act-in { font-weight: 700; color: #14532d; }
.sheet-grid input.qty-custom { border-color: #f59e0b; background: #fffbeb; }
.sheet-grid .std-note { display: block; font-size: .7rem; }
.check-inline { display: inline-flex; gap: .4rem; align-items: center; font-size: .9rem; margin: .25rem 0 .5rem; }
input.tiny-num { width: 92px; text-align: right; }
.order-table th.act-h, .table th.act-h { background: #dcfce7; color: #14532d; }
.order-table td.act-c, .table td.act-c { background: rgba(220, 252, 231, .35); }
input.act-follow { color: #6b7280; font-style: italic; }
.actual-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-top: .75rem; padding: .6rem .8rem; border: 1px solid #bbf7d0; background: #f0fdf4; border-radius: 10px; }
.order-sup { display: flex; align-items: center; gap: .35rem; margin-top: .3rem; }
.order-sup select { font-size: .8rem; padding: .2rem .4rem; min-width: 150px; max-width: 220px; height: auto; }
.order-bar select { width: auto; flex: 0 0 auto; max-width: 260px; }

/* Amaran persediaan bayaran upah ikut progress */
.pp-strip { display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem; margin-bottom: 1rem; border-radius: var(--radius); background: var(--warn-bg); border: 1px solid #f3cf8e; border-left: 5px solid #e08a00; color: #5c3800; text-decoration: none; box-shadow: var(--shadow); }
.pp-strip:hover { background: #ffecc7; }
.pp-strip-late { background: var(--danger-bg); border-color: #f5c2c0; border-left-color: var(--danger); color: #7a1a12; }
.pp-strip-late:hover { background: #fbdcd8; }
.pp-strip-icon { font-size: 1.2rem; }
.pp-strip-go { margin-left: auto; font-weight: 700; white-space: nowrap; }
.pp-late-txt { color: var(--danger); font-weight: 700; }
.pp-alert { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #f3cf8e; border-left: 5px solid #e08a00; padding: 1rem; margin-bottom: 1rem; }
.pp-alert-late { border-color: #f5c2c0; border-left-color: var(--danger); }
.pp-alert-head { display: flex; align-items: flex-start; gap: .7rem; margin-bottom: .5rem; }
.pp-alert-head h2 { margin: 0; font-size: 1.05rem; }
.pp-alert-head p { margin: .15rem 0 0; color: var(--ink-2); }
.pp-alert-head .btn { margin-left: auto; }
.pp-alert-icon { font-size: 1.5rem; line-height: 1; }
.pp-alert-table tr.row-late td { background: #fff6f5; }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
@media (max-width: 640px) { .pp-strip { flex-wrap: wrap; } .pp-strip-go { margin-left: 0; } .pp-alert-head { flex-wrap: wrap; } .pp-alert-head .btn { margin-left: 0; } }

/* Paparan pembentangan (sementara): fasa & petak lot */
.present-side { background: linear-gradient(180deg, #04032d, #030325); border-right: none; padding: .75rem .6rem 2rem; }
.present-side a { color: #e6ebff; }
.present-side a:hover { background: rgba(255,255,255,.08); }
.present-home { font-weight: 700; }
.present-home:first-child { background: var(--blue); color: #fff; margin-bottom: .4rem; }
.present-proj { margin-top: .5rem; }
.present-proj-name { font-weight: 600; }
.present-proj-name > span:last-child { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.present-proj-name .pp-line { white-space: nowrap; font-size: 1rem; }
.present-proj-name b { color: #ffc56b; margin-left: .25rem; }
.present-proj-name small { color: #9fb0e8; font-weight: 400; font-size: .72rem; margin-top: .15rem; }
.sidebar.present-side .present-fasa { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .1rem; min-height: 64px; margin: .55rem .15rem; border-radius: 14px; background: #2e3a8c; border: 2px solid rgba(255,255,255,.75); color: #ffc56b; font-size: 1.05rem; font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.sidebar.present-side .present-fasa small { color: #c7d2fe; font-size: .72rem; font-weight: 500; }
.sidebar.present-side a.present-fasa:hover { background: #3a47a8; }
.sidebar.present-side a.present-fasa.active { background: var(--blue); border-color: #fff; color: #fff; }
.present-head h1 { font-size: 2rem; color: var(--deep); }
.present-crumb { color: var(--ink-2); font-weight: 600; font-size: .85rem; }
.lot-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .9rem; background: #0b1580; padding: .9rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.lot-tile { min-width: 0; display: flex; flex-direction: column; background: #2e3a8c; border: 2px solid rgba(255,255,255,.85); border-radius: 14px; padding: .55rem .6rem .6rem; color: #fff; text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.3); transition: transform .12s ease, box-shadow .12s ease; }
.lot-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,.35); }
.lot-tile-code { text-align: center; font-size: 1.35rem; font-weight: 800; letter-spacing: .02em; line-height: 1.2; }
.lot-tile-owner { text-align: center; font-size: 1.15rem; font-weight: 700; min-height: 1.9rem; margin: .1rem 0 .35rem; display: flex; align-items: center; justify-content: center; min-width: 0; }
.lot-tile-name { display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lot-tile-dots { display: block; width: 75%; border-bottom: 3px dotted rgba(255,255,255,.85); height: .9rem; }
.lot-tile-prog { background: #fff; color: var(--ink); border-radius: 8px; padding: .4rem .5rem; }
.lot-tile-label { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.lot-tile-val { font-size: 1.15rem; font-weight: 800; color: var(--ink); line-height: 1.2; }
.lot-tile-plan { font-size: .68rem; color: var(--muted); margin-top: .15rem; }
.lot-tile-done { font-size: .65rem; background: #b42318; color: #fff; border-radius: 999px; padding: .05rem .4rem; vertical-align: middle; }
.lot-tile.is-done { border-color: #ff6b6b; background: #8a1c12; }
@media (max-width: 640px) { .lot-board { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; padding: .6rem; } .lot-tile-code { font-size: 1.1rem; } }
.sidebar.present-side .present-fasa.is-placeholder { cursor: default; user-select: none; }

/* Paparan awal */
.home-welcome { padding: 2.5rem 1.5rem; }
.home-welcome h1 { font-size: 2rem; color: var(--deep); margin: 0; }

.row-active td { background: #eef3ff; }
.actions-cell { text-align: right; }
.actions-cell .btn + form { margin-left: .3rem; }
/* Projek */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.proj-card { display: flex; align-items: center; min-height: 96px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.2rem; border-top: 4px solid var(--blue); text-decoration: none; transition: transform .12s ease, box-shadow .12s ease; }
.proj-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16,24,40,.15); }
.proj-card h2 { margin: 0; font-size: 1.2rem; color: var(--deep); }
/* Senarai fasa di menu kiri */
.side-proj { margin: .3rem 0 .6rem; padding: 0 .1rem; }
.sidebar .side-proj-name { display: block; color: #ffc56b; font-weight: 700; font-size: .9rem; padding: .35rem .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar a.side-phase { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .1rem; min-height: 60px; margin: .5rem .2rem; border-radius: 14px; background: #2e3a8c; border: 2px solid rgba(255,255,255,.75); color: #ffc56b; font-size: 1.05rem; font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.sidebar a.side-phase small { color: #c7d2fe; font-size: .72rem; font-weight: 500; }
.sidebar a.side-phase:hover { background: #3a47a8; }
.sidebar a.side-phase.active { background: var(--blue); border-color: #fff; color: #fff; }
/* Masukkan Lot */
.phase-card { scroll-margin-top: calc(var(--top-h) + 1rem); }
.phase-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.phase-head h2 { margin: 0; }
.phase-gen summary { list-style: none; cursor: pointer; }
.phase-gen summary::-webkit-details-marker { display: none; }
.phase-gen[open] summary { margin-bottom: .5rem; }
.phase-gen-form { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; background: var(--bg); padding: .6rem .8rem; border-radius: 8px; }
.phase-gen-form label { display: flex; align-items: center; gap: .4rem; font-weight: 600; }
.phase-gen-form input[type=number] { width: 6rem; }
.lot-table input[type=text] { width: 100%; min-width: 8rem; }
.lot-table td { vertical-align: middle; }
.lot-actions { width: 1%; }
.lot-save-bar { position: sticky; bottom: 0; background: var(--surface); padding: .7rem 0 .5rem; margin-top: .3rem; border-top: 1px solid var(--line); z-index: 2; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.lot-edit { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.lot-edit input[type=text] { flex: 1 1 12rem; min-width: 8rem; }
.lot-table tr { scroll-margin-top: calc(var(--top-h) + 1rem); }
/* Menu lot di menu kiri */
.side-lot-name { color: #fff; font-weight: 800; font-size: 1rem; text-align: center; padding: .5rem .5rem .1rem; border-top: 1px solid rgba(255,255,255,.15); margin-top: .4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar a.side-lotmenu { min-height: 42px; margin: .35rem .2rem; font-size: .9rem; border-radius: 10px; padding: .35rem .6rem; }
.lot-section-title { font-size: 1.1rem; font-weight: 700; color: var(--blue); margin-top: .2rem; }
a.lot-tile { cursor: pointer; }
/* Gambar pelan lot */
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.plan-upload { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.plan-empty { border: 2px dashed #b9c6e6; border-radius: var(--radius); padding: 3rem 1rem; text-align: center; color: var(--muted); background: #f7faff; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.plan-item { margin: 0; background: #f7faff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.plan-item a { display: block; background: #fff; }
.plan-item img { display: block; width: 100%; height: 220px; object-fit: contain; background: #fff; }
.plan-item figcaption { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem .6rem; }
.plan-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Popup gambar besar (lightbox) */
.plan-item a { cursor: zoom-in; }
.lb { position: fixed; inset: 0; z-index: 1000; background: rgba(6, 8, 30, .95); display: flex; align-items: center; justify-content: center; padding: 3.2rem 3.6rem; }
.lb[hidden] { display: none; }
.lb-fig { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.lb-fig img { display: block; max-width: 100%; max-height: calc(100vh - 7.5rem); object-fit: contain; background: #fff; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lb-cap { color: #e8ecff; font-size: .9rem; text-align: center; }
.lb-btn { position: absolute; border: 0; background: rgba(255,255,255,.14); color: #fff; width: 46px; height: 46px; border-radius: 50%; font-size: 1.6rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lb-btn:hover, .lb-btn:focus-visible { background: rgba(255,255,255,.3); outline: none; }
.lb-close { top: .7rem; right: .8rem; }
.lb-prev { left: .7rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: .7rem; top: 50%; transform: translateY(-50%); }
body.lb-open { overflow: hidden; }
@media (max-width: 600px) { .lb { padding: 3.2rem .5rem 4.5rem; } .lb-prev, .lb-next { top: auto; bottom: .8rem; transform: none; } .lb-prev { left: calc(50% - 56px); } .lb-next { right: calc(50% - 56px); } }
/* Tarikh mula & jangka siap lot */
.lot-dates { padding: .8rem 1rem; margin-bottom: 1rem; }
.lot-dates-view, .lot-dates-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .8rem 2rem; }
.lot-date { display: flex; flex-direction: column; gap: .2rem; }
.lot-date-label { font-size: .8rem; color: var(--muted, #667); text-transform: uppercase; letter-spacing: .03em; }
.lot-date strong { font-size: 1.05rem; }
.lot-dates-edit { margin-left: auto; }
.lot-date-field { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .9rem; }
.lot-date-field input { min-width: 180px; }
.lot-dates-actions { display: flex; gap: .5rem; }
.badge.lot-due.ok { background: #dcfce7; color: #166534; }
.badge.lot-due.warn { background: #fef3c7; color: #92400e; }
.badge.lot-due.late { background: #fee2e2; color: #991b1b; }
@media (max-width: 600px) { .lot-dates-view { gap: .7rem 1.4rem; } .lot-dates-edit { margin-left: 0; } }
/* Galeri berbilang (cth. Lokasi & Geran) */
.gallery-wrap { display: grid; gap: 1rem; }
.gallery-multi { grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); align-items: start; }
.gallery-wrap > .card { margin: 0; }
.gallery-title { font-size: 1.15rem; margin: 0 0 .6rem; color: var(--blue); }
.gallery-multi .plan-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.gallery-multi .plan-item img { height: 190px; }
/* Helaian jenis Excel (Kontraktor Pembinaan) */
.sheet-card { padding: .9rem 1rem 1rem; }
.sheet-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.sheet-toolbar .btn-primary { margin-left: auto; min-width: 110px; }
.sheet-state.is-dirty { color: #b45309; font-weight: 600; }
.sheet-help { margin: .2rem 0 .7rem; }
.sheet-scroll { overflow: auto; max-height: calc(100vh - 220px); border: 1px solid #9aa3b5; border-radius: 4px; background: #fff; }
.sheet { border-collapse: collapse; width: 100%; min-width: 1080px; table-layout: fixed; font-size: .92rem; }
.sheet col.c-no { width: 52px; } .sheet col.c-date { width: 112px; } .sheet col.c-item { width: 26%; }
.sheet col.c-num { width: 116px; } .sheet col.c-sign { width: 120px; } .sheet col.c-note { width: 18%; } .sheet col.c-act { width: 62px; }
.sheet th { position: sticky; top: 0; z-index: 2; background: #e8ecf6; color: #1f2a44; font-weight: 600; font-size: .85rem; padding: .45rem .3rem; border: 1px solid #b9c0cf; text-align: center; }
.sheet td { border: 1px solid #c9cfdb; padding: 0; height: 32px; background: #fff; }
.sheet td input { width: 100%; height: 32px; border: 0; border-radius: 0; padding: 0 .4rem; background: transparent; font: inherit; color: inherit; box-shadow: none; min-width: 0; }
.sheet td input:focus { outline: 2px solid #1a56db; outline-offset: -2px; background: #f3f7ff; }
.sheet td input.r, .sheet td.r { text-align: right; font-variant-numeric: tabular-nums; }
.sheet td input.c { text-align: center; }
.sheet td.cell-err { background: #fee2e2; }
.sheet td.cell-err input { outline: 2px solid #dc2626; outline-offset: -2px; }
.sheet tr.row-contractor td { background: #f4f6fb; border-top: 2px solid #8b95ab; }
.sheet .sub { display: flex; align-items: center; gap: .4rem; margin: 0; padding-left: .5rem; font-weight: 400; }
.sheet .sub span { flex: none; font-size: .82rem; color: #4b5568; font-weight: 600; }
.sheet .sub input { flex: 1; }
.sheet td.act { text-align: center; white-space: nowrap; background: #fafbfd; }
.row-btn { border: 0; background: transparent; width: 24px; height: 24px; border-radius: 4px; cursor: pointer; font-size: 1.05rem; line-height: 1; color: #4b5568; opacity: .45; }
.sheet tr:hover .row-btn, .row-btn:focus-visible { opacity: 1; }
.row-btn:hover { background: #e5e9f2; }
.row-btn.del:hover { background: #fee2e2; color: #b91c1c; }
.sheet tfoot td { position: sticky; bottom: 0; z-index: 1; background: #eef1f8; font-weight: 700; padding: 0 .5rem; border-top: 2px solid #8b95ab; }
.sheet tfoot td:first-child { text-align: right; }
@media (max-width: 700px) { .sheet-toolbar .btn-primary { margin-left: 0; } .sheet-scroll { max-height: none; } }
@media print { .sheet-toolbar, .sheet-help, .sheet td.act, .sheet th.act { display: none; } .sheet-scroll { max-height: none; overflow: visible; border: 0; } }
.sheet td input::placeholder { color: transparent; }
.sheet td input:focus::placeholder { color: #9aa3b5; }
/* Kotak Baki Belum Dijelaskan */
.sheet-summary { display: flex; margin: .6rem 0 .3rem; }
.sum-box { display: flex; flex-direction: column; gap: .15rem; min-width: 260px; padding: .7rem 1rem; border-radius: 8px; border: 1px solid #c9cfdb; border-left-width: 6px; background: #fff; }
.sum-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #4b5568; }
.sum-value { font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.sum-formula { color: #4b5568; font-variant-numeric: tabular-nums; }
.sum-balance.owing { border-color: #f59e0b; background: #fffbeb; } .sum-balance.owing .sum-value { color: #b45309; }
.sum-balance.clear { border-color: #16a34a; background: #f0fdf4; } .sum-balance.clear .sum-value { color: #15803d; }
.sum-balance.over { border-color: #dc2626; background: #fef2f2; } .sum-balance.over .sum-value { color: #b91c1c; }
@media (max-width: 600px) { .sum-box { min-width: 0; width: 100%; } }
.page-head .head-balance { margin-left: auto; align-self: center; }
.sheet tr.row-subtotal td { background: #f4f6fb; font-weight: 700; padding: 0 .5rem; border-top: 1.5px solid #8b95ab; }
.sheet tr.row-subtotal td.sub-label { text-align: right; color: #4b5568; font-size: .85rem; }
.sheet tr.row-subtotal td.act { padding: 0; }
/* Bahan Material: lajur Anggaran & Sebenar */
.sheet col.c-qty { width: 78px; } .sheet col.c-price { width: 92px; } .sheet col.c-shop { width: 90px; }
.sheet-bahan col.c-item, .sheet[class*="sheet-bahan-"] col.c-item { width: 22%; }
.sheet[class*="sheet-bahan-"] col.c-note { width: 12%; }
.sheet thead tr.sub-head th { top: 33px; }
.sheet th.grp { border-bottom: 1px solid #b9c0cf; }
.sheet th.grp-0 { background: #e3ecfb; } .sheet th.grp-1 { background: #e4f4e8; }
.sheet-tpl { margin: .3rem 0 .5rem; }
/* Submenu Bahan di sidebar: butang */
.sidebar .side-subs { margin: .1rem .2rem .6rem .7rem; padding: .35rem 0 .1rem .55rem; border-left: 3px solid #ffc56b; display: flex; flex-direction: column; gap: .32rem; }
.sidebar a.side-sub { display: flex; align-items: center; gap: .5rem; min-height: 40px; padding: .35rem .55rem .35rem .4rem; border-radius: 10px; background: #26307a; border: 1.5px solid rgba(255,255,255,.35); color: #e6ebff; font-size: .84rem; font-weight: 600; line-height: 1.2; text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: background .15s, border-color .15s, transform .1s; }
.sidebar a.side-sub .ss-no { flex: none; min-width: 2.4rem; padding: .2rem .3rem; border-radius: 7px; background: rgba(255,197,107,.16); color: #ffc56b; font-size: .76rem; font-weight: 800; text-align: center; }
.sidebar a.side-sub:hover { background: #33409c; border-color: rgba(255,255,255,.7); }
.sidebar a.side-sub:active { transform: scale(.98); }
.sidebar a.side-sub.active { background: var(--blue); border-color: #fff; color: #fff; box-shadow: 0 0 0 2px rgba(255,197,107,.55), 0 2px 8px rgba(0,0,0,.4); }
.sidebar a.side-sub.active .ss-no { background: #ffc56b; color: #0b0f4d; }
.sidebar .side-subs[hidden] { display: none; }
.sidebar .sub-caret { display: inline-block; margin-left: .25rem; font-size: .85em; color: #ffc56b; }
/* Carta jadual kerja (Kemajuan Kerja Kontraktor Utama) */
.sched-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .3rem; }
.sched-head h2 { margin: 0; font-size: 1.15rem; }
.sched-legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; color: #4b5568; }
.sched-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.lg { display: inline-block; width: 18px; height: 11px; border-radius: 2px; border: 1px solid #9aa3b5; }
.lg-plan { background: repeating-linear-gradient(45deg, #f4b183 0 3px, #fde6d6 3px 6px); }
.lg-done { background: #ed9b33; border-color: #b45309; }
.lg-proj { background: #fff; border: 2px dashed #ed9b33; }
.lg-rest { background: #ffe1cc; }
.lg-today { background: #fff; border: 2px solid #dc2626; }
.sched-help { margin: .2rem 0 .6rem; }
.gantt-scroll { overflow: auto; max-height: 70vh; border: 1px solid #9aa3b5; border-radius: 4px; background: #fff; position: relative; }
.gantt { border-collapse: separate; border-spacing: 0; font-size: .78rem; }
.gantt th, .gantt td { border-right: 1px solid #e3e7ef; border-bottom: 1px solid #e3e7ef; padding: 0; }
.gantt thead th { position: sticky; z-index: 3; background: #e8ecf6; color: #1f2a44; text-align: center; font-weight: 600; }
.gantt thead tr:first-child th { top: 0; height: 26px; }
.gantt thead tr:nth-child(2) th { top: 26px; height: 24px; }
.gantt th.g-month { border-bottom: 1px solid #b9c0cf; border-left: 2px solid #8b95ab; font-size: .8rem; white-space: nowrap; padding: 0 .4rem; text-align: left; }
.gantt th.g-day { min-width: 24px; width: 24px; font-variant-numeric: tabular-nums; }
.gantt th.g-day.is-rest { background: #f8b98a; color: #7c2d12; }
.gantt th.g-day.is-today { background: #dc2626; color: #fff; }
.gantt .m-start { border-left: 2px solid #8b95ab; }
.gantt th.g-name { position: sticky; left: 0; z-index: 2; background: #fff; min-width: 210px; max-width: 260px; text-align: left; padding: .25rem .5rem; border-right: 2px solid #8b95ab; border-bottom: 2px solid #c9cfdb; font-weight: 600; vertical-align: middle; }
.gantt thead th.g-corner { z-index: 4; background: #e8ecf6; vertical-align: middle; }
.gantt .g-sw, .task-table .g-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: .35rem; border: 1px solid rgba(0,0,0,.2); }
.gantt .g-nm { font-size: .84rem; }
.g-st { display: block; font-size: .72rem; font-weight: 600; margin-top: .1rem; }
.task-table .g-st { display: inline-block; padding: .1rem .45rem; border-radius: 999px; }
.g-st.st-wait { color: #4b5568; } .g-st.st-late { color: #b91c1c; } .g-st.st-run { color: #b45309; } .g-st.st-done { color: #15803d; }
.task-table .g-st.st-wait { background: #eef1f6; } .task-table .g-st.st-late { background: #fee2e2; } .task-table .g-st.st-run { background: #fef3c7; } .task-table .g-st.st-done { background: #dcfce7; }
.gantt td { height: 17px; position: relative; }
.gantt tr.g-row-act td { border-bottom: 2px solid #c9cfdb; height: 21px; cursor: pointer; }
.gantt td.is-rest { background: #fff1e6; }
.gantt td.is-today { box-shadow: inset 2px 0 0 #dc2626, inset -2px 0 0 #dc2626; }
.gantt td.g-p.on { background: repeating-linear-gradient(45deg, var(--c) 0 3px, color-mix(in srgb, var(--c) 30%, #fff) 3px 6px); }
.gantt td.g-a.done { background: var(--c); }
.gantt td.g-a.proj { background: #fff; box-shadow: inset 0 0 0 2px var(--c); }
.gantt td.g-a.proj.is-today, .gantt td.g-a.done.is-today { box-shadow: inset 2px 0 0 #dc2626, inset -2px 0 0 #dc2626, inset 0 0 0 2px var(--c); }
.gantt tr.g-row-act td:hover { outline: 2px solid #1a56db; outline-offset: -2px; }
.gantt td.g-a.sel { outline: 3px solid #1a56db; outline-offset: -3px; }
.g-amt { position: absolute; left: 2px; top: 0; z-index: 1; font-size: .7rem; font-weight: 800; color: #111827; white-space: nowrap; text-shadow: 0 0 2px #fff, 0 0 2px #fff; line-height: 17px; pointer-events: none; }
.g-mk { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .7rem; color: #fff; text-shadow: 0 0 2px rgba(0,0,0,.8); pointer-events: none; }
.g-menu { position: absolute; z-index: 1200; min-width: 240px; max-width: 320px; background: #fff; border: 1px solid #9aa3b5; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: .5rem; display: flex; flex-direction: column; gap: .3rem; }
.g-menu-head { font-weight: 700; font-size: .85rem; padding: .1rem 1.6rem .3rem .3rem; border-bottom: 1px solid #e3e7ef; color: #1f2a44; }
.g-menu form { margin: 0; }
.g-menu-btn { width: 100%; text-align: left; border: 1px solid #c9cfdb; background: #f6f8fc; border-radius: 7px; padding: .5rem .6rem; font: inherit; font-size: .88rem; cursor: pointer; color: #1f2a44; }
.g-menu-btn:hover, .g-menu-btn:focus-visible { background: #e3ecfb; border-color: #1a56db; outline: none; }
.g-menu-btn.danger { color: #b91c1c; } .g-menu-btn.danger:hover { background: #fee2e2; border-color: #dc2626; }
.g-menu-x { position: absolute; top: .3rem; right: .4rem; border: 0; background: transparent; font-size: 1.2rem; line-height: 1; cursor: pointer; color: #4b5568; }
.task-table td { vertical-align: middle; }
.task-table .num, .task-table input.num { text-align: right; }
.task-table input:not([type=color]) { width: 100%; min-width: 0; }
.task-table td:first-child { min-width: 220px; }
.task-namecell { display: flex; gap: .35rem; align-items: center; }
.task-namecell input[type=color] { width: 36px; height: 32px; padding: 2px; flex: none; border-radius: 6px; }
.task-table tr.task-new td { background: #f6f8fc; }
.task-table .task-delay { color: #b91c1c; font-weight: 600; }
.task-table .actions { white-space: nowrap; }
/* Nama pelabur terus di halaman lot */
.lot-inv-form { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .1rem 0; }
.lot-inv-form h1 { margin: 0; }
.lot-inv-form input[name=investor_name] { width: 260px; max-width: 100%; height: 38px; border: 2px solid #f59e0b; background: #fffbeb; border-radius: 8px; padding: 0 .6rem; font-size: 1rem; }
.lot-inv-form input[name=investor_name]:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgba(26,86,219,.2); }
.lot-inv-hint { color: #92400e; font-weight: 600; }
.lot-inv-edit { font-size: .9rem; text-decoration: none; margin-left: .3rem; padding: .1rem .4rem; border-radius: 6px; color: var(--blue); background: rgba(255,255,255,.6); vertical-align: middle; }
.lot-inv-edit:hover { background: #fff; }
/* Akaun penginvestor: baca sahaja & dilindungi */
body.protect { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.protect input, body.protect textarea { -webkit-user-select: text; user-select: text; }
body.protect img { -webkit-user-drag: none; user-drag: none; pointer-events: auto; }
.wm { position: fixed; inset: 0; z-index: 900; pointer-events: none; background-repeat: repeat; }
.shield { position: fixed; inset: 0; z-index: 5000; background: #0b0f4d; color: #fff; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 1.3rem; }
.shield[hidden] { display: none; }
@media print {
  body.protect > * { display: none !important; }
  body.protect::before { content: attr(data-protect-msg); display: block; padding: 3rem; font: 700 20pt sans-serif; text-align: center; }
}
.sheet-ro .sheet td input { cursor: default; }
.sheet-ro .sheet td input:focus { outline: none; background: transparent; }
.gantt-ro tr.g-row-act td { cursor: default; }
.gantt-ro tr.g-row-act td:hover { outline: none; }
.lot-tile-locked { cursor: default; }
.lot-tile-locked .lot-tile-owner { min-height: 1.3em; }
.lot-tile-locked:hover { transform: none; box-shadow: none; }
.lot-tile-lock { font-size: 1.1rem; }
.lot-tile-mine { box-shadow: 0 0 0 3px #ffc56b, 0 4px 12px rgba(0,0,0,.2); }
.owner-badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .45rem; border-radius: 999px; background: #e0e7ff; color: #3730a3; vertical-align: middle; }
.lot-inv-form select[name=owner_user_id], .lot-edit select[name=owner_user_id] { height: 38px; max-width: 260px; border-radius: 8px; }
.proj-card { flex-direction: column; align-items: flex-start; justify-content: center; gap: .4rem; }
.proj-card-mine { border-top-color: #f59e0b; }
.proj-mine { font-size: .8rem; font-weight: 700; color: #92400e; background: #fef3c7; padding: .15rem .55rem; border-radius: 999px; }
.restore-form { display: flex; flex-direction: column; gap: .8rem; }
.restore-step { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; }
.restore-no { flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: .9rem; }
.restore-file { font-weight: 600; color: var(--night); word-break: break-all; }
.restore-confirm { font-size: .95rem; }
#restore-confirm { width: 160px; text-transform: uppercase; }
