/* ASD Green CRM — brand palette sampled from the ASD Green logo pack (same as the PV calculator). */
:root {
  --brand: #1b8a4a;
  --brand-dark: #146b39;
  --brand-soft: #e7f4ec;
  --brand2: #00579d;
  --brand2-dark: #003f73;
  --brand2-soft: #e5eff8;
  --gold: #d9a017;
  --gold-soft: #fbf3dc;
  --danger: #c62828;
  --danger-soft: #fdecea;
  --warn: #b26a00;
  --warn-soft: #fff4e0;
  --bg: #f3f6f8;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #62707e;
  --border: #dde3e8;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 10px;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
}
a { color: var(--brand2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ---------- Layout ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: linear-gradient(170deg, var(--brand2-dark) 0%, var(--brand2) 55%, var(--brand) 100%);
  color: #fff; display: flex; flex-direction: column; transition: transform .2s;
}
.sidebar .logo { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 2px solid var(--gold); }
.sidebar .logo img { width: 42px; height: 42px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }
.sidebar .logo b { display: block; font-size: 16px; letter-spacing: .2px; }
.sidebar .logo span { font-size: 11px; opacity: .8; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 10px 8px 20px; }
.sidebar .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; opacity: .6; padding: 14px 10px 4px; }
.sidebar .grp-toggle {
  display: flex; align-items: center; gap: 5px; width: 100%; background: none; border: 0; cursor: pointer;
  color: #fff; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; opacity: .6; padding: 14px 10px 4px;
}
.sidebar .grp-toggle:hover { opacity: .9; }
.sidebar .grp-toggle .grp-chev { font-size: 9px; width: 10px; }
.sidebar .grp-items { display: flex; flex-direction: column; overflow: hidden; }
.sidebar .grp-items.collapsed { display: none; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: rgba(255,255,255,.88); font-weight: 500; text-decoration: none;
}
.sidebar nav a:hover { background: rgba(255,255,255,.1); }
.sidebar nav a.active { background: rgba(255,255,255,.18); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.sidebar nav a.soon { opacity: .45; cursor: default; }
.sidebar nav a.soon:hover { background: none; }
.sidebar nav a .tag { margin-left: auto; font-size: 10px; background: rgba(255,255,255,.15); padding: 1px 6px; border-radius: 10px; }
.sidebar nav a .count { margin-left: auto; font-size: 11px; background: var(--gold); color: #3a2a00; padding: 0 7px; border-radius: 10px; font-weight: 700; }
.sidebar .me { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.15); font-size: 12px; }
.sidebar .me b { display: block; font-size: 13px; }
.sidebar .me button { background: none; border: 0; color: #fff; opacity: .8; cursor: pointer; padding: 0; margin-right: 10px; text-decoration: underline; }
.sidebar .me .lang-switch { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.sidebar .me .lang-switch button { margin: 0; padding: 3px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,.4); text-decoration: none; opacity: .75; }
.sidebar .me .lang-switch button.on { background: #fff; color: #063b5a; opacity: 1; font-weight: 600; }
.sidebar .me .demo-switch { display: block; margin-bottom: 10px; padding: 8px; border-radius: 8px; background: rgba(180,83,9,.35); border: 1px solid rgba(255,255,255,.25); }
.sidebar .me .demo-switch span { display: block; font-weight: 600; margin-bottom: 4px; }
.sidebar .me .demo-switch select { width: 100%; padding: 5px 6px; border-radius: 6px; border: 0; font: inherit; font-size: 13px; color: #1b2430; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 12px 24px; min-height: 58px;
}
.topbar h1 { font-size: 18px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; }
.content { padding: 20px 24px 60px; flex: 1; }
.backdrop { display: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: block; }
  .topbar { padding: 10px 16px; }
  .content { padding: 16px 16px 60px; }
}

/* ---------- Components ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-h h3 { font-size: 14px; font-weight: 700; }
.card-b { padding: 16px; }
.grid { display: grid; gap: 16px; }
/* Grid children may shrink below their content (wide tables scroll inside their card instead of
   widening the page — on a phone that made the whole page zoom out). */
.grid > *, .detail-grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .detail-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }

.kpi { padding: 14px 16px; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.alert .v { color: var(--danger); }
.kpi.good .v { color: var(--brand); }
a.kpi { display: block; color: inherit; text-decoration: none; }
a.kpi:hover { border-color: var(--brand2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px;
  border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-weight: 600;
  white-space: nowrap; text-decoration: none !important; color: var(--text);
}
.btn:hover { background: #f6f8fa; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.blue { background: var(--brand2); border-color: var(--brand2); color: #fff; }
.btn.wa { background: #1faa53; border-color: #1faa53; color: #fff; }
.btn.danger { color: var(--danger); border-color: #f1c1bd; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: #eef1f4; color: #44525f; white-space: nowrap; }
.b-new { background: var(--brand2-soft); color: var(--brand2); }
.b-contacting { background: var(--gold-soft); color: #7a5600; }
.b-qualified, .b-site_visit { background: #ece8fb; color: #4b3aa8; }
.b-quotation, .b-financing { background: var(--warn-soft); color: var(--warn); }
.b-converted, .b-won, .b-done { background: var(--brand-soft); color: var(--brand-dark); }
.b-lost, .b-junk, .b-cancelled { background: var(--danger-soft); color: var(--danger); }
.b-hot { background: var(--danger-soft); color: var(--danger); }
.b-warm { background: var(--gold-soft); color: #7a5600; }
.b-cold { background: var(--brand2-soft); color: var(--brand2); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { min-width: 220px; flex: 1; max-width: 340px; }
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=number], input[type=date],
input[type=datetime-local], input[type=password], select, textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; min-width: 0;
}
.toolbar select { width: auto; }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(0, 87, 157, .25); border-color: var(--brand2); }
label.f { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.fgrid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .fgrid { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 16px; height: 16px; }

.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); background: #fafbfc; white-space: nowrap; }
table.t th.num { text-align: right; }
table.t td { padding: 10px 12px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f7fafc; }
table.t tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }

/* Mobile: tables become cards */
@media (max-width: 700px) {
  table.t.cards thead { display: none; }
  table.t.cards, table.t.cards tbody, table.t.cards tr, table.t.cards td { display: block; width: 100%; }
  table.t.cards tr { border-bottom: 1px solid var(--border); padding: 8px 4px; }
  table.t.cards td { border: 0; padding: 2px 10px; }
  table.t.cards td[data-l]::before { content: attr(data-l) ': '; color: var(--muted); font-size: 12px; }
  table.t.cards td.hide-m { display: none; }
  table.t.cards td.num { text-align: left; }
}

/* Info list */
dl.info { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; }
dl.info dt { color: var(--muted); font-size: 12.5px; }
dl.info dd { font-weight: 500; word-break: break-word; }
@media (max-width: 500px) { dl.info { grid-template-columns: 1fr; } dl.info dd { margin-bottom: 6px; } }

/* Timeline */
.tl { list-style: none; }
.tl li { position: relative; padding: 0 0 14px 22px; }
.tl li::before { content: ''; position: absolute; left: 5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand2); }
.tl li::after { content: ''; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.tl li:last-child::after { display: none; }
.tl li.t-whatsapp::before { background: #1faa53; }
.tl li.t-call::before { background: var(--gold); }
.tl li.t-status::before, .tl li.t-system::before { background: #9aa6b2; }
.tl .meta { font-size: 12px; color: var(--muted); }
.tl .body { white-space: pre-wrap; word-break: break-word; }

/* Pipeline board */
.board { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: #e9eef2; border-radius: var(--radius); padding: 8px; min-height: 200px; }
.col.drop { outline: 2px dashed var(--brand2); }
.col-h { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 6px 8px; font-weight: 700; font-size: 13px; }
.col-h .sum { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.col[data-stage=won] { background: #e2f1e8; }
.col[data-stage=lost] { background: #f7e6e4; }
.dcard { background: #fff; border-radius: 8px; padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; border-left: 3px solid var(--brand2); }
.dcard:active { cursor: grabbing; }
.dcard b { display: block; font-size: 13px; line-height: 1.3; }
.dcard .v { font-weight: 700; color: var(--brand-dark); margin-top: 4px; font-variant-numeric: tabular-nums; }
.dcard .m { font-size: 12px; color: var(--muted); }

/* Stage stepper */
.stepper { display: flex; gap: 4px; flex-wrap: wrap; }
.stepper button { flex: 1; min-width: 90px; border: 1px solid var(--border); background: #fff; padding: 7px 6px; font-size: 12px; font-weight: 600; cursor: pointer; border-radius: 6px; color: var(--muted); }
.stepper button.done { background: var(--brand-soft); color: var(--brand-dark); border-color: #bfe0cb; }
.stepper button.cur { background: var(--brand2); color: #fff; border-color: var(--brand2); }
.stepper button.lost.cur { background: var(--danger); border-color: var(--danger); }

/* Bars (dashboard) */
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 64px; gap: 10px; align-items: center; font-size: 13px; }
.bar { height: 10px; background: #eef1f4; border-radius: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand2); border-radius: 6px; }
.bar > span.g { background: var(--brand); }

/* Lead-to-Cash strip (dashboard) */
.flow-legend { margin-left: auto; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.flow-legend span { display: inline-flex; align-items: center; gap: 6px; }
.flow-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.flow-scroll { overflow-x: auto; padding: 18px 12px 14px; }
.flow { display: grid; grid-template-columns: repeat(11, minmax(96px, 1fr)); min-width: 1056px; position: relative; }
.flow::before { content: ''; position: absolute; left: 48px; right: 48px; top: 26px; height: 3px; background: #e3e8ee; }
.flow-step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 0 4px; border-radius: 10px; }
.flow-step[data-k] { cursor: pointer; }
.flow-step[data-k]:hover .dot, .flow-step[data-k]:focus-visible .dot { transform: scale(1.08); box-shadow: 0 0 0 5px rgba(0, 87, 157, .12); }
.flow-step:focus-visible { outline: none; }
.flow-step .dot {
  position: relative; width: 54px; height: 54px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 8px; border: 4px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.12); transition: transform .15s, box-shadow .15s;
}
.flow-step .cnt {
  position: absolute; top: -6px; right: -8px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--danger); color: #fff; font-size: 11.5px; line-height: 18px; border: 2px solid #fff;
}
.flow-step b { font-size: 13px; line-height: 1.25; }
.flow-step .sub { font-size: 12px; color: var(--muted); }
.flow-step.soon .dot { opacity: .35; }
.flow-step.soon b { color: var(--muted); font-weight: 600; }

/* Modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 32, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 640px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.sm { max-width: 420px; }
.modal.lg { max-width: 920px; }

/* TNB bills */
.bill-thumb { display: flex; width: 48px; height: 56px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; align-items: center; justify-content: center; background: #f3f6f8; font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none; }
.bill-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bill-review { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 18px; align-items: start; }
.bill-preview { display: flex; align-items: center; justify-content: center; min-height: 180px; border: 1px solid var(--border); border-radius: 8px; background: #f3f6f8; overflow: hidden; }
.bill-preview img { width: 100%; max-height: 70vh; object-fit: contain; display: block; }
@media (max-width: 760px) { .bill-review { grid-template-columns: 1fr; } .bill-preview img { max-height: 40vh; } }
.modal-h { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-h h3 { font-size: 16px; }
.modal-h button { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-b { padding: 18px; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.err { background: var(--danger-soft); color: var(--danger); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; font-weight: 500; }
.note-box { background: var(--gold-soft); border: 1px solid #f0dca5; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 18px; background: #f3f6f8; padding: 10px 14px; border-radius: 8px; letter-spacing: 1px; user-select: all; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; }
#toast div { background: #1c2733; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-weight: 500; }
#toast div.bad { background: var(--danger); }

.loading { padding: 40px; text-align: center; color: var(--muted); }
.page-h { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-h h2 { font-size: 20px; line-height: 1.25; }
.page-h .sub { color: var(--muted); font-size: 13px; }
.page-h .btns { margin-left: auto; }
.back { display: inline-block; margin-bottom: 10px; font-size: 13px; }

/* ---------- Agent portal ---------- */
a.err.block { display: block; text-decoration: none; }
.click-card { cursor: pointer; }
.click-card:hover { border-color: var(--brand2); }
.steps { display: flex; gap: 3px; margin: 8px 0 4px; max-width: 260px; }
.steps i { flex: 1; height: 5px; border-radius: 3px; background: #e3e8ee; }
.steps i.on { background: var(--brand); }
.steps.lost i.on { background: var(--danger); }
#tabbar { display: none; }
@media (max-width: 900px) {
  body.portal .menu-btn { display: none; }
  body.portal .content { padding-bottom: 90px; }
  body.portal #tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #fff;
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  #tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 2px 0; }
  #tabbar a span { font-size: 19px; line-height: 1.2; }
  #tabbar a.active { color: var(--brand2); }
  body.portal .page-h .btns { margin-left: 0; }
  body.portal .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  body.portal .kpi { padding: 12px; }
  body.portal .kpi .v { font-size: 20px; }
}

/* ---------- Phones, tablets, touch (Android, iPhone/iPad, Windows touch) ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: rgba(0, 87, 157, .12); }
a, button, select, label, .click, .click-card, tr.click, [data-go] { touch-action: manipulation; }
body.portal .content { max-width: 1100px; }
.install-card { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.install-card img { width: 40px; height: 40px; border-radius: 10px; }
.install-card div { flex: 1; min-width: 180px; font-size: 13px; }
@media (max-width: 900px) {
  /* iOS Safari zooms into any field under 16px; keep them at 16px on small screens. */
  input[type=text], input[type=search], input[type=email], input[type=tel], input[type=number], input[type=date],
  input[type=datetime-local], input[type=password], select, textarea { font-size: 16px; }
  /* Notch / home-indicator safe areas (iPhone in portrait and landscape, Android cut-outs). */
  .topbar { padding-top: max(10px, env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .content { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  body.portal #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  #tabbar a { min-height: 48px; justify-content: center; }
}
@media (pointer: coarse) {
  /* Finger-sized targets (~44px) on touch screens, whatever the screen width. */
  .btn { min-height: 44px; }
  .btn.sm { min-height: 38px; padding: 6px 12px; }
  .check input { width: 20px; height: 20px; }
  .stepper button { min-height: 40px; }
}
@media (max-width: 600px) {
  /* Forms open as a bottom sheet on phones, with the action buttons always reachable. */
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 94vh; display: flex; flex-direction: column; }
  .modal-b { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .modal-f { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1; }
  .page-h h2 { font-size: 18px; }
}

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, var(--brand2-dark), var(--brand2) 50%, var(--brand)); }
.login { background: #fff; border-radius: 14px; width: 100%; max-width: 380px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.25); border-top: 4px solid var(--gold); }
.login img { width: 70px; display: block; margin: 0 auto 8px; }
.login h1 { text-align: center; font-size: 20px; }
.login p.sub { text-align: center; color: var(--muted); margin-bottom: 18px; font-size: 13px; }
.login .btn { width: 100%; padding: 10px; }

/* ---------- Documents (lead page) ---------- */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; padding: 14px 16px; }
.doc { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 8px; padding: 8px; min-width: 0; }
.doc-thumb { width: 64px; height: 64px; flex: none; border-radius: 6px; overflow: hidden; background: var(--bg); display: flex; align-items: center; justify-content: center; text-decoration: none; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb span { font-size: 12px; font-weight: 700; color: var(--danger); }
.doc-meta { display: grid; gap: 2px; min-width: 0; }
.doc-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Partner portal deal steps (api PARTNER_STAGE) */
.b-open { background: #e8f1f8; color: #00579d; }
.b-asd { background: #fff4e0; color: #7a4a00; }

/* ---------- Projek (migration 020) ---------- */
.pj-bar { height: 8px; background: #eef1f4; border-radius: 6px; overflow: hidden; margin-top: 6px; }
.pj-bar > span { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.pj-chips { flex-wrap: wrap; }
.pj-steps { display: flex; gap: 4px; margin-top: 12px; overflow-x: auto; padding-bottom: 2px; }
.pj-step { flex: 1 0 90px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 11.5px; color: var(--muted); text-decoration: none; }
.pj-step i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); background: #fff; }
.pj-step.pj-done i { background: var(--brand); border-color: var(--brand); }
.pj-step.pj-na i { background: #d5dbe1; border-color: #d5dbe1; }
.pj-step.pj-in_progress i { border-color: var(--gold, #d9a017); background: var(--gold-soft, #fff4d6); }
.pj-step.cur { color: var(--text, #132019); font-weight: 600; }
.pj-step.cur i { box-shadow: 0 0 0 3px rgba(0, 87, 157, .25); }
.pj-tl { list-style: none; margin: 0; padding: 0; }
.pj-ms { position: relative; padding: 10px 0 12px 22px; border-bottom: 1px solid #eef1f4; scroll-margin-top: 70px; }
.pj-ms:last-child { border-bottom: 0; }
.pj-ms::before { content: ''; position: absolute; left: 4px; top: 15px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--border); background: #fff; }
.pj-ms.pj-done::before { background: var(--brand); border-color: var(--brand); }
.pj-ms.pj-na::before { background: #d5dbe1; border-color: #d5dbe1; }
.pj-ms.pj-in_progress::before { border-color: #d9a017; background: #fff4d6; }
.pj-ms.cur { background: linear-gradient(90deg, rgba(0, 87, 157, .05), transparent 60%); }
.pj-ms-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pj-ms-meta { margin-top: 3px; color: var(--muted); }
.pj-ans { margin-top: 6px; font-size: 13px; }
.pj-up { margin-top: 8px; flex-wrap: wrap; }
#pj-sig { width: 100%; max-width: 600px; aspect-ratio: 3 / 1; border: 1px dashed var(--border); border-radius: 8px; background: #fff; touch-action: none; display: block; }
.pj-csec { padding: 10px 0; border-bottom: 1px solid #eef1f4; }
.pj-csec:last-child { border-bottom: 0; }
.pj-csec-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pj-csec-h .ss-prog { margin-left: auto; }
#pj-check { scroll-margin-top: 70px; }
#pj-equip { scroll-margin-top: 70px; }
.pj-eq { margin-bottom: 10px; }
.pj-eqt td { padding: 5px 8px; }
.pj-eqf { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
