:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-light: #eef2ff;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --accent-light: #fef3c7;
  --success: #16a34a;
  --success-light: #dcfce7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --bg: #f7f8fc;
  --surface: #ffffff;
  --border: #e5e7f0;
  --text: #1e2333;
  --text-muted: #6b7186;
}

html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 16px; } }

html {
  position: relative;
  min-height: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  margin-bottom: 60px;
}

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--brand);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ---------- Navbar ---------- */
.navbar-loja {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
}
.navbar-brand {
  font-weight: 800;
  color: var(--brand) !important;
  display: flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: .2px;
}
.navbar-brand i { font-size: 1.4rem; }
.navbar-brand .navbar-logo {
  height: 32px; width: 32px;
  object-fit: contain;
  border-radius: .4rem;
  flex-shrink: 0;
}
.navbar-brand span {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-link-icon {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--text-muted) !important;
  border-radius: .6rem;
  padding: .5rem .85rem !important;
  font-weight: 500;
  transition: background-color .15s ease, color .15s ease;
}
.nav-link-icon i { font-size: 1.05rem; }
.nav-link-icon:hover { color: var(--brand) !important; background: var(--brand-light); }
.nav-link-icon.active { color: var(--brand) !important; background: var(--brand-light); font-weight: 600; }

/* ---------- Sidebar (usuário autenticado) ---------- */
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }
.app-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.sidebar {
  width: 250px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar.offcanvas-lg { --bs-offcanvas-width: 250px; }
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.sidebar-body { display: flex; flex-direction: column; padding: 0; height: 100%; }
.sidebar-brand { padding: 1.1rem 1rem .75rem; border-bottom: 1px solid var(--border); }
.sidebar-brand .navbar-brand { margin: 0; }

.sidebar-nav { flex: 1; padding: .75rem .65rem; overflow-y: auto; }
.sidebar-section-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  color: var(--text-muted);
  padding: .9rem .5rem .3rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--text-muted) !important;
  border-radius: .6rem;
  padding: .55rem .7rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.sidebar-link i { font-size: 1.05rem; width: 1.1rem; text-align: center; }
.sidebar-link:hover { color: var(--brand) !important; background: var(--brand-light); }
.sidebar-link.active { color: var(--brand) !important; background: var(--brand-light); font-weight: 600; }

.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border); }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .65rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

/* ---------- Buttons ---------- */
.btn { border-radius: .6rem; font-weight: 500; }
.btn-primary { background-color: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background-color: var(--brand-dark); border-color: var(--brand-dark); }
.btn-accent { background-color: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background-color: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background-color: var(--brand); border-color: var(--brand); }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--border); border-radius: .9rem; }
.card-hover { transition: transform .15s ease, box-shadow .15s ease; }
.card-hover:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,.07); }

/* ---------- Soft color helpers ---------- */
.bg-brand-soft { background: var(--brand-light); color: var(--brand); }
.bg-accent-soft { background: var(--accent-light); color: var(--accent-dark); }
.bg-success-soft { background: var(--success-light); color: var(--success); }
.bg-danger-soft { background: var(--danger-light); color: var(--danger); }

/* ---------- Dashboard stat cards ---------- */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: .9rem;
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
}
.stat-card .stat-icon {
  width: 46px; height: 46px;
  border-radius: .75rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { color: var(--text-muted); font-size: .82rem; margin: 0; }

/* ---------- Home action cards ---------- */
.action-card {
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  display: block;
  height: 100%;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.action-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(15,23,42,.08); border-color: var(--brand); color: var(--text); }
.action-icon {
  width: 52px; height: 52px; border-radius: .85rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin-bottom: .85rem;
}
.action-card h3, .feature-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: .4rem; }
.action-card p, .feature-card p { color: var(--text-muted); font-size: .88rem; margin: 0; }

/* ---------- Landing page (visitante não logado) ---------- */
.landing-hero {
  padding: 3rem 1rem 2rem;
  background: radial-gradient(circle at 50% 0%, var(--brand-light) 0%, transparent 60%);
  border-radius: 1.5rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  height: 100%;
}

.how-it-works { max-width: 900px; margin-left: auto; margin-right: auto; }
.step-number {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}

.landing-cta {
  background: var(--brand-light);
  border-radius: 1.5rem;
  padding: 2.5rem 1.5rem;
}

/* ---------- Badges ---------- */
.badge-pill-soft { border-radius: 50rem; font-weight: 600; padding: .35em .75em; font-size: .78rem; }
.badge-estoque-ok { background: var(--success-light); color: var(--success); }
.badge-estoque-baixo { background: var(--accent-light); color: var(--accent-dark); }
.badge-estoque-zerado { background: var(--danger-light); color: var(--danger); }
.badge-categoria { background: var(--brand-light); color: var(--brand); }

/* ---------- PDV ---------- */
.pdv-product-card {
  border: 1px solid var(--border);
  border-radius: .85rem;
  padding: .9rem 1rem;
  background: var(--surface);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.pdv-product-card:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(15,23,42,.06); }
.pdv-product-icon {
  width: 42px; height: 42px; border-radius: .65rem;
  background: var(--brand-light); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; flex-shrink: 0;
}

.payment-option { position: absolute; opacity: 0; pointer-events: none; }
.payment-option-label {
  border: 1.5px solid var(--border);
  border-radius: .75rem;
  padding: .65rem .5rem;
  text-align: center;
  cursor: pointer;
  transition: all .15s ease;
  display: block;
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 500;
}
.payment-option-label i { font-size: 1.35rem; display: block; margin-bottom: .3rem; }
.payment-option:checked + .payment-option-label {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 700;
}

.cart-panel { position: sticky; top: 1rem; }
.cart-header {
  background: var(--brand);
  color: #fff;
  border-radius: .9rem .9rem 0 0;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
}
.cart-total-bar {
  background: var(--brand-light);
  border-radius: .75rem;
  padding: .9rem 1.1rem;
}

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 2.75rem; opacity: .35; display: block; margin-bottom: .6rem; }

/* ---------- Tables ---------- */
.table-loja thead th { color: var(--text-muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; border-bottom-width: 1px; }
.table-loja tbody tr:hover { background-color: var(--brand-light); }

/* ---------- Auth pages ---------- */
.auth-card { border-radius: 1.1rem; }
.auth-icon {
  width: 60px; height: 60px; border-radius: 1rem;
  background: var(--brand-light); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; margin: 0 auto 1rem;
}

/* ---------- Impressão (etiquetas, recibos) ---------- */
@media print {
  header.navbar-loja, footer.footer, .sidebar, .topbar { display: none !important; }
  .container { max-width: none; margin: 0; padding: 0; }
  body { margin-bottom: 0; }
}
