/* FrenzelTech Ecommerce — identidade visual: azul-marinho institucional, vermelho da marca (#FF3131), fundo claro. */
:root {
  --navy: #0b2545;
  --navy-2: #13315c;
  --navy-3: #1d4e89;
  --accent: #2563eb;
  --positive: #0f9d58;
  --negative: #d93025;
  --warning: #f59e0b;
  --muted: #64748b;
  --border: #e3e8ef;
  --bg: #f5f7fb;
  --card: #ffffff;
  --sidebar-w: 248px;
  --brand: #ff3131;
  --brand-dark: #e01e1e;
  --brand-soft: #fff1f1;
  --ink: #0b1220;
  --bs-primary: #1d4e89;
  --bs-primary-rgb: 29, 78, 137;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: #1e293b;
  --bs-border-color: var(--border);
}

body { background: var(--bg); font-size: .925rem; }
a { color: var(--navy-3); }
.btn-primary { --bs-btn-bg: var(--navy-3); --bs-btn-border-color: var(--navy-3); --bs-btn-hover-bg: var(--navy-2);
  --bs-btn-hover-border-color: var(--navy-2); --bs-btn-active-bg: var(--navy); }
.btn-outline-primary { --bs-btn-color: var(--navy-3); --bs-btn-border-color: var(--navy-3);
  --bs-btn-hover-bg: var(--navy-3); --bs-btn-hover-border-color: var(--navy-3); }
.text-navy { color: var(--navy) !important; }
.bg-navy { background: var(--navy) !important; }
.text-positive { color: var(--positive) !important; }
.text-negative { color: var(--negative) !important; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--navy); color: #cbd5e1; position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column; z-index: 1040; transition: transform .2s ease;
}
.sidebar .brand { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; padding: 1rem 1.25rem .9rem;
  color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand img { height: 34px; width: auto; max-width: 100%; }
.sidebar .brand .brand-sub { font-size: .66rem; letter-spacing: .22em; text-transform: uppercase; color: #8aa0bd;
  padding-left: 2.6rem; }
.sidebar .brand .logo { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg,#3b82f6,#0f9d58);
  display: grid; place-items: center; color: #fff; }
.sidebar nav { overflow-y: auto; overflow-x: hidden; padding: .75rem .6rem 1rem; flex: 1 1 0; min-height: 0;
  flex-wrap: nowrap; }
.sidebar .nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #7d8fa9;
  padding: .9rem .75rem .35rem; }
.sidebar .nav-link { color: #cbd5e1; border-radius: 8px; padding: .5rem .75rem; display: flex; align-items: center;
  gap: .7rem; font-weight: 500; }
.sidebar .nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar .nav-link.active { background: var(--navy-3); color: #fff; }
.sidebar .badge-alert { margin-left: auto; background: var(--negative); font-size: .65rem; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--border); height: 62px; display: flex; align-items: center;
  gap: .75rem; padding: 0 1.25rem; position: sticky; top: 0; z-index: 1030; }
.topbar .company-name { font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 260px; }
.topbar .search { max-width: 420px; flex: 1; position: relative; }
.topbar .search input { background: var(--bg); border-color: transparent; padding-left: 2.2rem; }
.topbar .search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-results { position: absolute; top: 110%; left: 0; right: 0; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(15,23,42,.12); max-height: 420px; overflow-y: auto; z-index: 1050; }
.search-results:empty { display: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy-3); color: #fff; display: grid;
  place-items: center; font-weight: 600; font-size: .8rem; }
.content { padding: 1.5rem; flex: 1; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; color: var(--navy); margin: 0; }
.page-header .subtitle { color: var(--muted); font-size: .875rem; margin-top: .15rem; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(15,23,42,.45); }
  .main { margin-left: 0; }
  .topbar .company-name { max-width: 140px; }
  .content { padding: 1rem; }
}

/* ---------- Cards e KPIs ---------- */
.card { border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); font-weight: 600; color: var(--navy);
  padding: .85rem 1.1rem; }
