/* TirtaTrack Aquatic Control — tema frontend (Bootstrap 5 base). */
:root {
  --tt-primary: #0284c7;
  --tt-primary-dark: #0369a1;
  --tt-primary-soft: #e0f2fe;
  --tt-teal: #0d9488;
  --tt-teal-soft: #ccfbf1;
  --tt-canvas: #f0f9ff;
  --tt-card: #ffffff;
  --tt-border: #e2e8f0;
  --tt-ink: #0f172a;
  --tt-muted: #64748b;
  --tt-green: #10b981;
  --tt-green-bg: #ecfdf5;
  --tt-green-tx: #065f46;
  --tt-amber: #f59e0b;
  --tt-amber-bg: #fffbeb;
  --tt-amber-tx: #92400e;
  --tt-red: #ef4444;
  --tt-red-bg: #fef2f2;
  --tt-red-tx: #991b1b;
  --tt-blue-bg: #f0f9ff;
  --tt-blue-tx: #075985;
  --tt-radius: 16px;
}

html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--tt-canvas);
  color: var(--tt-ink);
  font-size: 14px;
}
h1, h2, h3, h4, h5, .font-head { font-family: 'Plus Jakarta Sans', sans-serif; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.tt-sidebar {
  position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 1040;
  background: #fff; border-right: 1px solid var(--tt-border);
  display: flex; flex-direction: column;
}
.tt-brand { display: flex; align-items: center; gap: .65rem; padding: 1rem 1.1rem .6rem; }
.tt-logo { height: 40px; width: 40px; object-fit: contain; border-radius: 10px; background: #fff; flex: none; }
.tt-brand .logo {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--tt-primary), var(--tt-teal));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.tt-brand strong { font-family: 'Plus Jakarta Sans'; font-size: 1.05rem; color: var(--tt-primary); display: block; line-height: 1.1; }
.tt-brand small { font-size: .62rem; letter-spacing: .12em; color: var(--tt-muted); font-weight: 600; }
.tt-session {
  margin: .4rem .9rem; padding: .5rem .7rem; border-radius: 10px;
  background: var(--tt-canvas); display: flex; align-items: center; gap: .5rem; font-size: .78rem;
}
.tt-session .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tt-teal); flex: none; }
.tt-nav { flex: 1; overflow-y: auto; padding: .4rem .9rem; }
.tt-nav .nav-cap { font-size: .68rem; font-weight: 700; letter-spacing: .1em; color: var(--tt-muted); padding: .7rem .6rem .3rem; }
.tt-nav .nav-link {
  display: flex; align-items: center; gap: .7rem; color: #334155;
  padding: .6rem .75rem; border-radius: 10px; font-weight: 500; margin-bottom: 2px;
}
.tt-nav .nav-link i { font-size: 1.1rem; }
.tt-nav .nav-link:hover { background: var(--tt-canvas); color: var(--tt-ink); }
.tt-nav .nav-link.active { background: var(--tt-primary); color: #fff; font-weight: 600; box-shadow: 0 4px 10px -2px rgba(2,132,199,.4); }
.tt-user { margin: .9rem; padding: .6rem .7rem; background: var(--tt-canvas); border-radius: 12px; display: flex; align-items: center; gap: .6rem; }
.tt-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--tt-primary); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: .85rem;
}
.tt-body { margin-left: 264px; min-height: 100vh; display: flex; flex-direction: column; }
.tt-topbar {
  position: sticky; top: 0; z-index: 1030; background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--tt-border);
  padding: .6rem 1.5rem; display: flex; align-items: center; gap: .8rem;
}
.tt-main { padding: 1.4rem 1.5rem 3rem; flex: 1; }

