/* ══════════════════════════════════════════
   UMKM Manager v2 — style.css
══════════════════════════════════════════ */

:root {
  --primary:        #16a34a;
  --primary-dk:     #15803d;
  --primary-lt:     #dcfce7;
  --primary-ring:   rgba(22,163,74,.15);
  --accent:         #f97316;
  --accent-lt:      #fff7ed;
  --danger:         #ef4444;
  --danger-lt:      #fee2e2;
  --warning:        #f59e0b;
  --warning-lt:     #fef3c7;
  --info:           #3b82f6;
  --info-lt:        #dbeafe;
  --ink:            #111827;
  --ink2:           #374151;
  --muted:          #6b7280;
  --border:         #e5e7eb;
  --surface:        #f9fafb;
  --white:          #ffffff;
  --sidebar-w:      256px;
  --topbar-h:       60px;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:      0 12px 32px rgba(0,0,0,.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* ─── LAYOUT ─── */
.shell   { display: flex; min-height: 100vh; }
.main-wrap { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; transition: margin .3s; }

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--ink);
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200;
  display: flex; flex-direction: column;
  overflow-y: auto;
  transition: transform .3s;
}
.sb-brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-link { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-icon {
  width: 40px; height: 40px; background: var(--primary);
  border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 20px; flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { color: #fff; font-size: 14px; font-weight: 700; line-height: 1.2; }
.brand-ver  { color: #6b7280; font-size: 10px; }

.sb-user {
  padding: 13px 18px; border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 10px;
}
.sb-avatar {
  width: 34px; height: 34px; background: var(--accent);
  border-radius: 50%; font-size: 14px; font-weight: 700;
  color: white; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sb-realname { color: #fff; font-size: 13px; font-weight: 600; display: block; line-height: 1.2; }
.sb-username { color: #6b7280; font-size: 11px; }

.sb-nav { padding: 10px 0; flex: 1; }
.nav-group { padding: 8px 18px 3px; color: #4b5563; font-size: 9.5px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; color: #9ca3af; font-size: 13.5px;
  font-weight: 500; text-decoration: none;
  border-left: 3px solid transparent;
  transition: all .18s;
}
.nav-link:hover { color: white; background: rgba(255,255,255,.05); }
.nav-link.is-active { color: #fff; background: rgba(22,163,74,.18); border-left-color: var(--primary); }
.nav-link .ni { font-size: 16px; width: 20px; text-align: center; }
.nav-sep { margin: 8px 0; border-top: 1px solid rgba(255,255,255,.07); }
.nav-logout { color: #f87171 !important; }
.nav-logout:hover { background: rgba(239,68,68,.12) !important; }

/* ─── TOPBAR ─── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.page-title  { font-size: 17px; font-weight: 700; color: var(--ink); }
.date-chip   { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 4px 12px; font-size: 12px; color: var(--muted); }
.hamburger   { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); display: none; padding: 4px; }

/* ─── PAGE WRAP ─── */
.page-wrap { padding: 22px; flex: 1; }

/* ─── CARDS ─── */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-hd { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-hd-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.card-hd-sub   { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.card-body     { padding: 18px; }

/* ─── STAT GRID ─── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; align-items: flex-start; justify-content: space-between;
  box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-val   { font-size: 22px; font-weight: 800; color: var(--ink); margin: 4px 0; line-height: 1; }
.stat-sub   { font-size: 11.5px; color: var(--muted); }
.stat-sub.up { color: var(--primary); }
.stat-sub.dn { color: var(--danger); }
.stat-icon  { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.si-green  { background: var(--primary-lt); }
.si-blue   { background: var(--info-lt); }
.si-red    { background: var(--danger-lt); }
.si-yellow { background: var(--warning-lt); }
.si-orange { background: #fff7ed; }
.si-teal   { background: #ccfbf1; }

/* ─── TABLE ─── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th { background: var(--surface); padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
table td { padding: 12px 14px; border-bottom: 1px solid #f3f4f6; font-size: 13.5px; vertical-align: middle; }
table tbody tr:hover td { background: #fafafa; }
table tbody tr:last-child td { border-bottom: none; }
.tbl-foot td { background: var(--surface); font-weight: 700; border-top: 2px solid var(--border); padding: 10px 14px; }

/* ─── BADGES ─── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.b-green  { background: var(--primary-lt); color: var(--primary-dk); }
.b-red    { background: var(--danger-lt);  color: #b91c1c; }
.b-yellow { background: var(--warning-lt); color: #92400e; }
.b-blue   { background: var(--info-lt);    color: #1d4ed8; }
.b-gray   { background: #f3f4f6;           color: var(--muted); }
.b-orange { background: #fff7ed;           color: #c2410c; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; text-decoration: none;
  transition: all .18s; white-space: nowrap; line-height: 1.4;
}
.btn:hover   { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active  { transform: none; box-shadow: none; }
.btn-block   { width: 100%; justify-content: center; }
.btn-sm      { padding: 5px 11px; font-size: 12px; border-radius: 6px; }
.btn-lg      { padding: 11px 22px; font-size: 15px; }
.btn-primary { background: var(--primary);  color: white; }
.btn-primary:hover { background: var(--primary-dk); }
.btn-danger  { background: var(--danger);   color: white; }
.btn-warning { background: var(--warning);  color: white; }
.btn-info    { background: var(--info);     color: white; }
.btn-orange  { background: var(--accent);   color: white; }
.btn-outline { background: white; color: var(--ink2); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost   { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }

/* ─── FORMS ─── */
.form-group  { margin-bottom: 14px; }
.form-label  { display: block; font-size: 13px; font-weight: 600; color: var(--ink2); margin-bottom: 5px; }
.form-label .req { color: var(--danger); }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--ink); background: white;
  font-family: inherit; outline: none; transition: border-color .18s, box-shadow .18s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.form-control:disabled { background: var(--surface); cursor: not-allowed; }
.form-hint  { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-row   { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.input-wrap { position: relative; }
.input-wrap .input-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--muted); pointer-events: none; }
.input-wrap .form-control { padding-left: 38px; }

/* ─── ALERTS ─── */
.alert { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13.5px; display: flex; align-items: flex-start; gap: 9px; }
.alert-success { background: var(--primary-lt); color: var(--primary-dk); border: 1px solid #bbf7d0; }
.alert-danger  { background: var(--danger-lt);  color: #b91c1c;          border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-lt); color: #92400e;          border: 1px solid #fde68a; }
.alert-info    { background: var(--info-lt);    color: #1d4ed8;          border: 1px solid #bfdbfe; }

/* ─── MODALS ─── */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 500; align-items: center; justify-content: center; padding: 16px; }
.modal-bg.open { display: flex; }
.modal { background: white; border-radius: var(--radius); width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: modalIn .22s ease; }
.modal-lg { max-width: 760px; }
.modal-hd { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 15px; font-weight: 700; }
.modal-body  { padding: 20px; }
.modal-ft    { padding: 13px 20px; border-top: 1px solid var(--border); background: var(--surface); display: flex; justify-content: flex-end; gap: 8px; }
.btn-close   { background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; border-radius: 5px; padding: 2px 5px; }
.btn-close:hover { background: var(--surface); color: var(--ink); }

@keyframes modalIn { from { opacity:0; transform: scale(.95) translateY(10px); } to { opacity:1; transform: none; } }

/* ─── POS ─── */
.pos-wrap { display: grid; grid-template-columns: 1fr 360px; gap: 16px; height: calc(100vh - var(--topbar-h) - 44px); }
.pos-left  { overflow-y: auto; }
.pos-right { background: white; border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; box-shadow: var(--shadow); overflow: hidden; }

.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.prod-card {
  background: white; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 14px 12px; text-align: center; cursor: pointer; transition: all .18s;
}
.prod-card:hover:not(.out) { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.prod-card.out { opacity: .5; cursor: not-allowed; }
.p-emoji { font-size: 28px; margin-bottom: 7px; }
.p-name  { font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 3px; line-height: 1.3; }
.p-price { font-size: 13px; font-weight: 700; color: var(--primary); }
.p-stok  { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.p-stok.low    { color: var(--warning); font-weight: 600; }
.p-stok.empty  { color: var(--danger); font-weight: 600; }

.cart-hd    { padding: 12px 14px; border-bottom: 1px solid #f3f4f6; background: var(--surface); }
.cart-items { flex: 1; overflow-y: auto; padding: 6px; }
.cart-item  { display: flex; align-items: center; gap: 8px; padding: 9px 6px; border-bottom: 1px solid #f9fafb; }
.ci-main    { flex: 1; }
.ci-name    { font-size: 12.5px; font-weight: 600; }
.ci-price   { font-size: 11px; color: var(--muted); }
.qty-wrap   { display: flex; align-items: center; gap: 5px; }
.q-btn      { width: 23px; height: 23px; border: 1.5px solid var(--border); border-radius: 5px; background: white; cursor: pointer; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.q-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.q-val      { font-size: 13px; font-weight: 700; min-width: 24px; text-align: center; }
.ci-total   { font-size: 12.5px; font-weight: 700; color: var(--primary); min-width: 72px; text-align: right; }
.ci-del     { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 18px; padding: 0 2px; }

.cart-sum  { padding: 12px 14px; border-top: 1px solid #f3f4f6; background: var(--surface); }
.cs-row    { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.cs-total  { font-size: 17px; font-weight: 800; color: var(--ink); border-top: 1.5px solid var(--border); padding-top: 8px; margin-top: 3px; }
.cart-foot { padding: 12px 14px; border-top: 1px solid var(--border); }

/* ─── STOK BAR ─── */
.stok-bar      { height: 4px; background: #e5e7eb; border-radius: 2px; overflow: hidden; margin-top: 4px; }
.stok-bar-fill { height: 100%; border-radius: 2px; transition: width .5s; }

/* ─── AUTH PAGES ─── */
.auth-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #064e3b 0%, #111827 60%, #134e4a 100%);
  display: flex; align-items: stretch;
  position: relative; overflow: hidden;
}
.auth-bg::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(16,185,129,.1) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(249,115,22,.07) 0%, transparent 50%);
}
.auth-panel-left {
  flex: 1; display: flex; flex-direction: column; align-items: flex-start;
  justify-content: center; padding: 60px;
  position: relative; z-index: 1;
}
.auth-big-logo { font-size: 52px; margin-bottom: 20px; }
.auth-tagline  { font-size: 36px; font-weight: 800; color: white; line-height: 1.2; margin-bottom: 14px; }
.auth-tagline span { color: #34d399; }
.auth-desc   { font-size: 15px; color: #9ca3af; line-height: 1.7; max-width: 380px; }
.auth-feat   { margin-top: 28px; display: flex; flex-direction: column; gap: 10px; }
.auth-feat-item { display: flex; align-items: center; gap: 10px; color: #d1fae5; font-size: 13.5px; }
.auth-feat-item .tick { width: 22px; height: 22px; background: rgba(52,211,153,.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }

.auth-panel-right {
  width: 440px; flex-shrink: 0;
  background: white; display: flex; align-items: center; justify-content: center;
  padding: 40px 44px;
  position: relative; z-index: 1;
}
.auth-form-wrap { width: 100%; }
.auth-form-title { font-size: 24px; font-weight: 800; color: var(--ink); margin-bottom: 4px; }
.auth-form-sub   { font-size: 13px; color: var(--muted); margin-bottom: 26px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.auth-switch a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* ─── EMPTY STATE ─── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state .e-icon  { font-size: 44px; margin-bottom: 10px; opacity: .5; }
.empty-state .e-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 5px; }
.empty-state .e-desc  { font-size: 13px; }

/* ─── MISC ─── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.grid-2  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-31 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
code-chip { background: var(--surface); border: 1px solid var(--border); padding: 2px 7px; border-radius: 5px; font-family: monospace; font-size: 11.5px; }

/* ─── PRINT ─── */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-wrap { margin-left: 0 !important; }
  .page-wrap { padding: 0 !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1100px) { .pos-wrap { grid-template-columns: 1fr; height: auto; } }
@media (max-width: 900px)  {
  .auth-panel-left { display: none; }
  .auth-panel-right { width: 100%; }
}
@media (max-width: 768px)  {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-wrap { margin-left: 0; }
  .hamburger { display: block !important; }
  .grid-2, .grid-31, .form-row { grid-template-columns: 1fr; flex-direction: column; }
  .page-wrap { padding: 14px; }
}
