:root {
  --wine: #6b1f2a;
  --wine-dark: #4a141d;
  --wine-light: #8c3340;
  --gold: #c8a35a;
  --bg: #f5f1ec;
  --card: #ffffff;
  --ink: #2b2622;
  --muted: #8a817a;
  --ok: #2e7d4f;
  --hidden: #7a7a7a;
  --missing: #c0392b;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a { text-decoration: none; color: inherit; }

/* Topbar */
.topbar {
  background: linear-gradient(135deg, var(--wine), var(--wine-dark));
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 1.25rem; margin: 0; }
.brand p { margin: 0; font-size: 0.8rem; opacity: 0.8; }
.logo { font-size: 1.8rem; }
.back {
  font-size: 1.5rem; color: #fff; margin-right: 4px;
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 50%; transition: background 0.2s;
}
.back:hover { background: rgba(255, 255, 255, 0.15); }
.sync { font-size: 0.78rem; opacity: 0.85; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* Filtros */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  border: 1px solid #ddd; background: #fff; color: var(--ink);
  padding: 7px 16px; border-radius: 999px; cursor: pointer;
  font-size: 0.85rem; transition: all 0.15s;
}
.chip:hover { border-color: var(--wine-light); }
.chip.active { background: var(--wine); color: #fff; border-color: var(--wine); }

/* Edição (modal) */
.btn-edit { background: rgba(255,255,255,0.18); color: #fff; border: none; padding: 6px 12px; border-radius: 8px; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.btn-edit:hover { background: rgba(255,255,255,0.3); }
.hero-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.opt-edit { background: none; border: none; cursor: pointer; font-size: 0.85rem; padding: 0 4px; opacity: 0.6; }
.opt-edit:hover { opacity: 1; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #eee; }
.modal-head h3 { margin: 0; font-size: 1.1rem; }
.modal-x { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--muted); }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.mfield { display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.mfield input, .mfield select, .mfield textarea { padding: 9px 11px; border: 1px solid #ddd; border-radius: 8px; font-size: 0.95rem; color: var(--ink); font-family: inherit; }
.mfield-check { flex-direction: row; align-items: center; gap: 8px; }
.mfield-check input { width: 18px; height: 18px; accent-color: var(--wine); }
.modal-promo { background: #faf6f1; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.modal-note { font-size: 0.78rem; color: var(--muted); margin: 0; }
.modal-foot { display: flex; align-items: center; gap: 12px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid #eee; }
.modal-foot .cfg-msg { margin-right: auto; }

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; background: linear-gradient(135deg, var(--wine), var(--wine-dark)); }
.login-card { background: #fff; border-radius: 16px; padding: 40px 36px; width: 320px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,0.25); }
.login-logo { font-size: 3rem; }
.login-card h1 { margin: 8px 0 2px; font-size: 1.3rem; color: var(--wine); }
.login-sub { margin: 0 0 22px; color: var(--muted); font-size: 0.85rem; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card input { padding: 12px 14px; border: 1px solid #ddd; border-radius: 9px; font-size: 1rem; }
.login-card input:focus { outline: none; border-color: var(--wine-light); }
.login-card .btn { padding: 12px; font-size: 1rem; }
.btn-logout { background: rgba(255,255,255,0.15); color: #fff; padding: 8px 14px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; border: none; }
.btn-logout:hover { background: rgba(255,255,255,0.28); }

/* Seletor de categoria */
.cat-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.cat-bar label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.cat-bar select {
  padding: 8px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 0.95rem;
  font-weight: 600; color: var(--wine); background: #fff; cursor: pointer;
}

/* Cards de resumo (contábil) */
.acct-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.sum-card { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; border-left: 4px solid #ddd; }
.sum-label { font-size: 0.78rem; color: var(--muted); }
.sum-value { font-size: 1.5rem; font-weight: 700; }
.sum-revenue { border-left-color: var(--wine); } .sum-revenue .sum-value { color: var(--wine); }
.sum-profit { border-left-color: var(--ok); } .sum-profit .sum-value { color: var(--ok); }
.sum-margin { border-left-color: var(--gold); } .sum-margin .sum-value { color: var(--gold); }
.sum-cost { border-left-color: var(--missing); } .sum-cost .sum-value { color: var(--missing); }
.sum-stock { border-left-color: var(--wine-light); } .sum-stock .sum-value { color: var(--wine); }
.sum-sub { font-size: 0.68rem; color: var(--muted); margin-top: 2px; }

/* Contábil */
.acct-block { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 22px; }
.acct-block h2 { margin: 0 0 6px; font-size: 1.15rem; }
.acct-hint { color: var(--muted); font-size: 0.85rem; margin: 0 0 14px; line-height: 1.5; }
.acct-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.acct-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.acct-form input { padding: 8px 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 0.95rem; }
.acct-form input[type="text"] { min-width: 180px; }
.lnk-del { background: none; border: none; color: var(--missing); cursor: pointer; font-size: 0.78rem; }
.lnk-del:hover { text-decoration: underline; }
.pay-done { opacity: 0.55; }
.pay-done .td-name { text-decoration: line-through; }
.pay-over .td-name { color: var(--missing); }
.fin-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ok); }
.acct-in { color: var(--ok); font-weight: 700; }
.acct-out { color: var(--missing); font-weight: 700; }
.acct-action { display: flex; gap: 6px; align-items: center; }
.acct-action input { width: 110px; padding: 6px 8px; border: 1px solid #ddd; border-radius: 6px; font-size: 0.9rem; }
.acct-action .btn { padding: 6px 12px; font-size: 0.82rem; }

/* Aviso compacto do Conselheiro na home */
.ai-teaser { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, #2b2440, #3a2f57); color: #f3eefc; border-radius: 12px; padding: 14px 18px; margin-bottom: 22px; box-shadow: var(--shadow); transition: transform 0.12s; }
.ai-teaser:hover { transform: translateY(-2px); }
.ai-teaser-icon { font-size: 1.8rem; }
.ai-teaser-text { display: flex; flex-direction: column; gap: 2px; }
.ai-teaser-text strong { font-size: 1rem; }
.ai-teaser-text small { font-size: 0.8rem; opacity: 0.75; }
.ai-teaser.empty { opacity: 0.85; }

/* Conselheiro de IA (página dedicada) */
.ai-card { background: linear-gradient(135deg, #2b2440, #3a2f57); color: #f3eefc; border-radius: 14px; padding: 18px 20px; margin-bottom: 22px; box-shadow: var(--shadow); }
.ai-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.ai-title { font-size: 1.15rem; font-weight: 800; }
.ai-when { font-size: 0.76rem; opacity: 0.7; margin-right: auto; }
.ai-head .btn { background: #c8a35a; color: #2b2440; }
.ai-head .btn:hover { background: #d8b76e; }
.ai-body { font-size: 0.9rem; line-height: 1.6; }
.ai-body h4 { margin: 12px 0 4px; font-size: 0.98rem; color: var(--gold); }
.ai-body.muted { opacity: 0.7; }

/* Top 12 */
.top12 { margin-bottom: 24px; }
.t12-head { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.t12-head small { color: var(--muted); font-weight: 400; font-size: 0.8rem; }
.t12-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.t12-card {
  display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 12px;
  box-shadow: var(--shadow); padding: 12px 14px; transition: transform 0.12s, box-shadow 0.12s;
}
.t12-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); }
.t12-rank { font-size: 1.3rem; font-weight: 800; color: var(--gold); width: 26px; text-align: center; flex-shrink: 0; }
.t12-thumb { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; background: #efe9e1; flex-shrink: 0; }
.t12-thumb-empty { display: grid; place-items: center; font-size: 1.4rem; font-weight: 700; color: var(--wine-light); }
.t12-info { flex: 1; min-width: 0; }
.t12-name { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t12-cat { font-size: 0.68rem; color: var(--wine-light); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 4px; }
.t12-metrics { display: flex; gap: 16px; }
.t12-metric { display: flex; flex-direction: column; line-height: 1.2; }
.t12-metric span { font-size: 0.64rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.t12-metric b { font-size: 0.9rem; color: var(--ink); }
.t12-metric:nth-child(1) b { color: var(--ok); }
.t12-scorebox { display: flex; flex-direction: column; align-items: center; justify-content: center; background: #faf6f1; border-radius: 9px; padding: 8px 12px; flex-shrink: 0; }
.t12-scorebox b { font-size: 1.25rem; font-weight: 800; color: var(--gold); line-height: 1; }
.t12-scorebox span { font-size: 0.6rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* Lista de categorias (config) */
.cat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-bottom: 16px; }
.cat-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #eee; border-radius: 8px; cursor: pointer; }
.cat-item:hover { border-color: var(--wine-light); }
.cat-item input { width: 18px; height: 18px; accent-color: var(--wine); }
.cat-name { font-weight: 600; flex: 1; }
.cat-count { font-size: 0.75rem; color: var(--muted); }

/* Grid de cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}
.card {
  background: var(--card); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12); }
.thumb { width: 100%; height: 160px; object-fit: cover; background: #efe9e1; display: block; }
.thumb-empty {
  display: grid; place-items: center; font-size: 3rem; font-weight: 700;
  color: var(--wine-light); background: #efe9e1;
}
.card-body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.card-top { display: flex; }
.card-body h3 { margin: 0; font-size: 1rem; line-height: 1.25; }
.card-cat { font-size: 0.68rem; color: var(--wine-light); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.card-meta { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); margin-top: auto; }
.stock.muted { color: #b3aaa1; }
.sold { color: var(--wine); font-weight: 600; }

/* Badges de status */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-ativo { background: #e3f3ea; color: var(--ok); }
.badge-oculto { background: #ececec; color: var(--hidden); }
.badge-em_falta { background: #fdecea; color: var(--missing); }
.badge-outro { background: #eee; color: #555; }

/* Estados */
.loading, .error { color: var(--muted); padding: 40px 0; text-align: center; }
.error { color: var(--missing); }

/* Detalhe */
.detail { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.hero { display: flex; gap: 24px; padding: 24px; align-items: center; flex-wrap: wrap; }
.hero-img { width: 200px; height: 200px; object-fit: cover; border-radius: 12px; background: #efe9e1; }
.hero-info { flex: 1; min-width: 240px; }
.hero-info h2 { margin: 10px 0 6px; font-size: 1.6rem; }
.desc { color: var(--muted); font-size: 0.9rem; line-height: 1.5; margin: 0; }

.metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px; background: #ece6de; border-top: 1px solid #ece6de;
}
.metric { background: #fff; padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.metric-label { font-size: 0.78rem; color: var(--muted); }
.metric-value { font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.metric-hint { font-size: 0.72rem; color: #b3aaa1; }
.metric-revenue .metric-value { color: var(--wine); }
.metric-profit .metric-value { color: var(--ok); }
.metric-margin .metric-value { color: var(--gold); }
.metric-roi .metric-value { color: var(--gold); }
.metric-below .metric-value { color: var(--missing); }

/* Seção financeira na página do produto */
.prod-fin { border-top: 1px solid #ece6de; padding: 20px 24px; }
.prod-fin-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.prod-fin-head h3 { margin: 0; font-size: 1.1rem; margin-right: auto; }
.prod-fin-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: #ece6de; border: 1px solid #ece6de; border-radius: 10px; overflow: hidden;
}
.prod-fin-cards .metric { background: #fff; }
.pf-chart-wrap { margin-top: 18px; height: 280px; background: #fff; border: 1px solid #ece6de; border-radius: 10px; padding: 14px; }
.btn-danger { background: var(--missing); }
.btn-danger:hover { background: #a02617; }
.btn-ghost { background: #efe9e1; color: var(--wine); }
.btn-ghost:hover { background: #e3dccf; }
.notif-toggles { margin: 16px 0; display: flex; flex-direction: column; gap: 12px; }
.notif-row { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.notif-row input[type="time"] { padding: 5px 8px; border: 1px solid #ddd; border-radius: 6px; }
.notif-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--wine); }

.muted { color: var(--muted); }

/* Complementos / opções */
.og { padding: 20px 24px; border-top: 1px solid #ece6de; }
.og-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.og-title h3 { margin: 0; font-size: 1.1rem; }
.tag-req, .tag-opt {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
}
.tag-req { background: #fdecea; color: var(--missing); }
.tag-opt { background: #eef; color: #4a5; }
.og-total { margin-left: auto; font-size: 0.8rem; color: var(--wine); font-weight: 600; }
.opt-row { padding: 10px 0; border-bottom: 1px dashed #eee; }
.opt-row:last-child { border-bottom: none; }
.opt-head { display: flex; justify-content: space-between; align-items: center; }
.opt-name { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.opt-sold { font-weight: 700; color: var(--wine); }
.opt-stock { font-size: 0.68rem; font-weight: 600; color: var(--ok); background: #e3f3ea; padding: 2px 8px; border-radius: 999px; }
.opt-stock.low { color: var(--missing); background: #fdecea; }
.opt-low { background: #fff8f7; border-left: 3px solid var(--missing); padding-left: 10px; margin-left: -10px; }
.opt-min { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.opt-min label { font-size: 0.72rem; color: var(--muted); }
.opt-min-input { width: 64px; padding: 4px 8px; border: 1px solid #ddd; border-radius: 6px; font-size: 0.85rem; }
.opt-min-save { border: none; background: #efe9e1; color: var(--wine); padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 0.75rem; font-weight: 600; }
.opt-min-save:hover { background: #e3dccf; }
.opt-bar { height: 7px; background: #efe9e1; border-radius: 4px; margin: 6px 0; overflow: hidden; }
.opt-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--wine-light), var(--wine)); border-radius: 4px; }
.opt-foot { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); }

/* Topbar direita / botão relatório */
.topbar-right { display: flex; align-items: center; gap: 16px; }
.btn-report {
  background: rgba(255,255,255,0.15); color: #fff; padding: 8px 14px;
  border-radius: 8px; font-size: 0.85rem; font-weight: 600; transition: background 0.15s;
}
.btn-report:hover { background: rgba(255,255,255,0.28); }

/* Período / filtros do relatório */
.period {
  background: #fff; border-radius: 12px; box-shadow: var(--shadow);
  padding: 16px 20px; margin-bottom: 20px; display: flex;
  justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
}
.period-presets { display: flex; gap: 8px; }
.period-dates { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.period-dates label { font-size: 0.82rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.period-dates input { padding: 6px 8px; border: 1px solid #ddd; border-radius: 6px; font-size: 0.85rem; }
.btn {
  background: var(--wine); color: #fff; border: none; padding: 8px 18px;
  border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 600;
}
.btn:hover { background: var(--wine-dark); }

/* KPIs profissionais */
.summary-cards { margin-bottom: 22px; }
.kpi-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 14px; }
.kpi-card {
  border-radius: 14px; padding: 22px 24px; color: #fff;
  display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}
.kpi-card::after {
  content: ""; position: absolute; right: -20px; top: -20px;
  width: 90px; height: 90px; border-radius: 50%; background: rgba(255,255,255,0.08);
}
.kpi-revenue { background: linear-gradient(135deg, var(--wine), var(--wine-dark)); }
.kpi-profit { background: linear-gradient(135deg, #2e7d4f, #1f5a38); }
.kpi-roi { background: linear-gradient(135deg, #b8893a, #936b27); }
.kpi-below { background: linear-gradient(135deg, #c0392b, #962718); }
.kpi-label { font-size: 0.82rem; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 2.1rem; font-weight: 800; line-height: 1.1; }
.kpi-hint { font-size: 0.78rem; opacity: 0.8; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi-mini {
  background: #fff; border-radius: 10px; box-shadow: var(--shadow);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 3px;
  border-left: 3px solid #e0d9cf;
}
.kpi-mini-label { font-size: 0.74rem; color: var(--muted); }
.kpi-mini-value { font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.kpi-mini-down { border-left-color: var(--missing); }
.kpi-mini-neutral { border-left-color: var(--gold); }

/* Tabela financeira */
.table-wrap { background: #fff; border-radius: 12px; box-shadow: var(--shadow); overflow-x: auto; }
.fin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.fin-table thead th {
  background: var(--wine); color: #fff; padding: 12px 14px; text-align: left;
  font-weight: 600; font-size: 0.8rem; white-space: nowrap;
}
.fin-table th.num, .fin-table td.num { text-align: right; }
.fin-table tbody tr { border-bottom: 1px solid #f0ece6; cursor: pointer; transition: background 0.1s; }
.fin-table tbody tr:hover { background: #faf6f1; }
.fin-table td { padding: 12px 14px; white-space: nowrap; }
.fin-table .rank { color: var(--muted); font-weight: 700; }
.fin-table .td-name { font-weight: 600; white-space: normal; }
.fin-table .strong { font-weight: 700; color: var(--wine); }
.fin-table .profit { color: var(--ok); font-weight: 600; }
.fin-table .roi { color: var(--gold); font-weight: 700; }
.fin-table .below { color: var(--missing); font-weight: 700; }

.cfg-subtitle { font-size: 1.05rem; margin: 26px 0 4px; color: var(--ink); }

/* Página de configurações */
.cfg-card { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 26px; max-width: 640px; }
.cfg-intro { color: var(--muted); font-size: 0.9rem; margin: 0 0 22px; line-height: 1.5; }
.cfg-intro a { color: var(--wine); font-weight: 600; }
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.cfg-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--ink); font-weight: 600; }
.cfg-field input {
  padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px;
  font-size: 1.1rem; font-weight: 700; color: var(--wine);
}
.cfg-field input:focus { outline: none; border-color: var(--wine-light); }
.cfg-actions { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.cfg-msg { font-size: 0.9rem; font-weight: 600; }
.cfg-msg.ok { color: var(--ok); }
.cfg-msg.err { color: var(--missing); }
.cfg-note { color: var(--muted); font-size: 0.82rem; margin-top: 18px; max-width: 640px; }

/* Alertas de reposição */
.alert-banner {
  background: #fdecea; border: 1px solid #f5c6c0; border-left: 5px solid var(--missing);
  border-radius: 12px; padding: 14px 18px; margin-bottom: 20px;
}
.alert-title { font-weight: 700; color: var(--missing); font-size: 0.92rem; }
.alert-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.alert-chip {
  background: #fff; border: 1px solid #f5c6c0; color: var(--ink);
  padding: 5px 12px; border-radius: 999px; font-size: 0.82rem; transition: background 0.15s;
}
.alert-chip:hover { background: #fff5f4; }
.alert-chip strong { color: var(--missing); }

.restock-badge {
  background: var(--missing); color: #fff; font-size: 0.65rem; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; text-transform: uppercase;
}
.card-alert { box-shadow: 0 0 0 2px var(--missing), var(--shadow); }

.restock-alert {
  background: #fdecea; color: #922; border-left: 5px solid var(--missing);
  padding: 14px 18px; border-radius: 10px; margin: 18px; font-size: 0.92rem;
}

/* Cadastro de estoque mínimo na página do produto */
.minstock-box { margin: 18px; padding: 16px 18px; background: #faf6f1; border-radius: 10px; }
.minstock-box.low { background: #fdecea; }
.minstock-box.disabled { color: var(--muted); font-size: 0.85rem; }
.minstock-box label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.minstock-row { display: flex; align-items: center; gap: 10px; }
.minstock-row input {
  width: 120px; padding: 9px 12px; border: 1px solid #ddd; border-radius: 8px;
  font-size: 1.1rem; font-weight: 700; color: var(--wine);
}
.mb-title { margin: 0 0 4px; font-size: 1.05rem; }
.mb-hint { margin: 0 0 14px; font-size: 0.8rem; color: var(--muted); }
.mb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 14px; }
.mb-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.mb-field input { padding: 9px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 1.1rem; font-weight: 700; color: var(--wine); }
.mb-note { font-size: 0.85rem; color: var(--muted); align-self: center; }
.ptarget { margin-top: 16px; padding: 14px 16px; background: #fff; border: 1px dashed #d8cdbf; border-radius: 10px; }
.ptarget.muted { color: var(--muted); font-size: 0.85rem; border-style: solid; }
.ptarget-head { font-size: 0.95rem; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ptarget-value { font-size: 1.5rem; font-weight: 800; color: var(--wine); }
.ptarget-detail { font-size: 0.85rem; color: var(--ink); margin-top: 6px; }
.ptarget-note { font-size: 0.76rem; color: var(--muted); margin-top: 6px; }
.ptarget-warn { color: var(--missing); font-weight: 600; margin-top: 6px; }
.ptarget-ok { color: var(--ok); font-weight: 600; margin-top: 6px; }

@media (max-width: 520px) {
  .hero-img { width: 100%; height: 220px; }
}
