/* ============================================================
   Font utama: Poppins (gaya bersih/rounded ala Perfex CRM).
   Open Sans (file lama) tetap ada sebagai fallback/cadangan.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 300;
  src: url("fonts/opensans-light.woff") format("woff");
}
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 400;
  src: url("fonts/opensans.woff") format("woff");
}
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 700;
  src: url("fonts/opensans-bold.woff") format("woff");
}

:root {
  --navy: #5d78ff;       /* topbar/nav — warna aksen utama featured_crm */
  --navy-2: #4c65e0;
  --steel: #3d5fd9;      /* dipakai untuk teks/ikon aksen sekunder — dibikin lebih gelap dari amber biar beda kontras */
  --amber: #6690F4;      /* tombol utama — sama seperti .btn-primary featured_crm */
  --amber-2: #4076f2;    /* hover tombol — sama seperti featured_crm */
  /* BARU: turunan otomatis dari --navy, dipakai untuk background highlight/hover
     (tab aktif, hover baris tabel, dsb) -- supaya warna-warna ini IKUT BERUBAH
     kalau warna brand diganti lewat Pengaturan > Branding, bukan tetap biru. */
  --navy-tint: color-mix(in srgb, var(--navy) 10%, white);
  --bg: #f4f6f9;         /* body background — sedikit lebih gelap dari card biar card kelihatan menonjol */
  --card: #ffffff;
  --ink: #2f3b45;         /* warna teks utama — dipertegas dari #4e5e6a biar lebih gampang dibaca */
  --muted: #6b7885;       /* dipertegas dari #8a97a6 biar label/keterangan tetap terbaca jelas */
  --line: #dfe3e8;        /* border — dipertegas dari #f1f1f5 biar batas antar elemen kelihatan */
  --ok: #0abb87;          /* sukses — sama seperti .btn-success featured_crm */
  --danger: #d9534f;
  --warning: #b5790a;
  font-family: "Poppins", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }

