:root {
      --primary: #04CCCC;
      --secondary: #6F7BF7;
      --dark: #10131A;
      --bg: #EEF1F6;
      --mint: #D3EED9;
      --mint-strong: #C3E7CC;
      --surface: #FFFFFF;
      --soft: #F7F9F7;
      --line: #E8ECE8;
      --muted: #7B837D;
      --success: #17A966;
      --warning: #F2A51A;
      --danger: #E94747;
      --shadow: 0 18px 44px rgba(40, 73, 48, .12);
    }

    * { box-sizing: border-box; }
    html { scroll-behavior: smooth; background: var(--bg); }
    body {
      margin: 0;
      min-height: 100dvh;
      color: var(--dark);
      background: var(--bg);
      font-family: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      -webkit-font-smoothing: antialiased;
      overflow-x: hidden;
    }
    button, input, select, textarea { font: inherit; }
    button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
    a { color: inherit; }
    .hidden { display: none !important; }
    .desktop-only { display: block; }
    .mobile-only { display: none; }
    .stack { display: grid; gap: 14px; }
    .center { text-align: center; }

    .app {
      position: relative;
      width: min(100%, 440px);
      min-height: 100dvh;
      margin: 0 auto;
      padding: 0 15px 104px;
      overflow: hidden;
      background:
        radial-gradient(circle at 86% 7%, rgba(255,255,255,.6), transparent 14rem),
        linear-gradient(180deg, #DDF2E2 0%, #EAF5EC 36%, #F8FAF8 100%);
    }

    .app::before {
      content: '';
      position: absolute;
      top: 10px;
      left: 50%;
      width: 54px;
      height: 6px;
      border-radius: 999px;
      background: rgba(33, 72, 45, .10);
      transform: translateX(-50%);
      pointer-events: none;
    }

    .topbar {
      position: relative;
      z-index: 30;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      min-height: 84px;
      padding: 26px 4px 12px;
      color: var(--dark);
      background: transparent;
    }
    .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
    .brand-icon {
      width: 40px;
      height: 40px;
      flex: 0 0 40px;
      display: grid;
      place-items: center;
      overflow: hidden;
      border: 2px solid rgba(255,255,255,.9);
      border-radius: 50%;
      color: #fff;
      background: linear-gradient(145deg, var(--primary), var(--secondary));
      box-shadow: 0 7px 18px rgba(54, 94, 65, .16);
      font-size: 13px;
      font-weight: 900;
    }
    .brand-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .brand-name { margin: 0; font-size: 12px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .brand-tagline { margin: 2px 0 0; color: #657069; font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .top-actions { display: flex; align-items: center; gap: 7px; }
    .icon-btn, .top-btn {
      min-height: 38px;
      border: 1px solid rgba(83, 118, 92, .12);
      color: var(--dark);
      background: rgba(255,255,255,.52);
      cursor: pointer;
      box-shadow: 0 8px 18px rgba(60, 91, 68, .06);
    }
    .icon-btn { width: 38px; border-radius: 50%; font-weight: 900; }
    .top-btn { padding: 0 12px; border-radius: 13px; font-size: 9px; font-weight: 900; }
    .icon-btn:hover, .top-btn:hover { background: #fff; transform: translateY(-1px); }

    .page { position: relative; z-index: 2; margin-top: 2px; }
    .customer-grid { display: grid; gap: 14px; }
    .card {
      border: 1px solid rgba(255,255,255,.92);
      border-radius: 24px;
      background: rgba(255,255,255,.96);
      box-shadow: var(--shadow);
    }
    .card-pad { padding: 18px; }

    .wallet-card {
      position: relative;
      overflow: hidden;
      min-height: 270px;
      padding: 20px;
      color: var(--dark);
      border: 1px solid rgba(255,255,255,.86);
      border-radius: 25px;
      background: linear-gradient(145deg, rgba(198,233,207,.96), rgba(223,244,228,.98));
      box-shadow: 0 22px 45px rgba(62, 104, 73, .13);
    }
    .wallet-card::before {
      content: '';
      position: absolute;
      width: 210px;
      height: 210px;
      right: -105px;
      top: -90px;
      border-radius: 50%;
      background: rgba(255,255,255,.30);
    }
    .wallet-card::after {
      content: '▥';
      position: absolute;
      right: 19px;
      top: 19px;
      width: 38px;
      height: 38px;
      display: grid;
      place-items: center;
      border-radius: 14px;
      color: var(--primary);
      background: rgba(255,255,255,.65);
      font-size: 17px;
      font-weight: 900;
    }
    .wallet-content { position: relative; z-index: 2; min-height: 228px; display: flex; flex-direction: column; }
    .eyebrow { margin: 0; color: #6C756F; font-size: 8px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
    .wallet-title { margin: 13px 0 0; max-width: 300px; font-size: 27px; line-height: 1.08; letter-spacing: -.045em; }
    .wallet-text { margin: 10px 0 0; max-width: 310px; color: #5F6862; font-size: 10px; line-height: 1.65; }
    .search-box {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
      margin-top: auto;
      padding: 8px;
      border: 1px solid rgba(255,255,255,.9);
      border-radius: 18px;
      background: rgba(255,255,255,.72);
      box-shadow: 0 13px 26px rgba(61, 96, 70, .10);
    }
    .search-box input {
      min-width: 0;
      height: 44px;
      padding: 0 13px;
      border: 1px solid var(--line);
      border-radius: 13px;
      outline: 0;
      color: var(--dark);
      background: #fff;
      font-size: 10px;
      font-weight: 800;
      text-transform: uppercase;
    }
    .search-box input::placeholder { color: #A0A7A2; text-transform: none; }
    .search-box button {
      width: 100%;
      height: 44px;
      border: 0;
      border-radius: 13px;
      color: #fff;
      background: linear-gradient(135deg, var(--primary), var(--secondary));
      box-shadow: 0 11px 22px rgba(255,107,34,.22);
      cursor: pointer;
      font-size: 10px;
      font-weight: 900;
    }

    .quick-card { padding: 17px; box-shadow: 0 15px 35px rgba(53, 83, 60, .08); }
    .section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
    .section-title { margin: 0; font-size: 12px; font-weight: 900; letter-spacing: -.02em; }
    .section-sub { margin: 3px 0 0; color: var(--muted); font-size: 8px; line-height: 1.5; }
    .quick-list { display: grid; gap: 8px; }
    .quick-item {
      display: grid;
      grid-template-columns: 38px 1fr auto;
      align-items: center;
      gap: 10px;
      min-height: 60px;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 17px;
      background: #FBFCFB;
    }
    .quick-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; color: var(--primary); background: #FFF0E7; font-size: 16px; }
    .quick-item strong { display: block; font-size: 10px; }
    .quick-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
    .quick-arrow { color: var(--primary); font-weight: 900; }

    .invoice-shell {
      width: 100%;
      padding: 0;
      overflow: hidden;
      border-radius: 26px;
      background: var(--mint);
      box-shadow: 0 24px 60px rgba(51, 94, 63, .16);
    }
    .invoice-head {
      padding: 18px 17px 12px;
      color: var(--dark);
      background: linear-gradient(180deg, #D1EDD8, #DDF3E2);
    }
    .invoice-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .back-btn {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      min-height: 36px;
      padding: 0 10px;
      border: 0;
      border-radius: 12px;
      color: var(--dark);
      background: rgba(255,255,255,.22);
      cursor: pointer;
      font-size: 9px;
      font-weight: 900;
    }
    .invoice-number { margin: 14px 0 0; font-size: 21px; line-height: 1.1; letter-spacing: -.035em; word-break: break-word; }
    .invoice-date { margin: 7px 0 0; color: #66716A; font-size: 8px; line-height: 1.5; }
    .amount-panel {
      margin: 14px 0 -45px;
      padding: 15px;
      border: 1px solid rgba(255,255,255,.92);
      border-radius: 20px;
      color: var(--dark);
      background: rgba(255,255,255,.92);
      box-shadow: 0 16px 34px rgba(47, 86, 58, .12);
    }
    .amount-label { margin: 0; color: var(--muted); font-size: 8px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
    .amount-value { margin: 6px 0 0; font-size: 28px; letter-spacing: -.045em; }
    .amount-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
    .pill { display: inline-flex; align-items: center; gap: 5px; min-height: 25px; padding: 0 9px; border-radius: 999px; font-size: 8px; font-weight: 900; }
    .pill-light { color: #6A4A35; background: #FFF0E7; }
    .status-paid { color: #087A49; background: #E8FAF1; }
    .status-pending { color: #C55A16; border: 1px solid #F2A36F; background: #FFF9F4; }
    .status-validation { color: #8A5B00; background: #FFF3CF; }
    .status-dp { color: #1B62A8; background: #EAF4FF; }
    .status-expired { color: #B42331; background: #FFECEF; }

    .invoice-body { padding: 62px 13px 14px; background: #fff; }
    .progress-card { padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: #FBFCFB; }
    .progress-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
    .progress-top strong { font-size: 10px; }
    .progress-top span { color: var(--muted); font-size: 9px; font-weight: 900; }
    .progress-track { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; margin-top: 10px; }
    .progress-track i { height: 3px; border-radius: 999px; background: #E4E9E5; }
    .progress-track i.active { background: var(--primary); }
    .progress-track i.success { background: var(--success); }

    .invoice-content { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
    .section-card { padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
    .service-list { display: grid; gap: 8px; margin-top: 10px; }
    .service-row { display: grid; grid-template-columns: 42px 1fr auto; gap: 9px; align-items: center; padding: 9px; border-radius: 15px; background: #F8FAF8; }
    .service-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: var(--primary); background: #FFF0E7; font-size: 16px; }
    .service-row h4 { margin: 0; font-size: 9px; }
    .service-row p { margin: 3px 0 0; color: var(--muted); font-size: 7.5px; line-height: 1.4; }
    .service-price { font-size: 9px; font-weight: 900; white-space: nowrap; }
    .detail-list { display: grid; gap: 10px; margin-top: 10px; }
    .detail-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 9px; border-bottom: 1px dashed #D9DFDA; }
    .detail-row:last-child { padding-bottom: 0; border-bottom: 0; }
    .detail-row span { color: var(--muted); font-size: 8px; }
    .detail-row strong { max-width: 66%; text-align: right; font-size: 8.5px; word-break: break-word; }
    .timeline { display: grid; gap: 0; margin-top: 10px; }
    .timeline-row { display: grid; grid-template-columns: 24px 1fr; gap: 8px; min-height: 52px; }
    .timeline-dot-wrap { position: relative; display: flex; justify-content: center; }
    .timeline-dot-wrap::after { content: ''; position: absolute; top: 20px; bottom: -4px; width: 2px; background: #E2E8E3; }
    .timeline-row:last-child .timeline-dot-wrap::after { display: none; }
    .timeline-dot { position: relative; z-index: 2; width: 17px; height: 17px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #D7DDD8; font-size: 8px; }
    .timeline-row.active .timeline-dot { background: var(--success); }
    .timeline-row.current .timeline-dot { background: var(--primary); }
    .timeline-row h5 { margin: 1px 0 0; font-size: 8.5px; }
    .timeline-row p { margin: 3px 0 0; color: var(--muted); font-size: 7.5px; line-height: 1.4; }

    .total-strip {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-top: 12px;
      padding: 13px 14px;
      border-radius: 15px;
      color: var(--dark);
      background: #FFF3EA;
      border: 1px solid #FFE2D1;
    }
    .total-strip span { color: #846A5A; font-size: 8px; }
    .total-strip strong { font-size: 16px; }
    .action-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 10px; }
    .btn {
      min-height: 45px;
      padding: 0 14px;
      border: 0;
      border-radius: 13px;
      cursor: pointer;
      font-size: 9px;
      font-weight: 900;
      transition: .18s ease;
    }
    .btn:hover { transform: translateY(-1px); filter: brightness(.98); }
    .btn-primary { color: #fff; background: linear-gradient(135deg, var(--primary), var(--secondary)); box-shadow: 0 11px 22px rgba(255,107,34,.20); }
    .btn-dark { color: #fff; background: #171A18; }
    .btn-soft { color: var(--dark); background: #F0F3F0; }
    .btn-success { color: #fff; background: var(--success); }
    .btn-danger { color: #fff; background: var(--danger); }
    .btn-outline { color: #C95E1D; border: 1px solid #FFD7BF; background: #FFF7F1; }
    .btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

    .footer { margin-top: 14px; padding: 12px; color: var(--muted); text-align: center; font-size: 8px; }

    .admin-page { display: grid; gap: 13px; }
    .admin-login { max-width: 390px; margin: 22px auto 0; padding: 21px; }
    .admin-logo { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto; overflow: hidden; border-radius: 50%; color: #fff; background: linear-gradient(135deg, var(--primary), var(--secondary)); font-size: 20px; font-weight: 900; }
    .admin-logo img { width: 100%; height: 100%; object-fit: cover; }
    .field-label { display: block; margin-bottom: 6px; color: #657069; font-size: 8px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
    .field {
      width: 100%;
      min-height: 45px;
      padding: 0 12px;
      border: 1px solid var(--line);
      border-radius: 13px;
      outline: 0;
      color: var(--dark);
      background: #FAFBFA;
      font-size: 9px;
    }
    textarea.field { min-height: 92px; padding-top: 12px; resize: vertical; }
    .field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,107,34,.10); }
    .form-grid { display: grid; grid-template-columns: 1fr; gap: 11px; }
    .span-2 { grid-column: auto; }
    .stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
    .stat-card { padding: 14px; background: rgba(255,255,255,.96); }
    .stat-card:first-child { grid-column: 1 / -1; background: linear-gradient(145deg, #CBEAD3, #E3F4E7); }
    .stat-card span { color: var(--muted); font-size: 8px; font-weight: 800; }
    .stat-card strong { display: block; margin-top: 7px; font-size: 19px; letter-spacing: -.03em; }
    .admin-head {
      display: grid;
      gap: 14px;
      padding: 17px;
      background: linear-gradient(145deg, #CDEBD5, #E0F3E5);
    }
    .admin-tools { display: grid; grid-template-columns: repeat(2,1fr); gap: 7px; }
    .table-card { padding: 14px; }
    .filter-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 10px; }
    .filter-row .field { min-width: 0; }
    .admin-list { display: grid; gap: 8px; }
    .admin-invoice {
      display: grid;
      grid-template-columns: 1fr auto;
      align-items: center;
      gap: 8px 10px;
      padding: 11px;
      border: 1px solid var(--line);
      border-radius: 16px;
      background: #FBFCFB;
    }
    .admin-invoice h4 { margin: 0; font-size: 9px; }
    .admin-invoice p { margin: 3px 0 0; color: var(--muted); font-size: 7.5px; }
    .admin-invoice > div:nth-child(3), .admin-invoice > div:nth-child(4) { text-align: right; }
    .admin-actions { grid-column: 1 / -1; display: flex; justify-content: flex-start; gap: 5px; flex-wrap: wrap; }
    .mini-btn { min-height: 32px; padding: 0 9px; border: 0; border-radius: 10px; cursor: pointer; font-size: 8px; font-weight: 900; }

    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 90;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      padding: 0;
      background: rgba(24, 37, 28, .56);
      backdrop-filter: blur(9px);
    }
    .modal {
      width: min(440px, 100%);
      max-height: 92dvh;
      overflow: auto;
      border-radius: 28px 28px 0 0;
      background: #fff;
      box-shadow: 0 -20px 60px rgba(21, 45, 28, .22);
    }
    .modal-wide { width: min(760px, 100%); }
    .modal-head {
      position: sticky;
      top: 0;
      z-index: 4;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 13px;
      padding: 16px 17px;
      border-bottom: 1px solid var(--line);
      background: rgba(255,255,255,.97);
      backdrop-filter: blur(15px);
    }
    .modal-title { margin: 0; font-size: 12px; }
    .modal-close { width: 36px; height: 36px; border: 0; border-radius: 12px; color: var(--dark); background: #F0F3F0; cursor: pointer; font-size: 17px; }
    .modal-body { padding: 17px; }
    .modal-foot { display: flex; gap: 8px; padding: 0 17px calc(17px + env(safe-area-inset-bottom)); }
    .modal-foot .btn { flex: 1; }
    .qr-frame { width: min(240px, 100%); aspect-ratio: 1; display: grid; place-items: center; margin: 0 auto; overflow: hidden; border: 8px solid #F3F6F3; border-radius: 21px; background: #fff; }
    .qr-frame img { width: 100%; height: 100%; object-fit: contain; }
    .snap-bootstrap-host {
      position: fixed;
      left: -10000px;
      top: 0;
      z-index: -1;
      width: 430px;
      height: 760px;
      overflow: hidden;
      opacity: .001;
      pointer-events: none;
      background: #fff;
    }
    .snap-bootstrap-host:empty { display: none; }
    .snap-bootstrap-host iframe {
      width: 430px !important;
      min-height: 720px !important;
      border: 0 !important;
    }

    /* Modal QRIS memakai struktur modal standar: nominal, gambar QR, timer, dan aksi. */
    .qr-frame.snap-embed-frame {
      position: relative;
      width: min(310px, calc(100vw - 44px));
      height: min(310px, calc(100vw - 44px));
      min-height: 0;
      aspect-ratio: auto;
      padding: 0;
      border: 0;
      border-radius: 22px;
      overflow: hidden;
      background: #fff;
      box-shadow: 0 14px 34px rgba(18, 43, 84, .12);
    }
    .qr-frame.snap-embed-frame #snapContainer {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      background: #fff;
    }
    .qr-frame.snap-embed-frame iframe {
      position: absolute !important;
      left: 50% !important;
      top: -174px !important;
      width: 430px !important;
      max-width: none !important;
      height: 720px !important;
      min-height: 720px !important;
      border: 0 !important;
      transform: translateX(-50%) scale(.82) !important;
      transform-origin: top center !important;
      background: #fff !important;
    }
    .qr-frame.snap-embed-frame::before,
    .qr-frame.snap-embed-frame::after {
      content: '';
      position: absolute;
      left: 0;
      right: 0;
      z-index: 4;
      pointer-events: none;
      background: #fff;
    }
    .qr-frame.snap-embed-frame::before { top: 0; height: 6px; }
    .qr-frame.snap-embed-frame::after { bottom: 0; height: 8px; }
    @media (max-width: 420px) {
      .qr-frame.snap-embed-frame {
        width: min(300px, calc(100vw - 40px));
        height: min(300px, calc(100vw - 40px));
        min-height: 0;
      }
      .qr-frame.snap-embed-frame iframe {
        top: -178px !important;
        width: 440px !important;
        transform: translateX(-50%) scale(.78) !important;
      }
    }
    .qr-timer { margin-top: 11px; color: var(--muted); text-align: center; font-size: 8px; }
    .qris-breakdown {
      display: grid;
      gap: 8px;
      margin: -5px auto 16px;
      padding: 12px 14px;
      border: 1px solid var(--line);
      border-radius: 14px;
      background: #F8FAFD;
      text-align: left;
    }
    .qris-breakdown-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 9px; }
    .qris-breakdown-row span { color: var(--muted); }
    .qris-breakdown-row strong { color: var(--dark); font-size: 9px; }
    .qris-fee-note { margin: 8px 0 0; color: var(--muted); text-align: center; font-size: 8px; line-height: 1.5; }
    .account-list { display: grid; gap: 9px; }
    .account-card { display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 16px; background: #F8FAF8; }
    .bank-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(135deg, var(--primary), var(--secondary)); font-size: 10px; font-weight: 900; }
    .account-card h4 { margin: 0; font-size: 9px; }
    .account-card p { margin: 3px 0 0; color: var(--muted); font-size: 8px; }
    .account-number { margin-top: 4px !important; color: var(--dark) !important; font-size: 11px !important; font-weight: 900; letter-spacing: .05em; }
    .copy-btn { grid-column: 1 / -1; min-height: 39px; padding: 0 10px; border: 0; border-radius: 11px; color: #fff; background: var(--primary); cursor: pointer; font-size: 8px; font-weight: 900; }
    .setting-section { padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: #FBFCFB; }
    .setting-section + .setting-section { margin-top: 11px; }
    .setting-section h4 { margin: 0 0 11px; font-size: 10px; }
    .logo-preview { width: 65px; height: 65px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; color: #fff; background: linear-gradient(135deg, var(--primary), var(--secondary)); font-weight: 900; }
    .logo-preview img { width: 100%; height: 100%; object-fit: cover; }
    .static-qris-preview { background: #fff; color: var(--muted); border: 1px solid var(--line); }
    .static-qris-preview img { object-fit: contain; background: #fff; padding: 4px; }
    .upload-row { display: flex; align-items: flex-start; gap: 11px; }
    .upload-row .field-wrap { flex: 1; }
    .color-field { display: grid; grid-template-columns: 45px 1fr; gap: 7px; }
    .color-field input[type=color] { width: 45px; min-height: 45px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
    .share-caption { white-space: pre-wrap; min-height: 125px !important; }
    .empty-state { padding: 26px 16px; color: var(--muted); text-align: center; font-size: 9px; }

    .share-success {
      position: relative;
      margin: 0 0 15px;
      padding: 18px 14px;
      text-align: center;
      border-radius: 18px;
      background: linear-gradient(180deg, #F2FBF4, #FFFFFF);
      border: 1px solid #E2EEE5;
    }
    .receipt-icon { width: 44px; height: 44px; display: grid; place-items: center; margin: 0 auto; border-radius: 15px; color: var(--primary); background: #FFF0E7; font-size: 20px; }
    .share-success h4 { margin: 11px 0 0; font-size: 15px; }
    .share-success p { margin: 5px 0 0; color: var(--muted); font-size: 8px; }
    .share-total { margin-top: 11px; font-size: 22px; font-weight: 900; }
    .share-customer { margin-top: 12px; padding: 11px; border-radius: 14px; background: #F7F9F7; text-align: left; }
    .share-customer span { display: block; color: var(--muted); font-size: 7px; text-transform: uppercase; letter-spacing: .06em; }
    .share-customer strong { display: block; margin-top: 4px; font-size: 9px; }
    .barcode { height: 42px; margin-top: 14px; border-radius: 4px; background: repeating-linear-gradient(90deg, #101411 0 3px, transparent 3px 5px, #101411 5px 7px, transparent 7px 10px); }

    .bottom-nav {
      position: fixed;
      left: 50%;
      bottom: calc(10px + env(safe-area-inset-bottom));
      z-index: 70;
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 4px;
      width: min(380px, calc(100% - 30px));
      padding: 6px;
      border: 1px solid rgba(255,255,255,.92);
      border-radius: 19px;
      background: rgba(255,255,255,.92);
      box-shadow: 0 16px 38px rgba(48, 84, 58, .15);
      backdrop-filter: blur(16px);
      transform: translateX(-50%);
    }
    .bottom-nav button { min-height: 43px; border: 0; border-radius: 13px; color: #858D87; background: transparent; cursor: pointer; font-size: 8px; font-weight: 900; line-height: 1.45; }
    .bottom-nav button.active { color: #fff; background: #151815; }

    .toast {
      position: fixed;
      left: 50%;
      bottom: calc(74px + env(safe-area-inset-bottom));
      z-index: 120;
      max-width: min(390px, calc(100% - 28px));
      padding: 11px 14px;
      border-radius: 13px;
      color: #fff;
      background: #171A18;
      box-shadow: 0 14px 34px rgba(0,0,0,.22);
      transform: translateX(-50%);
      font-size: 8px;
      font-weight: 800;
    }
    .toast.error { background: var(--danger); }

    .app-alert-backdrop {
      position: fixed;
      inset: 0;
      z-index: 220;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
      background: rgba(9, 17, 31, .58);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }
    .app-alert-card {
      width: min(380px, 100%);
      padding: 24px 20px 18px;
      border: 1px solid rgba(255,255,255,.72);
      border-radius: 25px;
      background: #FFFFFF;
      box-shadow: 0 28px 80px rgba(8, 18, 35, .30);
      text-align: center;
      animation: alertPop .18s ease-out;
    }
    .app-alert-icon {
      width: 64px;
      height: 64px;
      display: grid;
      place-items: center;
      margin: 0 auto 14px;
      border-radius: 22px;
      font-size: 29px;
      font-weight: 900;
      color: #04CCCC;
      background: #EAF2FF;
    }
    .app-alert-icon.success { color: #0B9C5A; background: #E8F8F0; }
    .app-alert-icon.error { color: #D92D20; background: #FEEDEC; }
    .app-alert-icon.warning { color: #B54708; background: #FFF3E8; }
    .app-alert-card h3 { margin: 0; font-size: 19px; line-height: 1.3; letter-spacing: -.02em; }
    .app-alert-card p { margin: 9px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65; white-space: pre-line; }
    .app-alert-actions { display: grid; grid-template-columns: 1fr; gap: 9px; margin-top: 19px; }
    .app-alert-actions.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .app-alert-actions .btn { min-height: 47px; }
    @keyframes alertPop { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

    .qris-modal-actions { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
    .qris-modal-actions .btn { width: 100%; min-width: 0; padding-left: 10px; padding-right: 10px; }
    .spinner { width: 32px; height: 32px; border: 4px solid #E2E8E3; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
    @keyframes spin { to { transform: rotate(360deg); } }

    body.direct-mode .topbar, body.direct-mode .footer, body.direct-mode .bottom-nav { display: none !important; }
    body.direct-mode .app { padding-top: 14px; }
    body.direct-mode .page { margin-top: 0; }
    body.invoice-open .bottom-nav { display: none; }
    body.invoice-open .topbar { display: none; }
    body.invoice-open .app { padding: 0 0 18px; }
    body.invoice-open .page { margin-top: 0; }
    body.invoice-open .invoice-shell { border-radius: 0; min-height: 100dvh; box-shadow: none; }
    body.invoice-open .invoice-head { padding-top: calc(20px + env(safe-area-inset-top)); }

    @media (min-width: 700px) {
      body { padding: 28px; }
      .app {
        min-height: calc(100dvh - 56px);
        border-radius: 34px;
        box-shadow: 0 26px 80px rgba(41, 74, 49, .18);
      }
      .modal-backdrop { align-items: center; padding: 22px; }
      .modal { border-radius: 26px; }
      .form-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
      .span-2 { grid-column: span 2; }
      .modal-wide { max-height: 88dvh; }
      body.invoice-open .app { border-radius: 34px; overflow: hidden; }
      body.invoice-open .invoice-shell { min-height: calc(100dvh - 56px); border-radius: 34px; }
    }

    @media (max-width: 767px) {
      .desktop-only, .admin-entry, #adminPage { display: none !important; }
      .mobile-only { display: block; }
      .app { width: 100%; }
      .brand-tagline { max-width: 210px; }
      .top-btn { display: none; }
      .modal-wide { width: 100%; }
      .toast { bottom: calc(72px + env(safe-area-inset-bottom)); }
      body.invoice-open .toast, body.direct-mode .toast { bottom: calc(18px + env(safe-area-inset-bottom)); }
      .app-alert-backdrop { padding: 16px; }
      .app-alert-card { width: 100%; max-width: 360px; padding: 23px 18px 17px; border-radius: 24px; }
      .app-alert-card h3 { font-size: 19px !important; }
      .app-alert-card p { font-size: 14px !important; }
      .qris-modal-actions { grid-template-columns: 1fr; }
      .qris-modal-actions .btn { min-height: 49px; }
    }


    /* Tablet dan desktop memakai ruang layar penuh, tanpa merusak pengalaman mobile. */
    @media (min-width: 768px) {
      body {
        padding: 24px;
        background:
          radial-gradient(circle at 12% 10%, rgba(255,255,255,.72), transparent 24rem),
          linear-gradient(135deg, #DCEFE1 0%, #EDF7EF 46%, #E5F2E8 100%);
      }
      .app {
        width: min(100%, 1040px);
        min-height: calc(100dvh - 48px);
        padding: 0 24px 42px;
        border-radius: 34px;
        overflow: visible;
        box-shadow: 0 28px 90px rgba(38, 74, 47, .16);
      }
      .app::before { top: 12px; }
      .topbar { min-height: 92px; padding: 28px 4px 14px; }
      .brand-icon { width: 46px; height: 46px; flex-basis: 46px; }
      .brand-name { font-size: 14px; }
      .brand-tagline { font-size: 9px; }
      .top-btn { min-height: 42px; padding-inline: 16px; font-size: 10px; }
      .customer-grid {
        grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
        align-items: start;
        gap: 20px;
      }
      .customer-grid > .stack { position: sticky; top: 24px; }
      .wallet-card { min-height: 310px; padding: 24px; border-radius: 28px; }
      .wallet-title { font-size: 31px; }
      .wallet-text { font-size: 11px; }
      .quick-card { padding: 19px; }
      .invoice-shell { border-radius: 30px; }
      .invoice-head { padding: 22px 22px 15px; }
      .invoice-number { font-size: 24px; }
      .amount-panel { padding: 18px; }
      .invoice-body { padding: 66px 18px 18px; }
      .invoice-content { grid-template-columns: minmax(0, 1.12fr) minmax(260px, .88fr); gap: 14px; }
      .section-card { padding: 16px; }
      .action-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
      .modal-backdrop { align-items: center; padding: 24px; }
      .modal { border-radius: 28px; }
      .modal-wide { width: min(860px, 100%); }
      .form-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
      .span-2 { grid-column: span 2; }
      .stats-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
      .stat-card:first-child { grid-column: auto; }
      .admin-tools { grid-template-columns: repeat(4, minmax(0,1fr)); }
      .admin-invoice {
        grid-template-columns: minmax(190px,1.3fr) minmax(130px,.8fr) 105px 135px;
        padding: 13px 14px;
      }
      .admin-actions { grid-column: 1 / -1; justify-content: flex-end; }
      .bottom-nav { display: none; }
      body.invoice-open .topbar { display: flex; }
      body.direct-mode.invoice-open .topbar { display: none !important; }
      body.invoice-open .app {
        width: min(100%, 1040px);
        min-height: calc(100dvh - 48px);
        padding: 0 24px 42px;
        border-radius: 34px;
        overflow: visible;
      }
      body.invoice-open .page { margin-top: 2px; }
      body.invoice-open .invoice-shell { min-height: auto; border-radius: 30px; box-shadow: 0 24px 60px rgba(51,94,63,.16); }
      body.invoice-open .invoice-head { padding-top: 22px; }
      body.direct-mode .customer-grid { grid-template-columns: minmax(0, 820px); justify-content: center; }
      body.direct-mode #customerHomeColumn { display: none !important; }
    }

    @media (min-width: 1180px) {
      body { padding: 32px; }
      .app {
        width: min(100%, 1320px);
        min-height: calc(100dvh - 64px);
        padding: 0 38px 48px;
      }
      .customer-grid { grid-template-columns: 380px minmax(0,1fr); gap: 28px; }
      .wallet-card { min-height: 330px; }
      .invoice-content { grid-template-columns: minmax(0,1.25fr) minmax(330px,.75fr); gap: 18px; }
      .invoice-body { padding: 70px 22px 22px; }
      .service-row { padding: 12px; }
      .admin-head { grid-template-columns: 1fr auto; align-items: center; }
      .admin-tools { min-width: 520px; }
      body.invoice-open .app {
        width: min(100%, 1320px);
        min-height: calc(100dvh - 64px);
        padding: 0 38px 48px;
      }
    }

    @media (max-width: 767px) {
      body { padding: 0; }
      .app { min-height: 100dvh; border-radius: 0; box-shadow: none; }
      .invoice-body { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
      .action-grid .btn { min-height: 48px; }
      .amount-value { font-size: clamp(25px, 8vw, 31px); }
      .modal-foot { position: sticky; bottom: 0; background: #fff; padding-top: 10px; border-top: 1px solid var(--line); }
    }

    @media print {
      body * { visibility: hidden !important; }
      #pdfContent, #pdfContent * { visibility: visible !important; }
      #pdfContent { position: absolute; inset: 0; width: 100%; }
    }
  
    /* =========================================================
       BLUE FINANCE UI 2026
       Mobile-first. Tablet dan desktop menggunakan lebar penuh.
       ========================================================= */
    :root {
      --primary: #04CCCC;
      --secondary: #6F7BF7;
      --dark: #10131A;
      --bg: #EEF1F6;
      --mint: #E8EEFF;
      --mint-strong: #D9E4FF;
      --surface: #FFFFFF;
      --soft: #F5F7FB;
      --line: #E6EAF1;
      --muted: #7A8190;
      --success: #12B76A;
      --warning: #F5A524;
      --danger: #F04452;
      --shadow: 0 18px 50px rgba(24, 48, 91, .12);
    }

    html, body {
      min-height: 100%;
      background: #E8EBF1;
    }

    body {
      padding: 0;
      background:
        radial-gradient(circle at 10% 10%, rgba(255,255,255,.75), transparent 30rem),
        linear-gradient(135deg, #E3E6EC 0%, #F0F2F6 52%, #E4E8EF 100%);
    }

    .app {
      width: 100%;
      max-width: none;
      min-height: 100dvh;
      margin: 0;
      padding: 0 15px 104px;
      border-radius: 0;
      overflow: hidden;
      background:
        radial-gradient(circle at 82% 5%, rgba(132, 100, 255, .38), transparent 25rem),
          linear-gradient(180deg, #04CCCC 0, #2B67E8 310px, #F4F6FA 310px, #F4F6FA 100%);
      box-shadow: none;
    }

    .app::before {
      top: 10px;
      background: rgba(255,255,255,.28);
    }

    .topbar {
      min-height: 88px;
      padding: 27px 3px 13px;
      color: #fff;
    }

    .brand-icon {
      border-color: rgba(255,255,255,.72);
      background: linear-gradient(145deg, rgba(255,255,255,.28), rgba(255,255,255,.09));
      box-shadow: 0 10px 30px rgba(3, 28, 91, .22);
    }

    .brand-name { color: #fff; }
    .brand-tagline { color: rgba(255,255,255,.74); }

    .icon-btn,
    .top-btn {
      color: #fff;
      border-color: rgba(255,255,255,.26);
      background: rgba(255,255,255,.13);
      box-shadow: 0 8px 26px rgba(6, 35, 103, .15);
      backdrop-filter: blur(18px);
      -webkit-backdrop-filter: blur(18px);
    }

    .icon-btn:hover,
    .top-btn:hover {
      color: #fff;
      background: rgba(255,255,255,.22);
    }

    .card {
      border-color: rgba(255,255,255,.96);
      background: rgba(255,255,255,.98);
      box-shadow: var(--shadow);
    }

    .wallet-card {
      min-height: 286px;
      padding: 21px;
      color: #fff;
      border-color: rgba(255,255,255,.34);
      background:
        radial-gradient(circle at 78% 16%, rgba(255, 255, 255, .32), transparent 10rem), radial-gradient(circle at 18% 105%, rgba(88, 219, 255, .42), transparent 13rem), linear-gradient(145deg, rgb(28 195 187 / 92%), rgb(29 169 169 / 94%));
      box-shadow: 0 28px 60px rgba(31, 80, 192, .28);
      backdrop-filter: blur(18px);
      -webkit-backdrop-filter: blur(18px);
    }

    .wallet-card::before {
      width: 250px;
      height: 190px;
      right: -78px;
      top: 52px;
      border-radius: 42px;
      background:
        linear-gradient(135deg, rgba(255,255,255,.26), rgba(255,255,255,.04));
      border: 1px solid rgba(255,255,255,.28);
      transform: rotate(-8deg);
      box-shadow:
        -34px 28px 0 -2px rgba(255,255,255,.08),
        -64px 50px 0 -4px rgba(255,255,255,.05);
    }

    .wallet-card::after {
      content: '◉';
      right: 20px;
      top: 18px;
      color: #fff;
      background: rgba(255,255,255,.15);
      border: 1px solid rgba(255,255,255,.24);
    }

    .eyebrow,
    .wallet-text {
      color: rgba(255,255,255,.78);
    }

    .wallet-title {
      max-width: 330px;
      color: #fff;
      text-shadow: 0 4px 20px rgba(9, 36, 110, .18);
    }

    .search-box {
      border-color: rgba(255,255,255,.28);
      background: rgba(255,255,255,.16);
      box-shadow: 0 14px 34px rgba(12, 38, 108, .20);
      backdrop-filter: blur(18px);
      -webkit-backdrop-filter: blur(18px);
    }

    .search-box input {
      border-color: rgba(255,255,255,.65);
      background: rgba(255,255,255,.95);
    }

    .search-box button {
      color: #10131A;
      background: #FFFFFF;
      box-shadow: 0 10px 22px rgba(12, 36, 100, .18);
    }

    .quick-card {
      border: 0;
      box-shadow: 0 15px 40px rgba(30, 46, 86, .10);
    }

    .quick-item {
      border: 0;
      background: #FFFFFF;
      box-shadow: 0 8px 24px rgba(30, 46, 86, .07);
    }

    .quick-icon,
    .service-icon,
    .receipt-icon {
      color: var(--primary);
      background: #EAF1FF;
    }

    .quick-arrow { color: var(--primary); }

    .invoice-shell {
      border: 1px solid rgba(255,255,255,.9);
      background: #FFFFFF;
      box-shadow: 0 28px 70px rgba(22, 53, 112, .17);
    }

    .invoice-head {
      color: #fff;
      background:
        radial-gradient(circle at 82% 0%, rgba(126, 91, 255, .54), transparent 15rem),
        linear-gradient(145deg, #04CCCC, #3A63E8);
    }

    .back-btn {
      color: #fff;
      background: rgba(255,255,255,.13);
      border: 1px solid rgba(255,255,255,.20);
    }

    .invoice-date { color: rgba(255,255,255,.72); }

    .amount-panel {
      color: var(--dark);
      border-color: rgba(255,255,255,.94);
      background: rgba(255,255,255,.97);
      box-shadow: 0 20px 42px rgba(8, 45, 125, .19);
    }

    .pill-light {
      color: #2F59AD;
      background: #EBF2FF;
    }

    .invoice-body { background: #F8F9FC; }

    .progress-card,
    .section-card {
      border-color: #E8EBF2;
      background: #FFFFFF;
      box-shadow: 0 8px 26px rgba(27, 43, 80, .06);
    }

    .progress-track i { background: #E5E9F2; }
    .service-row { background: #F7F9FD; }
    .timeline-dot-wrap::after { background: #E3E8F2; }

    .total-strip {
      color: var(--dark);
      border-color: #DDE7FF;
      background: #EEF4FF;
    }

    .total-strip span { color: #63749A; }

    .btn-primary {
      color: #fff;
      background: linear-gradient(135deg, var(--primary), var(--secondary));
      box-shadow: 0 12px 26px rgba(23,104,242,.24);
    }

    .btn-dark { background: linear-gradient(180deg, #292C36, #11131A); }
    .btn-soft { color: #303746; background: #EEF1F6; }
    .btn-outline { color: #275EC5; border-color: #D8E4FF; background: #F3F7FF; }

    .admin-login {
      margin-top: 18px;
      border: 1px solid rgba(255,255,255,.9);
      background: rgba(255,255,255,.98);
      box-shadow: 0 28px 70px rgba(18, 45, 105, .20);
    }

    .admin-logo {
      background: linear-gradient(135deg, var(--primary), var(--secondary));
      box-shadow: 0 12px 30px rgba(23,104,242,.25);
    }

    .field {
      border-color: #E1E6EF;
      background: #F8FAFD;
    }

    .field:focus {
      border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(23,104,242,.11);
    }

    .admin-head,
    .stat-card:first-child {
      color: #fff;
      background:
        radial-gradient(circle at 90% 0%, rgba(128, 92, 255, .52), transparent 15rem),
        linear-gradient(145deg, #04CCCC, #3861E6);
    }

    .admin-head .section-sub,
    .stat-card:first-child span {
      color: rgba(255,255,255,.76);
    }

    .admin-invoice {
      border-color: #E6EAF2;
      background: #FFFFFF;
      box-shadow: 0 8px 24px rgba(28, 44, 80, .06);
    }

    .modal-backdrop {
      background: rgba(13, 22, 43, .62);
    }

    .bottom-nav {
      border-color: rgba(255,255,255,.82);
      background: rgba(255,255,255,.91);
      box-shadow: 0 18px 45px rgba(22, 42, 84, .22);
    }

    .bottom-nav button { color: #7C8494; }
    .bottom-nav button.active {
      color: #fff;
      background: linear-gradient(180deg, #272A34, #11131A);
      box-shadow: 0 8px 20px rgba(17,19,26,.22);
    }

    .footer { color: #89909E; }

    body.direct-mode .app,
    body.invoice-open .app {
      background: #F4F6FA;
    }

    @media (max-width: 767px) {
      .desktop-only { display: none !important; }
      .admin-entry { display: none !important; }
      #adminPage { display: grid; }
      #adminPage.hidden { display: none !important; }

      .app {
        width: 100%;
        padding-inline: 14px;
      }

      .admin-login {
        max-width: 420px;
        margin-top: 22px;
      }

      .admin-page {
        min-height: calc(100dvh - 196px);
        align-content: start;
      }

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

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

      .admin-invoice {
        grid-template-columns: minmax(0,1fr) auto;
      }

      body.invoice-open .invoice-shell {
        border-radius: 0;
      }
    }

    @media (min-width: 768px) {
      body { padding: 0; }

      .app {
        width: 100%;
        max-width: none;
        min-height: 100dvh;
        padding: 0 28px 48px;
        border-radius: 0;
        overflow: hidden;
        box-shadow: none;
        background:
          radial-gradient(circle at 82% 5%, rgba(132, 100, 255, .38), transparent 25rem),
          linear-gradient(180deg, #04CCCC 0, #2B67E8 310px, #F4F6FA 310px, #F4F6FA 100%);
      }

      .topbar {
        min-height: 98px;
        padding-top: 30px;
      }

      .customer-grid {
        width: 100%;
        grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
        gap: 24px;
      }

      .customer-grid > .stack {
        position: sticky;
        top: 22px;
      }

      .wallet-card {
        min-height: 336px;
        border-radius: 32px;
      }

      .quick-card { border-radius: 28px; }

      .invoice-shell { border-radius: 32px; }
      .invoice-content {
        grid-template-columns: minmax(0, 1.15fr) minmax(290px, .85fr);
        gap: 16px;
      }

      .admin-page,
      .admin-dashboard,
      #adminDashboard {
        width: 100%;
      }

      .admin-login {
        width: min(460px, 100%);
        max-width: 460px;
        margin: 48px auto 0;
      }

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

      .stat-card:first-child { grid-column: auto; }

      .admin-tools {
        grid-template-columns: repeat(4, minmax(120px,1fr));
      }

      .table-card { padding: 18px; }
      .bottom-nav { display: none; }

      body.invoice-open .app {
        width: 100%;
        min-height: 100dvh;
        padding: 0 28px 48px;
        border-radius: 0;
      }

      body.direct-mode .customer-grid {
        width: 100%;
        grid-template-columns: minmax(0, 1fr);
        justify-content: stretch;
      }

      body.direct-mode .invoice-shell {
        width: 100%;
      }
    }

    @media (min-width: 1180px) {
      .app { padding-inline: 42px; }
      .customer-grid {
        grid-template-columns: minmax(360px, 430px) minmax(0,1fr);
        gap: 32px;
      }

      .wallet-card { min-height: 360px; }
      .wallet-title { font-size: 36px; }

      .invoice-content {
        grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr);
        gap: 20px;
      }

      .admin-head {
        grid-template-columns: minmax(0,1fr) auto;
        align-items: center;
      }

      .admin-tools { min-width: 620px; }

      .admin-list {
        grid-template-columns: repeat(2, minmax(0,1fr));
        gap: 12px;
      }

      .admin-invoice {
        grid-template-columns: minmax(0,1fr) auto;
        align-content: start;
      }

      .admin-invoice > div:nth-child(3),
      .admin-invoice > div:nth-child(4) {
        text-align: right;
      }
    }

    @media (min-width: 1600px) {
      .app { padding-inline: 58px; }
      .customer-grid {
        grid-template-columns: 460px minmax(0,1fr);
        gap: 38px;
      }
      .invoice-content {
        grid-template-columns: minmax(0,1.35fr) minmax(390px,.65fr);
      }
    }


    /* =========================================================
       STABILITY FIXES: mobile admin, readable type and desktop dark mode
       ========================================================= */
    #themeToggleBtn { font-size: 16px; line-height: 1; }

    @media (max-width: 767px) {
      /* Override legacy rule that hid the whole admin page on phones. */
      #adminPage { display: grid !important; min-height: calc(100dvh - 180px); align-content: start; }
      #adminPage.hidden { display: none !important; }
      #adminLoginCard { display: block; width: 100%; max-width: 460px; margin: 16px auto 0; }
      #adminLoginCard.hidden { display: none !important; }
      #adminDashboard:not(.hidden) { display: grid !important; width: 100%; }
      #adminDashboard.hidden { display: none !important; }
      #themeToggleBtn { display: none !important; }

      /* Normal mobile typography. The previous 7-10px sizes were too small. */
      body { font-size: 15px; }
      .brand-name { font-size: 14px !important; }
      .brand-tagline { max-width: 220px; font-size: 11px !important; line-height: 1.35; }
      .eyebrow { font-size: 11px !important; }
      .wallet-title { font-size: clamp(28px, 8vw, 36px) !important; }
      .wallet-text { font-size: 14px !important; line-height: 1.65; }
      .search-box input, .search-box button { min-height: 48px; font-size: 14px !important; }
      .section-title { font-size: 16px !important; }
      .section-sub { font-size: 12px !important; line-height: 1.55; }
      .quick-item strong { font-size: 14px !important; }
      .quick-item span { font-size: 11px !important; }
      .invoice-number { font-size: 24px !important; }
      .invoice-date { font-size: 12px !important; }
      .amount-label, .field-label, .progress-caption, .meta-label { font-size: 11px !important; }
      .amount-value { font-size: 30px !important; }
      .pill { font-size: 11px !important; }
      .progress-title, .line-item strong, .info-row strong, .timeline-item strong { font-size: 13px !important; }
      .line-item span, .info-row span, .timeline-item span, .payment-note { font-size: 11px !important; line-height: 1.55; }
      .field, select.field, textarea.field { min-height: 48px; font-size: 14px !important; }
      textarea.field { min-height: 92px; }
      .btn, .mini-btn, .top-btn { font-size: 13px !important; }
      .admin-login h2 { font-size: 22px !important; }
      .admin-invoice h4 { font-size: 13px !important; }
      .admin-invoice p { font-size: 11px !important; line-height: 1.5; }
      .stat-card span { font-size: 11px !important; }
      .stat-card strong { font-size: 18px !important; }
      .modal-title { font-size: 18px !important; }
      .bottom-nav button { font-size: 11px !important; line-height: 1.35; }
      .toast { font-size: 12px !important; }
    }

    @media (min-width: 768px) {
      #themeToggleBtn { display: inline-grid !important; place-items: center; }

      html.dark-mode body {
        color: #F4F7FF;
        background: #080B12 !important;
      }
      html.dark-mode .app {
        background:
          radial-gradient(circle at 84% 3%, rgba(88, 91, 255, .30), transparent 28rem),
          linear-gradient(180deg, #04CCCC 0, #6F7BF7 310px, #0D1119 310px, #0D1119 100%) !important;
      }
      html.dark-mode .topbar,
      html.dark-mode .brand-name { color: #FFFFFF; }
      html.dark-mode .brand-tagline { color: #C8D2E6; }
      html.dark-mode .icon-btn,
      html.dark-mode .top-btn {
        color: #F7F9FF;
        border-color: rgba(255,255,255,.15);
        background: rgba(12,17,28,.45);
      }
      html.dark-mode .card,
      html.dark-mode .quick-card,
      html.dark-mode .table-card,
      html.dark-mode .admin-login,
      html.dark-mode .admin-head,
      html.dark-mode .stat-card,
      html.dark-mode .admin-invoice,
      html.dark-mode .modal,
      html.dark-mode .invoice-body,
      html.dark-mode .detail-card,
      html.dark-mode .payment-card,
      html.dark-mode .timeline-card,
      html.dark-mode .share-success,
      html.dark-mode .setting-section {
        color: #F2F5FB !important;
        border-color: #272E3B !important;
        background: #151A24 !important;
        box-shadow: 0 18px 46px rgba(0,0,0,.30) !important;
      }
      html.dark-mode .wallet-card {
        color: #F6F8FF;
        border-color: rgba(255,255,255,.12);
        background: linear-gradient(145deg, rgb(1 207 207), rgb(21 127 127)) !important;
      }
      html.dark-mode .wallet-text,
      html.dark-mode .eyebrow,
      html.dark-mode .section-sub,
      html.dark-mode .invoice-date,
      html.dark-mode .admin-invoice p,
      html.dark-mode .field-label,
      html.dark-mode .footer,
      html.dark-mode .timeline-item span,
      html.dark-mode .line-item span,
      html.dark-mode .info-row span { color: #AAB4C7 !important; }
      html.dark-mode .quick-item,
      html.dark-mode .search-box,
      html.dark-mode .progress-card,
      html.dark-mode .summary-strip,
      html.dark-mode .info-row,
      html.dark-mode .account-card,
      html.dark-mode .filter-row {
        color: #F1F4FB;
        border-color: #2B3240 !important;
        background: #111620 !important;
      }
      html.dark-mode .field,
      html.dark-mode input,
      html.dark-mode select,
      html.dark-mode textarea {
        color: #F7F9FD !important;
        border-color: #303848 !important;
        background: #0F141D !important;
      }
      html.dark-mode .field::placeholder,
      html.dark-mode input::placeholder,
      html.dark-mode textarea::placeholder { color: #6F7A8F !important; }
      html.dark-mode .btn-soft,
      html.dark-mode .mini-btn.btn-soft,
      html.dark-mode .modal-close {
        color: #E8EDF7 !important;
        background: #272E3A !important;
      }
      html.dark-mode .invoice-shell { background: #111722 !important; }
      html.dark-mode .invoice-head { background: linear-gradient(145deg, #164FBF, #463AC6) !important; }
      html.dark-mode .bottom-nav {
        border-color: #282F3B;
        background: rgba(18,23,33,.94);
      }
      html.dark-mode .bottom-nav button { color: #A9B2C2; }
      html.dark-mode .app-alert-card { color: #F5F7FB; background: #171C26; border-color: #2B3444; }
      html.dark-mode .app-alert-card p { color: #AEB7C6; }
      html.dark-mode .modal-backdrop { background: rgba(0,0,0,.76); }
    }



    /* =========================================================
       READABLE TYPOGRAPHY: mobile, tablet, and desktop
       ========================================================= */
    body { font-size: 16px; line-height: 1.5; }
    .brand-name { font-size: 15px !important; }
    .brand-tagline { font-size: 12px !important; line-height: 1.35; }
    .top-btn { font-size: 13px !important; }
    .eyebrow { font-size: 12px !important; }
    .wallet-text { font-size: 15px !important; line-height: 1.65; }
    .search-box input,
    .search-box button { min-height: 48px; font-size: 15px !important; }
    .section-title { font-size: 18px !important; }
    .section-sub { font-size: 13px !important; line-height: 1.6; }
    .quick-item strong { font-size: 15px !important; }
    .quick-item span { font-size: 13px !important; line-height: 1.45; }
    .back-btn { font-size: 13px !important; }
    .invoice-number { font-size: 26px !important; }
    .invoice-date { font-size: 13px !important; }
    .amount-label { font-size: 12px !important; }
    .pill { min-height: 30px; padding-inline: 11px; font-size: 12px !important; }
    .progress-top strong { font-size: 14px !important; }
    .progress-top span { font-size: 12px !important; }
    .service-row h4 { font-size: 14px !important; line-height: 1.4; }
    .service-row p { font-size: 12px !important; line-height: 1.55; }
    .service-price { font-size: 14px !important; }
    .detail-row span,
    .detail-row strong { font-size: 13px !important; line-height: 1.45; }
    .timeline-row h5 { font-size: 14px !important; }
    .timeline-row p { font-size: 12px !important; line-height: 1.5; }
    .total-strip span { font-size: 13px !important; }
    .total-strip strong { font-size: 20px !important; }
    .footer { font-size: 12px !important; line-height: 1.55; }
    .field-label { font-size: 12px !important; line-height: 1.35; }
    .field,
    select.field,
    textarea.field { min-height: 48px; font-size: 15px !important; }
    textarea.field { min-height: 96px; }
    .btn { min-height: 46px; font-size: 14px !important; }
    .stat-card span { font-size: 12px !important; }
    .stat-card strong { font-size: 21px !important; }
    .admin-invoice h4 { font-size: 14px !important; }
    .admin-invoice p { font-size: 12px !important; line-height: 1.5; }
    .mini-btn { min-height: 38px; font-size: 12px !important; }
    .modal-title { font-size: 19px !important; }
    .qr-timer { font-size: 12px !important; }
    .account-card h4 { font-size: 14px !important; }
    .account-card p { font-size: 12px !important; }
    .account-number { font-size: 16px !important; }
    .copy-btn { min-height: 44px; font-size: 13px !important; }
    .setting-section h4 { font-size: 15px !important; }
    .empty-state { font-size: 13px !important; line-height: 1.55; }
    .share-success p { font-size: 12px !important; }
    .share-customer span { font-size: 11px !important; }
    .share-customer strong { font-size: 14px !important; }
    .bottom-nav button { font-size: 12px !important; }
    .toast { font-size: 13px !important; }

    @media (max-width: 767px) {
      .app { padding-inline: 14px; }
      .topbar { min-height: 88px; }
      .wallet-card { padding: 20px 18px; }
      .wallet-title { font-size: clamp(30px, 9vw, 38px) !important; }
      .amount-value { font-size: 32px !important; }
      .card-pad { padding: 18px; }
      .modal-body { padding: 18px; }
      .modal-foot { padding: 14px 18px 18px; }
    }

    @media (min-width: 768px) {
      .brand-name { font-size: 17px !important; }
      .brand-tagline { font-size: 13px !important; }
      .wallet-title { font-size: 38px !important; }
      .wallet-text { font-size: 16px !important; }
      .section-title { font-size: 20px !important; }
      .section-sub { font-size: 14px !important; }
      .invoice-number { font-size: 30px !important; }
      .amount-value { font-size: 34px !important; }
      .service-row h4 { font-size: 15px !important; }
      .service-row p { font-size: 13px !important; }
      .detail-row span,
      .detail-row strong { font-size: 14px !important; }
      .timeline-row h5 { font-size: 15px !important; }
      .timeline-row p { font-size: 13px !important; }
      .admin-invoice h4 { font-size: 15px !important; }
      .admin-invoice p { font-size: 13px !important; }
    }


    /* =========================================================
       FINAL DARK MODE AND PAYMENT SETTINGS FIX
       ========================================================= */
    .quick-item.is-disabled { opacity: .58; filter: grayscale(.25); }
    .quick-item.is-disabled .quick-arrow { display: none; }
    .setting-toggle {
      display: flex;
      align-items: flex-start;
      gap: 11px;
      padding: 13px 14px;
      border: 1px solid var(--line);
      border-radius: 14px;
      background: #F8FAFD;
      cursor: pointer;
    }
    .setting-toggle input { width: 19px; height: 19px; margin: 2px 0 0; accent-color: var(--primary); }
    .setting-toggle span { display: grid; gap: 3px; }
    .setting-toggle strong { font-size: 14px; }
    .setting-toggle small { color: var(--muted); font-size: 12px; line-height: 1.5; }
    .secret-status { color: var(--danger); font-weight: 700; }
    .secret-status.configured { color: var(--success); }

    html.dark-mode,
    html.dark-mode body {
      color-scheme: dark;
      color: #F4F7FC;
      background: #080B12 !important;
    }
    html.dark-mode .app {
      background:
        radial-gradient(circle at 84% 3%, rgba(112, 93, 255, .28), transparent 28rem),
        linear-gradient(180deg, var(--primary) 0, var(--secondary) 310px, #0B0F17 310px, #0B0F17 100%) !important;
    }
    html.dark-mode body.direct-mode .app,
    html.dark-mode body.invoice-open .app { background: #0B0F17 !important; }
    html.dark-mode .card,
    html.dark-mode .quick-card,
    html.dark-mode .table-card,
    html.dark-mode .admin-login,
    html.dark-mode .stat-card:not(:first-child),
    html.dark-mode .admin-invoice,
    html.dark-mode .modal,
    html.dark-mode .invoice-body,
    html.dark-mode .section-card,
    html.dark-mode .progress-card,
    html.dark-mode .setting-section,
    html.dark-mode .share-success,
    html.dark-mode .amount-panel,
    html.dark-mode #loadingOverlay .card {
      color: #F2F5FB !important;
      border-color: #283142 !important;
      background: #151B26 !important;
      box-shadow: 0 18px 46px rgba(0,0,0,.34) !important;
    }
    html.dark-mode .admin-head,
    html.dark-mode .stat-card:first-child {
      color: #FFFFFF !important;
      border-color: rgba(255,255,255,.12) !important;
      background:
        radial-gradient(circle at 90% 0%, rgba(134, 104, 255, .48), transparent 15rem),
        linear-gradient(145deg, var(--primary), var(--secondary)) !important;
    }
    html.dark-mode .invoice-shell { border-color: #273043 !important; background: #111722 !important; }
    html.dark-mode .invoice-head { background: linear-gradient(145deg, var(--primary), var(--secondary)) !important; }
    html.dark-mode .modal-head,
    html.dark-mode .modal-foot {
      color: #F4F7FC !important;
      border-color: #283142 !important;
      background: rgba(21,27,38,.98) !important;
    }
    html.dark-mode .quick-item,
    html.dark-mode .service-row,
    html.dark-mode .account-card,
    html.dark-mode .share-customer,
    html.dark-mode .setting-toggle,
    html.dark-mode #paymentPlanPreview,
    html.dark-mode .search-box,
    html.dark-mode .qr-frame {
      color: #F2F5FB !important;
      border-color: #2B3547 !important;
      background: #101620 !important;
      box-shadow: none !important;
    }
    html.dark-mode .field,
    html.dark-mode input,
    html.dark-mode select,
    html.dark-mode textarea {
      color: #F7F9FD !important;
      border-color: #303B4E !important;
      background: #0D131D !important;
    }
    html.dark-mode select option { color: #F7F9FD; background: #0D131D; }
    html.dark-mode .field::placeholder,
    html.dark-mode input::placeholder,
    html.dark-mode textarea::placeholder { color: #78849A !important; }
    html.dark-mode .section-sub,
    html.dark-mode .wallet-text,
    html.dark-mode .eyebrow,
    html.dark-mode .invoice-date,
    html.dark-mode .field-label,
    html.dark-mode .footer,
    html.dark-mode .admin-invoice p,
    html.dark-mode .service-row p,
    html.dark-mode .detail-row span,
    html.dark-mode .timeline-row p,
    html.dark-mode .quick-item span,
    html.dark-mode .account-card p,
    html.dark-mode .share-success p,
    html.dark-mode .share-customer span,
    html.dark-mode .setting-toggle small,
    html.dark-mode .qr-timer { color: #AAB5C8 !important; }
    html.dark-mode .detail-row { border-color: #313B4D; }
    html.dark-mode .progress-track i { background: #30394A; }
    html.dark-mode .timeline-dot-wrap::after { background: #30394A; }
    html.dark-mode .total-strip {
      color: #F4F7FC !important;
      border-color: #334566 !important;
      background: #17243A !important;
    }
    html.dark-mode .total-strip span { color: #AFC0DD !important; }
    html.dark-mode .quick-icon,
    html.dark-mode .service-icon,
    html.dark-mode .receipt-icon {
      color: #AFC5FF !important;
      background: #1C2B47 !important;
    }
    html.dark-mode .btn-soft,
    html.dark-mode .mini-btn.btn-soft,
    html.dark-mode .modal-close {
      color: #E9EEF8 !important;
      background: #283243 !important;
    }
    html.dark-mode .btn-outline {
      color: #BFD0FF !important;
      border-color: #3A4C70 !important;
      background: #18243A !important;
    }
    html.dark-mode .status-pending { color: #FFBE88 !important; border-color: #7B4D2F !important; background: #342317 !important; }
    html.dark-mode .status-validation { color: #FFD17A !important; background: #352A13 !important; }
    html.dark-mode .status-dp { color: #91C5FF !important; background: #172D47 !important; }
    html.dark-mode .status-paid { color: #75E4B1 !important; background: #123529 !important; }
    html.dark-mode .status-expired { color: #FF9EA8 !important; background: #3A1B22 !important; }
    html.dark-mode .pill-light { color: #BFD0FF !important; background: #1B2A45 !important; }
    html.dark-mode .account-number { color: #F7F9FD !important; }
    html.dark-mode .bottom-nav { border-color: #2A3343; background: rgba(17,23,33,.96); }
    html.dark-mode .bottom-nav button { color: #AAB4C5; }
    html.dark-mode .app-alert-card { color: #F5F7FB; border-color: #2B3547; background: #171D28; }
    html.dark-mode .app-alert-card p { color: #AEB8C9; }
    html.dark-mode .modal-backdrop { background: rgba(0,0,0,.78); }
    html.dark-mode .barcode { filter: invert(1); opacity: .8; }

    @media (max-width: 767px) {
      #themeToggleBtn { display: inline-grid !important; place-items: center; }
    }

  

    /* Dynamic invoice service editor */
    .invoice-items-editor {
      padding: 14px;
      border: 1px solid var(--line);
      border-radius: 17px;
      background: #F8FAFD;
    }
    .invoice-items-editor-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 11px;
    }
    .invoice-item-editor-list { display: grid; gap: 10px; }
    .invoice-item-editor-row {
      display: grid;
      grid-template-columns: minmax(150px, .9fr) minmax(190px, 1.35fr) minmax(130px, .7fr) auto;
      gap: 9px;
      align-items: end;
      padding: 12px;
      border: 1px solid #E2E7F0;
      border-radius: 15px;
      background: #FFFFFF;
      box-shadow: 0 6px 18px rgba(31, 48, 88, .05);
    }
    .invoice-item-remove {
      width: 42px;
      min-height: 48px;
      border: 0;
      border-radius: 13px;
      color: #B42331;
      background: #FFECEF;
      cursor: pointer;
      font-size: 19px;
      font-weight: 900;
    }
    .invoice-item-index {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 26px;
      height: 26px;
      margin-right: 7px;
      border-radius: 9px;
      color: var(--primary);
      background: #EAF1FF;
      font-size: 12px;
      font-weight: 900;
    }
    html.dark-mode .invoice-items-editor,
    html.dark-mode .invoice-item-editor-row {
      color: #F2F5FB !important;
      border-color: #2B3342 !important;
      background: #111620 !important;
    }
    html.dark-mode .invoice-item-remove {
      color: #FF9EA8;
      background: #3B1D25;
    }
    @media (max-width: 767px) {
      .invoice-item-editor-row { grid-template-columns: 1fr; }
      .invoice-item-remove { width: 100%; }
      .invoice-items-editor-head { align-items: flex-start; }
    }

/* v1.2.0: public portal has no Admin entry. */
.bottom-nav{grid-template-columns:repeat(2,1fr)}
#adminPage{display:none!important}
