:root {
  --bg: #f7f3f4;
  --surface: #ffffff;
  --surface-2: #f1e8ec;
  --ink: #272126;
  --muted: #756b71;
  --primary: #8f2d56;
  --primary-dark: #67203e;
  --accent: #d98aa8;
  --success: #177854;
  --warning: #aa6a00;
  --danger: #b3263e;
  --line: #e7dde1;
  --shadow: 0 14px 34px rgba(71, 36, 51, .09);
  --radius: 20px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; overflow-x: hidden; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.app-shell { min-height: 100vh; max-width: 740px; margin: 0 auto; overflow-x: clip; background: var(--bg); }
.topbar { position: sticky; top: 0; z-index: 20; display:flex; justify-content:space-between; align-items:center; padding: 18px 18px 12px; background: rgba(247,243,244,.94); backdrop-filter: blur(16px); }
.eyebrow { margin:0 0 4px; font-size:.72rem; font-weight:800; letter-spacing:.14em; color:var(--primary); }
h1,h2,h3,p { margin-top:0; }
h1 { margin-bottom:0; font-size:1.45rem; }
h2 { margin-bottom:6px; font-size:1.1rem; }
p { color:var(--muted); line-height:1.45; }
.icon-btn { width:42px; height:42px; border:0; border-radius:14px; background:var(--surface); color:var(--primary); box-shadow:var(--shadow); font-size:1.4rem; }
.topbar-actions { display:flex; align-items:center; gap:8px; }
.topbar-actions form { margin:0; }
.session-btn { min-height:38px; padding:8px 12px; border:1px solid var(--line); border-radius:12px; background:var(--surface); color:var(--ink); font:inherit; font-size:.82rem; font-weight:800; cursor:pointer; }
.main-content { padding: 6px 16px calc(92px + var(--safe-bottom)); }
.view { display:none; animation:fade .2s ease; }
.view.active { display:block; }
@keyframes fade { from{opacity:.35; transform:translateY(4px)} to{opacity:1; transform:none} }
.hero-card { padding:22px; border-radius:26px; background:linear-gradient(135deg,#6e2244,#a23a67); color:#fff; box-shadow:0 18px 38px rgba(105,34,66,.24); }
.hero-card h2 { font-size:1.55rem; margin:8px 0; }
.hero-card p { color:#f7dfe9; margin-bottom:18px; }
.soft-label { display:inline-flex; padding:7px 10px; border-radius:999px; background:rgba(255,255,255,.16); font-size:.78rem; font-weight:700; }
.primary-btn,.secondary-btn,.text-btn { border:0; border-radius:14px; font-weight:800; }
.primary-btn { background:var(--primary); color:#fff; padding:13px 16px; box-shadow:0 10px 22px rgba(143,45,86,.2); }
.hero-card .primary-btn { background:#fff; color:var(--primary); box-shadow:none; }
.secondary-btn { background:var(--surface-2); color:var(--primary); padding:13px 16px; }
.text-btn { padding:8px 0; background:transparent; color:var(--primary); }
.compact { padding:10px 12px; }
.full { width:100%; }
.stats-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-top:14px; }
.stat-card { background:var(--surface); padding:15px; border-radius:18px; border:1px solid var(--line); box-shadow:0 6px 18px rgba(71,36,51,.04); }
.stat-card span { display:block; font-size:.76rem; color:var(--muted); }
.stat-card strong { display:block; margin-top:4px; font-size:1.28rem; }
.stat-card.alert strong { color:var(--danger); }
.section-heading { margin:24px 2px 12px; }
.section-heading p { margin:0; font-size:.9rem; }
.row-between { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.quick-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.quick-card { min-height:126px; display:flex; flex-direction:column; align-items:flex-start; justify-content:flex-end; padding:15px; border:1px solid var(--line); border-radius:20px; background:var(--surface); text-align:left; box-shadow:0 8px 22px rgba(71,36,51,.05); }
.quick-card span { font-size:1.65rem; margin-bottom:auto; }
.quick-card strong { margin-top:8px; }
.quick-card small { color:var(--muted); margin-top:3px; }
.stack-list { display:grid; gap:10px; }
.list-card { display:flex; gap:12px; padding:13px; border-radius:18px; background:var(--surface); border:1px solid var(--line); box-shadow:0 6px 18px rgba(71,36,51,.04); }
.thumb { width:70px; height:70px; flex:0 0 70px; object-fit:cover; border-radius:14px; background:#eadfe4; }
.list-card-body { min-width:0; flex:1; }
.list-card h3 { margin:1px 0 4px; font-size:.98rem; }
.meta { display:flex; flex-wrap:wrap; gap:6px 10px; font-size:.78rem; color:var(--muted); }
.card-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.mini-btn { border:0; border-radius:11px; padding:9px 10px; background:var(--surface-2); color:var(--primary); font-weight:800; font-size:.78rem; }
.mini-btn.primary { background:var(--primary); color:#fff; }
.mini-btn.success { background:#e1f2eb; color:var(--success); }
.badge { display:inline-flex; align-items:center; padding:5px 8px; border-radius:999px; font-size:.7rem; font-weight:900; letter-spacing:.02em; }
.badge.available,.badge.received,.badge.paid { background:#def1e8; color:var(--success); }
.badge.sold,.badge.issue,.badge.overdue { background:#f9dfe4; color:var(--danger); }
.badge.pending,.badge.sent,.badge.agency,.badge.partial,.badge.separated { background:#fff0d7; color:var(--warning); }
.form-card { padding:16px; border-radius:22px; background:var(--surface); border:1px solid var(--line); box-shadow:var(--shadow); }
label { display:block; margin-bottom:14px; font-size:.82rem; font-weight:800; color:#51474d; }
input,select,textarea { width:100%; min-width:0; margin-top:7px; padding:12px 13px; border:1px solid var(--line); border-radius:13px; background:#fff; color:var(--ink); outline:none; }
input:focus,select:focus,textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(217,138,168,.16); }
textarea { resize:vertical; }
.field-grid { display:grid; gap:10px; }
.field-grid > label { min-width:0; }
.field-grid.two { grid-template-columns:repeat(2,minmax(0,1fr)); }
.field-grid.three { grid-template-columns:repeat(3,minmax(0,1fr)); }
.money-input { display:flex; align-items:center; margin-top:7px; border:1px solid var(--line); border-radius:13px; overflow:hidden; background:#fff; }
.money-input span { padding-left:12px; color:var(--muted); }
.money-input input { margin:0; border:0; box-shadow:none; }
.photo-picker { width:100%; min-width:0; min-height:190px; margin-bottom:14px; display:flex; flex-direction:column; align-items:center; justify-content:center; border:2px dashed #d7c6ce; border-radius:20px; overflow:hidden; background:#fbf8f9; text-align:center; }
.photo-picker input { display:none; }
.photo-picker img { width:100%; height:220px; object-fit:cover; }
.photo-placeholder { width:100%; padding:22px 16px; display:flex; flex-direction:column; align-items:center; gap:5px; color:var(--primary); }
.photo-icon { font-size:1.9rem; }
.photo-picker strong { font-size:.95rem; }
.photo-picker small { font-size:.76rem; color:var(--muted); font-weight:500; }
.photo-actions { width:100%; max-width:420px; padding:0 14px 14px; display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.photo-source-btn { min-height:46px; margin:0; display:flex; align-items:center; justify-content:center; padding:10px 12px; border:1px solid var(--primary); border-radius:13px; background:var(--primary); color:#fff; font-size:.78rem; font-weight:800; cursor:pointer; }
.photo-source-btn.secondary { border-color:var(--line); background:var(--surface); color:var(--primary); }
.field-help { display:block; margin-top:6px; color:var(--muted); font-size:.72rem; font-weight:500; line-height:1.35; }
.file-field { min-width:0; }
.file-upload { position:relative; min-height:48px; margin-top:7px; display:flex; align-items:center; justify-content:center; padding:11px 14px; overflow:hidden; border:1px solid var(--line); border-radius:13px; background:#fbf8f9; color:var(--primary); font-size:.82rem; font-weight:800; }
.file-upload input[type="file"] { position:absolute; inset:0; width:100%; height:100%; margin:0; padding:0; opacity:0; cursor:pointer; }
.file-name { display:block; margin-top:7px; overflow:hidden; color:var(--muted); font-size:.72rem; font-weight:500; text-overflow:ellipsis; white-space:nowrap; }
.module-notice { margin:0 0 14px; padding:13px 14px; border:1px solid #efd6ab; border-radius:14px; background:#fff8e9; color:#7a530e; font-size:.82rem; font-weight:700; line-height:1.45; }
.is-loading { opacity:.65; pointer-events:none; }
.primary-btn:disabled,.secondary-btn:disabled { opacity:.55; cursor:wait; box-shadow:none; }
.sticky-actions { display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.filter-scroll { display:flex; flex-wrap:wrap; gap:8px; overflow:visible; padding:0 0 10px; }
.filter-scroll::-webkit-scrollbar { display:none; }
.filter-chip { white-space:nowrap; border:1px solid var(--line); border-radius:999px; padding:9px 12px; background:var(--surface); color:var(--muted); font-weight:800; font-size:.78rem; }
.filter-chip.active { background:var(--primary); border-color:var(--primary); color:#fff; }
.search-row { display:grid; grid-template-columns:1.6fr .9fr; gap:8px; margin-bottom:14px; }
.search-row input,.search-row select { margin-top:0; }
.product-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; }
.product-grid > .empty-state,
.stats-grid > .empty-state { grid-column:1/-1; }
.product-card { overflow:hidden; border-radius:20px; background:var(--surface); border:1px solid var(--line); box-shadow:0 8px 22px rgba(71,36,51,.05); }
.product-image-wrap { position:relative; aspect-ratio:4/5; background:#eadfe4; }
.product-image-wrap img { width:100%; height:100%; object-fit:cover; }
.product-image-wrap .badge { position:absolute; top:9px; left:9px; }
.product-info { padding:12px; }
.product-info h3 { min-height:39px; margin:0 0 5px; font-size:.92rem; }
.product-info p { margin:0; font-size:.78rem; }
.product-price { display:flex; align-items:center; justify-content:space-between; margin-top:9px; }
.product-price strong { font-size:1rem; }
.product-actions { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin-top:10px; }
.debt-summary { padding:18px; border-radius:22px; background:linear-gradient(135deg,#fff,#f6e8ee); border:1px solid var(--line); }
.debt-summary strong { display:block; font-size:1.65rem; color:var(--danger); }
.bottom-nav { position:fixed; z-index:30; bottom:0; left:50%; transform:translateX(-50%); width:min(100%,740px); display:grid; grid-template-columns:repeat(5,1fr); padding:8px 8px calc(8px + var(--safe-bottom)); background:rgba(255,255,255,.96); border-top:1px solid var(--line); backdrop-filter:blur(16px); }
.bottom-nav button { display:flex; flex-direction:column; align-items:center; gap:3px; padding:6px 2px; border:0; background:transparent; color:#8b7f85; font-weight:800; }
.bottom-nav button span { font-size:1.1rem; }
.bottom-nav button small { font-size:.67rem; }
.bottom-nav button.active { color:var(--primary); }
.modal { border:0; padding:0; width:min(92%,420px); border-radius:22px; box-shadow:0 30px 90px rgba(38,24,30,.3); }
.modal::backdrop { background:rgba(32,21,26,.52); backdrop-filter:blur(4px); }
.modal-card { position:relative; padding:22px; }
.modal-close { position:absolute; right:13px; top:10px; border:0; background:transparent; font-size:1.7rem; color:var(--muted); }
.toast { position:fixed; z-index:50; left:50%; bottom:100px; transform:translate(-50%,20px); max-width:90%; padding:11px 15px; border-radius:999px; background:#2e282b; color:#fff; opacity:0; pointer-events:none; transition:.2s; box-shadow:var(--shadow); font-weight:700; font-size:.85rem; }
.toast.show { opacity:1; transform:translate(-50%,0); }
.empty-state { padding:28px 18px; text-align:center; border:1px dashed #d8cbd1; border-radius:20px; background:rgba(255,255,255,.5); }
.empty-state strong { display:block; margin-bottom:5px; }
.catalog-body { min-height:100vh; }
.catalog-header { padding:28px 18px 24px; background:linear-gradient(135deg,#6e2244,#a23a67); color:#fff; }
.catalog-header p { max-width:620px; margin:10px auto 0; color:#f4dce6; }
.catalog-brand { max-width:620px; margin:0 auto; display:flex; align-items:center; gap:12px; }
.brand-mark { width:50px; height:50px; display:grid; place-items:center; border-radius:16px; background:#fff; color:var(--primary); font-size:1.55rem; font-weight:900; }
.catalog-brand .eyebrow { color:#f6ccd9; }
.catalog-main { max-width:740px; margin:0 auto; padding:20px 16px 44px; }
.catalog-search { position:sticky; top:0; z-index:10; padding:10px 0; background:var(--bg); }
.catalog-footer { padding:22px 18px; text-align:center; border-top:1px solid var(--line); }
.catalog-footer p { margin:0; font-size:.82rem; }
.catalog-card .product-actions { grid-template-columns:1fr; }
.whatsapp-btn { width:100%; border:0; border-radius:12px; padding:11px; background:#e2f5ec; color:#087a4b; font-weight:900; }
.auth-body { min-height:100vh; margin:0; background:radial-gradient(circle at 10% 0%,rgba(143,45,86,.13),transparent 35%),linear-gradient(180deg,#fff 0%,var(--bg) 100%); }
.auth-shell { width:min(100%,470px); min-height:100vh; margin:0 auto; padding:max(36px,env(safe-area-inset-top)) 20px max(28px,env(safe-area-inset-bottom)); display:grid; place-items:center; }
.auth-card { width:100%; padding:30px 24px; border:1px solid rgba(143,45,86,.12); border-radius:28px; background:rgba(255,255,255,.96); box-shadow:0 24px 70px rgba(81,40,59,.13); }
.auth-mark { width:58px; height:58px; margin-bottom:18px; border-radius:20px; display:grid; place-items:center; background:linear-gradient(135deg,var(--primary),#bc5c85); color:#fff; font-size:1.65rem; font-weight:900; box-shadow:0 12px 28px rgba(143,45,86,.25); }
.auth-card h1 { margin:5px 0 10px; font-size:clamp(1.7rem,7vw,2.2rem); }
.auth-card > p:not(.eyebrow) { margin:0; color:var(--muted); line-height:1.55; }
.auth-form { margin-top:24px; display:grid; gap:16px; }
.auth-form h2 { margin:10px 0 -4px; font-size:1rem; }
.auth-alert,.auth-success { margin-top:20px; padding:13px 15px; border-radius:14px; font-size:.9rem; font-weight:700; line-height:1.45; }
.auth-alert { border:1px solid #f0c5c5; background:#fff2f2; color:#9a3030; }
.auth-success { border:1px solid #bde3cf; background:#effaf4; color:#226840; }
.button-link { margin-top:20px; display:inline-flex; align-items:center; justify-content:center; text-decoration:none; }
.installer-shell { width:min(100%,600px); place-items:start center; }
.installer-form { gap:15px; }
@media (min-width:620px) {
  .main-content { padding-inline:22px; }
  .quick-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .product-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width:390px) {
  .field-grid.three { grid-template-columns:1fr 1fr; }
  .field-grid.three label:last-child { grid-column:1/-1; }
  .sticky-actions { grid-template-columns:1fr; }
  .search-row { grid-template-columns:1fr; }
  .photo-actions { grid-template-columns:1fr; }
}
