:root {
  --accent: #c8202f;
  --accent-soft: rgba(200, 32, 47, 0.14);
  --gold: #e2bd62;
  --bg: #0d0f13;
  --panel: #15181e;
  --panel-2: #1b1f27;
  --line: #262b35;
  --line-2: #323845;
  --text: #eef0f4;
  --muted: #9aa1ae;
  --faint: #6b7280;
  --ok: #2fc47a;
  --warn: #f0b232;
  --bad: #ef5350;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; background: var(--bg); color: var(--text); }

body {
  font: 14px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .num { font-family: 'Space Grotesk', Inter, sans-serif; letter-spacing: -0.01em; }
h1 { font-size: 26px; margin: 0; }
h2 { font-size: 17px; margin: 0; }
h3 { font-size: 15px; margin: 0; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Layout ---------- */

.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 20px;
  padding: 22px 16px;
  background: linear-gradient(180deg, #12151b, #0f1116);
  border-right: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.brand img { width: 42px; height: 42px; border-radius: 12px; border: 2px solid var(--gold); object-fit: cover; background: var(--panel-2); }
.brand strong { display: block; font-family: 'Space Grotesk', sans-serif; font-size: 16px; }
.brand span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav a img { width: 22px; height: 22px; border-radius: 6px; opacity: 0.75; transition: opacity 0.15s; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav a.active img, .nav a:hover img { opacity: 1; }
.nav .count { margin-left: auto; font-size: 11px; color: var(--faint); }

.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.me img { width: 32px; height: 32px; border-radius: 50%; }
.me div { flex: 1; min-width: 0; }
.me strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me span { font-size: 11px; color: var(--muted); }

.main { min-width: 0; }
.page { max-width: 1180px; margin: 0 auto; padding: 32px 32px 64px; display: flex; flex-direction: column; gap: 22px; }
.loading { color: var(--muted); padding: 40px 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }

/* ---------- Componentes ---------- */

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head p { color: var(--muted); font-size: 13px; }

.grid-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { position: relative; overflow: hidden; }
.stat .label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.stat .label img { width: 22px; height: 22px; border-radius: 6px; }
.stat .num { font-size: 28px; font-weight: 700; margin-top: 10px; }
.stat .sub { color: var(--faint); font-size: 12px; }

.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text); font-weight: 600; cursor: pointer;
  transition: transform 0.06s, background 0.15s, border-color 0.15s; white-space: nowrap;
}
.btn:hover { border-color: #444b5a; background: #222733; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn img { width: 18px; height: 18px; border-radius: 5px; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 6px 18px var(--accent-soft); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: #ff8a80; }
.btn.danger:hover { background: rgba(239, 83, 80, 0.12); border-color: rgba(239, 83, 80, 0.4); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.approved { color: var(--ok); background: rgba(47, 196, 122, 0.1); border-color: rgba(47, 196, 122, 0.25); }
.badge.pending { color: var(--warn); background: rgba(240, 178, 50, 0.1); border-color: rgba(240, 178, 50, 0.25); }
.badge.expired, .badge.cancelled { color: var(--faint); }

.alert { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(240, 178, 50, 0.3); background: rgba(240, 178, 50, 0.07); }
.alert img { width: 26px; height: 26px; border-radius: 7px; }
.alert div { flex: 1; }
.alert p { color: var(--muted); font-size: 13px; }

.checklist { display: flex; flex-direction: column; gap: 10px; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--line); }
.check-item .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; font-size: 12px; }
.check-item.done .dot { background: var(--ok); border-color: var(--ok); color: #0b1a12; font-weight: 800; }
.check-item.done span { color: var(--muted); text-decoration: line-through; }
.check-item a { margin-left: auto; font-size: 13px; color: var(--muted); }

/* ---------- Formulários ---------- */

.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-weight: 600; font-size: 13px; }
.field .hint { color: var(--faint); font-size: 12px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.form { display: flex; flex-direction: column; gap: 16px; }

input[type='text'], input[type='number'], input[type='password'], input[type='email'], input[type='url'], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  background: #0f1217; border: 1px solid var(--line-2); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.money { position: relative; }
.money span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); font-weight: 600; }
.money input { padding-left: 38px; }

.drop {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 16px; border-radius: 12px; border: 1.5px dashed var(--line-2);
  background: #0f1217; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop img.icon { width: 34px; height: 34px; border-radius: 9px; }
.drop strong { display: block; }
.drop span { color: var(--faint); font-size: 12px; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop.has { border-style: solid; border-color: rgba(47, 196, 122, 0.45); }

.video-preview { width: 100%; border-radius: 12px; background: #000; max-height: 260px; display: block; }

.tabs { display: inline-flex; padding: 3px; gap: 3px; background: #0f1217; border: 1px solid var(--line-2); border-radius: 10px; }
.tabs button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13px; }
.tabs button.on { background: var(--panel-2); color: var(--text); }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 12px; border: 3px solid var(--gold); cursor: pointer; position: relative; }
.swatch.on { outline: 3px solid var(--text); outline-offset: 2px; }

.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--muted); }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

.progress { height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width 0.15s; }

/* ---------- Produtos ---------- */

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { max-width: 260px; }

.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.mod { display: flex; flex-direction: column; overflow: hidden; padding: 0; transition: border-color 0.15s, transform 0.15s; }
.mod:hover { border-color: var(--line-2); transform: translateY(-2px); }
.mod .media { position: relative; aspect-ratio: 16 / 9; background: radial-gradient(circle at 50% 35%, #232836, #0f1217); display: grid; place-items: center; }
.mod .media video, .mod .media > img { width: 100%; height: 100%; object-fit: cover; }
.mod .media .empty { color: var(--faint); font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mod .media .empty img { width: 34px; height: 34px; border-radius: 9px; opacity: 0.6; }
.mod .number {
  position: absolute; top: 10px; left: 10px; z-index: 1;
  padding: 4px 10px; border-radius: 9px; font: 700 15px 'Space Grotesk', sans-serif;
  background: rgba(10, 11, 14, 0.82); border: 1px solid var(--gold); color: var(--gold); backdrop-filter: blur(4px);
}
.mod .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.mod .title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.mod .title h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod .price { font: 700 16px 'Space Grotesk', sans-serif; color: var(--text); white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); padding: 5px 9px; border-radius: 8px; background: var(--panel-2); max-width: 100%; }
.chip img { width: 16px; height: 16px; border-radius: 4px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.warn { color: var(--warn); }
.mod .actions { display: flex; gap: 8px; margin-top: auto; }
.mod .actions .btn { flex: 1; }

.list { display: flex; flex-direction: column; gap: 12px; }
.item { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.item .ico { width: 46px; height: 46px; border-radius: 12px; }
.item h3 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.item ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.item .side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.role { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--panel-2); }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-state img { width: 56px; height: 56px; border-radius: 15px; }

/* ---------- Vendas ---------- */

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); font-weight: 600; padding: 0 12px 10px; }
.table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: rgba(255, 255, 255, 0.015); }
.user { display: flex; align-items: center; gap: 10px; }
.user img { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 12px; }
.right { text-align: right; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { border: 1px solid var(--line-2); background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13px; }
.filters button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* ---------- Aparência ---------- */

.banner-prev { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.logo-prev { width: 120px; height: 120px; border-radius: 22px; object-fit: cover; border: 3px solid var(--gold); background: var(--panel-2); }
.icon-row { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-row img { width: 34px; height: 34px; border-radius: 9px; }

/* ---------- Diálogo e avisos ---------- */

dialog {
  width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  padding: 0; border: 1px solid var(--line-2); border-radius: 18px;
  background: var(--panel); color: var(--text); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(5, 6, 9, 0.72); backdrop-filter: blur(3px); }
dialog .d-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
dialog .d-head img { width: 32px; height: 32px; border-radius: 9px; }
dialog .d-head h2 { flex: 1; }
dialog .d-body { padding: 20px 22px; overflow: auto; max-height: calc(100vh - 190px); }
dialog .d-foot { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding: 14px 22px; border-top: 1px solid var(--line); }
dialog .d-foot .progress { flex: 1; }

details summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
details[open] summary { margin-bottom: 12px; }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); max-width: 360px; animation: in 0.2s ease-out; }
.toast img { width: 22px; height: 22px; border-radius: 6px; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Celular ---------- */

@media (max-width: 980px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .nav { min-width: 0; }
  .sidebar { position: sticky; z-index: 10; height: auto; padding: 12px 16px; gap: 10px; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { flex: 1; padding: 0; }
  .me { padding: 4px; border: 0; background: transparent; }
  .me div { display: none; }
  .nav { order: 3; flex: 1 0 100%; flex-direction: row; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .nav a { flex: none; padding: 7px 10px; }
  .nav a.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .nav .count { display: none; }
  .page { padding: 20px 16px 48px; }
  h1 { font-size: 22px; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 6px; }
  .table td { border: 0; padding: 0; }
  .table td.right { text-align: right; }
  .item { grid-template-columns: auto 1fr; }
  .item .side { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .toasts { left: 16px; right: 16px; }
}

@media (max-width: 480px) {
  .grid-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .num { font-size: 22px; }
  .search { max-width: none; flex: 1; }
}

.card-head .ico { width: 34px; height: 34px; border-radius: 9px; }