.kpi { padding: 1rem 1.1rem; height: 100%; }
.kpi .label { color: var(--muted); font-size: .78rem; font-weight: 500; display: flex; align-items: center; gap: .4rem; }
.kpi .value { font-size: 1.45rem; font-weight: 700; color: var(--navy); margin-top: .2rem; line-height: 1.2;
  word-break: break-word; }
.kpi .hint { font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.kpi .icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; float: right;
  background: #eef3fb; color: var(--navy-3); }
.kpi.negative .value { color: var(--negative); }
.kpi.positive .value { color: var(--positive); }
.delta-up { color: var(--positive); font-weight: 600; }
.delta-down { color: var(--negative); font-weight: 600; }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }

/* ---------- Tabelas ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 600; border-bottom-width: 1px; white-space: nowrap; background: #f8fafc; }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fbff; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge-soft { background: #eef3fb; color: var(--navy-3); font-weight: 600; }
.status-ok { background: #e7f6ee; color: #137a43; }
.status-low { background: #fff4e0; color: #a35b00; }
.status-out { background: #fde8e7; color: #b42318; }
.status-excess { background: #eef2ff; color: #3730a3; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.4rem; color: #b6c2d3; display: block; margin-bottom: .6rem; }

/* ---------- Formulários ---------- */
.form-label { font-weight: 500; font-size: .85rem; color: #334155; }
.form-text { font-size: .76rem; }
.formula { background: #f1f5fb; border-left: 3px solid var(--navy-3); padding: .6rem .85rem; border-radius: 6px;
  font-size: .82rem; color: #334155; }
.result-highlight { background: linear-gradient(135deg, var(--navy), var(--navy-3)); color: #fff; border-radius: 12px;
  padding: 1.1rem 1.25rem; }
.result-highlight .value { font-size: 1.8rem; font-weight: 700; }
.filters { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .75rem; margin-bottom: 1rem; }
.checkbox-grid ul, .checkbox-grid > div { list-style: none; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .35rem .75rem; }

/* ---------- Autenticação (login, cadastro, senha, cadastro da empresa) ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: #fff; }
.auth-side { position: relative; overflow: hidden; color: #cbd5e1; padding: 3rem clamp(2rem, 5vw, 4.5rem);
  display: flex; flex-direction: column; justify-content: space-between; gap: 2.5rem;
  background:
    radial-gradient(60rem 30rem at 110% -10%, rgba(255, 49, 49, .28), transparent 60%),
    radial-gradient(40rem 26rem at -20% 115%, rgba(29, 78, 137, .55), transparent 60%),
    linear-gradient(160deg, #0b1220 0%, #0b2545 100%); }
.auth-side::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent); }
.auth-side > * { position: relative; z-index: 1; }
.auth-side .auth-logo { height: 44px; width: auto; align-self: flex-start; object-fit: contain; }
.auth-side h2 { color: #fff; font-weight: 700; font-size: clamp(1.7rem, 2.6vw, 2.35rem); line-height: 1.18;
  letter-spacing: -.02em; margin-bottom: 1rem; }
.auth-side h2 .hl { color: var(--brand); }
.auth-side .lead { color: #aab8cc; font-size: 1rem; max-width: 30rem; }
.auth-features { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .9rem; max-width: 31rem; }
.auth-features li { display: flex; gap: .85rem; align-items: flex-start; padding: .8rem .95rem; border-radius: 12px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); }
.auth-features .ico { flex: 0 0 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255, 49, 49, .14); color: #ff6b6b; font-size: 1.05rem; }
.auth-features strong { color: #fff; font-weight: 600; display: block; font-size: .92rem; }
.auth-features span { font-size: .82rem; color: #93a3b8; }
.auth-side .auth-foot { font-size: .78rem; color: #6f819b; display: flex; gap: 1.25rem; flex-wrap: wrap; }
.auth-side .auth-foot i { color: #8aa0bd; margin-right: .3rem; }

.auth-form { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; background: #fff; }
.auth-form .box { width: 100%; max-width: 410px; }
.auth-form .box.wide { max-width: 520px; }
.auth-form .form-logo { height: 40px; width: auto; margin-bottom: 2rem; }
.auth-title { font-size: 1.65rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; margin-bottom: .35rem; }
.auth-subtitle { color: var(--muted); margin-bottom: 1.75rem; }
.auth-form .form-control, .auth-form .form-select { border-radius: 10px; padding: .7rem .9rem; border-color: #d9e0ea;
  background-color: #fbfcfe; }
.auth-form .form-control:focus, .auth-form .form-select:focus { border-color: var(--brand);
  box-shadow: 0 0 0 .2rem rgba(255, 49, 49, .14); background-color: #fff; }
.auth-form .input-icon { position: relative; }
.auth-form .input-icon > i { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: #94a3b8;
  pointer-events: none; }
.auth-form .input-icon .form-control { padding-left: 2.6rem; }
.auth-form .input-icon .toggle-pass { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: #94a3b8; padding: .35rem .55rem; border-radius: 8px; }
.auth-form .input-icon .toggle-pass:hover { color: var(--ink); background: #f1f5f9; }
.auth-form .input-icon.has-toggle .form-control { padding-right: 2.8rem; }
.auth-form .form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.auth-form a { color: var(--brand-dark); font-weight: 500; text-decoration: none; }
.auth-form a:hover { text-decoration: underline; }
.btn-brand { --bs-btn-color: #fff; --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: #c81818; --bs-btn-active-border-color: #c81818; --bs-btn-focus-shadow-rgb: 255, 49, 49;
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
  font-weight: 600; border-radius: 10px; padding: .72rem 1rem; box-shadow: 0 8px 20px -10px rgba(255, 49, 49, .7); }
/* Escolha de plano (cadastro da empresa e assinatura) */
.plan-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem; }
.plan-option { position: relative; cursor: pointer; margin: 0; }
.plan-option input { position: absolute; opacity: 0; pointer-events: none; }
.plan-card { display: flex; flex-direction: column; gap: .25rem; height: 100%; padding: 1rem 1.05rem; border-radius: 12px;
  border: 1.5px solid #e2e8f0; background: #fff; transition: border-color .15s, box-shadow .15s; }
.plan-option:hover .plan-card { border-color: #cbd5e1; }
.plan-option input:checked + .plan-card { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(255, 49, 49, .12); }
.plan-option input:focus-visible + .plan-card { outline: 2px solid var(--brand); outline-offset: 2px; }
.plan-option.disabled { cursor: not-allowed; opacity: .55; }
.plan-card.trial { background: linear-gradient(160deg, #fff, var(--brand-soft)); }
.plan-badge { align-self: flex-start; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--brand-dark); background: var(--brand-soft); border-radius: 999px; padding: .15rem .55rem; margin-bottom: .2rem; }
.plan-name { font-weight: 700; color: var(--ink); font-size: 1.02rem; }
.plan-price { font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.plan-price small { font-size: .78rem; font-weight: 500; color: var(--muted); }
.plan-desc { font-size: .8rem; color: var(--muted); }
.plan-limits { font-size: .74rem; color: #94a3b8; margin-top: auto; padding-top: .35rem; }

.auth-divider { display: flex; align-items: center; gap: .75rem; color: #94a3b8; font-size: .8rem; margin: 1.5rem 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: #e5e9f0; }
.auth-secure { font-size: .76rem; color: #94a3b8; text-align: center; margin-top: 1.75rem; }
.auth-secure i { color: #16a34a; }
.auth-form .alert { border-radius: 10px; }
@media (max-width: 991.98px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-form { align-items: flex-start; padding-top: 3rem; }
}
@media (min-width: 992px) { .auth-form .form-logo.mobile-only { display: none; } }

.platform .sidebar { background: #111827; }
.platform .sidebar .nav-link.active { background: #374151; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
