/* =====================================================================
   TRAVELA — Mobile-first UI (1080×1920 ratio / 9:16)
   ===================================================================== */
:root{
  --bg:#eef2f7;
  --surface:#ffffff;
  --surface-2:#f8fafc;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e2e8f0;
  --shadow:0 2px 10px rgba(15,23,42,.06);
  --shadow-lg:0 12px 32px rgba(15,23,42,.12);
  --radius:16px;
  --radius-sm:12px;
  /* warna tema (default blue) */
  --brand:#2563eb;
  --brand-2:#1d4ed8;
  --brand-soft:#dbeafe;
  --ok:#16a34a; --warn:#d97706; --bad:#dc2626;
}
[data-theme="green"]{ --brand:#059669; --brand-2:#047857; --brand-soft:#d1fae5; }
[data-theme="purple"]{ --brand:#7c3aed; --brand-2:#6d28d9; --brand-soft:#ede9fe; }
[data-theme="orange"]{ --brand:#ea580c; --brand-2:#c2410c; --brand-soft:#ffedd5; }
[data-theme="rose"]{ --brand:#e11d48; --brand-2:#be123c; --brand-soft:#ffe4e6; }

/* DARK MODE */
body.dark{
  --bg:#0b1220; --surface:#121a2b; --surface-2:#0f1626;
  --text:#e7edf6; --muted:#94a3b8; --border:#243049;
  --shadow:0 2px 10px rgba(0,0,0,.4); --shadow-lg:0 12px 32px rgba(0,0,0,.55);
  --brand-soft:rgba(37,99,235,.18);
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Inter,system-ui,sans-serif;
  background:var(--bg); color:var(--text);
  display:flex; justify-content:center; min-height:100vh;
}
img{max-width:100%;display:block}
.ic{flex:none}

/* ====== Frame "HP" : maks 480px, rasio 9:16 di desktop ====== */
.phone{ width:100%; max-width:480px; min-height:100vh; position:relative; }
.app{
  background:var(--bg); min-height:100vh;
  display:flex; flex-direction:column;
  padding-bottom:84px; /* ruang bottom nav */
}

/* ====== HEADER ====== */
.appbar{
  position:sticky; top:0; z-index:30;
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:14px 16px;
  background:var(--surface); border-bottom:1px solid var(--border);
}
.appbar-left{display:flex; align-items:center; gap:10px; min-width:0}
.logo-box{
  width:46px;height:46px;border-radius:12px;flex:none;overflow:hidden;
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
  color:#fff;display:flex;align-items:center;justify-content:center;
  font-weight:800;font-size:11px;letter-spacing:.5px;
}
.logo-box img{width:100%;height:100%;object-fit:cover}
.appbar-brand{display:flex;flex-direction:column;min-width:0}
.appbar-brand small{color:var(--muted);font-size:11px}
.appbar-brand strong{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.appbar-right{display:flex;flex-direction:column;align-items:flex-end;text-align:right;line-height:1.25}
.appbar-right .city{font-size:13px}
.appbar-right .time{font-size:13px;color:var(--brand);font-weight:700}
.appbar-right .date{font-size:11px;color:var(--muted)}

/* ====== CONTENT ====== */
.content{flex:1;padding:16px;display:flex;flex-direction:column;gap:16px}
.section-title{font-size:15px;font-weight:800;margin:2px 0;display:flex;align-items:center;gap:8px}
.muted{color:var(--muted)}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}

/* ====== RINGKASAN KEUANGAN ====== */
.summary{
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
  color:#fff;border-radius:var(--radius);padding:18px;box-shadow:var(--shadow-lg);
}
.summary h3{margin:0 0 12px;font-size:13px;opacity:.9;font-weight:600;letter-spacing:.5px}
.summary .row{display:flex;justify-content:space-between;align-items:center;padding:7px 0}
.summary .row + .row{border-top:1px solid rgba(255,255,255,.18)}
.summary .label{font-size:14px;opacity:.92}
.summary .val{font-size:20px;font-weight:800;letter-spacing:.3px}
.summary .row.total .val{font-size:23px}

/* ====== KALENDER ====== */
.calendar{padding:14px}
.cal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.cal-head strong{font-size:15px}
.cal-nav{display:flex;gap:6px}
.cal-nav button{
  width:34px;height:34px;border-radius:10px;border:1px solid var(--border);
  background:var(--surface-2);color:var(--text);font-size:18px;cursor:pointer;
}
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:5px}
.cal-grid .dow{text-align:center;font-size:11px;color:var(--muted);font-weight:700;padding:2px 0 4px}
.cal-cell{
  aspect-ratio:1/1;display:flex;align-items:center;justify-content:center;
  border-radius:10px;font-size:13.5px;cursor:pointer;position:relative;border:1px solid var(--border);
  background:var(--surface-2);
}
.cal-cell.empty{background:transparent;border-color:transparent;cursor:default}
.cal-cell:not(.empty):active{transform:scale(.94)}
.cal-cell:not(.empty):hover{border-color:var(--brand)}
.cal-cell.today{background:var(--brand-soft);color:var(--brand);border-color:var(--brand)}
.cal-cell.today .num{font-weight:800}
.cal-cell.has-order{border-color:var(--brand)}
.cal-cell .cnt{
  position:absolute;top:3px;right:3px;min-width:15px;height:15px;padding:0 3px;
  border-radius:8px;background:var(--brand);color:#fff;font-size:9px;font-weight:800;
  display:flex;align-items:center;justify-content:center;line-height:1;
}

/* ====== GRID MENU KATEGORI (4 kolom) ====== */
.cat-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.cat-item{
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sm);
  box-shadow:var(--shadow);padding:12px 6px;text-decoration:none;color:var(--text);
  display:flex;flex-direction:column;align-items:center;gap:7px;transition:.15s;
}
.cat-item:active{transform:scale(.96)}
.cat-ic{
  width:42px;height:42px;border-radius:12px;display:flex;align-items:center;justify-content:center;
  background:var(--brand-soft);color:var(--brand);
}
.cat-item span{font-size:11px;font-weight:600;text-align:center;line-height:1.2}

/* ====== TOMBOL ====== */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  border:none;border-radius:12px;padding:12px 16px;font-size:14px;font-weight:700;
  cursor:pointer;text-decoration:none;transition:.15s;
}
.btn-primary{background:var(--brand);color:#fff}
.btn-primary:active{background:var(--brand-2)}
.btn-block{width:100%}
.btn-soft{background:var(--brand-soft);color:var(--brand)}
.btn-outline{background:transparent;border:1px solid var(--border);color:var(--text)}
.btn-danger{background:var(--bad);color:#fff}
.btn-ok{background:var(--ok);color:#fff}
.btn-sm{padding:8px 12px;font-size:12px;border-radius:10px}

/* ====== KARTU ORDER ====== */
.order-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  box-shadow:var(--shadow);padding:14px;display:flex;flex-direction:column;gap:8px}
.order-top{display:flex;justify-content:space-between;align-items:flex-start;gap:8px}
.order-top h4{margin:0;font-size:15px}
.order-top .sub{font-size:12px;color:var(--muted)}
.order-rows{display:grid;grid-template-columns:1fr 1fr;gap:6px 12px;font-size:13px}
.order-rows .k{color:var(--muted)}
.order-rows .v{text-align:right;font-weight:700}
.order-rows .full{grid-column:1/-1;display:flex;justify-content:space-between;border-top:1px dashed var(--border);padding-top:8px;margin-top:2px}
.order-actions{display:flex;gap:8px;margin-top:4px}
.badge{font-size:11px;font-weight:700;padding:3px 9px;border-radius:999px;white-space:nowrap}
.badge.belum{background:#fee2e2;color:#991b1b}
.badge.dp{background:#fef3c7;color:#92400e}
.badge.lunas{background:#dcfce7;color:#166534}
.badge.pending{background:#e2e8f0;color:#334155}
.badge.proses{background:#dbeafe;color:#1e40af}
.badge.selesai{background:#dcfce7;color:#166534}
.badge.batal{background:#fee2e2;color:#991b1b}
body.dark .badge.belum,body.dark .badge.batal{background:rgba(220,38,38,.2)}
body.dark .badge.dp{background:rgba(217,119,6,.22)}
body.dark .badge.lunas,body.dark .badge.selesai{background:rgba(22,163,74,.22)}

/* ====== FORM ====== */
.field{margin-bottom:12px}
.field label{display:block;font-size:13px;font-weight:600;margin-bottom:5px}
.field input,.field select,.field textarea{
  width:100%;padding:12px;border:1px solid var(--border);border-radius:12px;
  background:var(--surface-2);color:var(--text);font-size:14px;font-family:inherit;
}
.field textarea{min-height:70px;resize:vertical}
.field input:focus,.field select:focus,.field textarea:focus{outline:2px solid var(--brand-soft);border-color:var(--brand)}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}
.calc-box{background:var(--brand-soft);border-radius:12px;padding:12px;display:flex;flex-direction:column;gap:8px;margin:4px 0 12px}
.calc-box .row{display:flex;justify-content:space-between;font-size:14px}
.calc-box .row b{font-size:16px}

/* ====== FAB tambah order ====== */
.fab{
  position:fixed;right:calc(50% - 240px + 16px);bottom:100px;z-index:35;
  width:auto;padding:14px 18px;border-radius:999px;box-shadow:var(--shadow-lg);
}
@media(max-width:512px){.fab{right:16px}}

/* ====== BOTTOM NAV ====== */
.bottomnav{
  position:fixed;bottom:0;left:50%;transform:translateX(-50%);
  width:100%;max-width:480px;height:68px;z-index:40;
  background:var(--surface);border-top:1px solid var(--border);
  display:flex;align-items:center;justify-content:space-around;
  padding:0 6px;box-shadow:0 -4px 20px rgba(0,0,0,.06);
}
.navitem{
  flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;
  text-decoration:none;color:var(--muted);font-size:10px;font-weight:600;
}
.navitem.active{color:var(--brand)}
.nav-home{position:relative}
.home-fab{
  position:absolute;top:-26px;width:58px;height:58px;border-radius:50%;
  background:linear-gradient(135deg,var(--brand),var(--brand-2));color:#fff;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 6px 18px rgba(37,99,235,.45);border:4px solid var(--surface);
}
.home-label{margin-top:34px;color:var(--brand)}

/* ====== THEME TOGGLE (night mode) — di header, di samping jam & tanggal ====== */
.appbar-right-wrap{display:flex;align-items:center;gap:10px;flex:none}
.theme-toggle{
  width:38px;height:38px;border-radius:50%;flex:none;cursor:pointer;
  border:1px solid var(--border);background:var(--surface-2);color:var(--text);
  display:flex;align-items:center;justify-content:center;transition:.15s;
}
.theme-toggle:active{transform:scale(.92)}
body.dark .theme-toggle{background:var(--surface);color:#fbbf24}

/* ====== MODAL / POPUP ====== */
.modal-overlay{
  position:fixed;inset:0;z-index:100;background:rgba(15,23,42,.55);
  display:none;align-items:flex-end;justify-content:center;
}
.modal-overlay.open{display:flex}
.modal{
  background:var(--surface);width:100%;max-width:480px;max-height:90vh;overflow-y:auto;
  border-radius:22px 22px 0 0;padding:18px;animation:slideup .25s ease;
}
@keyframes slideup{from{transform:translateY(100%)}to{transform:translateY(0)}}
.modal-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}
.modal-head h3{margin:0;font-size:17px}
.modal-close{background:var(--surface-2);border:none;border-radius:10px;width:34px;height:34px;cursor:pointer;color:var(--text);display:flex;align-items:center;justify-content:center}
.empty-state{text-align:center;color:var(--muted);padding:30px 10px;font-size:14px}

/* ====== AUTH PAGES (login/register) ====== */
.auth-wrap{width:100%;max-width:480px;min-height:100vh;display:flex;flex-direction:column;justify-content:center;padding:24px;gap:18px}
.auth-logo{width:74px;height:74px;border-radius:20px;margin:0 auto;background:linear-gradient(135deg,var(--brand),var(--brand-2));color:#fff;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:18px;box-shadow:var(--shadow-lg)}
.auth-title{text-align:center}
.auth-title h1{margin:0;font-size:24px}
.auth-title p{margin:6px 0 0;color:var(--muted);font-size:14px}
.auth-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:20px}
.auth-link{text-align:center;font-size:14px;color:var(--muted)}
.auth-link a{color:var(--brand);font-weight:700;text-decoration:none}
.alert{padding:12px 14px;border-radius:12px;font-size:13px;margin-bottom:4px}
.alert.error{background:#fee2e2;color:#991b1b}
.alert.success{background:#dcfce7;color:#166534}
.alert.info{background:var(--brand-soft);color:var(--brand-2)}

/* QRIS box */
.qris-box{text-align:center;background:var(--surface-2);border:1px dashed var(--border);border-radius:16px;padding:16px;margin:8px 0}
.qris-box img{max-width:220px;margin:0 auto;border-radius:12px}

/* tabel admin */
.admin-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:14px;display:flex;flex-direction:column;gap:10px}
.admin-card .meta{display:grid;grid-template-columns:1fr 1fr;gap:4px 12px;font-size:12.5px}
.admin-card .meta .k{color:var(--muted)}
.admin-card .actions{display:flex;flex-wrap:wrap;gap:6px}
.tag-status{font-size:11px;font-weight:700;padding:3px 9px;border-radius:999px}
.tag-status.active{background:#dcfce7;color:#166534}
.tag-status.pending{background:#fef3c7;color:#92400e}
.tag-status.inactive{background:#fee2e2;color:#991b1b}

/* invoice */
.invoice-sheet{background:#fff;color:#111;border-radius:16px;padding:22px;box-shadow:var(--shadow);font-size:13px}
body.dark .invoice-sheet{background:#fff;color:#111}
.inv-head{display:flex;justify-content:space-between;align-items:flex-start;border-bottom:2px solid #111;padding-bottom:12px;margin-bottom:12px}
.inv-head .logo{width:50px;height:50px;border-radius:10px;background:var(--brand);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:10px}
.inv-table{width:100%;border-collapse:collapse;margin:10px 0}
.inv-table th,.inv-table td{text-align:left;padding:7px 6px;border-bottom:1px solid #e5e7eb;font-size:12.5px}
.inv-table th{background:#f3f4f6}
.inv-total{display:flex;justify-content:space-between;padding:5px 0;font-size:13px}
.inv-total.grand{font-weight:800;font-size:16px;border-top:2px solid #111;padding-top:8px;margin-top:6px}

/* date range */
.range{display:flex;gap:8px;align-items:flex-end}
.range .field{flex:1;margin:0}

/* utility */
.row-between{display:flex;justify-content:space-between;align-items:center;gap:10px}
.stack{display:flex;flex-direction:column;gap:12px}
hr.div{border:none;border-top:1px solid var(--border);margin:4px 0}
.page-head{display:flex;align-items:center;gap:10px;margin-bottom:4px}
.page-head a.back{color:var(--text);display:flex}
.page-head h2{margin:0;font-size:18px}

/* durasi hari di form order */
.days-pill{background:var(--brand-soft);color:var(--brand);border-radius:10px;padding:8px 12px;font-size:13px;margin-bottom:12px;font-weight:600}

/* blok Detail Pesanan (laporan & invoice) */
.detail-block{background:var(--surface-2);border:1px solid var(--border);border-radius:12px;padding:10px 12px;margin-top:2px}
.detail-title{font-size:12px;font-weight:800;color:var(--muted);text-transform:uppercase;letter-spacing:.4px;margin-bottom:6px}
.detail-row{display:flex;justify-content:space-between;gap:12px;font-size:13px;padding:3px 0}
.detail-row span{color:var(--muted)}
.detail-row b{text-align:right;font-weight:700}
.invoice-sheet .detail-block{background:#f7f8fa;border-color:#e5e7eb}
.invoice-sheet .detail-row span{color:#666}

/* swatch tema warna (settings) */
.theme-swatches{display:flex;gap:12px;flex-wrap:wrap}
.theme-swatches input{position:absolute;opacity:0;pointer-events:none}
.swatch{
  width:46px;height:46px;border-radius:12px;cursor:pointer;position:relative;
  border:3px solid transparent;box-shadow:var(--shadow);transition:.15s;
  display:flex;align-items:center;justify-content:center;
}
.swatch:active{transform:scale(.92)}
.swatch[data-c="blue"]{background:linear-gradient(135deg,#2563eb,#1d4ed8)}
.swatch[data-c="green"]{background:linear-gradient(135deg,#059669,#047857)}
.swatch[data-c="purple"]{background:linear-gradient(135deg,#7c3aed,#6d28d9)}
.swatch[data-c="orange"]{background:linear-gradient(135deg,#ea580c,#c2410c)}
.swatch[data-c="rose"]{background:linear-gradient(135deg,#e11d48,#be123c)}
.theme-swatches input:checked + .swatch{border-color:var(--text)}
.theme-swatches input:checked + .swatch::after{content:"✓";color:#fff;font-weight:900;font-size:18px}

.print-only{display:none}
.print-kop{margin-bottom:12px;font-size:13px;line-height:1.5}
.print-kop strong{font-size:17px}

@media print{
  .print-only{display:block!important}
  .appbar,.bottomnav,.theme-toggle,.fab,.no-print{display:none!important}
  body,.app,.phone{background:#fff!important}
  .app{padding:0!important}
}
