/* =====================================================================
   DTF BY BERANDA — tema "glass" (kaca buram) modern
   Latar gradasi biru bercahaya + panel kaca tembus pandang (backdrop blur).
   ===================================================================== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-darker: #0b2a6f;
  --primary-light: rgba(37, 99, 235, .10);
  --brand: #00359e;

  --bg: #eaf0fb;
  --glass: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .80);
  --glass-soft: rgba(255, 255, 255, .38);
  --glass-border: rgba(255, 255, 255, .72);
  --blur: saturate(170%) blur(18px);

  --white: #ffffff;
  --text: #0f1b33;
  --text-muted: #5d6b85;
  --border: rgba(15, 40, 90, .09);

  --success: #0f9f5a;
  --success-bg: rgba(16, 185, 105, .13);
  --warning: #b86e00;
  --warning-bg: rgba(245, 158, 11, .16);
  --danger: #dc2f45;
  --danger-bg: rgba(239, 68, 90, .12);

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 10px 36px rgba(20, 50, 130, .10), 0 1px 2px rgba(20, 50, 130, .05);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased;
}
body { background: var(--bg); }
/* Latar bercahaya (fixed, aman di iOS karena pakai pseudo-element) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(700px 520px at 8% -8%, rgba(37, 99, 235, .30), transparent 62%),
    radial-gradient(640px 520px at 105% 8%, rgba(6, 182, 212, .20), transparent 60%),
    radial-gradient(760px 620px at 70% 115%, rgba(99, 102, 241, .20), transparent 60%),
    linear-gradient(160deg, #e8f0ff 0%, #f4f7ff 48%, #e7eefc 100%);
}
h1, h2, h3, h4 { margin: 0 0 4px; letter-spacing: -.01em; }
p { margin: 0; }
button { font-family: inherit; }
[hidden] { display: none !important; }

/* Ikon garis minimalis (sprite <symbol> di index.html) */
.ic {
  width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: -3px;
  stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.ic-lg { width: 18px; height: 18px; }

/* ---------- Login ---------- */
#loginScreen {
  position: fixed; inset: 0; z-index: 500; padding: 16px;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(520px 420px at 15% 15%, rgba(96, 165, 250, .55), transparent 60%),
    radial-gradient(520px 460px at 90% 85%, rgba(34, 211, 238, .35), transparent 60%),
    radial-gradient(600px 500px at 80% 10%, rgba(129, 140, 248, .40), transparent 60%),
    linear-gradient(150deg, #06205f 0%, #00359e 55%, #1d4ed8 100%);
}
.login-card {
  width: 340px; max-width: 100%; text-align: center; padding: 36px 30px 30px;
  border-radius: 26px; color: #fff;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .28);
  box-shadow: 0 24px 60px rgba(2, 12, 45, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.login-logo {
  width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 16px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .18); color: #fff; font-weight: 800; font-size: 20px;
  box-shadow: 0 10px 28px rgba(0, 20, 80, .35), 0 0 0 1px rgba(255, 255, 255, .3);
}
.login-logo img, .brand-badge img { width: 100%; height: 100%; object-fit: cover; }
.login-card h1 { font-size: 19px; color: #fff; }
.login-card .tagline { color: rgba(255, 255, 255, .72); font-size: 12.5px; margin-bottom: 22px; }
.login-card input {
  width: 100%; text-align: center; letter-spacing: 8px; font-size: 22px; padding: 13px;
  border-radius: 14px; margin-bottom: 12px; color: #0f1b33;
  background: rgba(255, 255, 255, .92); border: 1px solid rgba(255, 255, 255, .6);
}
.login-card input::placeholder { color: #94a3b8; letter-spacing: 6px; }
.login-card .btn-primary { background: #fff; color: var(--brand); box-shadow: 0 8px 22px rgba(0, 10, 50, .3); }
.login-card .btn-primary:hover { background: #eef4ff; }
.login-error { color: #ffd1d7; font-size: 12.5px; min-height: 16px; margin-bottom: 8px; }

.logo-upload-row { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.logo-preview {
  width: 60px; height: 60px; border-radius: 16px; flex-shrink: 0; overflow: hidden;
  background: var(--brand); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 53, 158, .25);
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- App shell ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; top: 12px; bottom: 12px; left: 12px; width: 228px; z-index: 300;
  display: flex; flex-direction: column; padding: 18px 0 14px; overflow-y: auto; color: #fff;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(6, 28, 88, .86), rgba(0, 53, 158, .80));
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 18px 50px rgba(6, 28, 88, .28);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 18px 18px; }
.brand-badge {
  width: 42px; height: 42px; border-radius: 13px; overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 800;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .22);
}
.brand-name { font-weight: 700; font-size: 14px; line-height: 1.25; }
.brand-name small { display: block; font-weight: 400; opacity: .65; font-size: 10.5px; margin-top: 2px; }
.nav { list-style: none; margin: 6px 0; padding: 0; flex: 1; }
.nav li { margin: 2px 10px; }
.nav button {
  width: 100%; display: flex; align-items: center; gap: 11px; text-align: left;
  background: transparent; border: 1px solid transparent; color: rgba(255, 255, 255, .72);
  padding: 10px 12px; border-radius: 12px; cursor: pointer; font-size: 13.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav button.active {
  background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600;
  border-color: rgba(255, 255, 255, .20);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 4px 14px rgba(0, 10, 40, .18);
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-footer { padding: 12px 16px 0; margin: 0 4px; border-top: 1px solid rgba(255, 255, 255, .10); }
.logout-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); color: #fff;
  padding: 9px; border-radius: 12px; cursor: pointer; font-size: 12.5px;
}
.logout-btn:hover { background: rgba(255, 255, 255, .16); }

.main { margin-left: 252px; flex: 1; padding: 12px 22px 60px 8px; min-width: 0; }
.topbar {
  position: sticky; top: 12px; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 18px; padding: 10px 12px 10px 18px; border-radius: 18px;
  background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar h2 { font-size: 18px; font-weight: 700; color: var(--text); margin: 0; }
.topbar .date {
  color: var(--text-muted); font-size: 12px; text-align: right; padding: 6px 12px;
  background: var(--glass-soft); border-radius: 999px; border: 1px solid var(--border); white-space: nowrap;
}
.menu-btn {
  display: none; width: 38px; height: 38px; border-radius: 12px; cursor: pointer; flex-shrink: 0;
  align-items: center; justify-content: center; color: var(--text);
  background: var(--glass-soft); border: 1px solid var(--border);
}
.menu-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
.nav-overlay { display: none; }
.page { display: none; animation: fadeUp .22s ease; }
.page.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Layar HP: sidebar jadi panel kaca yang digeser masuk */
@media (max-width: 820px) {
  .sidebar { transform: translateX(calc(-100% - 24px)); transition: transform .22s ease; }
  #app.nav-open .sidebar { transform: none; }
  #app.nav-open .nav-overlay {
    display: block; position: fixed; inset: 0; z-index: 250;
    background: rgba(8, 20, 55, .30); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  }
  .main { margin-left: 0; padding: 10px 12px 60px; }
  .topbar { top: 8px; padding: 8px 10px; border-radius: 16px; }
  .menu-btn { display: inline-flex; }
  .topbar h2 { font-size: 16px; }
  .topbar .date { font-size: 10.5px; padding: 5px 9px; }
}

/* ---------- Komponen ---------- */
.card {
  padding: 20px; margin-bottom: 16px; border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.card h3 {
  font-size: 14.5px; font-weight: 650; color: var(--text); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.card h3 > .ic { color: var(--primary); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }
.stat-grid .card { margin-bottom: 0; }
.stat-grid + * { margin-top: 16px; }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; } .stat-card .value { font-size: 18px !important; } .card { padding: 16px; } }
.stat-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; position: relative; overflow: hidden; }
.stat-card::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, .16), transparent 70%); pointer-events: none;
}
.stat-card .label { color: var(--text-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat-card .value { font-size: 24px; font-weight: 750; color: var(--text); letter-spacing: -.02em; overflow-wrap: anywhere; }
.stat-card .sub { font-size: 11.5px; color: var(--text-muted); }

label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin: 12px 0 5px; }
label:first-child { margin-top: 0; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; font-family: inherit;
  color: var(--text); background: rgba(255, 255, 255, .72); border: 1px solid rgba(15, 40, 90, .12);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; background: #fff; border-color: rgba(37, 99, 235, .55); box-shadow: 0 0 0 4px rgba(37, 99, 235, .14);
}
input[type=checkbox] { width: auto; accent-color: var(--primary); }
textarea { resize: vertical; min-height: 60px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
  font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: transform .08s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  color: #fff; background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 55%, #00359e 100%);
  box-shadow: 0 8px 20px rgba(29, 78, 216, .28), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:hover { box-shadow: 0 10px 26px rgba(29, 78, 216, .38), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn-secondary { background: rgba(37, 99, 235, .10); color: var(--primary-dark); border-color: rgba(37, 99, 235, .14); }
.btn-secondary:hover { background: rgba(37, 99, 235, .16); }
.btn-ghost { background: rgba(255, 255, 255, .55); color: var(--text); border-color: rgba(15, 40, 90, .10); }
.btn-ghost:hover { background: rgba(255, 255, 255, .85); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(220, 47, 69, .14); }
.btn-danger:hover { background: rgba(239, 68, 90, .18); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
thead th {
  text-align: left; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(37, 99, 235, .05); }
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.muted { color: var(--text-muted); }
.empty-row td { text-align: center; color: var(--text-muted); padding: 26px; }
.empty-row:hover { background: transparent !important; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.icon-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; cursor: pointer; color: var(--text-muted);
  border-radius: 10px; transition: background .12s, color .12s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .8); border-color: var(--border); color: var(--primary); }
.icon-btn.danger:hover { color: var(--danger); }
.toolbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .field { flex: 1; min-width: 140px; }
.toolbar label { margin: 0 0 5px; }
.toolbar h3 { margin-bottom: 0 !important; }

/* ---------- Kasir ---------- */
.kasir-cabang-bar { display: flex; align-items: center; margin-bottom: 10px; font-size: 13px; font-weight: 600; color: var(--text); }
.kasir-cabang-bar .field { display: inline-block; min-width: 220px; }
.kasir-jump { margin-bottom: 14px; }
.kasir-jump a {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; text-decoration: none;
  padding: 8px 14px; border-radius: 999px; color: var(--primary-dark);
  background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.kasir-jump a:hover { background: var(--glass-strong); }
.kasir-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
.kasir-layout .card { margin-bottom: 0; }
@media (max-width: 1050px) { .kasir-layout { grid-template-columns: 1fr; } }
.kasir-layout .card-full { grid-column: 1 / -1; }
.add-item-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 10px; align-items: end; }
@media (max-width: 560px) { .add-item-row { grid-template-columns: 1fr 1fr; } .add-item-row > div:first-child { grid-column: 1 / -1; } }
.summary-line { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13.5px; }
.summary-line.total {
  font-size: 19px; font-weight: 750; color: var(--text); letter-spacing: -.01em;
  border-top: 1px dashed rgba(15, 40, 90, .16); margin-top: 8px; padding-top: 12px;
}
.summary-line .lbl { color: var(--text-muted); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 400; padding: 16px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 20, 55, .32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fadeIn .15s ease;
}
.modal {
  width: 480px; max-width: 100%; max-height: 88vh; overflow-y: auto; padding: 24px; border-radius: 24px;
  background: rgba(255, 255, 255, .86); border: 1px solid var(--glass-border);
  box-shadow: 0 30px 80px rgba(8, 20, 55, .30);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  animation: popIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal.modal-lg { width: 640px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.modal-header h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.modal-header h3 .ic { color: var(--success); width: 20px; height: 20px; }
.modal-close {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(15, 40, 90, .05); border: none; cursor: pointer; color: var(--text-muted);
}
.modal-close:hover { background: rgba(15, 40, 90, .10); color: var(--text); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 600;
  padding: 12px 20px; border-radius: 14px; font-size: 13px; color: #fff; max-width: 90vw;
  background: rgba(11, 30, 80, .88); border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 14px 40px rgba(8, 20, 55, .30);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  opacity: 0; pointer-events: none; transition: all .25s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: rgba(200, 30, 55, .90); }

/* ---------- Target harian ---------- */
.target-card { display: flex; flex-direction: column; gap: 10px; }
.target-card .target-top { display: flex; justify-content: space-between; align-items: baseline; }
.target-card .target-pct { font-size: 30px; font-weight: 750; letter-spacing: -.02em; color: var(--text); }
.target-card .target-nums { font-size: 12.5px; color: var(--text-muted); }
.target-track { background: rgba(15, 40, 90, .08); border-radius: 999px; height: 12px; overflow: hidden; }
.target-fill {
  height: 100%; border-radius: 999px; transition: width .4s ease;
  background: linear-gradient(90deg, #60a5fa, #2563eb 60%, #00359e);
  box-shadow: 0 0 12px rgba(37, 99, 235, .45);
}
.target-fill.reached { background: linear-gradient(90deg, #34d399, #10b981, #047857); box-shadow: 0 0 12px rgba(16, 185, 129, .45); }
.target-note { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }

/* ---------- Laporan (bar omzet harian) ---------- */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.bar-label { width: 90px; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.bar-track { flex: 1; background: rgba(15, 40, 90, .07); border-radius: 8px; height: 16px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 8px; background: linear-gradient(90deg, #60a5fa, #2563eb); }
.bar-value { width: 96px; text-align: right; font-size: 12px; font-weight: 700; flex-shrink: 0; }

/* Perangkat yang meminta transparansi dikurangi: panel dibuat solid */
@media (prefers-reduced-transparency: reduce) {
  .card, .topbar, .modal, .kasir-jump a { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---------- Nota / print ---------- */
#notaPrint { display: none; }
.nota-box { width: 300px; margin: 0 auto; font-family: 'Courier New', monospace; font-size: 12px; color: #000; }
.nota-box .center { text-align: center; }
.nota-box hr { border: none; border-top: 1px dashed #000; margin: 8px 0; }
.nota-box table { font-size: 11.5px; border-collapse: collapse; }
.nota-box td { padding: 2px 0; border: none; }
@media print {
  body::before { display: none; }
  body { background: #fff; }
  body * { visibility: hidden; }
  #notaPrint, #notaPrint * { visibility: visible; }
  #notaPrint { display: block; position: absolute; top: 0; left: 0; width: 100%; }
}
