:root {
  --ink: #0B2B26;
  --teal-900: #0F3D3A;
  --teal-700: #14746A;
  --teal-600: #17877A;
  --teal-500: #1DA492;
  --foam: #EAF6F3;
  --paper: #F7FBFA;
  --white: #FFFFFF;
  --amber: #E8A33D;
  --amber-dark: #C9821F;
  --red: #D14343;
  --red-bg: #FCEAEA;
  --green-bg: #E7F6EE;
  --line: #DCEAE7;
  --muted: #5C7B76;
  --shadow: 0 8px 24px rgba(15, 61, 58, 0.10);
  --radius: 16px;
  --radius-sm: 10px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  touch-action: manipulation;
}

h1, h2, h3, h4 { font-family: 'Fraunces', Georgia, serif; margin: 0; font-weight: 600; }

button { font-family: inherit; }

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--teal-900);
  color: var(--white);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}
.topbar .back {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: none;
  color: var(--white);
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.topbar .title { flex: 1; }
.topbar .title h1 { font-size: 18px; color: var(--white); }
.topbar .title span { font-size: 12px; opacity: .75; display:block; margin-top:2px;}
.topbar .kasir-badge {
  font-size: 11px;
  background: rgba(255,255,255,0.14);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.content { flex: 1; padding: 16px; padding-bottom: 90px; }

/* ---------- Login (PIN) ---------- */
.login-screen {
  min-height: 100vh;
  background: radial-gradient(circle at 30% 0%, var(--teal-700), var(--teal-900) 70%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--white); padding: 24px;
  text-align: center;
}
.login-screen .brand-mark {
  width: 64px; height: 64px; border-radius: 20px;
  background: var(--amber);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-size: 30px; color: var(--teal-900); font-weight: 700;
  margin-bottom: 18px;
  transform: rotate(-4deg);
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.login-screen h1 { font-size: 26px; color: var(--white); margin-bottom: 4px; }
.login-screen p.sub { opacity: .8; font-size: 14px; margin-bottom: 32px; }

.pin-dots { display: flex; gap: 14px; justify-content: center; margin-bottom: 28px; }
.pin-dots span {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5);
  transition: all .15s;
}
.pin-dots span.filled { background: var(--amber); border-color: var(--amber); }
.pin-dots.error span { border-color: var(--red); background: var(--red); }

.pin-pad {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px; width: 100%; max-width: 300px;
}
.pin-pad button {
  aspect-ratio: 1; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: var(--white); font-size: 24px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.pin-pad button:active { background: rgba(255,255,255,.22); }
.pin-pad button.ghost { background: transparent; border: none; font-size: 14px; }
.login-error { color: #FFB4B4; font-size: 13px; height: 18px; margin-bottom: 6px; }

/* ---------- Dashboard ---------- */
.dash-header {
  background: linear-gradient(160deg, var(--teal-700), var(--teal-900));
  color: var(--white);
  padding: 22px 20px 30px;
  border-radius: 0 0 28px 28px;
}
.dash-header .greet { font-size: 13px; opacity: .8; }
.dash-header h1 { color: var(--white); font-size: 24px; margin-top: 2px; }
.dash-header .shift-pill {
  margin-top: 14px;
  background: rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  display: flex; justify-content: space-between; align-items: center;
}
.dash-header .shift-pill.off { background: rgba(232,163,61,.18); }
.dash-header .shift-pill b { display:block; font-size: 16px; font-family:'Fraunces', serif; margin-top:2px;}

.menu-grid {
  display: grid;
  gap: 14px;
  padding: 20px 18px;
  margin-top: -14px;
}
.menu-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--line);
}
.menu-card .icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.menu-card .icon.a { background: var(--foam); color: var(--teal-700); }
.menu-card .icon.b { background: #FDF1DD; color: var(--amber-dark); }
.menu-card .icon.c { background: #E9F0FF; color: #3554C9; }
.menu-card .text h3 { font-size: 16px; }
.menu-card .text p { font-size: 12.5px; color: var(--muted); margin: 3px 0 0; }

.logout-link {
  text-align: center; padding: 6px 0 24px;
}
.logout-link button {
  background: none; border: none; color: var(--red); font-size: 13px;
}

/* ---------- Buttons ---------- */
.btn {
  display: block; width: 100%;
  padding: 15px; border-radius: var(--radius-sm);
  border: none; font-size: 15px; font-weight: 600;
  text-align: center; cursor: pointer;
}
.btn-primary { background: var(--teal-700); color: var(--white); }
.btn-primary:active { background: var(--teal-900); }
.btn-amber { background: var(--amber); color: var(--teal-900); }
.btn-outline { background: var(--white); border: 1.5px solid var(--teal-700); color: var(--teal-700); }
.btn-ghost { background: var(--foam); color: var(--teal-700); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn:disabled { opacity: .45; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600;}
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); font-size: 15px; background: var(--white);
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--teal-600);
}
.helper { font-size: 12px; color: var(--muted); margin-top: 4px; }

.card { background: var(--white); border-radius: var(--radius); padding: 16px; border: 1px solid var(--line); margin-bottom: 14px; }
.card h3 { font-size: 15px; margin-bottom: 12px; }

/* ---------- Customer search dropdown ---------- */
.search-wrap { position: relative; }
.result-list {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-top: 6px; box-shadow: var(--shadow); z-index: 10; max-height: 220px; overflow-y: auto;
}
.result-item { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.result-item:last-child { border-bottom: none; }
.result-item b { display: block; font-size: 14px; }
.result-item span { font-size: 12px; color: var(--muted); }
.result-item.add-new { color: var(--teal-700); font-weight: 600; }

.selected-customer {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--foam); border-radius: var(--radius-sm); padding: 12px 14px;
}
.selected-customer b { font-size: 14px; display:block; }
.selected-customer span { font-size: 12px; color: var(--muted); }
.selected-customer button { background: none; border: none; color: var(--teal-700); font-size: 12px; font-weight:600; }

/* ---------- Service grid ---------- */
.service-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.service-btn {
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 12px; text-align: left;
}
.service-btn.active { border-color: var(--teal-600); background: var(--foam); }
.service-btn b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.service-btn span { font-size: 12px; color: var(--muted); }

.item-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 10px;
}
.item-row .info { flex: 1; }
.item-row .info b { font-size: 13.5px; display:block; }
.item-row .info span { font-size: 12px; color: var(--muted); }
.item-row input {
  width: 64px; padding: 8px; border-radius: 8px; border: 1.5px solid var(--line);
  text-align: center; font-size: 15px;
}
.item-row .subtotal { font-size: 13px; font-weight: 700; min-width: 78px; text-align: right; }
.item-row .remove { background: none; border: none; color: var(--red); font-size: 18px; padding: 0 2px; }

.total-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 520px; margin: 0 auto;
  background: var(--white); border-top: 1px solid var(--line);
  padding: 14px 16px; box-shadow: 0 -8px 20px rgba(0,0,0,.05);
  z-index: 15;
}
.total-bar .row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.total-bar .row span { font-size: 13px; color: var(--muted); }
.total-bar .row b { font-size: 22px; font-family: 'Fraunces', serif; color: var(--teal-900); }

