:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #102033;
  --muted: #66758a;
  --line: #dfe6ee;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 20px 60px rgba(15, 23, 42, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(246, 248, 251, .88);
  backdrop-filter: blur(8px);
  z-index: 50;
  transition: opacity .25s ease, visibility .25s ease;
}
.app-loader.hidden { opacity: 0; visibility: hidden; }
.loader-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #dbeafe;
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  border: 0;
  border-radius: 7px;
  padding: 11px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
  min-height: 42px;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--primary); color: white; box-shadow: 0 10px 25px rgba(37, 99, 235, .24); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.light { background: #eef4ff; color: var(--primary); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.danger { background: #fee2e2; color: #b91c1c; }
.btn.icon { width: 38px; height: 38px; padding: 0; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.site-nav, .hero, .section-inner {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}
.site-nav {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
}
.nav-actions { display: flex; align-items: center; gap: 10px; }
.hero {
  min-height: calc(100vh - 96px);
  display: grid;
  grid-template-columns: 1fr 430px;
  gap: 44px;
  align-items: center;
  padding: 24px 0 72px;
}
.eyebrow { color: var(--primary); font-weight: 800; text-transform: uppercase; font-size: 12px; letter-spacing: .12em; }
.hero h1 { font-size: clamp(42px, 6vw, 76px); line-height: .98; margin: 12px 0 18px; letter-spacing: 0; }
.hero p { color: var(--muted); font-size: 18px; line-height: 1.7; margin: 0 0 24px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}
.mock-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.pill { background: #ecfdf5; color: #047857; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.mock-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mock-product { border: 1px solid var(--line); border-radius: 8px; padding: 14px; min-height: 96px; background: #fbfdff; }
.mock-product strong { display: block; margin-top: 24px; }
.mock-product span { color: var(--muted); font-size: 13px; }
.mock-total { margin-top: 14px; padding: 16px; border-radius: 8px; color: white; background: #102033; display: flex; justify-content: space-between; align-items: center; }

.section { padding: 72px 0; background: white; border-top: 1px solid var(--line); }
.section.alt { background: #f7fafc; }
.section-title { font-size: 34px; margin: 0 0 10px; }
.section-copy { color: var(--muted); max-width: 660px; line-height: 1.7; }
.feature-grid, .price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 28px; }
.feature, .price-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.feature svg { color: var(--primary); }
.price-card strong { font-size: 30px; display: block; margin: 12px 0; }
.cta-band { background: #102033; color: white; padding: 46px; border-radius: 8px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.cta-band p { color: #cbd5e1; }
.cta-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.auth-card h1 { margin: 20px 0 8px; font-size: 30px; }
.auth-card p { color: var(--muted); line-height: 1.6; }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field label { color: #344256; font-size: 13px; font-weight: 800; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 42px;
  padding: 10px 12px;
  background: white;
  outline: none;
  transition: border .18s ease, box-shadow .18s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .10);
}
.check-row { display: flex; align-items: center; gap: 8px; color: var(--muted); margin: 4px 0 18px; }

.dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}
.sidebar {
  background: #0f172a;
  color: white;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sidebar .brand-mark { background: linear-gradient(135deg, #60a5fa, #34d399); }
.side-nav { display: grid; gap: 6px; }
.side-link {
  border: 0;
  background: transparent;
  color: #cbd5e1;
  border-radius: 7px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-weight: 700;
}
.side-link.active, .side-link:hover { background: rgba(255,255,255,.10); color: white; }
.side-footer { margin-top: auto; display: grid; gap: 10px; color: #94a3b8; font-size: 13px; }
.main-area { min-width: 0; }
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(255,255,255,.86);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}
.mobile-menu { display: none; }
.page { padding: 24px; animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 28px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 380px; gap: 18px; align-items: start; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
}
.panel-pad { padding: 18px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search { flex: 1; min-width: 180px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.product-card {
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 124px;
  display: grid;
  align-content: space-between;
  transition: transform .18s ease, border .18s ease, box-shadow .18s ease;
}
.product-card:hover { transform: translateY(-2px); border-color: #bfdbfe; box-shadow: 0 12px 28px rgba(37, 99, 235, .10); }
.product-card small, .muted { color: var(--muted); }
.price { font-weight: 800; color: var(--primary); }
.cart-list { display: grid; gap: 10px; max-height: 350px; overflow: auto; }
.cart-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.qty { display: inline-flex; align-items: center; gap: 7px; }
.qty button { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.totals { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; display: grid; gap: 8px; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-size: 22px; font-weight: 800; color: var(--ink); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; background: #f8fafc; }
.actions { display: flex; gap: 8px; justify-content: flex-end; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { padding: 18px; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 700; }
.stat strong { display: block; margin-top: 8px; font-size: 26px; }
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 92px; gap: 12px; align-items: center; }
.bar { height: 12px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 40;
}
.modal {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; }
.receipt { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: #111827; }
.receipt-row { display: flex; justify-content: space-between; gap: 12px; margin: 7px 0; }
.receipt hr { border: 0; border-top: 1px dashed #94a3b8; margin: 12px 0; }
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: grid; gap: 10px; }
.toast {
  width: min(360px, calc(100vw - 36px));
  background: #102033;
  color: white;
  padding: 13px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: toastIn .2s ease;
}
.toast.success { background: #047857; }
.toast.error { background: #b91c1c; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media print {
  body * { visibility: hidden; }
  .modal, .modal * { visibility: visible; }
  .modal { position: absolute; inset: 0; width: 100%; box-shadow: none; }
  .modal-head .btn, .modal-head button { display: none; }
}

@media (max-width: 920px) {
  .hero { grid-template-columns: 1fr; padding-top: 10px; }
  .feature-grid, .price-grid, .stat-grid, .grid-2 { grid-template-columns: 1fr; }
  .dashboard { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    transform: translateX(-102%);
    transition: transform .22s ease;
    z-index: 30;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .page { padding: 16px; }
  .cta-band { display: grid; padding: 28px; }
  .cta-actions { align-items: stretch; }
}

@media (max-width: 560px) {
  .site-nav { height: auto; padding: 14px 0; align-items: flex-start; }
  .nav-actions { flex-wrap: wrap; justify-content: flex-end; }
  .hero h1 { font-size: 42px; }
  .mock-grid { grid-template-columns: 1fr; }
  .page-head { display: grid; }
  .toolbar .btn, .toolbar .field { width: 100%; }
  .actions { justify-content: flex-start; flex-wrap: wrap; }
}
