/* PM Dashboard v2 — Design System
   Tema: Industrial refinado · DM Sans + DM Mono
   Paleta: Slate escuro, acentos amber/sky */

:root {
  --bg:          #080c14;
  --surface:     #0d1320;
  --card:        #111827;
  --card-hover:  #161f30;
  --border:      rgba(255,255,255,.07);
  --border-2:    rgba(255,255,255,.12);
  --text:        #e2e8f0;
  --muted:       #64748b;
  --muted-2:     #94a3b8;
  --accent:      #f59e0b;
  --accent-dim:  rgba(245,158,11,.12);
  --sky:         #38bdf8;
  --sky-dim:     rgba(56,189,248,.1);
  --green:       #10b981;
  --green-dim:   rgba(16,185,129,.12);
  --red:         #f43f5e;
  --red-dim:     rgba(244,63,94,.12);
  --violet:      #818cf8;
  --violet-dim:  rgba(129,140,248,.12);
  --shadow-sm:   0 2px 8px rgba(0,0,0,.4);
  --shadow-md:   0 8px 32px rgba(0,0,0,.5);
  --shadow-lg:   0 24px 64px rgba(0,0,0,.6);
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --font-body:   'DM Sans', system-ui, sans-serif;
  --font-mono:   'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: #2d3748; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4a5568; }

/* ── Top navigation ────────────────────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8,12,20,.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.topnav-inner {
  max-width: 1600px; margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex; align-items: center; gap: 8px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  font-weight: 700; font-size: .95rem;
  letter-spacing: -.01em;
  margin-right: 8px;
  flex-shrink: 0;
}
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #d97706);
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: #000;
  flex-shrink: 0;
}
.brand-icon-lg { width: 56px; height: 56px; border-radius: var(--radius-md); }
.brand-icon-lg svg { width: 28px; height: 28px; }

.topnav-links {
  display: flex; align-items: center; gap: 2px;
  flex: 1;
}
.nav-link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  color: var(--muted-2);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav-link.active { color: var(--accent); background: var(--accent-dim); }

.topnav-right {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
}

.lang-switch {
  display: flex; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); overflow: hidden;
}
.lang-btn {
  padding: 5px 12px;
  color: var(--muted-2); text-decoration: none;
  font-size: .8rem; font-weight: 700; letter-spacing: .05em;
  background: transparent; transition: all .15s;
}
.lang-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
.lang-btn.active { color: #000; background: var(--accent); }

/* ── Notificações ──────────────────────────────────────────────────────── */
.notif-wrap { position: relative; }
.notif-btn {
  position: relative;
  width: 36px; height: 36px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--muted-2); cursor: pointer;
  display: grid; place-items: center;
  transition: all .15s;
}
.notif-btn:hover { color: var(--text); border-color: var(--border-2); background: rgba(255,255,255,.08); }
.notif-count {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  background: var(--red); color: #fff;
  font-size: .7rem; font-weight: 700;
  border-radius: 999px; display: grid; place-items: center;
  padding: 0 4px;
}
.notif-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 340px;
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none; flex-direction: column;
  overflow: hidden;
}
.notif-wrap.open .notif-dropdown { display: flex; }
.notif-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.notif-header strong { font-size: .9rem; }
.notif-mark-all { font-size: .78rem; color: var(--sky); text-decoration: none; }
.notif-mark-all:hover { text-decoration: underline; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.notif-item:hover { background: var(--card-hover); }
.notif-item.unread { background: rgba(56,189,248,.04); }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; margin-top: 5px;
}
.notif-type-new_product { background: var(--accent); }
.notif-type-info { background: var(--sky); }
.notif-text { flex: 1; font-size: .85rem; line-height: 1.4; }
.notif-time { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.notif-empty { padding: 24px; text-align: center; color: var(--muted); }

/* ── User chip ─────────────────────────────────────────────────────────── */
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.user-avatar {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--violet), var(--sky));
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: .75rem; font-weight: 700; color: #fff;
}
.user-name { font-size: .83rem; font-weight: 500; }
.btn-logout {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  color: var(--muted); background: transparent;
  border-radius: var(--radius-sm); text-decoration: none;
  transition: all .15s;
}
.btn-logout:hover { color: var(--red); background: var(--red-dim); }

/* ── Main content ──────────────────────────────────────────────────────── */
.main-content { min-height: calc(100vh - 60px - 48px); }
.container {
  max-width: 1600px; margin: 0 auto;
  padding: 28px 24px 48px;
}

/* ── Page hero ─────────────────────────────────────────────────────────── */
.page-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e1206 100%);
  border-bottom: 1px solid var(--border);
  padding: 40px 0 36px;
}
.page-hero-inner {
  max-width: 1600px; margin: 0 auto;
  padding: 0 24px;
}
.eyebrow {
  display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent); font-size: .72rem; font-weight: 700;
  margin-bottom: 10px;
}
h1, h2, h3 { line-height: 1.2; }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; font-weight: 600; }
.lead { color: var(--muted-2); margin-top: 8px; font-size: .95rem; }

