:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f1f4f8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { background: #111827; color: #fff; padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { padding: 0 10px 22px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand strong { display: block; font-size: 20px; }
.brand span { color: #9ca3af; font-size: 13px; }
.nav { display: grid; gap: 7px; margin-top: 18px; }
.nav button { border: 0; background: transparent; color: #cbd5e1; text-align: left; padding: 12px 14px; border-radius: 12px; font-weight: 700; }
.nav button:hover, .nav button.active { background: #fff; color: #111827; }
.userbox { margin-top: 22px; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.07); font-size: 13px; color: #cbd5e1; }
.userbox strong { color: #fff; display: block; margin-bottom: 4px; }
.logout { width: 100%; margin-top: 10px; border: 1px solid rgba(255,255,255,.16); background: transparent; color: #fff; padding: 9px; border-radius: 10px; }

.main { padding: 26px; min-width: 0; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(24px, 3vw, 34px); margin-bottom: 6px; }
.muted { color: #6b7280; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: #fff; border: 1px solid #e4e8ef; border-radius: 18px; padding: 18px; box-shadow: 0 8px 24px rgba(15,23,42,.05); min-width: 0; }
.card h2 { font-size: 18px; margin-bottom: 4px; }
.stat-label { color: #667085; font-size: 13px; font-weight: 700; }
.stat-value { margin-top: 8px; font-size: 29px; font-weight: 850; letter-spacing: -.03em; }
.stat-help { color: #98a2b3; font-size: 12px; margin-top: 5px; }

.form { display: grid; gap: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 750; color: #475467; }
input, select, textarea { width: 100%; border: 1px solid #d0d5dd; border-radius: 11px; padding: 10px 12px; background: #fff; color: #101828; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #d08b37; box-shadow: 0 0 0 3px rgba(208,139,55,.15); }
textarea { resize: vertical; min-height: 78px; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.btn { border: 0; border-radius: 11px; padding: 10px 15px; font-weight: 800; background: #111827; color: #fff; }
.btn:hover { background: #273449; }
.btn.secondary { color: #344054; background: #eef2f6; }
.btn.danger { background: #b42318; }
.btn.small { padding: 7px 10px; font-size: 12px; }

.table-wrap { overflow: auto; border: 1px solid #eaecf0; border-radius: 13px; }
table { width: 100%; border-collapse: collapse; min-width: 650px; }
th, td { padding: 11px 13px; border-bottom: 1px solid #eaecf0; text-align: left; font-size: 13px; vertical-align: middle; }
th { background: #f8fafc; color: #475467; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: 11px; font-weight: 850; background: #eef2f6; color: #344054; }
.badge.ok { background: #dcfae6; color: #067647; }
.badge.warn { background: #fef0c7; color: #b54708; }
.badge.bad { background: #fee4e2; color: #b42318; }
.money { white-space: nowrap; font-weight: 800; }
.empty { padding: 24px; text-align: center; color: #667085; background: #f8fafc; border-radius: 12px; }
.notice { margin-bottom: 14px; padding: 12px 14px; border-radius: 12px; font-size: 13px; font-weight: 700; }
.notice.ok { background: #dcfae6; color: #067647; }
.notice.error { background: #fee4e2; color: #b42318; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.toolbar label { min-width: 180px; }
.product-list { display: grid; gap: 9px; max-height: 420px; overflow: auto; }
.product-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #eaecf0; border-radius: 12px; padding: 11px; }
.product-row small { display: block; color: #667085; margin-top: 3px; }
.cart-line { display: grid; grid-template-columns: 1fr 86px 100px 34px; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid #eaecf0; }
.cart-line:last-child { border-bottom: 0; }
.cart-total { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 19px; font-weight: 850; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: linear-gradient(135deg, #101828, #273449); }
.login-card { width: min(410px, 100%); background: #fff; border-radius: 22px; padding: 28px; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.login-card h1 { margin-bottom: 8px; }

.mobile-menu { display: none; }
.loading { padding: 50px; text-align: center; color: #667085; }

@media (max-width: 1050px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .three { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 250px; transform: translateX(-105%); transition: transform .18s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 18px 13px; }
  .mobile-menu { display: inline-flex; border: 0; border-radius: 10px; background: #111827; color: #fff; padding: 9px 12px; }
  .stats, .two, .form-grid, .form-grid.three-col { grid-template-columns: 1fr; }
  .topbar { align-items: center; }
  .cart-line { grid-template-columns: 1fr 72px 80px 30px; font-size: 12px; }
}