.toggle-row { display: flex; gap: 10px; }
.toggle-btn {
  flex: 1; padding: 12px; border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  background: var(--white); font-size: 13.5px; font-weight: 600; color: var(--muted);
}
.toggle-btn.active.lunas { background: var(--green-bg); border-color: #3E9C6F; color: #256B45; }
.toggle-btn.active.belum { background: #FDF1DD; border-color: var(--amber-dark); color: var(--amber-dark); }
.toggle-btn.active.method { background: var(--foam); border-color: var(--teal-600); color: var(--teal-700); }

/* ---------- Tabs (daftar nota) ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab { flex: 1; text-align: center; padding: 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--white); border: 1.5px solid var(--line); color: var(--muted); }
.tab.active { background: var(--teal-700); border-color: var(--teal-700); color: var(--white); }

.nota-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px;
}
.nota-card .top-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.nota-card .no-nota { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.nota-card .cust-name { font-size: 16px; margin-top: 2px; }
.nota-card .amount { font-size: 17px; font-weight: 700; color: var(--teal-900); font-family: 'Fraunces', serif;}
.badge { display: inline-block; font-size: 11px; padding: 4px 9px; border-radius: 999px; font-weight: 700; }
.badge.lunas { background: var(--green-bg); color: #256B45; }
.badge.belum { background: #FDF1DD; color: var(--amber-dark); }
.badge.selesai { background: var(--foam); color: var(--teal-700); }
.nota-card .meta { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state .emoji { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ---------- Shift screen ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat-box { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.stat-box span { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.stat-box b { font-size: 18px; font-family: 'Fraunces', serif; }
.stat-box.highlight { background: var(--teal-900); border-color: var(--teal-900); }
.stat-box.highlight span { color: rgba(255,255,255,.7); }
.stat-box.highlight b { color: var(--white); }

.expense-item { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.expense-item:last-child { border-bottom: none; }
.expense-item span.time { color: var(--muted); font-size: 11.5px; display:block; }

/* ---------- Modal / sheet ---------- */
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(11,43,38,.45);
  z-index: 50; display: flex; align-items: flex-end;
}
.sheet {
  background: var(--paper); width: 100%; max-width: 520px; margin: 0 auto;
  border-radius: 22px 22px 0 0; padding: 20px; max-height: 88vh; overflow-y: auto;
  animation: slideUp .2s ease-out;
}
@keyframes slideUp { from { transform: translateY(30px); opacity:0; } to { transform: translateY(0); opacity:1; } }
.sheet h2 { font-size: 18px; margin-bottom: 16px; }
.sheet .close-x { position: absolute; top: 16px; right: 16px; background: var(--line); border: none; width: 30px; height: 30px; border-radius: 50%; }

.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: var(--teal-900); color: var(--white); padding: 12px 20px; border-radius: 999px;
  font-size: 13.5px; z-index: 100; box-shadow: var(--shadow);
  max-width: 90%; text-align: center;
}
.toast.err { background: var(--red); }