/* ---------- Loading overlay ---------- */
#loadingOverlay {
  display: none; position: fixed; inset: 0; background: rgba(255,255,255,.6);
  z-index: 200; align-items: center; justify-content: center; backdrop-filter: blur(1px);
}
#loadingOverlay.active { display: flex; }
.spinner {
  width: 38px; height: 38px; border: 4px solid var(--line); border-top-color: var(--amber);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* skeleton shimmer buat baris tabel yang lagi loading */
.skeleton-row td {
  background: linear-gradient(90deg, #eef0f3 25%, #f6f7f9 37%, #eef0f3 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; height: 14px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Login screen ---------- */
#loginScreen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
}
.login-card {
  background: var(--card); border-radius: 5px; padding: 48px 40px;
  width: 380px; text-align: center; box-shadow: 0 30px 60px rgba(0,0,0,.25);
}
.login-card .brand-mark {
  width: 44px; height: 44px; margin: 0 auto 18px; border-radius: 5px; overflow: hidden;
  background: var(--amber); display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 20px;
}
.login-card h1 { font-size: 17px; margin: 0 0 4px; letter-spacing: .01em; font-weight: 700; }
.login-card p { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
  border-radius: 4px; padding: 10px 18px; font-size: 14px; font-weight: 600;
  background: var(--amber); color: white; transition: background .15s;
}
.btn:hover { background: var(--amber-2); }
.btn.secondary { background: var(--navy-2); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }

/* ---------- App shell (sidebar layout) ---------- */
#appScreen { display: none; }

.app-shell { display: flex; min-height: 100vh; }

/* ----- Sidebar kiri ----- */
aside.sidebar {
  width: 240px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.sidebar-brand .brand-mark {
  width: 34px; height: 34px; border-radius: 5px; background: var(--amber); overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: #fff;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.sidebar-brand .brand-text { color: var(--ink); font-size: 11px; font-weight: 700; line-height: 1.3; }
.sidebar-brand .brand-text small { display: block; font-weight: 400; color: var(--muted); font-size: 10px; }

nav.tabs { display: flex; flex-direction: column; padding: 12px 10px; gap: 2px; flex: 1; overflow-y: auto; }
.tab-btn {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: none; border: none; border-left: 3px solid transparent; color: var(--muted); padding: 10px 12px; font-size: 13px;
  font-weight: 600; cursor: pointer; border-radius: 0 5px 5px 0; white-space: nowrap;
}
.tab-btn:hover { background: var(--navy-tint); color: var(--amber); }
.tab-btn.active { color: var(--amber); background: var(--navy-tint); border-left-color: var(--amber); }
.tab-btn .tab-icon { width: 16px; text-align: center; font-size: 14px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.tab-btn .tab-icon svg { width: 17px; height: 17px; }
.tab-btn.sub { padding-left: 40px; font-weight: 500; }

/* ----- Grup submenu (Sales, Vendor Management) ----- */
.nav-group-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; border-left: 3px solid transparent; color: var(--muted);
  padding: 10px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
  border-radius: 0 5px 5px 0;
}
.nav-group-toggle:hover { background: var(--navy-tint); color: var(--amber); }
.nav-group-toggle .tab-icon svg { width: 17px; height: 17px; }
.nav-group-toggle .nav-group-label { flex: 1; }
.nav-group-toggle .chevron { width: 14px; flex-shrink: 0; transition: transform .15s; }
.nav-group-toggle .chevron svg { width: 14px; height: 14px; }
.nav-group-toggle.open .chevron { transform: rotate(180deg); }
.nav-group-toggle.open { color: var(--amber); }
.nav-group-items {
  display: none; flex-direction: column; gap: 2px; margin: 2px 0 6px;
}
.nav-group-items.open { display: flex; }

/* Sub-item nav-group muncul kaskade dari atas ke bawah (bukan langsung
   nongol semua) -- berlaku otomatis ke SEMUA menu utama yang punya
   dropdown vertikal (CRM, Project, Sales, Vendor Management, dst) */
@keyframes navSubItemIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.nav-group-items.open .tab-btn.sub { animation: navSubItemIn .22s ease both; }
.nav-group-items.open .tab-btn.sub:nth-child(1) { animation-delay: 0ms; }
.nav-group-items.open .tab-btn.sub:nth-child(2) { animation-delay: 40ms; }
.nav-group-items.open .tab-btn.sub:nth-child(3) { animation-delay: 80ms; }
.nav-group-items.open .tab-btn.sub:nth-child(4) { animation-delay: 120ms; }
.nav-group-items.open .tab-btn.sub:nth-child(5) { animation-delay: 160ms; }
.nav-group-items.open .tab-btn.sub:nth-child(6) { animation-delay: 200ms; }
.nav-group-items.open .tab-btn.sub:nth-child(7) { animation-delay: 240ms; }

.sidebar-footer { padding: 14px 16px; border-top: 1px solid var(--line); }
.sidebar-footer .user { display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--muted); }
.sidebar-footer .user-name { font-weight: 700; color: var(--ink); }
.sidebar-footer .user-actions { display: flex; gap: 6px; }
.sidebar-footer .btn { flex: 1; justify-content: center; padding: 7px 8px; font-size: 12px; }

/* ----- Konten utama ----- */
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
header.topbar {
  background: #fff; border-bottom: 1px solid var(--line); color: var(--ink); padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}

main { max-width: 1180px; width: 100%; margin: 0 auto; padding: 24px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

#statusBar { min-height: 20px; font-size: 13px; color: var(--amber); padding: 0 24px; }

/* Sidebar jadi horizontal-collapse di layar kecil supaya tetap kepakai di HP/tablet */
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  aside.sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; }
  .sidebar-brand { border-bottom: none; border-right: 1px solid rgba(255,255,255,.12); }
  nav.tabs { flex-direction: row; overflow-x: auto; padding: 8px; }
  .sidebar-footer { border-top: none; }
}


/* ---------- Cards / forms (gaya .card featured_crm) ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 5px;
  padding: 15px; margin-bottom: 20px;
  box-shadow: 0px 3px 4px 0px rgba(0, 0, 0, 0.03);
}
.card h2 { font-size: 14px; margin: 0 0 16px; text-transform: uppercase; letter-spacing: .04em; color: var(--steel); font-weight: 700; }

/* ---------- Invoice/PO Preview page (iframe berisi dokumen HTML final) ---------- */
.invoice-preview-wrap {
  background: #eef1f5; border-radius: 10px; padding: 32px 24px; min-height: 400px;
  display: flex; justify-content: center;
}
.invoice-preview-wrap iframe {
  background: #fff; box-shadow: 0 6px 24px rgba(22, 35, 46, 0.14); border-radius: 6px;
  max-width: 900px;
}
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid #e5e5e5; border-radius: 4px;
  font-size: 13px; font-family: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--steel); outline-offset: 1px; }
.field { margin-bottom: 0; }
.field.span-2 { grid-column: span 2; }
.actions { margin-top: 16px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; position: relative; border: 1px solid var(--line); border-radius: 5px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
thead th {
  text-align: left; padding: 10px 12px; background: var(--navy); color: white;
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0;
  white-space: nowrap;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:nth-child(even) { background: #fafbfc; }
tbody tr:hover { background: var(--navy-tint); }

/* Petunjuk visual "geser untuk lihat lebih banyak" khusus layar kecil */
@media (max-width: 720px) {
  .table-wrap { box-shadow: inset -12px 0 8px -10px rgba(0,0,0,.12); }
  .table-wrap::after {
    content: "⇤ geser untuk lihat kolom lainnya ⇥";
    display: block; text-align: center; font-size: 10px; color: var(--muted);
    padding: 4px; background: #fafbfc; border-top: 1px solid var(--line);
  }
  table { font-size: 12px; }
  tbody td, thead th { padding: 8px 10px; }
}

/* ---------- KPI + charts ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: 18px; box-shadow: 0px 3px 4px 0px rgba(0, 0, 0, 0.03); }

/* ---------- Stat card gaya Perfex (dipakai di header Task, dst) ---------- */
.stat-card-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 12px;
}
.stat-card .stat-num { font-size: 26px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.stat-card .stat-label { font-size: 12px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card .stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-card.stat-blue .stat-label { color: var(--amber); }
.stat-card.stat-orange .stat-label { color: #e08b1f; }
.stat-card.stat-green .stat-label { color: var(--ok); }
.stat-card.stat-navy .stat-label { color: var(--navy); }
.stat-card.stat-money .stat-num { font-size: 20px; }

.kpi .num { font-size: 30px; font-weight: 800; color: var(--navy); }
.kpi .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.chart-row .card { padding: 20px; }
.chart-row canvas { max-height: 260px; }

/* ---------- Misc ---------- */
.card h2 small { text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 400; font-size: 12px; }
.btn.small { padding: 6px 12px; font-size: 12px; }
table a { color: var(--steel); font-weight: 600; text-decoration: none; }
table a:hover { text-decoration: underline; }

/* Badge — gaya .badge featured_crm (dipakai kalau nanti perlu status pill) */
.badge {
  display: inline-block; padding: 4px 5px; font-weight: 400; font-size: 85%;
  border-radius: 3px; background: var(--steel); color: #fff;
}
.badge.badge-success { background: var(--ok); }
.badge.badge-warning { background: #ffb822; }
.badge.badge-danger { background: #d9534f; }
.badge.badge-muted { background: var(--muted); }

/* Status pill khusus invoice/PO */
.status-pill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.status-pill.status-paid, .status-pill.status-completed, .status-pill.status-approved, .status-pill.status-active { background: #e5f8f1; color: var(--ok); }
.status-pill.status-not-paid, .status-pill.status-draft, .status-pill.status-inactive { background: #fff4e0; color: #b5790a; }
.status-pill.status-cancelled { background: #fbe9e9; color: #d9534f; }
.status-pill.status-login { background: #e5f8f1; color: var(--ok); }
.status-pill.status-create { background: #e5f8f1; color: var(--ok); }
.status-pill.status-update { background: #fff4e0; color: var(--warning); }
.status-pill.status-delete { background: #fbe9e9; color: var(--danger); }
.status-pill.status-awarded-in-progress { background: #e5f8f1; color: var(--ok); }
.status-pill.status-bidding { background: #fff4e0; color: #b5790a; }
.status-pill.status-won { background: #e5f8f1; color: var(--ok); }
.status-pill.status-lost { background: #fbe9e9; color: #d9534f; }
.status-pill.status-sent, .status-pill.status-negotiation { background: var(--navy-tint); color: var(--navy-2); }

/* ---------- Toolbar list (gaya "+ Add" + pill status count, mirip referensi) ---------- */
.list-toolbar-row {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px; margin-bottom: 16px;
}
.list-toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.filter-chips {
  display: inline-flex; flex-wrap: wrap; gap: 2px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 3px;
}
.filter-chips .chip {
  display: inline-flex; align-items: center; gap: 5px; border: none; background: transparent;
  color: var(--muted); padding: 6px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.filter-chips .chip .chip-count { font-size: 12.5px; font-weight: 700; }
.filter-chips .chip:hover { color: var(--amber); }
.filter-chips .chip.active { background: #fff; color: var(--amber); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* Upload file */
.file-upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-upload-row input[type="file"] { flex: 1; min-width: 200px; }
.upload-progress { font-size: 12px; color: var(--muted); }
.current-file-chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 4px; padding: 4px 10px; font-size: 12px;
}

/* ---------- Tombol aksi bergaya ikon (compact, dipakai di daftar Invoice dst) ---------- */
.icon-action-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer;
  color: var(--muted); margin-right: 3px; vertical-align: middle;
}
.icon-action-btn:hover { border-color: var(--amber); color: var(--amber); background: var(--navy-tint); }
.icon-action-btn svg { width: 15px; height: 15px; }
.icon-btn-chip {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border: 1px solid var(--line); background: var(--bg); border-radius: 6px; font-size: 14px;
  margin-right: 3px; vertical-align: middle; text-decoration: none;
}
.inv-doc-link { color: var(--amber); text-decoration: none; font-weight: 600; }
.inv-doc-link:hover { text-decoration: underline; }

/* Text box dinamis (contenteditable) — Enter = paragraf baru,
   Shift+Enter = ganti baris di dalam paragraf yang sama, persis
   seperti compose email. */
.rich-textbox {
  width: 100%; min-height: 90px; padding: 9px 10px; border: 1px solid #e5e5e5;
  border-radius: 4px; font-size: 13px; font-family: inherit; background: #fff;
  line-height: 1.5; outline: none;
}
.rich-textbox:focus { border-color: var(--amber); }
.rich-textbox p { margin: 0 0 8px; }
.rich-textbox p:last-child { margin-bottom: 0; }
.rich-textbox:empty:before { content: attr(data-placeholder); color: #9aa5b1; }

.qi-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.qi-table th { background: #f4f6f9; padding: 8px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; border-bottom: 2px solid var(--line); }
.qi-table td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.qi-table input { padding: 6px 8px; font-size: 12.5px; }
.qi-table .qi-price-cell { font-weight: 700; white-space: nowrap; text-align: right; padding-right: 10px; }
.qi-remove-btn { background: transparent; border: none; color: #d9534f; cursor: pointer; font-size: 18px; line-height: 1; padding: 4px; }
.qi-remove-btn:hover { color: #b52d3a; }

/* ---------- Search global ---------- */
.global-search-wrap { position: relative; flex: 1; max-width: 360px; margin-right: 16px; }
.global-search-wrap input {
  width: 100%; padding: 8px 12px 8px 32px; border: 1px solid var(--line); border-radius: 5px;
  font-size: 13px; background: var(--bg);
}
.global-search-wrap .search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted);
  display: flex; align-items: center;
}
.global-search-wrap .search-icon svg { width: 15px; height: 15px; display: block; }
.search-results {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff;
  border: 1px solid var(--line); border-radius: 5px; box-shadow: 0 12px 24px rgba(0,0,0,.12);
  max-height: 380px; overflow-y: auto; z-index: 100;
}
.search-results.active { display: block; }
.search-results .sr-group-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  padding: 8px 12px 4px;
}
.search-results .sr-item {
  display: block; width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  padding: 8px 12px; font-size: 13px; color: var(--ink); border-bottom: 1px solid var(--line);
}
.search-results .sr-item:hover { background: var(--bg); }
.search-results .sr-item small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.search-results .sr-empty { padding: 16px 12px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- Notifikasi / alert card di dashboard ---------- */
.alert-card {
  border-radius: 5px; padding: 14px 16px; margin-bottom: 12px; font-size: 13px;
  display: flex; align-items: flex-start; gap: 10px; border: 1px solid transparent;
}
.alert-card.alert-danger { background: #fbe9e9; border-color: #f3c9c8; color: #9b3330; }
.alert-card.alert-warning { background: #fff4e0; border-color: #f5deac; color: var(--warning); }
.alert-card .alert-icon { font-size: 16px; flex-shrink: 0; }
.alert-card .alert-title { font-weight: 700; margin-bottom: 2px; }
.alert-card ul { margin: 4px 0 0; padding-left: 18px; }
.alert-card a { color: inherit; font-weight: 700; text-decoration: underline; }

/* Baris input inline di dalam tabel (gaya Rise: entry langsung selaras kolom) */
tr.input-row { background: #f7f9fc; }
tr.input-row td { padding: 6px 8px; }
tr.input-row input, tr.input-row select {
  width: 100%; padding: 7px 8px; border: 1px solid var(--line); border-radius: 4px;
  font-size: 13px; font-family: inherit; background: #fff;
}
tr.input-row input:focus, tr.input-row select:focus { outline: none; border-color: var(--amber); }

/* ---------- Overview cards (gaya Rise: icon card, progress bar, stat list) ---------- */
.icon-kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.icon-kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: 18px;
  box-shadow: 0px 3px 4px 0px rgba(0, 0, 0, 0.03);
  display: flex; align-items: center; gap: 14px;
}
.icon-kpi .icon-box {
  width: 46px; height: 46px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff;
}
.icon-kpi .icon-box.icon-navy { background: var(--navy); }
.icon-kpi .icon-box.icon-amber { background: var(--amber); }
.icon-kpi .icon-box.icon-ok { background: var(--ok); }
.icon-kpi .icon-box.icon-steel { background: var(--steel); }
.icon-kpi .kpi-text { display: flex; flex-direction: column; }
.icon-kpi .kpi-num { font-size: 26px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.icon-kpi .kpi-lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }

.progress-kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.progress-kpi { background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: 18px; box-shadow: 0px 3px 4px 0px rgba(0, 0, 0, 0.03); }
.progress-kpi .pk-title { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.progress-kpi .pk-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.progress-kpi .pk-pct { font-size: 12px; color: var(--muted); }
.progress-kpi .pk-num { font-size: 24px; font-weight: 800; color: var(--ink); }
.progress-bar-track { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 3px; }
.progress-bar-fill.fill-warning { background: var(--warning); }
.progress-bar-fill.fill-danger { background: var(--danger); }
.progress-bar-fill.fill-ok { background: var(--ok); }

.stat-list-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.stat-list { background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: 18px; box-shadow: 0px 3px 4px 0px rgba(0, 0, 0, 0.03); }
.stat-list .sl-title { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.stat-list .sl-item {
  display: flex; align-items: center; justify-content: space-between; padding: 9px 0;
  border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink);
}
.stat-list .sl-item:last-child { border-bottom: none; }
.stat-list .sl-item .sl-label { display: flex; align-items: center; gap: 8px; }
.stat-list .sl-item .sl-icon { color: var(--muted); font-size: 14px; }
.stat-list .sl-item .sl-value { font-weight: 700; }

@media (max-width: 900px) {
  .icon-kpi-row, .progress-kpi-row, .stat-list-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .icon-kpi-row, .progress-kpi-row, .stat-list-row { grid-template-columns: 1fr; }
}

/* ---------- Toast notification (pengganti alert() browser) ---------- */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; max-width: 380px;
}
.toast {
  background: #fff; border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.15);
  padding: 14px 16px; display: flex; align-items: flex-start; gap: 12px;
  border-left: 4px solid var(--steel);
  animation: toast-in .2s ease-out;
}
.toast.toast-out { animation: toast-out .18s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(24px); } }
.toast.toast-success { border-left-color: var(--ok); }
.toast.toast-error { border-left-color: #e6684c; }
.toast.toast-warning { border-left-color: #f4b740; }
.toast .toast-icon { font-size: 18px; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.toast .toast-body { flex: 1; font-size: 13px; color: var(--ink); line-height: 1.5; white-space: pre-line; }
.toast .toast-close {
  background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px;
  line-height: 1; padding: 0; flex-shrink: 0;
}
.toast .toast-close:hover { color: var(--ink); }

/* ---------- Invoice Overview (gaya Rise, tab Payment) ---------- */
.invoice-overview-grid { display: block; }
.io-row { display: grid; grid-template-columns: 20px 110px 1fr 110px; align-items: center; gap: 10px; padding: 7px 0; }
.io-count { font-weight: 800; font-size: 14px; text-align: right; }
.io-label { font-size: 13px; color: var(--ink); }
.io-bar-track { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.io-bar-fill { display: block; height: 100%; border-radius: 3px; width: 0%; }
.io-amount { font-size: 13px; color: var(--ink); text-align: right; white-space: nowrap; }
.io-summary { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; gap: 32px; }
.io-summary-label { display: block; font-size: 12px; color: var(--muted); }
.io-summary-value { display: block; font-size: 18px; font-weight: 800; color: var(--ink); margin-top: 2px; }
.io-chart { display: flex; flex-direction: column; }
.io-chart-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; }

@media (max-width: 780px) {
  .invoice-overview-grid { grid-template-columns: 1fr; }
  .io-row { grid-template-columns: 18px 90px 1fr 90px; gap: 6px; }
  .io-amount, .io-count { font-size: 12px; }
}

/* ---------- Modal ---------- */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(30,32,45,.5);
  align-items: flex-start; justify-content: center; z-index: 50; padding: 24px;
  overflow-y: auto;
}
.modal-card {
  background: white; border-radius: 5px; padding: 28px; width: 100%; max-width: 720px;
  max-height: calc(100vh - 48px); overflow-y: auto;
  box-shadow: 0 30px 60px rgba(0,0,0,.25);
}
.modal-card h2 { font-size: 17px; margin: 0 0 4px; font-weight: 700; }
.modal-card.modal-wide { max-width: 860px; }
.modal-sub { font-size: 13px; color: var(--muted); margin: 0 0 18px; }

/* Close (X) button dipakai di modal ringkas seperti Atur Kolom */
.modal-x-close {
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: background .15s ease, color .15s ease;
}
.modal-x-close:hover { background: #f0f1f5; color: var(--navy); }

/* Daftar checkbox kolom Manpower — vertikal, tickbox di kiri */
.mp-column-list {
  display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px; margin-top: 4px;
}
.mp-column-list label {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px;
  font-size: 13.5px; color: var(--navy); cursor: pointer; transition: background .15s ease;
}
.mp-column-list label:hover { background: #f5f6fa; }
.mp-column-list input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--amber); flex-shrink: 0; }

/* ---------- Topbar user dropdown ---------- */
.user-menu-wrap { position: relative; margin-left: 14px; }
.user-menu-btn {
  display: flex; align-items: center; gap: 8px; background: none; border: none; cursor: pointer;
  padding: 4px 6px; border-radius: 6px;
}
.user-menu-btn:hover { background: var(--bg); }
.user-menu-avatar {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.avatar-fallback {
  display: flex; align-items: center; justify-content: center; background: var(--amber); color: #fff;
  font-size: 12px; font-weight: 700;
}
.user-menu-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.user-menu-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); right: 0; background: #fff;
  border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 12px 24px rgba(0,0,0,.12);
  min-width: 180px; z-index: 100; overflow: hidden;
}
.user-menu-dropdown.active { display: block; }
.user-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; background: none;
  border: none; cursor: pointer; font-size: 13px; color: var(--ink); text-align: left;
}
.user-menu-item svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.user-menu-item:hover { background: var(--bg); }

/* ---------- Team table avatar cell ---------- */
.team-avatar-cell { display: flex; align-items: center; }
.team-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.team-avatar.avatar-fallback { display: flex; align-items: center; justify-content: center; font-size: 11px; }

/* ---------- Profile modal ---------- */
.profile-header { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.profile-photo-wrap { position: relative; flex-shrink: 0; }
.profile-photo { width: 68px; height: 68px; border-radius: 50%; object-fit: cover; display: block; }
.profile-photo.avatar-fallback { font-size: 22px; }
.profile-photo-edit {
  position: absolute; bottom: -2px; right: -2px; background: var(--amber); color: #fff;
  width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 2px solid #fff;
}
.profile-photo-edit svg { width: 13px; height: 13px; }

.profile-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.profile-tab-btn {
  background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 14px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.profile-tab-btn.active { color: var(--amber); border-bottom-color: var(--amber); }
.profile-tab-panel { display: none; }
.profile-tab-panel.active { display: block; }

/* ---------- Role & Permission matrix ---------- */
.perm-matrix-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.perm-matrix-table th, .perm-matrix-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.perm-matrix-table th:first-child, .perm-matrix-table td:first-child { text-align: left; }
.perm-matrix-table thead th { background: var(--navy); color: #fff; font-size: 11px; text-transform: uppercase; }
.perm-role-group-row td { background: var(--navy-tint); font-weight: 700; padding: 8px 10px; color: var(--navy); }
.perm-matrix-table input[type="checkbox"] { width: 16px; height: 16px; }
.perm-matrix-table .perm-checkall-row { background: var(--bg-soft, #f2f4f7); }
.perm-matrix-table .perm-checkall-row td { border-bottom: 2px solid var(--line); }

.page-title-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* ---------- Horizontal sub-tabs (gaya "General Settings | UI Options | ...") ---------- */
.hsubtabs {
  display: flex; gap: 28px; border-bottom: 1px solid var(--line); margin-bottom: 20px;
  overflow-x: auto;
}
.hsubtab-btn {
  background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 2px;
  font-size: 14px; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.hsubtab-btn.active { color: var(--ink); border-bottom-color: var(--ink); }
.hsubtab-btn:hover:not(.active) { color: var(--amber); }
.hsubtab-panel { display: none; }
.hsubtab-panel.active { display: block; }

/* ---------- Password reveal input ---------- */
.password-reveal-wrap { position: relative; }
.password-reveal-wrap input { padding-right: 38px; }
.password-reveal-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none;
  cursor: pointer; color: var(--muted); padding: 4px;
}
.password-reveal-toggle svg { width: 16px; height: 16px; display: block; }

.credential-confirm-box {
  background: #e5f8f1; border: 1px solid #b6ead6; border-radius: 6px; padding: 14px 16px;
  margin-bottom: 16px; font-size: 13px;
}
.credential-confirm-box strong { font-family: monospace; font-size: 14px; }
.credential-confirm-box .cc-close { float: right; background: none; border: none; cursor: pointer; color: var(--muted); }

/* ---------- Roles chips list ---------- */
.role-chip-row {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid var(--line); gap: 10px; flex-wrap: wrap;
}
.role-chip-row:last-child { border-bottom: none; }
.role-chip-name { font-weight: 700; font-size: 13.5px; }
.role-chip-count { font-size: 11.5px; color: var(--muted); margin-left: 8px; }
.role-chip-actions { display: flex; gap: 6px; }

/* ---------- Access Permissions: layout 2 kolom (gaya Role list kiri + checklist kanan) ---------- */
.roles-perm-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; margin-top: 14px; align-items: start; }
.roles-perm-list { display: flex; flex-direction: column; gap: 4px; }
.roles-perm-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-radius: 6px; cursor: pointer; border: 1px solid var(--line);
  background: #fff; font-size: 13.5px; font-weight: 600; color: var(--ink);
}
.roles-perm-item:hover { border-color: var(--amber); }
.roles-perm-item.active { background: var(--amber); border-color: var(--amber); color: #fff; }
.roles-perm-item .rp-count { font-size: 11px; font-weight: 400; opacity: .8; }
.roles-perm-item .rp-icons { display: flex; gap: 4px; }
.roles-perm-item .rp-icon-btn {
  background: rgba(255,255,255,.25); border: none; border-radius: 4px; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: inherit; flex-shrink: 0;
}
.roles-perm-item:not(.active) .rp-icon-btn { background: var(--bg); color: var(--muted); }
.roles-perm-item .rp-icon-btn svg { width: 12px; height: 12px; }
.roles-perm-add-btn {
  margin-top: 6px; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 6px; background: none;
  cursor: pointer; font-size: 13px; color: var(--muted); text-align: left;
}
.roles-perm-add-btn:hover { border-color: var(--amber); color: var(--amber); }

.roles-perm-detail-title { font-size: 15px; font-weight: 700; margin: 0 0 16px; }
.perm-module-group { margin-bottom: 18px; }
.perm-module-group-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--navy); font-weight: 700;
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.perm-check-line {
  display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13.5px; color: var(--ink);
}
.perm-check-line input[type="checkbox"] { width: 17px; height: 17px; flex-shrink: 0; }
.perm-check-line label { cursor: pointer; }
.perm-check-line.disabled label { color: var(--muted); cursor: default; }

/* ---------- Custom Searchable Dropdown (pengganti <select> polos, dipasang otomatis lewat fillProjectSelect) ---------- */
.custom-select-wrap { position: relative; width: 100%; }
.custom-select-trigger {
  width: 100%; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff;
  text-align: left; display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-family: inherit; font-weight: 600; cursor: pointer; color: var(--ink);
}
.custom-select-trigger .cs-filter-icon { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
.custom-select-trigger .cs-trigger-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custom-select-trigger:hover { border-color: var(--amber); }
.custom-select-trigger.active { border-color: var(--amber); }
.custom-select-trigger .cs-chevron { width: 12px; height: 12px; color: var(--muted); flex-shrink: 0; transition: transform .15s; }
.custom-select-trigger.active .cs-chevron { transform: rotate(180deg); }

.custom-select-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff;
  border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 12px 28px rgba(0,0,0,.14);
  z-index: 80; overflow: hidden; min-width: 220px;
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98); transform-origin: top center;
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.custom-select-dropdown.active { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.custom-select-search {
  width: 100%; border: none; border-bottom: 1px solid var(--line); padding: 10px 14px;
  font-size: 13px; font-family: inherit; outline: none; box-sizing: border-box;
}
.custom-select-options { max-height: 260px; overflow-y: auto; }
.custom-select-option { padding: 10px 14px; font-size: 13px; cursor: pointer; color: var(--ink); }
.custom-select-option:hover { background: var(--bg); }
.custom-select-option.selected { background: var(--amber); color: #fff; font-weight: 600; }
.custom-select-empty { padding: 16px 14px; text-align: center; color: var(--muted); font-size: 12.5px; }
.custom-select-option.multi { display: flex; align-items: center; gap: 8px; }
.custom-select-option.multi input[type="checkbox"] { width: 15px; height: 15px; flex-shrink: 0; pointer-events: none; }
.custom-select-option.multi.selected { background: var(--navy-tint); color: var(--amber); font-weight: 600; }

/* ---------- Attendance: overlay konfirmasi scan (cooldown ~1 detik) ---------- */
.att-scan-overlay {
  display: none; position: absolute; inset: 0; background: rgba(10, 187, 135, .85);
  align-items: center; justify-content: center; z-index: 10;
  color: #fff; font-size: 16px; font-weight: 700;
}

/* Aktivitas Terbaru: entry baru highlight sebentar, fade 5 detik */
.att-activity-row {
  background-color: transparent;
  transition: background-color 5s ease;
  border-radius: 4px; padding-left: 6px; padding-right: 6px;
}
.att-activity-row.att-activity-new {
  background-color: #e5f8f1;
  transition: none;
}

@media (max-width: 780px) {
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal-card { max-width: 100%; max-height: 100vh; height: 100%; border-radius: 0; }
}

@media (max-width: 720px) {
  .grid, .grid.cols-3, .chart-row, .kpi-row { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: span 1; }
}