/* Impression Moda Festa — componentes da interface.
   Cores só por variável: o tema escuro troca os valores e tudo acompanha.
   Tela nova: use estas classes + utilitários do Tailwind para layout. Nunca cor fixa. */

/* Paleta do logo: dourado #D2AE6D. Tema claro: tudo branco, cinzas neutros, o dourado só
   como destaque; logo com "Moda Festa" em grafite (logo-claro.png). Tema escuro: preto e
   dourado, com o logo original (letra branca). */
:root {
  --sb-w: 252px;
  --brand: #8a6a2f;          /* dourado escuro: texto/realce legível sobre branco */
  --brand-strong: #6d5322;
  --brand-soft: #f8f2e6;
  --gold: #d2ae6d;           /* dourado do logo */
  --gold-soft: #faf5ec;
  --btn-bg: #18181b;         /* botão principal: preto, letra branca */
  --btn-bg-hover: #3a3a40;
  --btn-fg: #ffffff;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-3: #f4f4f5;
  --border: #ececee;
  --border-strong: #dcdce0;
  --text: #18181b;
  --text-2: #55555c;
  --text-3: #93939b;

  --ok: #15803d;   --ok-soft: #ecfdf3;
  --warn: #a16207; --warn-soft: #fef9e7;
  --err: #be123c;  --err-soft: #fff1f3;
  --info: #1d4ed8; --info-soft: #eff4ff;

  /* Menu lateral */
  --sb-bg: #ffffff;
  --sb-border: #ececee;
  --sb-text: #55555c;
  --sb-text-strong: #18181b;
  --sb-title: #a1a1aa;
  --sb-hover: #f4f4f5;
  --sb-active: #f8f2e6;
  --sb-active-text: #8a6a2f;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 16, 20, .04), 0 1px 3px rgba(16, 16, 20, .03);
  --shadow-lg: 0 12px 40px rgba(16, 16, 20, .08), 0 2px 6px rgba(16, 16, 20, .04);
  color-scheme: light;
}

html[data-theme="dark"] {
  --brand: #d2ae6d;
  --brand-strong: #e2c38c;
  --brand-soft: #2c2417;
  --gold: #d2ae6d;
  --gold-soft: #2c2417;
  --btn-bg: #d2ae6d;
  --btn-bg-hover: #e2c38c;
  --btn-fg: #14110e;

  --bg: #0f0e0c;
  --surface: #181613;
  --surface-2: #1e1b18;
  --surface-3: #27231f;
  --border: #2e2924;
  --border-strong: #3e3731;
  --text: #f0eae2;
  --text-2: #bdb3a7;
  --text-3: #877d72;

  --ok: #5cc895;   --ok-soft: #173326;
  --warn: #e6b45a; --warn-soft: #3a2e14;
  --err: #f17d8b;  --err-soft: #3d1a20;
  --info: #7fb0eb; --info-soft: #172a40;

  --sb-bg: #0b0a09;
  --sb-border: #221e1a;
  --sb-text: #b8ad9e;
  --sb-text-strong: #f4eee5;
  --sb-title: #756b5f;
  --sb-hover: rgba(255, 255, 255, .05);
  --sb-active: rgba(210, 174, 109, .15);
  --sb-active-text: #d2ae6d;
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text); }
body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
[x-cloak] { display: none !important; }
a { color: inherit; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.wordmark { font-family: "Didot", "Bodoni MT", "Playfair Display", Georgia, "Times New Roman", serif; letter-spacing: .02em; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sb-w); flex-shrink: 0; background: var(--sb-bg);
  border-right: 1px solid var(--sb-border); display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 40; transition: transform .2s ease;
}
.sidebar-brand { display: block; padding: 26px 24px 18px; }
.sidebar-brand img { width: 100%; max-width: 172px; height: auto; display: block; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 14px 12px; }
/* Um logo para cada tema: o claro tem "Moda Festa" escuro; o escuro, branco */
.logo-dark { display: none !important; }
html[data-theme="dark"] .logo-light { display: none !important; }
html[data-theme="dark"] .logo-dark { display: block !important; }
.nav-title { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--sb-title); padding: 18px 12px 6px; font-weight: 600; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--sb-text); font-weight: 500; text-decoration: none; font-size: 13.5px;
}
.nav-link:hover { background: var(--sb-hover); color: var(--sb-text-strong); }
.nav-link.active { background: var(--sb-active); color: var(--sb-active-text); font-weight: 600; }
.nav-link.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.sidebar-foot { border-top: 1px solid var(--sb-border); padding: 14px 24px; color: var(--sb-title); }

