/* assets/css/style.css */

:root {
  --bg: #0b1220;
  --card: #111a2e;
  --text: #eaf1ff;
  --muted: rgba(234, 241, 255, .70);
  --line: rgba(255, 255, 255, .10);
  --accent: #32B6FF;
  --danger: #ff4d4f;
  --ok: #22c55e;
  --r: 18px;
  --shadow: 0 14px 34px rgba(0, 0, 0, .35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

/* cegah Android/Chrome membesarkan font otomatis + tema gelap */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background:
    radial-gradient(1200px 500px at 20% -10%, rgba(50, 182, 255, .18), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(34, 197, 94, .10), transparent 60%),
    var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
}

@media (max-width: 768px) {
  .container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 5px;
  }

  .container form {
    width: 100%;
  }
}
/* Biar konten tidak ketutup bottom nav pada semua halaman yang pakai has-bottom-nav */
body.has-bottom-nav .container {
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

.card {
  background: rgba(17, 26, 46, .92);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px;
}

/* =================== TOPBAR =================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 32, .72);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 14px;
}

.brand-title {
  font-weight: 800;
  letter-spacing: .2px;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

.topbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chip {
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .04);
}

/* =================== NAV (PANEL) =================== */
.nav {
  display: flex;
  gap: 10px;
  margin: 12px 0 18px;
}

.navlink {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, .03);
}

.navlink.active {
  color: var(--text);
  border-color: rgba(50, 182, 255, .45);
  background: rgba(50, 182, 255, .10);
}

/* =================== GRID =================== */
.grid {
  display: grid;
  gap: 14px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 840px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.h1 {
  font-size: 20px;
  font-weight: 900;
  margin: 0 0 10px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

/* =================== INPUTS =================== */
.inp,
select,
textarea {
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  outline: none;
  max-width: 100%;
  min-width: 0;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

/* ==== FIX select dropdown biar tidak melebar di Android ==== */
select.inp {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  padding-right: 44px;
  /* ruang arrow */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background-image:
    linear-gradient(45deg, transparent 50%, rgba(234, 241, 255, .7) 50%),
    linear-gradient(135deg, rgba(234, 241, 255, .7) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

/* ==== utilities ==== */
.center {
  text-align: center;
}

.center select.inp,
select.inp.center {
  text-align: center;
  text-align-last: center;
}

/* =================== BUTTONS =================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(50, 182, 255, .35);
  background: rgba(50, 182, 255, .14);
  color: var(--text);
  cursor: pointer;
}

.btn:hover {
  filter: brightness(1.05);
}

.btn-ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
}

.btn-danger {
  border: 1px solid rgba(255, 77, 79, .45);
  background: rgba(255, 77, 79, .14);
}

.btn-ok {
  border: 1px solid rgba(34, 197, 94, .45);
  background: rgba(34, 197, 94, .14);
}

/* ===== FIX UTAMA: seragamkan font tombol (a/button) + rata tengah ===== */
.btn,
a.btn,
button.btn {
  font-size: 11px !important;
  line-height: 1.15 !important;
  font-family: inherit !important;
  font-weight: 600 !important;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  white-space: normal;
  /* supaya teks panjang bisa turun baris, tidak melebar */
}

/* hilangkan style default button di HP */
button.btn {
  -webkit-appearance: none;
  appearance: none;
}

/* rapikan padding tombol di HP (font tetap 11px) */
@media (max-width: 720px) {
  .btn {
    padding: 9px 10px;
    border-radius: 12px;
  }
}

/* =================== ROW / FLEX =================== */
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.row>* {
  flex: 1;
  min-width: 0;
  /* penting agar tidak memaksa melebar */
  max-width: 100%;
}

.row .fit {
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .row {
    gap: 8px;
  }
}

/* =================== TABLES =================== */
.table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 14px;
}

.table th,
.table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.table tr:hover td {
  background: rgba(255, 255, 255, .03);
}

/* =================== BADGE / ALERT =================== */
.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--muted);
}

.badge.ok {
  border-color: rgba(34, 197, 94, .5);
  background: rgba(34, 197, 94, .10);
  color: #b7ffd1;
}

.badge.warn {
  border-color: rgba(255, 193, 7, .45);
  background: rgba(255, 193, 7, .10);
  color: #ffe7a2;
}

.badge.danger {
  border-color: rgba(255, 77, 79, .5);
  background: rgba(255, 77, 79, .10);
  color: #ffd1d1;
}

.alert {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 77, 79, .45);
  background: rgba(255, 77, 79, .12);
  color: #ffd1d1;
  margin: 10px 0;
}

.alert.ok {
  border-color: rgba(34, 197, 94, .45);
  background: rgba(34, 197, 94, .12);
  color: #b7ffd1;
}

.hr {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

/* =================== PUBLIC HEADER & BOTTOM NAV =================== */
.public-top {
  position: sticky;
  top: 0;
  z-index: 25;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 32, .72);
  backdrop-filter: blur(10px);
}

.public-title {
  font-weight: 900;
  letter-spacing: .2px;
}

.public-container {
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-evenly;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  min-height: 64px;
  border-top: 1px solid var(--line);
  background: rgba(11, 18, 32, .92);
}

.bn-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  border-radius: 16px;
  color: rgba(234, 241, 255, .70);
}