.page-title-row {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px;
  margin-bottom: 24px;
}
.page-h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.row-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.card-header h2 { margin: 0; }
.card > .fields-grid,
.card > .kpi-grid,
.card > .store-grid,
.card > .activity-list,
.card > .table-wrap,
.card > form { padding: 22px; }
.card > .toggle-pills { padding: 18px 22px; }

/* ── Stats ─────────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  transition: border-color .2s;
}
.stat-card:hover { border-color: var(--border-2); }
.stat-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: grid; place-items: center; flex-shrink: 0;
}
.stat-icon-total   { background: var(--sky-dim);    color: var(--sky); }
.stat-icon-new     { background: var(--accent-dim);  color: var(--accent); }
.stat-icon-analysis{ background: var(--violet-dim);  color: var(--violet); }
.stat-icon-approved{ background: var(--green-dim);   color: var(--green); }
.stat-icon-vol     { background: rgba(56,189,248,.08);color: var(--sky); }
.stat-icon-margin  { background: var(--green-dim);   color: var(--green); }
.stat-label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 4px; }
.stat-value { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; }

/* ── Filtros ────────────────────────────────────────────────────────────── */
.filters-card { margin-bottom: 16px; }
.filters-form {
  padding: 14px 18px;
  display: flex; align-items: center;
  flex-wrap: wrap; gap: 10px;
}
.filter-group { display: flex; }
.filter-search { min-width: 260px; }
.count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 22px; padding: 0 6px;
  background: var(--accent-dim); color: var(--accent);
  border-radius: 999px; font-size: .78rem; font-weight: 700;
  margin-left: 8px;
}

/* ── Tabela ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 12px 14px;
  color: var(--muted); font-size: .78rem;
  font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap; text-align: left;
}
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--card-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }
.th-photo, .td-photo { width: 64px; }
.td-num { font-family: var(--font-mono); font-size: .85rem; text-align: right; white-space: nowrap; }
.td-main { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 2px; }
.td-sub  { display: block; font-size: .78rem; color: var(--muted); }
.td-actions { display: flex; gap: 6px; align-items: center; }
.th-actions { text-align: right; }
.row-pending td { }
.prio-row-urgent { border-left: 3px solid var(--red); }
.prio-row-high   { border-left: 3px solid var(--accent); }

/* ── Thumb / foto ───────────────────────────────────────────────────────── */
.thumb {
  width: 52px; height: 52px; object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.thumb-empty {
  width: 52px; height: 52px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: var(--muted);
}
.cat-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-left: 6px;
  vertical-align: middle;
}

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 700; letter-spacing: .02em;
  white-space: nowrap;
}
.badge-new      { background: var(--sky-dim);    color: var(--sky); }
.badge-analysis { background: var(--violet-dim); color: var(--violet); }
.badge-approved { background: var(--green-dim);  color: var(--green); }
.badge-rejected { background: var(--red-dim);    color: var(--red); }
.badge-hold     { background: var(--accent-dim); color: var(--accent); }
.badge-yes { background: var(--green-dim);  color: var(--green); }
.badge-no  { background: rgba(255,255,255,.05); color: var(--muted); }
.badge-prio-low    { background: rgba(255,255,255,.05); color: var(--muted); }
.badge-prio-normal { background: var(--sky-dim);    color: var(--sky); }
.badge-prio-high   { background: var(--accent-dim); color: var(--accent); }
.badge-prio-urgent { background: var(--red-dim);    color: var(--red); }

/* ── Botões ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: .875rem; font-weight: 600;
  text-decoration: none; border: none; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, #d97706, var(--accent));
  color: #000;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost {
  background: rgba(255,255,255,.06);
  color: var(--text);
  border: 1px solid var(--border-2);
}
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(244,63,94,.2); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: .8rem; }
.btn-lg { padding: 13px 24px; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Campos de formulário ──────────────────────────────────────────────── */
.fields-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-full { grid-column: 1 / -1; }
.field-label { font-size: .8rem; font-weight: 600; color: var(--muted-2); letter-spacing: .03em; }
.req { color: var(--accent); }
.field-hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }

input[type="text"], input[type="number"], input[type="email"],
input[type="password"], input[type="date"], input[type="file"],
select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-family: var(--font-body); font-size: .9rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
textarea { resize: vertical; min-height: 80px; }
select option { background: #1e293b; }
input::placeholder, textarea::placeholder { color: var(--muted); }

.input-with-unit { position: relative; }
.input-with-unit input { padding-right: 36px; }
.input-unit {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: .85rem; pointer-events: none;
}

/* ── Photo zone ─────────────────────────────────────────────────────────── */
.photo-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-md);
  min-height: 140px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .2s;
  overflow: hidden; position: relative;
}
.photo-zone:hover { border-color: var(--accent); background: var(--accent-dim); }
.photo-zone.has-photo { border-style: solid; border-color: var(--border-2); min-height: auto; }
.photo-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--muted); font-size: .85rem; text-align: center; padding: 24px;
}
.photo-zone.has-photo .photo-placeholder { display: none; }
.photo-zone img {
  width: 100%; max-height: 280px;
  object-fit: cover; display: block;
}

