/* Zeta ERP — ringkas di hadapan, lengkap di belakang.
   Layout: bar atas dengan navigasi modul, kandungan satu lajur (maks 1240px), kad hanya untuk kumpulan yang perlu dipisahkan. */
:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --ink: #17211f;
  --ink-2: #44524e;
  --muted: #6b7a76;
  --line: #dde4e1;
  --line-strong: #c5d0cc;
  --brand: #1f5e57;
  --brand-ink: #ffffff;
  --brand-soft: #e3efec;
  --brand-hover: #174a44;
  --focus: #2f8f83;

  --good: #23683c;  --good-bg: #e2f2e6;
  --warn: #8a5a12;  --warn-bg: #fbefd9;
  --bad: #a3302a;   --bad-bg: #fbe4e1;
  --info: #24548f;  --info-bg: #e3ecf8;
  --neutral: #4d5a57; --neutral-bg: #eceff0;

  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(23, 33, 31, .06), 0 2px 8px rgba(23, 33, 31, .04);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--f-body); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0; text-wrap: balance; }
h1 { font-size: 24px; font-weight: 600; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
.mono { font-family: var(--f-mono); font-size: .93em; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

/* ---------- Bar atas ---------- */
.topbar { background: var(--brand); color: var(--brand-ink); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: 16px; letter-spacing: .01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: #fff; color: var(--brand); display: grid; place-items: center; font: 700 15px/1 var(--f-mono); }
.mainnav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.mainnav a { color: rgba(255,255,255,.82); padding: 7px 12px; border-radius: 6px; font-size: 14px; white-space: nowrap; }
.mainnav a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.mainnav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 6px; color: rgba(255,255,255,.85); background: none; border: 0; cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 8px; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { background: rgba(255,255,255,.1); }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; z-index: 30; }
.menu-panel .menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-panel a, .menu-panel button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); text-decoration: none; }
.menu-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }

