:root {
  --bg: #f6f7fb; --card: #ffffff; --ink: #17181c; --muted: #7a7f8c;
  --line: #ececf1; --green: #b9f26b; --green-dark: #8ed83c; --accent: #f5793b;
  --dark: #141419; --dark-2: #1e1f26; --danger: #ef4444; --ok: #22c55e; --warn: #f59e0b;
  --radius: 18px; --shadow: 0 8px 24px rgba(23, 24, 28, .06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14.5px;
  -webkit-tap-highlight-color: transparent;
}
#app { min-height: 100vh; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea {
  font-family: inherit; font-size: 14.5px; padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: 12px; background: #fff; width: 100%; color: var(--ink); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--green-dark); }
label { font-size: 12.5px; color: var(--muted); font-weight: 600; display: block; margin: 10px 0 5px; }

/* ===== LOGIN ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #fdf2f6 0%, #eef7e8 100%); padding: 20px;
}
.login-card { background: #fff; border-radius: 24px; padding: 32px; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-card .logo { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 18px; }
.logo-dot { width: 34px; height: 34px; border-radius: 50%; background: conic-gradient(var(--green) 0 65%, var(--dark) 65% 100%); }
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.login-card p.sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* ===== LAYOUT ===== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 235px; background: var(--dark); color: #cfd2dc; padding: 18px 14px;
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
  transition: transform .25s ease;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; color: #fff; font-weight: 800; font-size: 17px; }
.sidebar nav { flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 11px 12px; border-radius: 12px; color: #cfd2dc; font-size: 14px; font-weight: 600;
  margin-bottom: 2px;
}
.nav-item .ico { width: 21px; text-align: center; font-size: 15px; }
.nav-item:hover { background: var(--dark-2); color: #fff; }
.nav-item.active { background: #fff; color: var(--ink); }
.nav-item .chev { margin-left: auto; opacity: .5; font-size: 12px; }
.nav-sec { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #5c5f6e; padding: 14px 12px 6px; }
.main { flex: 1; margin-left: 235px; padding: 22px 26px 90px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar h1 { font-size: 23px; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.hamburger { display: none; }

/* ===== COMPONENTS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 12px;
  font-weight: 700; font-size: 13.5px; background: var(--dark); color: #fff; transition: .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn.green { background: var(--green); color: #14330a; }
.btn.ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn.danger { background: #fee2e2; color: #b91c1c; }
.btn.sm { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
.btn.block { width: 100%; justify-content: center; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.stat { border-radius: var(--radius); padding: 16px 18px; background: #fff; box-shadow: var(--shadow); }
.stat.hl { background: var(--green); color: #14330a; }
.stat .t { font-size: 13px; font-weight: 700; display: flex; gap: 8px; align-items: center; }
.stat .v { font-size: 24px; font-weight: 800; margin-top: 8px; letter-spacing: -.02em; }
.stat .s { font-size: 11.5px; margin-top: 6px; opacity: .75; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill.ok { background: #dcfce7; color: #15803d; }
.pill.warn { background: #fef3c7; color: #b45309; }
.pill.bad { background: #fee2e2; color: #b91c1c; }
.pill.info { background: #e0e7ff; color: #4338ca; }
.pill.gray { background: #f1f2f6; color: #555a68; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 9px 10px; border-bottom: 1.5px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }
.rowflex { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.right { text-align: right; }

/* POS */
.pos-wrap { display: grid; grid-template-columns: 1fr 340px; gap: 16px; }
.pos-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pos-item { background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; text-align: left; transition: .12s; }
.pos-item:hover { border-color: var(--green-dark); transform: translateY(-2px); }
.pos-item .nm { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.pos-item .pr { color: var(--green-dark); font-weight: 800; font-size: 13.5px; }
.pos-item .st { font-size: 11px; color: var(--muted); margin-top: 3px; }
.cart { position: sticky; top: 16px; }
.cart-line { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cart-line .n { flex: 1; font-size: 13px; font-weight: 600; }
.qty-btn { width: 26px; height: 26px; border-radius: 8px; background: #f1f2f6; font-weight: 800; }
.total-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.total-row.grand { font-size: 18px; font-weight: 800; border-top: 2px solid var(--ink); margin-top: 8px; padding-top: 10px; }

/* Status service */
.status-badge { padding: 4px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.st-antri { background: #fef3c7; color: #b45309; }
.st-proses { background: #dbeafe; color: #1d4ed8; }
.st-selesai { background: #dcfce7; color: #15803d; }
.st-diambil { background: #f1f2f6; color: #555a68; }
.st-batal { background: #fee2e2; color: #b91c1c; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 16, 20, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 20px; padding: 22px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal h2 { font-size: 17px; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* Toast */
#toast-wrap { position: fixed; top: 14px; right: 14px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--dark); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 600; box-shadow: 0 8px 20px rgba(0,0,0,.2); animation: slideIn .25s ease; max-width: 320px; }
.toast.err { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Chat AI */
.ai-fab {
  position: fixed; right: 18px; bottom: 18px; width: 56px; height: 56px; border-radius: 50%;
  background: var(--green); color: #14330a; font-size: 24px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(142, 216, 60, .45); z-index: 90;
}
.ai-panel {
  position: fixed; right: 0; bottom: 0; top: 0; width: 400px; max-width: 100vw; background: #fff; z-index: 110;
  display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.15);
}
.ai-head { background: var(--dark); color: #fff; padding: 14px 18px; display: flex; align-items: center; gap: 10px; }
.ai-head .t { font-weight: 800; flex: 1; }
.ai-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #f6f7fb; }
.ai-msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; }
.ai-msg.user { align-self: flex-end; background: var(--green); color: #14330a; border-bottom-right-radius: 4px; font-weight: 600; }
.ai-msg.bot { align-self: flex-start; background: #fff; border: 1.5px solid var(--line); border-bottom-left-radius: 4px; }
.ai-msg .act { margin-top: 8px; font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px; }
.ai-input { display: flex; gap: 8px; padding: 12px; border-top: 1.5px solid var(--line); }
.ai-input input { flex: 1; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px 8px; }
.chip { font-size: 11.5px; background: #f1f2f6; border-radius: 999px; padding: 6px 11px; font-weight: 600; color: #444; }

/* Chart sederhana */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 10px; }
.bars .bar { flex: 1; background: var(--accent); border-radius: 8px 8px 4px 4px; min-height: 4px; position: relative; }
.bars .bar span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 9.5px; color: var(--muted); }

/* FAB & bottom-nav mobile */
.fab-wrap { position: fixed; right: 18px; bottom: 80px; display: flex; flex-direction: column; gap: 10px; z-index: 80; }
.fab { width: 52px; height: 52px; border-radius: 50%; background: var(--dark); color: #fff; font-size: 20px; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.fab.green { background: var(--green); color: #14330a; }

/* ===== RESPONSIVE / MOBILE ===== */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; padding: 14px 14px 96px; }
  .hamburger { display: inline-flex; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: repeat(2, 1fr); }
  .pos-wrap { grid-template-columns: 1fr; }
  .cart { position: fixed; bottom: 0; left: 0; right: 0; top: auto; background: #fff; border-radius: 18px 18px 0 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.12); z-index: 70; max-height: 60vh; overflow-y: auto; }
  .cart.collapsed .cart-lines, .cart.collapsed .cart-actions { display: none; }
  .ai-panel { width: 100vw; }
  .topbar h1 { font-size: 19px; }
  .stat .v { font-size: 19px; }
}
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }

/* Footer credit */
.app-footer { text-align: center; font-size: 11px; color: var(--muted); padding: 26px 0 10px; opacity: .8; }
.sidebar .credit { font-size: 10px; color: #6a6d7c; text-align: center; padding: 10px 0 2px; letter-spacing: .03em; }

/* Upgrade modal */
.upg-hero { text-align: center; padding: 6px 4px 0; }
.upg-hero .ico { font-size: 46px; }
.upg-hero h2 { margin: 8px 0 4px; font-size: 19px; }
.upg-hero p { color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.upg-list { background: #f6fdf0; border-radius: 14px; padding: 14px 16px; margin-top: 14px; text-align: left; font-size: 13.5px; }
.upg-list div { padding: 4px 0; }
.upg-badge { display: inline-block; background: var(--green); color: #14330a; font-weight: 800; font-size: 11px; padding: 4px 12px; border-radius: 999px; margin-bottom: 6px; }