/* ── Toggle pills / radio pills ─────────────────────────────────────────── */
.toggle-pills, .radio-pills {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.toggle-pill, .radio-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  padding: 8px 14px; border-radius: 999px;
  cursor: pointer; font-size: .85rem; font-weight: 500;
  transition: all .15s; user-select: none;
}
.toggle-pill:hover { border-color: var(--accent); }
.toggle-pill input, .radio-pill input { width: 14px; height: 14px; accent-color: var(--accent); }
.radio-pill input[type="radio"]:checked + * { color: var(--accent); }
.prio-low    { border-color: rgba(255,255,255,.1); }
.prio-normal { border-color: rgba(56,189,248,.3); }
.prio-high   { border-color: rgba(245,158,11,.3); }
.prio-urgent { border-color: rgba(244,63,94,.3); }

/* ── Form wizard (steps) ────────────────────────────────────────────────── */
.steps-indicator {
  display: flex; align-items: center;
  margin-bottom: 24px;
}
.step-btn {
  display: flex; align-items: center; gap: 10px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-family: var(--font-body);
  font-size: .875rem; font-weight: 500; padding: 0;
  transition: color .15s;
}
.step-btn.active { color: var(--accent); }
.step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface); border: 1.5px solid var(--border-2);
  display: grid; place-items: center;
  font-size: .8rem; font-weight: 700; transition: all .15s;
}
.step-btn.active .step-num { background: var(--accent); border-color: var(--accent); color: #000; }
.steps-line { flex: 1; height: 1px; background: var(--border); margin: 0 16px; }

.form-step { display: none; }
.form-step.active { display: block; }

.step-actions {
  padding: 20px 22px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ── Edit layout ────────────────────────────────────────────────────────── */
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px; align-items: start;
}
.form-actions-sticky {
  position: sticky; top: 76px;
  padding: 16px 0 0;
}

/* ── View layout ────────────────────────────────────────────────────────── */
.view-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px; align-items: start;
}
.view-photo {
  width: 100%; border-radius: var(--radius-md);
  border: 1px solid var(--border); object-fit: cover;
}
.view-photo-empty {
  width: 100%; aspect-ratio: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: grid; place-items: center; color: var(--muted);
}
.info-stack { margin-top: 16px; display: flex; flex-direction: column; gap: 2px; }
.info-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.info-item:last-child { border-bottom: none; }
.info-item > span { color: var(--muted); }
.info-item > strong { font-weight: 600; }

.kpi-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--border);
}
.kpi-item {
  background: var(--card); padding: 16px 18px;
}
.kpi-item > span { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 6px; }
.kpi-item > strong { font-size: 1.2rem; font-weight: 700; font-family: var(--font-mono); }
.kpi-accent { color: var(--green); }

.store-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.store-item > span { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 4px; }
.store-item > strong { font-size: .9rem; }

.field-view { padding: 14px 0; border-bottom: 1px solid var(--border); }
.field-view:last-child { border-bottom: none; }
.field-view > span { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 6px; }
.field-view > p { margin: 0; line-height: 1.6; }

/* ── Activity log ───────────────────────────────────────────────────────── */
.activity-list { padding: 8px 22px; }
.activity-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0; margin-top: 6px;
}
.activity-body { display: flex; flex-direction: column; gap: 2px; }
.activity-action { font-weight: 600; font-size: .875rem; }
.activity-detail { font-size: .8rem; color: var(--muted-2); }
.activity-meta { font-size: .75rem; color: var(--muted); }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-wrap { max-width: 440px; margin: 60px auto; padding: 0 16px; }

/* ── Alertas ────────────────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px; font-size: .875rem;
}
.alert-error   { background: var(--red-dim);   border: 1px solid rgba(244,63,94,.25);   color: #fda4af; }
.alert-success { background: var(--green-dim); border: 1px solid rgba(16,185,129,.25); color: #6ee7b7; }

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 56px 24px;
  color: var(--muted);
}
.empty-state svg { opacity: .3; margin-bottom: 12px; }
.empty-state p { font-size: .95rem; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  height: 48px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  gap: 8px; color: var(--muted); font-size: .8rem;
}
.footer-sep { opacity: .4; }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1024px) {
  .edit-grid { grid-template-columns: 1fr; }
  .view-grid { grid-template-columns: 1fr; }
  .kpi-grid  { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .topnav-links .nav-link span { display: none; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .fields-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: 1; }
  .user-name { display: none; }
  .container { padding: 16px 14px 40px; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .filter-search { min-width: 100%; }
}