.bn-item .bn-ico {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bn-item .bn-ico svg {
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
}

.bn-item.active {
  color: var(--danger);
}

/* =========================================================
   OPSIONAL: kalau kamu memang ingin tombol nav bawah header
   (panel .nav) hilang di SEMUA halaman admin, aktifkan ini.
   ========================================================= */
.nav {
  display: none !important;
}

/* HILANGKAN MENU/TOMBOL DI BAWAH HEADER (panel nav) */
body.has-bottom-nav .nav {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ===== FIX: Dropdown option tidak terlihat (white on white) ===== */
select.inp,
select {
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
}

/* Paksa warna item dropdown (option) agar terbaca (sebagian browser menghormati ini) */
select option,
select optgroup {
  background: #fff !important;
  color: #111 !important;
}

/* Android/Chrome: native dropdown sering pakai warna teks dari <select>.
   Trik: set warna teks <select> jadi hitam (agar option terbaca),
   tapi teks saat tertutup tetap putih via -webkit-text-fill-color. */
@supports (-webkit-text-fill-color: transparent) {

  select.inp,
  select {
    color: #111 !important;
    -webkit-text-fill-color: var(--text) !important;
  }
}

/* Tabel lebar: auto scroll horizontal di HP */
@media (max-width: 720px) {
  .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}

/* =================== UNIFIED FORM THEME (approvals-like) =================== */
body,
input,
select,
textarea,
button {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  line-height: 1.45;
}

body {
  font-size: 14px;
}

img,
svg,
canvas {
  max-width: 100%;
}

.card,
.card-body,
.row,
.grid,
.table-wrap,
.ui-table-host,
.ui-form,
.ui-actions,
.table,
.table th,
.table td,
.badge,
.chip,
.btn,
.h1,
.muted,
.mini,
.muted-mini,
.muted-sm,
.approval-mini,
.approval-row-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.card {
  position: relative;
  overflow: hidden;
}

.card-body {
  padding: 0;
}

.h1 {
  line-height: 1.2;
  letter-spacing: .2px;
}

.muted,
.mini,
.muted-mini,
.muted-sm,
.approval-mini {
  line-height: 1.4;
}

.mini,
.muted-mini,
.muted-sm {
  font-size: 12px;
  color: var(--muted);
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="month"],
input[type="week"],
input[type="file"],
input.inp,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

input[type="file"] {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
}

.ui-form,
.card form {
  width: 100%;
  max-width: 100%;
}

.ui-form .grid,
.ui-form .row,
.card form .grid,
.card form .row {
  align-items: stretch;
}

.ui-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.ui-actions > .btn,
.ui-actions > a.btn,
.ui-actions > button.btn {
  max-width: 100%;
}

.btn,
a.btn,
button.btn {
  min-height: 40px;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
}

.table-wrap,
.ui-table-host,
.pay-table-card,
.bill-table-card,
.paydet-table-card,
.resultWrap,
.impWrap,
.bacWrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.table {
  table-layout: auto;
}

.table th,
.table td {
  line-height: 1.4;
}

.table-sm th,
.table-sm td {
  padding: 9px 8px;
  font-size: 12px;
}

.badge,
.chip {
  line-height: 1.2;
}

@media (max-width: 720px) {
  .card {
    padding: 14px;
    border-radius: 16px;
  }

  .h1 {
    font-size: 19px;
  }

  .muted,
  .mini,
  .muted-mini,
  .muted-sm,
  .approval-mini {
    font-size: 12px;
  }

  .ui-actions > .btn,
  .ui-actions > a.btn,
  .ui-actions > button.btn {
    flex: 1 1 calc(50% - 6px);
  }

  .ui-actions > .btn.fit,
  .ui-actions > a.btn.fit,
  .ui-actions > button.btn.fit {
    flex: 0 0 auto;
  }
}


/* ===== NUMBERING / ORDERED LIST ala approvals ===== */
.card ol,
.card-body ol,
.ui-numbering,
.approval-numbering,
.approval-steps,
.info-numbering {
  counter-reset: uiol;
  list-style: none;
  margin: 0;
  padding: 0;
}

.card ol > li,
.card-body ol > li,
.ui-numbering > li,
.approval-numbering > li,
.approval-steps > li,
.info-numbering > li {
  counter-increment: uiol;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin: 0 0 20px;
  padding: 0;
}

.card ol > li:last-child,
.card-body ol > li:last-child,
.ui-numbering > li:last-child,
.approval-numbering > li:last-child,
.approval-steps > li:last-child,
.info-numbering > li:last-child {
  margin-bottom: 0;
}

.card ol > li::before,
.card-body ol > li::before,
.ui-numbering > li::before,
.approval-numbering > li::before,
.approval-steps > li::before,
.info-numbering > li::before {
  content: counter(uiol) ".";
  display: block;
  min-width: 42px;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: .2px;
  color: #74b6ff;
  text-align: left;
}

.card ol > li > *:first-child,
.card-body ol > li > *:first-child,
.ui-numbering > li > *:first-child,
.approval-numbering > li > *:first-child,
.approval-steps > li > *:first-child,
.info-numbering > li > *:first-child {
  margin-top: 0;
}

.card ol > li > *:last-child,
.card-body ol > li > *:last-child,
.ui-numbering > li > *:last-child,
.approval-numbering > li > *:last-child,
.approval-steps > li > *:last-child,
.info-numbering > li > *:last-child {
  margin-bottom: 0;
}

.card ol > li,
.card ol > li p,
.card-body ol > li,
.card-body ol > li p,
.ui-numbering > li,
.ui-numbering > li p,
.approval-numbering > li,
.approval-numbering > li p,
.approval-steps > li,
.approval-steps > li p,
.info-numbering > li,
.info-numbering > li p {
  line-height: 1.65;
}

@media (max-width: 720px) {
  .card ol > li,
  .card-body ol > li,
  .ui-numbering > li,
  .approval-numbering > li,
  .approval-steps > li,
  .info-numbering > li {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 18px;
  }

  .card ol > li::before,
  .card-body ol > li::before,
  .ui-numbering > li::before,
  .approval-numbering > li::before,
  .approval-steps > li::before,
  .info-numbering > li::before {
    min-width: 34px;
    font-size: 17px;
  }
}


/* ===== UNIFIED DARK SURFACE CARDS ===== */
.ui-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}

.ui-surface-card {
  background: linear-gradient(180deg, rgba(16, 24, 44, .96), rgba(12, 18, 33, .96)) !important;
  border: 1px solid rgba(134, 161, 214, .18) !important;
  border-radius: 18px !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255,255,255,.04) !important;
  color: var(--text) !important;
}

.ui-surface-card .ui-surface-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(234, 241, 255, .72);
  margin-bottom: 8px;
}

.ui-surface-card .ui-surface-note,
.ui-surface-card .ui-surface-muted {
  font-size: 12px;
  line-height: 1.55;
  color: rgba(234, 241, 255, .70) !important;
}

.ui-surface-card .ui-surface-note.is-danger {
  color: #ffb4b6 !important;
}

.ui-surface-card .ui-surface-note.is-info {
  color: #9ec5ff !important;
}

.ui-surface-card .ui-kpi-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
}

.ui-surface-card .ui-kpi-value small,
.ui-surface-card .ui-kpi-value .muted {
  font-size: 14px;
  color: rgba(234, 241, 255, .62) !important;
}

.ui-progress-track {
  margin-top: 8px;
  height: 10px;
  background: rgba(255, 255, 255, .08) !important;
  border-radius: 999px;
  overflow: hidden;
}

.ui-progress-bar {
  height: 10px;
  background: linear-gradient(90deg, rgba(50,182,255,.85), rgba(59,130,246,.95)) !important;
  border-radius: 999px;
}

@media (max-width: 720px) {
  .ui-kpi-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .ui-surface-card {
    border-radius: 16px !important;
  }
}
