:root {
  --blue-600: #0369a1;
  --blue-700: #075985;
  --blue-50: #f0f9ff;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --green: #16a34a;
  --red: #dc2626;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a { color: var(--blue-600); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .brand {
  font-weight: 700;
  color: var(--blue-700);
  font-size: 1.1rem;
}

.topbar nav a {
  margin-right: 16px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.92rem;
}
.topbar nav a.active, .topbar nav a:hover { color: var(--blue-700); font-weight: 600; }

.topbar .who {
  font-size: 0.85rem;
  color: var(--muted);
}

button, .btn {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 600;
}
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue-700); }
.btn-secondary { background: #eef2f7; color: var(--ink); }
.btn-danger { background: #fee2e2; color: var(--red); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.container { max-width: 1100px; margin: 0 auto; padding: 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

input, select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
}

label { font-size: 0.85rem; color: var(--muted); display: block; margin-bottom: 4px; }
.field { margin-bottom: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.02em; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge-green { background: #dcfce7; color: var(--green); }
.badge-red { background: #fee2e2; color: var(--red); }
.badge-gray { background: #f1f5f9; color: var(--muted); }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 360px; }
.login-card h1 { color: var(--blue-700); font-size: 1.3rem; margin-bottom: 4px; }
.login-card p.sub { color: var(--muted); font-size: 0.88rem; margin-top: 0; margin-bottom: 20px; }
.error-msg { color: var(--red); font-size: 0.85rem; margin-top: 8px; min-height: 1em; }

/* Layout kasir */
.kasir-grid { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
@media (max-width: 860px) { .kasir-grid { grid-template-columns: 1fr; } }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.product-tile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
  cursor: pointer;
  text-align: left;
}
.product-tile:hover { border-color: var(--blue-600); box-shadow: 0 0 0 1px var(--blue-600); }
.product-tile .name { font-weight: 600; font-size: 0.92rem; }
.product-tile .type { font-size: 0.75rem; color: var(--muted); }
.product-tile .price { color: var(--blue-700); font-weight: 700; margin-top: 6px; }

.cart-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cart-item .info { flex: 1; }
.cart-item .qty-ctrl { display: flex; align-items: center; gap: 6px; }
.qty-ctrl button { padding: 2px 9px; background: #eef2f7; }

.total-row { display: flex; justify-content: space-between; font-size: 1.05rem; font-weight: 700; margin: 12px 0; padding-top: 10px; border-top: 2px solid var(--ink); }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tabs button { background: #eef2f7; color: var(--muted); }
.tabs button.active { background: var(--blue-600); color: #fff; }

.empty-state { text-align: center; color: var(--muted); padding: 30px 0; font-size: 0.9rem; }

.receipt { font-family: monospace; font-size: 0.85rem; white-space: pre-wrap; background: #fff; border: 1px dashed var(--border); padding: 14px; border-radius: 8px; }

.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Stat tiles (Dashboard) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-tile .label { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.stat-tile .value { font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.stat-tile .sub { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.meter-track { background: #eef2f7; border-radius: 999px; height: 8px; margin-top: 8px; overflow: hidden; }
.meter-fill { background: var(--blue-600); height: 100%; border-radius: 999px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--muted); font-size: 0.85rem; }
