/* Camada visual do MargemZap. Não altera comportamento: só aparência. */

:root {
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --ring: 0 0 0 3px rgba(0, 184, 124, 0.28);
  --ml: #ffe600;
  --ml-ink: #1a1a1a;
  --shopee: #ee4d2d;
  --dafiti: #111111;
  --magalu: #0086ff;
  --tiktok: #111111;
}

.page, .app-shell { background: #f4f7fb; }

button.btn, a.btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #2563eb;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
button.btn:hover, a.btn:hover { background: #1d4ed8; }
button.btn:focus-visible, a.btn:focus-visible { outline: none; box-shadow: var(--ring); }
button.btn:disabled, button.btn.is-loading, a.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
}
button.btn.secondary, a.btn.secondary,
button.btn.ghost, a.btn.ghost {
  background: #fff;
  color: #1e293b;
  border-color: #cbd5e1;
}
button.btn.secondary:hover, a.btn.secondary:hover,
button.btn.ghost:hover, a.btn.ghost:hover { background: #f8fafc; border-color: #94a3b8; }
button.btn.danger, a.btn.danger {
  background: #fff;
  color: #be123c;
  border-color: #fecdd3;
}
button.btn.danger:hover, a.btn.danger:hover { background: #fff1f2; }
button.btn .ico, a.btn .ico { width: 16px; height: 16px; flex: none; }
button.menu-btn {
  appearance: none;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
  font-family: inherit;
  margin-bottom: 8px;
}

.card {
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.card h2 { letter-spacing: -0.02em; }

.form input:not([type="checkbox"]):not([type="radio"]), .form select, .form textarea,
.wrap input:not([type="checkbox"]):not([type="radio"]), .wrap select, .wrap textarea,
.app-content input:not([type="checkbox"]):not([type="radio"]), .app-content select, .app-content textarea,
.field input, .field select, .affix input {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  min-height: 40px;
  padding: 8px 12px;
  background-color: #fff;
  color: #0f172a;
  font-family: inherit;
  font-size: 14px;
  box-shadow: none;
}
.app-content select, .wrap select, .form select, .field select {
  padding-right: 32px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23475569' stroke-width='2' viewBox='0 0 24 24'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
input[type="checkbox"] { accent-color: #2563eb; width: 18px; height: 18px; }
.wrap input:focus, .wrap select:focus, .wrap textarea:focus,
.form input:focus, .form select:focus, .form textarea:focus,
.app-content input:focus, .app-content select:focus, .app-content textarea:focus {
  outline: none;
  border-color: #00b87c;
  box-shadow: var(--ring);
}

table { font-size: 13.5px; }
thead th { background: #f8fafc; position: sticky; top: 0; }
tbody tr:hover { background: #f8fafc; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; background: #f4f7fb; }
.app-side {
  background: linear-gradient(180deg, #0b2545 0%, #0f3460 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 12px;
}
.app-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; padding: 6px 8px 18px; letter-spacing: -0.03em; }
.app-brand img { width: 36px; height: 36px; border-radius: 10px; background: #fff; object-fit: contain; padding: 3px; }
.app-brand small { display: block; font-weight: 600; color: #86efac; font-size: 11px; letter-spacing: 0; }
.app-nav { display: grid; gap: 4px; }
.app-nav a {
  display: flex; align-items: center; gap: 10px;
  color: #dbe7f5; text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 10px 12px; border-radius: 10px; border-left: 3px solid transparent;
}
.app-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-nav a.is-active { background: rgba(0,184,124,.22); color: #fff; border-left-color: #00b87c; }
.app-nav svg { width: 18px; height: 18px; flex: none; display: block; stroke-linecap: round; stroke-linejoin: round; }
.app-side-foot { margin-top: auto; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.08); font-size: 12px; color: #dbeafe; }
.app-main { min-width: 0; }
.app-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 24px; background: rgba(255,255,255,.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.app-top h1 { font-size: 1.25rem; margin: 0; letter-spacing: -0.03em; }
.app-top p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.menu-btn { display: none; }
.app-content { padding: 20px 24px 48px; max-width: 1180px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 16px 14px;
  box-shadow: var(--shadow-sm);
}
.stat .label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.stat .value { font-size: 1.35rem; font-weight: 800; margin-top: 6px; letter-spacing: -0.03em; }
.stat .badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.badge.dry { background: #fef3c7; color: #92400e; }
.badge.live { background: #d1fae5; color: #065f46; }
.badge.off { background: #f1f5f9; color: #475569; }
.stat .hint { margin-top: 4px; color: var(--muted); font-size: 12px; }

.page-section { margin-top: 18px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.section-title h2 { margin: 0; }

.product-card {
  display: grid; grid-template-columns: 72px 1fr; gap: 16px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px;
  box-shadow: var(--shadow);
}
.thumb {
  width: 72px; height: 72px; border-radius: 12px; object-fit: cover;
  background: #f8fafc; border: 1px solid #e2e8f0;
}
.thumb.ph { display: grid; place-items: center; color: #94a3b8; }
.product-card h3 { margin: 0 0 6px; font-size: 1.02rem; letter-spacing: -0.02em; }
.price-lg { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.03em; }
.sku { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: #475569; background: #f1f5f9; border-radius: 6px; padding: 2px 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 800;
  border: 1px solid transparent;
}
.chip i { width: 8px; height: 8px; border-radius: 99px; background: currentColor; display: inline-block; }
.chip.ml { background: #fff6cc; color: #3f3a00; }
.chip.shopee { background: #ffece7; color: #9a3412; }
.chip.dafiti { background: #f1f5f9; color: #0f172a; }
.chip.magalu { background: #e0f2fe; color: #075985; }
.chip.tiktok { background: #f1f5f9; color: #111; }
.chip.soon { opacity: .55; }
.chip.soon::after { content: '· em breve'; font-weight: 700; margin-left: 4px; }

.badge { display: inline-flex; align-items: center; gap: 6px; }

.empty {
  text-align: center; padding: 36px 16px; border: 1px dashed #cbd5e1; border-radius: 18px; background: #fff;
}
.empty strong { display: block; margin: 8px 0 4px; }
.empty p { margin: 0; color: var(--muted); }

.skel { height: 14px; border-radius: 8px; background: linear-gradient(90deg, #e2e8f0, #f8fafc, #e2e8f0); background-size: 200% 100%; animation: sk 1.2s infinite; }
.skel.h { height: 88px; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.rule-grid { display: grid; gap: 12px; }
.rule-row {
  display: grid; grid-template-columns: 140px 1fr 160px 120px 150px; gap: 8px; align-items: end;
  padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc;
}
.field { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: #475569; }
.field .affix { display: flex; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.field .affix span { padding: 0 8px; color: #64748b; font-weight: 800; background: #f1f5f9; align-self: stretch; display: grid; place-items: center; }
.field .affix input { border: 0; border-radius: 0; width: 100%; box-shadow: none; }
.quote-box {
  margin-top: 12px; padding: 16px; border-radius: 16px;
  background: linear-gradient(135deg, #ecfdf5, #fff); border: 1px solid #a7f3d0;
}
.quote-box strong { font-size: 1.6rem; letter-spacing: -0.04em; display: block; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.scrim { display: none; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-side { position: fixed; z-index: 30; transform: translateX(-105%); width: 248px; transition: transform .2s ease; }
  .app-shell.nav-open .app-side { transform: none; }
  .menu-btn { display: inline-flex; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 20; border-radius: 0; }
  .app-shell.nav-open .scrim { display: block; }
  .stat-grid, .kpis { grid-template-columns: 1fr 1fr; }
  .rule-row, .product-card { grid-template-columns: 1fr; }
  .app-content, .app-top { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 640px) {
  .stat-grid, .kpis { grid-template-columns: 1fr; }
  .actions .btn { width: 100%; }
}

.mz-public { background: #fff; }
.mz-btn, .mz-link-quiet, .mz-links a { border-radius: 10px; }
.mz-btn:focus-visible, .btn:focus-visible, .app-nav a:focus-visible { outline: none; box-shadow: var(--ring); }
.auth-wrap .card { box-shadow: var(--shadow); }
.auth-wrap { padding-top: 48px; }
