:root {
  --rp-bg: #f6f7f9;
  --rp-surface: #ffffff;
  --rp-surface-muted: #f1f3f5;
  --rp-text: #111827;
  --rp-muted: #6b7280;
  --rp-border: #d9dee5;
  --rp-accent: #111827;
  --rp-success: #15803d;
  --rp-radius-sm: 6px;
  --rp-radius-md: 10px;
  --rp-shadow: 0 1px 2px rgba(17, 24, 39, .05);
}

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: var(--rp-bg);
  color: var(--rp-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

:focus-visible {
  outline: 3px solid rgba(17, 24, 39, .22);
  outline-offset: 2px;
}

.app-header,
.app-footer { background: var(--rp-surface); }

.navbar-brand {
  font-weight: 700;
  letter-spacing: -.02em;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--rp-radius-sm);
  background: var(--rp-text);
  color: #fff;
  font-size: .9rem;
}

.nav-link {
  color: var(--rp-muted);
  border-radius: var(--rp-radius-sm);
  padding-inline: .8rem !important;
}

.nav-link.active,
.nav-link:hover { color: var(--rp-text); background: var(--rp-surface-muted); }

.role-switcher .form-select { min-width: 132px; }

.hero-panel,
.section-card,
.metric-card,
.permission-card,
.product-card,
.receipt-card,
.empty-state,
.user-row,
.context-pill,
.summary-box {
  border-color: var(--rp-border) !important;
  border-radius: var(--rp-radius-md);
  background: var(--rp-surface);
  box-shadow: var(--rp-shadow);
}

.hero-panel { padding: clamp(1.25rem, 3vw, 2rem); }
.section-card, .receipt-card { padding: clamp(1rem, 2vw, 1.5rem); }
.permission-card, .product-card { padding: 1rem; }

h1, h2, h3, h4, h5, h6 { letter-spacing: -.025em; }
.lead { font-size: 1.05rem; }

.eyebrow {
  color: var(--rp-muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.btn { border-radius: var(--rp-radius-sm); font-weight: 650; }
.btn-lg { padding: .72rem 1rem; font-size: .95rem; }
.btn-dark { background: var(--rp-text); border-color: var(--rp-text); }
.btn-dark:hover { background: #000; border-color: #000; transform: translateY(-1px); }
.btn-outline-secondary { border-color: var(--rp-border); color: var(--rp-text); }

.form-control,
.form-select {
  border-color: var(--rp-border);
  border-radius: var(--rp-radius-sm);
}

.form-control:focus,
.form-select:focus {
  border-color: #9ca3af;
  box-shadow: 0 0 0 .2rem rgba(17, 24, 39, .10);
}

.metric-card {
  padding: 1rem;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-card span { color: var(--rp-muted); font-size: .85rem; }
.metric-card strong { font-size: clamp(1.45rem, 3vw, 2rem); letter-spacing: -.04em; }

.permission-list li {
  display: flex;
  gap: .5rem;
  align-items: center;
  padding: .38rem 0;
  color: #374151;
}

.permission-list li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--rp-success);
  flex: 0 0 auto;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--rp-success);
  box-shadow: 0 0 0 4px rgba(21, 128, 61, .12);
}

.user-row {
  padding: .8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
}

.context-pill {
  padding: .75rem 1rem;
  align-self: flex-start;
}

.product-card { transition: border-color .15s ease, transform .15s ease; }
.product-card:hover { border-color: #9ca3af !important; transform: translateY(-1px); }
.sku { color: var(--rp-muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; }
.qty-control { max-width: 84px; }
.qty-input { text-align: right; }

.sticky-summary { position: sticky; top: 1rem; }

.summary-box { padding: 1rem; background: #fbfbfc; }
.summary-box div,
.receipt-totals div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .35rem 0;
}
.summary-box span,
.receipt-totals span { color: var(--rp-muted); }
.summary-box .total,
.receipt-totals .total {
  border-top: 1px solid var(--rp-border);
  margin-top: .35rem;
  padding-top: .75rem;
  font-size: 1.05rem;
}

.receipt-totals { max-width: 320px; }
.table thead th { color: var(--rp-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.table > :not(caption) > * > * { padding: .85rem .75rem; }
.badge { font-weight: 650; }
.alert { border-radius: var(--rp-radius-md); }

@media (max-width: 991.98px) {
  .sticky-summary { position: static; }
  .role-switcher { padding-top: .75rem; }
}

@media print {
  .app-header, .app-footer, .btn, .alert { display: none !important; }
  body { background: #fff; }
  .receipt-card { box-shadow: none; border: none !important; }
}