/* ---------- Halaman ---------- */
.page { max-width: 1240px; margin: 0 auto; padding-inline: 16px; padding-block: 24px 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 18px; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Butang ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 500 14px/1 var(--f-body); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-good { background: var(--good); border-color: var(--good); color: #fff; }
.btn-good:hover { filter: brightness(.94); background: var(--good); }
.btn-danger { color: var(--bad); border-color: #e6bdb9; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-ghost { border-color: transparent; background: none; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--bad); }

/* ---------- Lencana ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.badge.overdue { background: var(--bad); color: #fff; }
.badge.overdue::before { display: none; }
.badge.plain::before { display: none; }

/* ---------- Jadual ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafcfb; }
.table .row-link { color: var(--ink); font-weight: 500; }
.table .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.empty { padding: 40px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------- Borang ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.req::after { content: " *"; color: var(--bad); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); font: 400 14px/1.4 var(--f-body); }
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; }
.input:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: var(--focus); }
.input.money { text-align: right; font-variant-numeric: tabular-nums; }
.input-group { display: flex; }
.input-group .prefix { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--line-strong); border-right: 0; border-radius: 6px 0 0 6px; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.input-group .input { border-radius: 0 6px 6px 0; }
.has-error .input { border-color: var(--bad); }
.error { color: var(--bad); font-size: 12.5px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.checks { display: flex; flex-wrap: wrap; gap: 10px 24px; }
fieldset.section { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; }
fieldset.section + fieldset.section { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 20px; }
.section legend { font-weight: 600; font-size: 15px; padding: 0; margin-bottom: 4px; }
details.more > summary { cursor: pointer; color: var(--brand); font-weight: 500; font-size: 14px; padding: 4px 0; }
details.more[open] > summary { margin-bottom: 14px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ---------- Penapis ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; }
.chip:hover { border-color: var(--line-strong); text-decoration: none; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .count { font-size: 12px; opacity: .75; font-variant-numeric: tabular-nums; }
.search { display: flex; gap: 6px; }
.search .input { width: 260px; max-width: 60vw; height: 32px; }

/* ---------- Mesej ---------- */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14px; }
.flash.ok { background: var(--good-bg); color: var(--good); }
.flash.err { background: var(--bad-bg); color: var(--bad); }
.flash.note { background: var(--warn-bg); color: var(--warn); }
.flash ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Dashboard ---------- */
.modules { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1000px) { .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .modules { grid-template-columns: minmax(0, 1fr); } }
.module { --m: var(--brand); --m-soft: var(--brand-soft); position: relative; overflow: hidden; display: grid; gap: 8px; padding: 18px 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); align-content: start; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.module::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--m); }
.module::after { content: ""; position: absolute; right: -36px; bottom: -36px; width: 110px; height: 110px; border-radius: 50%; background: var(--m-soft); opacity: .7; transition: transform .2s ease; }
.module:hover { transform: translateY(-2px); border-color: var(--m); box-shadow: 0 8px 22px rgba(23, 33, 31, .10); text-decoration: none; }
.module:hover::after { transform: scale(1.25); }
.module > * { position: relative; z-index: 1; }
.module .m-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.module .icon { width: 42px; height: 42px; border-radius: 11px; background: var(--m); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 10px color-mix(in srgb, var(--m) 35%, transparent); }
.module .go { color: var(--line-strong); transition: color .15s ease, transform .15s ease; }
.module:hover .go { color: var(--m); transform: translateX(3px); }
.module .name { font-weight: 600; font-size: 15px; }
.module .stat { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.module .stat strong { font-size: 24px; line-height: 1.1; font-weight: 700; color: var(--m); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.module .meta { font-size: 12.5px; color: var(--muted); }
.m-cust { --m: #2f6fb0; --m-soft: #e3edf8; }
.m-rfx { --m: #1f8a78; --m-soft: #e0f2ee; }
.m-quote { --m: #6b4fb8; --m-soft: #ece7f8; }
.m-wo { --m: #c2780f; --m-soft: #fbefdc; }
.m-po { --m: #1b7f9a; --m-soft: #dff0f5; }
.m-inv { --m: #b04a5a; --m-soft: #f8e5e8; }
.m-pay { --m: #2e8b4e; --m-soft: #e2f3e8; }
.m-rep { --m: #4a4fb0; --m-soft: #e6e7f8; }
.module.soon { opacity: .55; pointer-events: none; }
.module.soon .meta { font-size: 0; }
.module.soon .meta::after { font-size: 12.5px; content: "Akan datang"; }
.task-list { list-style: none; margin: 0; padding: 0; }
.task-list li + li { border-top: 1px solid var(--line); }
.task { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 18px; color: var(--ink); }
.task:hover { background: var(--surface-2); text-decoration: none; }
.task .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.task.urgent .dot { background: var(--bad); }
.task .kind { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.task .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task .meta { font-size: 13px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--line); }
.kpi { padding: 14px 18px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12.5px; color: var(--muted); }

/* ---------- Butiran dokumen ---------- */
.doc-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.doc-no { font: 500 14px/1 var(--f-mono); color: var(--muted); }
.progress { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin: 18px 0 4px; }
.progress .step { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.progress .bar { height: 6px; border-radius: 4px; background: var(--line); }
.progress .done .bar { background: linear-gradient(90deg, #1f8a78, #2fb59c); }
.progress .done { color: #1f7a6b; }
.progress .done span::before { content: "✓ "; font-weight: 700; }
.progress .current .bar { height: 8px; margin-top: -1px; background: linear-gradient(90deg, #f0a33a, #f6c35c); box-shadow: 0 0 0 3px rgba(240, 163, 58, .22); }
.progress .current { color: #9a5a08; font-weight: 700; }
.progress .current span::before { content: "● "; font-size: 10px; vertical-align: 1px; }
.progress .stopped .bar { background: var(--muted); }
@media (max-width: 640px) { .progress .step span { display: none; } .progress .current span { display: inline; grid-column: 1; } }
dl.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { dl.kv { grid-template-columns: minmax(0, 1fr); gap: 2px; } dl.kv dd { margin-bottom: 10px; } }
.callout { padding: 14px 16px; border-radius: var(--radius); background: var(--brand-soft); display: grid; gap: 10px; }
.callout.warn { background: var(--warn-bg); }
.callout.muted { background: var(--surface-2); border: 1px solid var(--line); }
.callout h3 { font-size: 14px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline li { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 12px; font-size: 13.5px; }
.timeline .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); margin-top: 6px; }
.timeline .when { font-size: 12px; color: var(--muted); }

/* ---------- Lampiran ---------- */
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); font-size: 14px; cursor: pointer; transition: background .15s, border-color .15s; }
.dropzone:hover, .dropzone.over { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.dropzone strong { color: var(--ink); }
.dropzone.busy { pointer-events: none; opacity: .7; }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.files li:last-child { border-bottom: 0; }
.files .ext { font: 600 10.5px/1 var(--f-mono); background: var(--neutral-bg); color: var(--neutral); padding: 6px 6px; border-radius: 4px; min-width: 40px; text-align: center; }
.files .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Dialog ---------- */
dialog.modal { border: 0; border-radius: 10px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--ink); }
dialog.modal::backdrop { background: rgba(23, 33, 31, .45); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 20px; display: grid; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }
.choice { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input { margin-top: 3px; accent-color: var(--brand); }
.choice .t { font-weight: 600; }
.choice .d { font-size: 13px; color: var(--muted); }

/* ---------- Tetapan ---------- */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .settings-layout { grid-template-columns: minmax(0, 1fr); } }
.subnav { display: grid; gap: 2px; position: sticky; top: 76px; }
.subnav a { padding: 8px 12px; border-radius: 6px; color: var(--ink-2); font-size: 14px; }
.subnav a:hover { background: var(--surface); text-decoration: none; }
.subnav a.active { background: var(--surface); color: var(--brand); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
@media (max-width: 860px) { .subnav { position: static; grid-auto-flow: column; overflow-x: auto; } }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.role-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.role-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.role-card input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); }
.role-card .t { font-weight: 600; font-size: 14px; }
.role-card .d { font-size: 12.5px; color: var(--muted); }
.secret { font: 600 18px/1 var(--f-mono); letter-spacing: .04em; background: #fff; padding: 10px 14px; border-radius: 6px; border: 1px solid var(--line); display: inline-block; user-select: all; }

/* ---------- Penomboran halaman ---------- */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pager .pages { display: flex; gap: 4px; }
.pager a, .pager span.cur { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line); color: var(--ink-2); }
.pager span.cur { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .disabled { opacity: .4; }

/* ---------- Log masuk ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, #e9f1ef 0%, var(--bg) 55%); }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 32px 28px; display: grid; gap: 22px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .brand-mark { background: var(--brand); color: #fff; width: 40px; height: 40px; font-size: 18px; border-radius: 9px; }
.auth-brand .t { font-weight: 600; font-size: 18px; }
.auth-brand .s { font-size: 13px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .topbar, .actions, .no-print { display: none !important; } body { background: #fff; } .panel { border: 0; } }

/* ---------- Jadual boleh ubah (Costing, Quotation) ---------- */
.grid-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 1060px; }
.grid-table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); padding: 9px 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.grid-table th.num, .grid-table td.num { text-align: right; }
.grid-table td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid-table .input { height: 34px; padding: 0 8px; font-size: 13.5px; }
.grid-table textarea.input { min-height: 34px; height: 34px; padding: 6px 8px; font-size: 12.5px; }
.grid-table .calc { padding-top: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid-table tr.low-margin .margin { color: var(--bad); font-weight: 600; }
.grid-table .idx { color: var(--muted); padding-top: 9px; width: 28px; }
.grid-table tfoot td { font-weight: 600; background: var(--surface-2); border-bottom: 0; }
.override-tag { display: block; font-size: 11px; color: var(--warn); margin-top: 2px; }
.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.summary-strip > div { padding: 14px 18px; border-right: 1px solid var(--line); }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-strip .l { font-size: 12.5px; color: var(--muted); }
.summary-strip .bad { color: var(--bad); }
.sq-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 10px; }
.sq-head { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: space-between; align-items: baseline; }
.totals { margin-left: auto; width: min(360px, 100%); display: grid; grid-template-columns: 1fr auto; gap: 6px 20px; font-size: 14px; }
.totals .num { font-variant-numeric: tabular-nums; }
.totals .grand { font-size: 17px; font-weight: 600; border-top: 1px solid var(--line); padding-top: 8px; }
.approval-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.approval-steps li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; font-size: 13.5px; }
.approval-steps .mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--neutral-bg); color: var(--neutral); }
.approval-steps .approved .mark { background: var(--good); color: #fff; }
.approval-steps .rejected .mark { background: var(--bad); color: #fff; }
.approval-steps .pending.current .mark { background: var(--warn); color: #fff; }

/* ---------- Sebut harga pembekal: lajur sejajar ---------- */
.sq-head { display: grid; grid-template-columns: minmax(0, 1fr) 110px 150px 70px; gap: 4px 16px; align-items: center; }
.sq-date { text-align: right; font-variant-numeric: tabular-nums; }
.sq-amount { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sq-actions { display: flex; gap: 14px; justify-content: flex-end; }
@media (max-width: 700px) {
  .sq-head { grid-template-columns: minmax(0, 1fr) auto; }
  .sq-date { text-align: left; }
  .sq-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
.sq-notes { background: var(--warn-bg); border-radius: 6px; padding: 10px 12px; font-size: 13.5px; display: grid; gap: 2px; }
.sq-notes .label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--warn); }
.dropzone-half { width: 50%; padding: 14px; text-align: left; display: flex; gap: 10px; align-items: center; }
@media (max-width: 700px) { .dropzone-half { width: 100%; } }
.file-actions { display: flex; gap: 14px; align-items: center; }

/* ---------- Pratonton lampiran ---------- */
dialog.modal.preview { width: min(1100px, calc(100vw - 32px)); height: min(88vh, 1000px); }
dialog.modal.preview[open] { display: flex; flex-direction: column; }
.preview-body { flex: 1; min-height: 0; background: #525659; display: grid; place-items: center; overflow: auto; }
.preview-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-body img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; }
.preview-body iframe.text { background: #fff; }
.modal-head .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Jenis entiti: warna berbeza supaya mudah dibezakan sepintas lalu */
.badge.cust { background: #e1ecfb; color: #1f4f96; }
.badge.vend { background: #efe4fa; color: #6b2fa3; }
.badge.cust::before, .badge.vend::before { display: none; }
.contact-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 12px 18px; }
.contact-row .acts { display: flex; gap: 10px; align-items: flex-start; }

/* Butang ikon (ubah / padam / muat turun) */
.icon-action { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.icon-action:hover { background: var(--surface-2); color: var(--brand); text-decoration: none; }
.icon-action.danger:hover { background: var(--bad-bg); color: var(--bad); }
.icon-action-form { display: inline; margin: 0; }
.icon-actions { display: flex; gap: 2px; align-items: center; justify-content: flex-end; }

/* Kad sebut harga pembekal: baris atas penuh; kandungan 70% */
.sq-body { width: 70%; display: grid; gap: 10px; }
.sq-body .dropzone-half { width: 100%; }
@media (max-width: 900px) { .sq-body { width: 100%; } }

/* ---------- Aliran tunai ---------- */
:root { --c-in: #1f6f62; --c-out: #c0782e; --c-line: #17211f; --grid: #e6ebe9; }
.chart-wrap { overflow-x: auto; }
.chart svg { display: block; width: 100%; min-width: 640px; height: auto; font-family: var(--f-body); }
.chart .tick { font-size: 11px; fill: var(--muted); }
.chart .mlabel { font-size: 11.5px; fill: var(--ink-2); }
.chart .mlabel.neg { fill: var(--bad); font-weight: 600; }
.chart .col:hover .hit { fill: rgba(31, 94, 87, .06); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.line { height: 2px; border-radius: 0; vertical-align: 3px; width: 16px; }
.table tr.neg td { background: #fdf3f2; }
.table tr.sel td { background: var(--brand-soft); }
.net-neg { color: var(--bad); font-weight: 600; }
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.report-card { display: grid; gap: 6px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
.report-card:hover { border-color: var(--brand); text-decoration: none; box-shadow: var(--shadow); }
.report-card .t { font-weight: 600; }
.report-card .d { font-size: 13px; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filters .input { height: 32px; width: auto; }
.bar-inline { height: 8px; border-radius: 4px; background: var(--brand); min-width: 2px; }

/* Aliran tunai tahunan: sebenar (padu) vs unjuran (berjalur) */
.legend i.proj-in { background: repeating-linear-gradient(135deg, var(--c-in) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px var(--c-in); }
.legend i.proj-out { background: repeating-linear-gradient(135deg, var(--c-out) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px var(--c-out); }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--c-line) 0 4px, transparent 4px 7px) !important; }
.chart .today-line { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .today-label { font-size: 11px; fill: var(--ink-2); font-weight: 600; }
.chart .mlabel.future { fill: var(--muted); }
.state-tag { font-size: 11px; color: var(--muted); font-weight: 400; }
.year-nav { display: flex; align-items: center; gap: 6px; }
.year-nav strong { min-width: 48px; text-align: center; }

/* Dashboard: kotak kelulusan */
.approval-box { border: 1px solid var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.approval-box h2 { display: flex; align-items: center; gap: 8px; }
.count-pill { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 13px; font-weight: 600; }
.chip.plain { height: 26px; cursor: default; }
.chip.plain:hover { border-color: var(--line); }

/* Pilihan boleh cari (select[data-search]) */
.combo { position: relative; }
.combo .combo-native { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.combo-list { position: absolute; z-index: 30; top: calc(100% + 2px); left: 0; min-width: 100%; width: max-content; max-width: min(420px, 90vw); max-height: 260px; overflow-y: auto; margin: 0; padding: 4px 0; list-style: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow); }
.combo-list li { padding: 7px 12px; font-size: 14px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-list li.active { background: var(--brand-soft); }
.combo-list li.sel { font-weight: 600; }
.combo-list li.none { color: var(--muted); cursor: default; }

/* Suis bahasa BM / EN */
.menu-lang { display: flex; gap: 4px; padding: 6px 10px 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.menu-lang form { margin: 0; }
.menu-panel .menu-lang button { width: auto; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; text-align: center; }
.menu-panel .menu-lang button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.lang-switch { display: flex; gap: 4px; justify-content: center; margin-top: 14px; }
.lang-switch form { margin: 0; }
.lang-switch button { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.lang-switch button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
