/* =====================================================================
   Toko Cat Gading Sakti - Tema "Clean Industrial / Slate & Emerald"
   Touch-first, Tablet Landscape 1280x800, tabular numbers.
   ===================================================================== */

:root {
    --navy:        #0F172A;
    --navy-700:    #1E293B;
    --navy-600:    #334155;
    --slate-500:   #64748B;
    --slate-400:   #94A3B8;
    --slate-200:   #E2E8F0;
    --slate-100:   #F1F5F9;
    --slate-50:    #F8FAFC;

    --emerald:     #0D9488;
    --emerald-600: #0B7C71;
    --emerald-50:  #ECFDF5;
    --blue:        #2563EB;

    --green:       #16A34A;
    --amber:       #F59E0B;
    --red:         #DC2626;

    --bg:          #F1F5F9;
    --card:        #FFFFFF;
    --text:        #0F172A;
    --muted:       #64748B;
    --border:      #E2E8F0;

    --radius:      12px;
    --radius-lg:   16px;
    --shadow:      0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
    --shadow-lg:   0 10px 25px rgba(15,23,42,.12);

    --sidebar-w:   248px;
    --header-h:    60px;
    --touch:       48px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    height: 100%;
}

body {
    font-family: 'Inter', 'Plus Jakarta Sans', 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

.num, td.num, .tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

a { color: var(--emerald-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------- Layout Shell ------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--navy);
    color: #CBD5E1;
    display: flex; flex-direction: column;
    position: fixed; top: 0; bottom: 0; left: 0;
    z-index: 40;
    transition: transform .2s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; height: var(--header-h);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
/* Logo hitam-transparan -> tampil putih di sidebar gelap, tanpa kotak putih */
.sidebar-brand img { width: 38px; height: 38px; object-fit: contain; filter: brightness(0) invert(1); }
.sidebar-brand b { color: #fff; font-size: 15px; line-height: 1.1; }
.sidebar-brand span { color: var(--slate-400); font-size: 11px; }

.nav { padding: 10px; overflow-y: auto; flex: 1; }
.nav-section { color: var(--slate-500); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 14px 12px 6px; }
.nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px; border-radius: 10px;
    color: #CBD5E1; font-weight: 500; font-size: 14.5px;
    text-decoration: none; margin-bottom: 2px;
}
.nav a .ico { width: 20px; text-align: center; font-size: 17px; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--emerald); color: #fff; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: var(--header-h);
    background: #fff; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px;
    padding: 0 20px; position: sticky; top: 0; z-index: 30;
}
.topbar .title { font-weight: 700; font-size: 17px; }
.topbar .spacer { flex: 1; }
.hamburger { display: none; font-size: 22px; background:none; border:none; cursor:pointer; }

.store-switch {
    display: flex; align-items: center; gap: 8px;
    background: var(--slate-100); border: 1px solid var(--border);
    padding: 7px 12px; border-radius: 10px; font-weight: 600; font-size: 13.5px;
    color: var(--navy);
}
.store-switch select { border:none; background:transparent; font-weight:600; color:var(--navy); font-size:13.5px; cursor:pointer; }
.store-badge { background: var(--emerald-50); color: var(--emerald-600); padding: 7px 12px; border-radius: 10px; font-weight:600; font-size:13.5px; }

.user-chip { display:flex; align-items:center; gap:8px; font-weight:600; font-size:13.5px; }
.user-chip .avatar { width:32px;height:32px;border-radius:50%;background:var(--emerald);color:#fff;display:flex;align-items:center;justify-content:center;font-size:14px; }

.content { padding: 22px; flex: 1; }

/* ------------------------- Cards & Stat ------------------------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display:flex; align-items:center; gap:12px; }
.card-head h2 { margin: 0; font-size: 16px; }
.card-head .spacer { flex: 1; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.stat { background:#fff; border:1px solid var(--border); border-radius: var(--radius-lg); padding:18px 20px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 600; display:flex; align-items:center; gap:8px; }
.stat .value { font-size: 26px; font-weight: 800; margin-top: 8px; letter-spacing: -0.5px; }
.stat .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.stat.accent { border-left: 4px solid var(--emerald); }
.stat.warn   { border-left: 4px solid var(--amber); }
.stat.danger { border-left: 4px solid var(--red); }

/* ------------------------- Buttons ------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--touch); padding: 0 18px;
    border: 1px solid var(--border); border-radius: 12px;
    background: #fff; color: var(--navy);
    font-weight: 600; font-size: 15px; cursor: pointer;
    transition: filter .1s ease, background .1s ease;
    text-decoration: none;
}
.btn:hover { filter: brightness(.98); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn-lg { min-height: 56px; font-size: 17px; padding: 0 24px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.btn-blue    { background: var(--blue); border-color: var(--blue); color:#fff; }
.btn-navy    { background: var(--navy); border-color: var(--navy); color:#fff; }
.btn-danger  { background: var(--red); border-color: var(--red); color:#fff; }
.btn-amber   { background: var(--amber); border-color: var(--amber); color:#fff; }
.btn-ghost   { background: var(--slate-100); border-color: transparent; }
.btn-wa      { background: #25D366; border-color:#25D366; color:#fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ------------------------- Forms ------------------------- */
.form-row { margin-bottom: 14px; }
.form-row label { display:block; font-weight:600; font-size:13.5px; margin-bottom:6px; color: var(--navy-700); }
.input, select.input, textarea.input {
    width: 100%; min-height: var(--touch);
    border: 1.5px solid var(--border); border-radius: 11px;
    padding: 0 14px; font-size: 15px; background:#fff; color: var(--text);
    font-family: inherit;
}
textarea.input { padding: 12px 14px; min-height: 90px; resize: vertical; }
.input:focus, select.input:focus, textarea.input:focus {
    outline: none; border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(13,148,136,.15);
}
.input.num-input { text-align: right; font-variant-numeric: tabular-nums; }
.form-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ------------------------- Tables ------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th { background: var(--slate-50); color: var(--navy-700); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing:.3px; position: sticky; top: 0; }
table.data tbody tr:hover { background: var(--slate-50); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .actions { display:flex; gap:6px; }

/* ------------------------- Badges & Status ------------------------- */
.badge { display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:999px; font-size:12px; font-weight:700; }
.badge-green  { background:#DCFCE7; color:#15803D; }
.badge-amber  { background:#FEF3C7; color:#B45309; }
.badge-red    { background:#FEE2E2; color:#B91C1C; }
.badge-blue   { background:#DBEAFE; color:#1D4ED8; }
.badge-slate  { background:var(--slate-100); color:var(--slate-500); }
.dot { width:11px; height:11px; border-radius:50%; display:inline-block; }
.dot-green { background: var(--green); } .dot-amber { background: var(--amber); } .dot-red { background: var(--red); }

/* ------------------------- Flash / Alert ------------------------- */
.alert { padding: 13px 16px; border-radius: 12px; margin-bottom: 16px; font-weight:500; border:1px solid transparent; }
.alert-success { background:#DCFCE7; color:#166534; border-color:#BBF7D0; }
.alert-error   { background:#FEE2E2; color:#991B1B; border-color:#FECACA; }
.alert-info    { background:#DBEAFE; color:#1E40AF; border-color:#BFDBFE; }
.alert-warn    { background:#FEF3C7; color:#92400E; border-color:#FDE68A; }

/* ------------------------- Page header ------------------------- */
.page-head { display:flex; align-items:center; gap:14px; margin-bottom:18px; flex-wrap: wrap; }
.page-head h1 { margin:0; font-size:22px; font-weight:800; letter-spacing:-.5px; }
.page-head .spacer { flex:1; }
.toolbar { display:flex; gap:10px; flex-wrap: wrap; align-items:center; }

/* ------------------------- POS Split Layout ------------------------- */
.pos { display: grid; grid-template-columns: 1fr 420px; gap: 18px; align-items: start; }
.pos-cart { position: sticky; top: calc(var(--header-h) + 22px); }
.product-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.product-card {
    background:#fff; border:1.5px solid var(--border); border-radius:14px; padding:14px; cursor:pointer;
    display:flex; flex-direction:column; gap:6px; min-height: 128px;
}
.product-card:hover { border-color: var(--emerald); box-shadow: var(--shadow); }
.product-card .pc-photo { width:100%; height:96px; object-fit:contain; background:#fff; border:1px solid var(--border); border-radius:8px; margin-bottom:4px; }
.product-card .pc-name { font-weight:700; font-size:14px; line-height:1.25; }
.product-card .pc-meta { font-size:12px; color:var(--muted); }
.product-card .pc-price { font-weight:800; color:var(--emerald-600); font-size:16px; margin-top:auto; }
.product-card .pc-add { margin-top:6px; }

.cart-items { max-height: 46vh; overflow-y:auto; }
.cart-item { display:flex; gap:10px; padding:10px 0; border-bottom:1px dashed var(--border); align-items:flex-start; }
.cart-item .ci-name { font-weight:600; font-size:14px; }
.cart-item .ci-sub { color:var(--muted); font-size:12.5px; }
.cart-item .ci-amt { font-weight:700; font-variant-numeric: tabular-nums; }
.qty-ctrl { display:flex; align-items:center; gap:4px; }
.qty-ctrl button { width:34px;height:34px;border-radius:8px;border:1px solid var(--border);background:#fff;font-size:18px;cursor:pointer; }
.qty-ctrl input { width:56px; height:34px; text-align:center; border:1px solid var(--border); border-radius:8px; font-variant-numeric:tabular-nums; }

.cart-total-row { display:flex; justify-content:space-between; padding:6px 0; font-size:14.5px; }
.cart-total-row.grand { font-size:20px; font-weight:800; border-top:2px solid var(--navy); margin-top:6px; padding-top:12px; }

.pay-methods { display:grid; grid-template-columns: repeat(2,1fr); gap:8px; margin:10px 0; }
.pay-methods .pm { border:1.5px solid var(--border); border-radius:11px; padding:12px; text-align:center; font-weight:600; cursor:pointer; font-size:14px; }
.pay-methods .pm.active { border-color: var(--emerald); background: var(--emerald-50); color: var(--emerald-600); }

/* ------------------------- Modal ------------------------- */
.modal-backdrop { position:fixed; inset:0; background:rgba(15,23,42,.5); display:none; align-items:center; justify-content:center; z-index:100; padding:20px; }
.modal-backdrop.show { display:flex; }
.modal { background:#fff; border-radius:16px; width:100%; max-width:480px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow:auto; }
.modal-head { padding:18px 20px; border-bottom:1px solid var(--border); font-weight:700; font-size:17px; display:flex; align-items:center; }
.modal-body { padding:20px; }
.modal-foot { padding:16px 20px; border-top:1px solid var(--border); display:flex; gap:10px; justify-content:flex-end; }

/* ------------------------- Login ------------------------- */
.login-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; background: linear-gradient(135deg, #0F172A, #1E293B); padding:20px; }
.login-card { background:#fff; border-radius:20px; box-shadow: var(--shadow-lg); width:100%; max-width:400px; padding:32px; }
.login-logo { text-align:center; margin-bottom:20px; }
.login-logo img { width:76px; height:76px; object-fit:contain; }
.login-logo h1 { font-size:20px; margin:12px 0 2px; }
.login-logo p { color:var(--muted); font-size:13px; margin:0; }

/* store picker */
.store-pick { display:grid; gap:14px; grid-template-columns: 1fr 1fr; }
.store-pick button {
    text-align:left; border:2px solid var(--border); border-radius:16px; padding:22px; background:#fff; cursor:pointer;
}
.store-pick button:hover { border-color: var(--emerald); box-shadow: var(--shadow); }
.store-pick .sp-name { font-weight:800; font-size:17px; color:var(--navy); }
.store-pick .sp-addr { color:var(--muted); font-size:13px; margin-top:6px; }

/* ------------------------- Utilities ------------------------- */
.text-muted { color: var(--muted); }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); }
.text-right { text-align: right; } .text-center { text-align:center; }
.fw-700 { font-weight:700; } .fw-800 { font-weight:800; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}
.flex{display:flex}.items-center{align-items:center}.gap-1{gap:8px}.gap-2{gap:16px}.wrap{flex-wrap:wrap}
.hidden{display:none !important}
.pill-tabs{display:flex;gap:8px;flex-wrap:wrap}
.pill-tabs a{padding:8px 14px;border-radius:999px;background:#fff;border:1px solid var(--border);font-weight:600;font-size:13.5px;color:var(--navy);}
.pill-tabs a.active{background:var(--navy);color:#fff;border-color:var(--navy);}
.empty { text-align:center; padding:40px 20px; color: var(--muted); }
.empty .big { font-size:40px; }

/* ------------------------- Responsive ------------------------- */
@media (max-width: 1024px) {
    .pos { grid-template-columns: 1fr; }
    .pos-cart { position: static; }
    .grid-4 { grid-template-columns: repeat(2,1fr); }
    .grid-3 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 820px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .hamburger { display: block; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .store-pick { grid-template-columns: 1fr; }
    .content { padding: 16px; }
}

/* ------------------------- Print (struk thermal) ------------------------- */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main { margin: 0; }
    body { background: #fff; }
}