/* nota print preview */
.nota-print {
  background: var(--white); border-radius: var(--radius); padding: 18px;
  font-family: 'Courier New', monospace; font-size: 13px; border: 1px dashed var(--line);
}
.nota-print .center { text-align: center; }
.nota-print hr { border: none; border-top: 1px dashed #999; margin: 10px 0; }
.nota-print .line { display: flex; justify-content: space-between; margin-bottom: 3px; }

.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--teal-700); border-radius: 50%; animation: spin .7s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Owner: nav tabs on dashboard header ---------- */
.owner-tabs { display: flex; gap: 8px; margin-top: 16px; }
.owner-tab {
  flex: 1; text-align: center; padding: 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: rgba(255,255,255,.10); color: rgba(255,255,255,.75); text-decoration: none;
}
.owner-tab.active { background: var(--amber); color: var(--teal-900); }

/* ---------- Owner: 7-day bar chart ---------- */
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; }
.chart-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.chart-bar-wrap { flex: 1; display: flex; align-items: flex-end; width: 100%; }
.chart-bar { width: 100%; background: linear-gradient(180deg, var(--teal-500), var(--teal-700)); border-radius: 6px 6px 2px 2px; min-height: 4px; }
.chart-bar-col span { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ---------- Owner: P&L rows ---------- */
.pnl-row { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; font-size: 14px; }
.pnl-row span { color: var(--muted); }
.pnl-row b { font-weight: 700; }
.pnl-row.minus b { color: var(--red); }
.pnl-row.total { border-top: 2px solid var(--teal-900); margin-top: 4px; padding-top: 12px; font-size: 16px; }
.pnl-row.total b { color: var(--teal-900); font-family: 'Fraunces', serif; font-size: 20px; }