/* ---------- komponen ---------- */
.tt-card {
  background: var(--tt-card); border: 1px solid var(--tt-border);
  border-radius: var(--tt-radius); padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(15,23,42,.05);
}
.tt-card h5, .tt-card .card-t { font-weight: 700; }
.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  border-radius: 9999px; padding: .2rem .65rem; font-size: .72rem; font-weight: 600; white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { background: var(--tt-green-bg); color: var(--tt-green-tx); }
.pill-amber { background: var(--tt-amber-bg); color: var(--tt-amber-tx); }
.pill-red { background: var(--tt-red-bg); color: var(--tt-red-tx); }
.pill-blue { background: var(--tt-blue-bg); color: var(--tt-blue-tx); }
.pill-grey { background: #f1f5f9; color: #475569; }

.metric-label { font-size: .78rem; color: var(--tt-muted); font-weight: 500; }
.metric-value { font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.metric-unit { font-size: .9rem; color: var(--tt-muted); font-weight: 400; }
.metric-icon {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.mi-blue { background: var(--tt-primary-soft); color: var(--tt-primary); }
.mi-teal { background: var(--tt-teal-soft); color: var(--tt-teal); }
.mi-green { background: var(--tt-green-bg); color: var(--tt-green); }
.mi-amber { background: var(--tt-amber-bg); color: var(--tt-amber); }
.mi-red { background: var(--tt-red-bg); color: var(--tt-red); }

.tt-table thead th {
  background: var(--tt-canvas); border: 0; font-size: .7rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--tt-muted); padding: .7rem .8rem; white-space: nowrap;
}
.tt-table tbody td { padding: .8rem; vertical-align: middle; border-color: #f1f5f9; }
.tt-table tbody tr:hover { background: #f8fafc; }

.btn-tt { background: var(--tt-primary); border-color: var(--tt-primary); color: #fff; font-weight: 600; border-radius: 10px; }
.btn-tt:hover, .btn-tt:focus { background: var(--tt-primary-dark); border-color: var(--tt-primary-dark); color: #fff; }
.btn-tt-soft { background: var(--tt-primary-soft); color: var(--tt-primary); font-weight: 600; border-radius: 10px; border: 0; }
.btn-tt-soft:hover { background: #bae6fd; color: var(--tt-primary-dark); }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--tt-border);
  background: #fff; color: var(--tt-ink); display: inline-flex; align-items: center; justify-content: center;
}
.form-control, .form-select { border-radius: 10px; min-height: 42px; font-size: .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--tt-primary); box-shadow: 0 0 0 3px rgba(2,132,199,.15); }

/* quick action tiles */
.qa-tile {
  background: var(--tt-canvas); border-radius: 14px; padding: 1rem .6rem;
  text-align: center; text-decoration: none; color: var(--tt-ink); display: block; height: 100%;
}
.qa-tile:hover { background: var(--tt-primary-soft); color: var(--tt-ink); }
.qa-tile .qi {
  width: 44px; height: 44px; border-radius: 50%; background: #fff; margin: 0 auto .5rem;
  display: flex; align-items: center; justify-content: center; font-size: 1.25rem; color: var(--tt-primary);
  box-shadow: 0 1px 3px rgba(15,23,42,.08);
}
.qa-tile b { display: block; font-size: .8rem; }
.qa-tile small { color: var(--tt-muted); font-size: .7rem; }

/* feed */
.feed-item { display: flex; gap: .5rem; padding: .6rem .8rem; background: var(--tt-canvas); border-radius: 12px; margin-bottom: .5rem; }
.feed-item:last-child { margin-bottom: 0; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tt-teal); }

/* ---------- POS kasir ---------- */
.pos-cat { border-radius: 10px; font-weight: 600; font-size: .82rem; }
.pos-cat.active { background: var(--tt-primary); color: #fff; }
.tiket-card { background: #fff; border: 1px solid var(--tt-border); border-radius: 14px; padding: 1rem; height: 100%; }
.qty-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--tt-border);
  background: #fff; font-size: 1.1rem; line-height: 1; color: var(--tt-ink);
}
.qty-btn.plus { background: var(--tt-primary); border-color: var(--tt-primary); color: #fff; }
.qty-val { min-width: 26px; text-align: center; font-weight: 700; font-size: 1.05rem; }
.pay-opt { border: 1.5px solid var(--tt-border); border-radius: 12px; padding: .7rem; cursor: pointer; text-align: center; font-weight: 600; }
.pay-opt.active { border-color: var(--tt-primary); background: var(--tt-primary); color: #fff; }
.pay-opt.active small { color: #e0f2fe !important; }

/* ---------- scan ---------- */
.scan-frame {
  position: relative; border-radius: 20px; overflow: hidden; background: #0f172a;
  min-height: 340px; display: flex; align-items: center; justify-content: center;
  background-image: radial-gradient(circle at 50% 30%, rgba(2,132,199,.35), transparent 70%);
}
.scan-corner { position: absolute; width: 52px; height: 52px; border: 4px solid #38bdf8; }
.sc-tl { top: 18px; left: 18px; border-right: 0; border-bottom: 0; border-radius: 12px 0 0 0; }
.sc-tr { top: 18px; right: 18px; border-left: 0; border-bottom: 0; border-radius: 0 12px 0 0; }
.sc-bl { bottom: 18px; left: 18px; border-right: 0; border-top: 0; border-radius: 0 0 0 12px; }
.sc-br { bottom: 18px; right: 18px; border-left: 0; border-top: 0; border-radius: 0 0 12px 0; }
.scan-line { position: absolute; left: 12%; right: 12%; height: 3px; background: #38bdf8; box-shadow: 0 0 18px #38bdf8; animation: scanmove 2.4s ease-in-out infinite; }
@keyframes scanmove { 0%,100% { top: 22%; } 50% { top: 72%; } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.keypad button {
  border: 0; border-radius: 12px; background: var(--tt-canvas); font-size: 1.3rem;
  font-weight: 600; padding: .8rem 0; color: var(--tt-ink);
}
.keypad button:hover { background: var(--tt-primary-soft); }
.keypad button.go { background: var(--tt-primary); color: #fff; }
#reader video { border-radius: 14px; }
#reader__dashboard_section, #reader__header_message { display: none !important; }
.result-banner { border-radius: 16px; padding: 1rem 1.2rem; display: flex; align-items: center; gap: .9rem; }
.result-ok { background: #a7f3d0; }
.result-exp { background: #fecaca; }

/* bottom nav (mobile) */
.tt-bottomnav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1040;
  background: #fff; border-top: 1px solid var(--tt-border); padding: .4rem .2rem calc(.4rem + env(safe-area-inset-bottom));
}
.tt-bottomnav a {
  flex: 1; text-align: center; text-decoration: none; color: var(--tt-muted);
  font-size: .66rem; font-weight: 600; padding: .2rem;
}
.tt-bottomnav a i { display: block; font-size: 1.3rem; }
.tt-bottomnav a.active { color: var(--tt-primary); }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background: radial-gradient(1000px 500px at 80% -10%, #bae6fd 0%, transparent 60%), radial-gradient(800px 500px at 10% 110%, #99f6e4 0%, transparent 55%), var(--tt-canvas); }
.login-card { background: #fff; border-radius: 24px; border: 1px solid var(--tt-border); max-width: 920px; width: 100%; overflow: hidden; }

@media (max-width: 991.98px) {
  .tt-sidebar { transform: translateX(-100%); transition: transform .25s; }
  .tt-sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .tt-body { margin-left: 0; }
  .tt-main { padding: 1rem 1rem 6rem; }
  .tt-bottomnav { display: flex; }
  .tt-topbar { padding: .6rem 1rem; }
}

/* nav-pills TirtaTrack (tab kasir & master) */
.nav-pills .nav-link { color: var(--tt-ink); font-weight: 600; border-radius: 10px; }
.nav-pills .nav-link.active { background: var(--tt-primary); }

/* cetak laporan */
@media print {
  .tt-sidebar, .tt-topbar, .tt-bottomnav, .no-print { display: none !important; }
  .tt-body { margin-left: 0; }
  .tt-main { padding: 0; }
  body { background: #fff; }
  .tt-card { box-shadow: none; }
}