.main { flex: 1; min-width: 0; margin-left: var(--sb-w); display: flex; flex-direction: column; }
.topbar {
  height: 64px; background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.content { padding: 28px 32px; max-width: 1400px; width: 100%; }
.backdrop { position: fixed; inset: 0; background: rgba(10, 8, 5, .45); z-index: 35; }

/* Tela de login: fundo branco com um brilho dourado bem leve */
.login-bg { background: radial-gradient(900px 480px at 50% -12%, rgba(210, 174, 109, .16), transparent 65%), var(--bg); }
.card.login-card { box-shadow: var(--shadow-lg); border-top: 3px solid var(--gold); }
.login-logo { width: 280px; max-width: 80%; height: auto; margin: 0 auto; display: block; }

@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
}

/* ── Componentes ────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { color: var(--text-2); margin-top: 2px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2 { font-size: 14.5px; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { background: var(--btn-bg-hover); }
.btn-primary:focus-visible, .btn-secondary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-soft), 0 0 0 4px var(--gold); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--err-soft); color: var(--err); border-color: transparent; }
.btn-danger:hover { filter: brightness(.97); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-icon { width: 38px; padding: 0; }

.label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; font-size: 14px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--brand-soft); }
.hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-err { background: var(--err-soft); color: var(--err); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-error { background: var(--err-soft); color: var(--err); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }

.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty svg { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--text-3); }
.empty h3 { font-weight: 600; color: var(--text); margin-bottom: 4px; }

.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { box-shadow: 0 8px 30px rgba(20, 10, 15, .15); }

.dropdown { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px rgba(20,10,15,.14); padding: 6px; z-index: 50; }
.dropdown a, .dropdown button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; color: var(--text); text-align: left; text-decoration: none; background: none; border: 0; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-3); }

.avatar { width: 32px; height: 32px; border-radius: 99px; background: var(--gold-soft); color: var(--gold); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px; flex-shrink: 0; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }

.json { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-word; background: var(--surface-3); border-radius: 8px; padding: 8px 10px; }

/* ── Dashboard ── */
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.stat-label svg { color: var(--text-3); }
.stat-value { font-size: 28px; font-weight: 750; letter-spacing: -.02em; margin-top: 8px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-big { font-size: 34px; }
.stat-huge { font-size: 46px; }
.stat-note { font-size: 12.5px; color: var(--text-3); margin-top: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.stat-hero { border-top: 3px solid var(--gold); }
.stat-hero .dot { width: 7px; height: 7px; border-radius: 99px; background: var(--ok); display: inline-block; box-shadow: 0 0 0 3px var(--ok-soft); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 170px; }
.bar-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar { width: 100%; max-width: 28px; background: color-mix(in srgb, var(--gold) 38%, transparent); border-radius: 6px 6px 2px 2px; }
.bar-today { background: var(--gold); }
.bar[style*="height:0%"] { border: 0; }
.bar-day { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .stat-huge { font-size: 34px; } .stat-big { font-size: 28px; } .bar-day { display: none; } }

/* ── Inventário ── */
.inv-row-diff td { background: var(--warn-soft); }
.inv-count { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 2.5ch; text-align: center; }

/* Abas (cadastros de produto) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; margin-bottom: -1px; font-size: 13.5px; font-weight: 500;
  color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--gold); }
.tab svg { color: var(--text-3); }
.tab.active svg { color: var(--brand); }

/* Fotos de produto: caixa de proporção fixa, a foto inteira aparece (vestido em pé) */
.photo-box { position: relative; aspect-ratio: 4 / 5; background: var(--surface-3); overflow: hidden; }
.photo-box img { width: 100%; height: 100%; object-fit: contain; display: block; }
.photo-box .photo-none { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.photo-thumb { width: 44px; height: 55px; flex: none; border-radius: 8px; background: var(--surface-3); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.photo-thumb img { width: 100%; height: 100%; object-fit: contain; }

/* PDV: vitrine de cartões com foto (mesmo jeito do Varejo) */
.pdv-card { display: flex; flex-direction: column; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; cursor: pointer; transition: border-color .12s, box-shadow .12s; padding: 0; font: inherit; color: inherit; }
.pdv-card:hover, .pdv-card:focus-visible { border-color: var(--brand); box-shadow: var(--shadow-lg); outline: none; }
.pdv-card.is-empty { opacity: .6; }
.pdv-card .pdv-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; line-height: 1.3; font-size: 13.5px; }
.pdv-cart-btn { width: 34px; height: 34px; border-radius: 99px; display: flex; align-items: center; justify-content: center; background: var(--text); color: var(--surface); flex: none; }
.modal-wrap { position: fixed; inset: 0; z-index: 55; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 8, 5, .45); }
.modal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow: auto; }
