/* ==========================================================================
   Calf Safe Admin — Design System
   Tokens → base → layout → componentes → páginas
   ========================================================================== */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  /* Superfícies e tinta (neutros levemente esverdeados, coerentes com a marca) */
  --bg:            #f5f6f3;
  --surface:       #ffffff;
  --surface-2:     #f9faf8;
  --surface-3:     #f1f3ef;
  --border:        #e4e7e1;
  --border-strong: #d2d7cf;
  --ink:           #121a15;
  --ink-2:         #46514b;
  --ink-3:         #78837c;
  --ink-4:         #a3aca6;

  /* Marca */
  --brand:         #1a6b2e;
  --brand-hover:   #155625;
  --brand-strong:  #0f411b;
  --brand-50:      #eef6f0;
  --brand-100:     #dcefe1;
  --brand-200:     #bce7c8;
  --gold:          #c9a227;
  --gold-50:       #fbf6e6;

  /* Sidebar */
  --side-bg:       #0d1c13;
  --side-bg-2:     #12261a;
  --side-ink:      #a7b6ac;
  --side-ink-hi:   #f3f6f4;
  --side-line:     rgba(255,255,255,.07);

  /* Status (reservados: sempre acompanhados de rótulo) */
  --ok:        #067647;  --ok-bg:      #ecfdf3;  --ok-line:      #abefc6;
  --warn:      #b54708;  --warn-bg:    #fffaeb;  --warn-line:    #fedf89;
  --danger:    #b42318;  --danger-bg:  #fef3f2;  --danger-line:  #fecdca;
  --info:      #175cd3;  --info-bg:    #eff8ff;  --info-line:    #b2ddff;
  --violet:    #5925dc;  --violet-bg:  #f4f3ff;  --violet-line:  #d9d6fe;
  --orange:    #c4320a;  --orange-bg:  #fff6ed;  --orange-line:  #f9dbaf;
  --muted:     #475467;  --muted-bg:   #f2f4f7;  --muted-line:   #e4e7ec;

  /* Forma */
  --r-sm: 8px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --shadow-xs: 0 1px 2px rgba(16, 28, 20, .05);
  --shadow-sm: 0 1px 2px rgba(16, 28, 20, .04), 0 1px 3px rgba(16, 28, 20, .06);
  --shadow-md: 0 4px 8px -2px rgba(16, 28, 20, .08), 0 2px 4px -2px rgba(16, 28, 20, .04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 28, 20, .22), 0 8px 16px -8px rgba(16, 28, 20, .10);
  --ring:      0 0 0 4px rgba(26, 107, 46, .14);
  --ring-danger: 0 0 0 4px rgba(180, 35, 24, .12);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar-w: 264px;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01", "ss03";
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code, .mono { font-family: var(--mono); font-size: .92em; }
::selection { background: var(--brand-100); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ── App shell ──────────────────────────────────────────────────────────── */
.app { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(201,162,39,.10), transparent 55%),
    linear-gradient(180deg, var(--side-bg-2), var(--side-bg));
  color: var(--side-ink);
  border-right: 1px solid rgba(0,0,0,.2);
  transition: transform .28s var(--ease);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; }
.sidebar-brand img { height: 34px; width: auto; filter: brightness(1.9) saturate(.9); }
.sidebar-brand strong { display: block; color: var(--side-ink-hi); font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.sidebar-brand span { display: block; font-size: 11.5px; color: var(--gold); letter-spacing: .04em; font-weight: 500; }

.sidebar-search {
  margin: 0 14px 10px; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r);
  background: rgba(255,255,255,.05); border: 1px solid var(--side-line);
  color: var(--side-ink); font-size: 13px; width: calc(100% - 28px); text-align: left;
  transition: background .15s, border-color .15s;
}
.sidebar-search:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); }
.sidebar-search kbd { margin-left: auto; }

.nav { flex: 1; overflow-y: auto; padding: 6px 14px 18px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.nav-group { padding: 18px 10px 8px; font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: rgba(167,182,172,.55); }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; margin: 1px 0; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500; color: var(--side-ink);
  transition: background .15s, color .15s;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.nav-link:hover { background: rgba(255,255,255,.05); color: var(--side-ink-hi); }
.nav-link.active { background: rgba(255,255,255,.08); color: var(--side-ink-hi); }
.nav-link.active svg { opacity: 1; color: var(--gold); }
.nav-link.active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--gold);
}

.sidebar-user { display: flex; align-items: center; gap: 10px; margin: 0 14px 14px; padding: 12px; border-radius: var(--r); background: rgba(255,255,255,.04); border: 1px solid var(--side-line); }
.sidebar-user .meta { min-width: 0; flex: 1; }
.sidebar-user .meta strong { display: block; font-size: 13px; color: var(--side-ink-hi); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .meta span { display: block; font-size: 11.5px; color: var(--side-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user a { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); color: var(--side-ink); transition: background .15s, color .15s; }
.sidebar-user a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-user a svg { width: 18px; height: 18px; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 32px;
  background: rgba(245,246,243,.82);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, background .2s;
}
.topbar.scrolled { border-bottom-color: var(--border); background: rgba(255,255,255,.86); }
.topbar-toggle { display: none; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); min-width: 0; }
.breadcrumb svg { width: 14px; height: 14px; color: var(--ink-4); }
.breadcrumb strong { color: var(--ink); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content { flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; padding: 28px 32px 56px; }

.sidebar-backdrop { display: none; }

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(13,28,19,.45); backdrop-filter: blur(2px); }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .topbar-toggle { display: inline-flex; }
  .content { padding: 20px 16px 48px; }
}

/* ── Page header ────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-title { font-size: 24px; line-height: 1.25; font-weight: 650; letter-spacing: -.022em; color: var(--ink); }
.page-subtitle { margin-top: 6px; font-size: 14px; color: var(--ink-3); max-width: 68ch; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.card + .card { margin-top: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-header.plain { border-bottom: 0; padding-bottom: 4px; }
.card-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.card-subtitle { margin-top: 2px; font-size: 13px; color: var(--ink-3); }
.card-body { padding: 22px; }
.card-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-footer.between { justify-content: space-between; }

.section-label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Layout helpers */
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-full { grid-column: 1 / -1; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.form-narrow { max-width: 760px; }
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--ink-3); } .text-faint { color: var(--ink-4); }
.text-sm { font-size: 13px; } .text-xs { font-size: 12px; }
.text-right { text-align: right; } .text-center { text-align: center; }
.text-ok { color: var(--ok); } .text-danger { color: var(--danger); }
.fw-600 { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  --btn-bg: var(--surface); --btn-ink: var(--ink-2); --btn-line: var(--border-strong);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 550; line-height: 1; white-space: nowrap;
  color: var(--btn-ink); background: var(--btn-bg);
  border: 1px solid var(--btn-line); box-shadow: var(--shadow-xs);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .08s;
}
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { --btn-bg: var(--brand); --btn-ink: #fff; --btn-line: var(--brand-hover); box-shadow: 0 1px 2px rgba(15,65,27,.25), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--brand-hover); color: #fff; }
.btn-danger { --btn-bg: var(--danger); --btn-ink: #fff; --btn-line: #912018; }
.btn-danger:hover { background: #912018; color: #fff; }
.btn-danger:focus-visible { box-shadow: var(--ring-danger); }
.btn-ghost { --btn-bg: transparent; --btn-line: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: var(--r-sm); }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: var(--r-sm); }
.btn-icon.btn-sm { width: 30px; height: 30px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  border-radius: var(--r-sm); border: 0; background: transparent; color: var(--ink-3);
  transition: background .15s, color .15s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }

/* Estado de carregamento (aplicado pelo admin.js no submit) */
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: rgba(255,255,255,.9) rgba(255,255,255,.9) transparent transparent;
  animation: spin .7s linear infinite;
}
.btn:not(.btn-primary):not(.btn-danger).is-loading::after { border-color: var(--ink-3) var(--ink-3) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

kbd {
  display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px; min-width: 20px; justify-content: center;
  font-family: var(--font); font-size: 11px; font-weight: 500; line-height: 18px;
  color: inherit; opacity: .8; border-radius: 5px; border: 1px solid currentColor; border-color: rgba(127,127,127,.35);
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 550; color: var(--ink-2); display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.label .opt { font-weight: 400; color: var(--ink-4); font-size: 12px; }
.label .req { color: var(--danger); }
.hint { font-size: 12px; color: var(--ink-3); }
.hint.error { color: var(--danger); }
.hint.ok { color: var(--ok); }

.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r);
  box-shadow: var(--shadow-xs); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:hover, .select:hover, .textarea:hover { border-color: #b9c0b5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: var(--ring); }
.input:disabled, .input[readonly] { background: var(--surface-3); color: var(--ink-3); cursor: not-allowed; }
.input.is-invalid { border-color: var(--danger); box-shadow: var(--ring-danger); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2378837c' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8 9l4-4 4 4m0 6l-4 4-4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.input[type="file"] { padding: 6px; min-height: auto; }
.input[type="file"]::file-selector-button { margin-right: 12px; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface-2); font-weight: 550; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.input-mono { font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase; }

.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { flex: 1; }
.input-group .addon { position: absolute; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 13.5px; pointer-events: none; display: flex; }
.input-group .addon svg { width: 17px; height: 17px; }
.input-group .addon.left { left: 12px; }
.input-group .addon.right { right: 12px; }
.input-group.has-left .input { padding-left: 38px; }
.input-group.has-left.has-text .input { padding-left: 40px; }
.input-group.has-right .input { padding-right: 38px; }

.counter { font-size: 11.5px; color: var(--ink-4); align-self: flex-end; margin-top: -2px; font-variant-numeric: tabular-nums; }
.counter.near { color: var(--warn); }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; width: 38px; height: 22px; border-radius: 99px; background: #cfd5cc; transition: background .2s var(--ease); flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch .switch-text strong { display: block; font-size: 14px; font-weight: 550; color: var(--ink); }
.switch .switch-text span { display: block; font-size: 12.5px; color: var(--ink-3); }

/* Opções em cartão (radio) */
.choice-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.choice { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.choice input { position: absolute; opacity: 0; }
.choice .choice-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--ink-2); }
.choice .choice-icon svg { width: 18px; height: 18px; }
.choice strong { display: block; font-size: 14px; font-weight: 600; }
.choice span { display: block; font-size: 12.5px; color: var(--ink-3); }
.choice:hover { border-color: #b9c0b5; }
.choice:has(input:checked) { border-color: var(--brand); box-shadow: var(--ring); background: var(--brand-50); }
.choice:has(input:checked) .choice-icon { background: var(--brand); color: #fff; }
.choice:has(input:focus-visible) { box-shadow: var(--ring); }

/* Estrelas (avaliação) */
.rating { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating label { cursor: pointer; color: #d6dbd3; transition: color .12s, transform .12s; }
.rating label svg { width: 26px; height: 26px; }
.rating label:hover, .rating label:hover ~ label, .rating input:checked ~ label { color: #f5b70a; }
.rating label:hover { transform: scale(1.08); }
.rating input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* Dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  padding: 34px 20px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface-2); color: var(--ink-3); cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.dropzone:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--brand); }
.dropzone .dz-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); color: var(--brand); }
.dropzone .dz-icon svg { width: 22px; height: 22px; }
.dropzone strong { color: var(--ink); font-size: 14px; font-weight: 600; }
.dropzone strong em { font-style: normal; color: var(--brand); }
.dropzone span { font-size: 12.5px; }
.file-list { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.file-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); font-size: 13px; }
.file-item .thumb { width: 36px; height: 36px; border-radius: 6px; background: var(--surface-3); object-fit: cover; flex-shrink: 0; display: grid; place-items: center; color: var(--ink-3); }
.file-item .thumb svg { width: 18px; height: 18px; }
.file-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }
.file-item .size { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  --b-ink: var(--muted); --b-bg: var(--muted-bg); --b-line: var(--muted-line);
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  font-size: 12px; font-weight: 550; line-height: 1; white-space: nowrap;
  color: var(--b-ink); background: var(--b-bg); border: 1px solid var(--b-line); border-radius: 99px;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.no-dot::before { display: none; }
.badge-ok      { --b-ink: var(--ok);     --b-bg: var(--ok-bg);     --b-line: var(--ok-line); }
.badge-warn    { --b-ink: var(--warn);   --b-bg: var(--warn-bg);   --b-line: var(--warn-line); }
.badge-danger  { --b-ink: var(--danger); --b-bg: var(--danger-bg); --b-line: var(--danger-line); }
.badge-info    { --b-ink: var(--info);   --b-bg: var(--info-bg);   --b-line: var(--info-line); }
.badge-violet  { --b-ink: var(--violet); --b-bg: var(--violet-bg); --b-line: var(--violet-line); }
.badge-orange  { --b-ink: var(--orange); --b-bg: var(--orange-bg); --b-line: var(--orange-line); }
.badge-brand   { --b-ink: var(--brand);  --b-bg: var(--brand-50);  --b-line: var(--brand-200); }
.badge-gold    { --b-ink: #8a6a07;       --b-bg: var(--gold-50);   --b-line: #efdc9c; }

.code-tag { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--brand-strong); background: var(--brand-50); border: 1px solid var(--brand-200); border-radius: 6px; }

/* ── Avatar ─────────────────────────────────────────────────────────────── */
.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 13.5px; font-weight: 600; color: var(--brand-strong);
  background: linear-gradient(135deg, var(--brand-100), var(--brand-200));
  background-size: cover; background-position: center; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }
.avatar-gold { color: #4d3b03; background: linear-gradient(135deg, #f3e2a2, var(--gold)); }

/* ── Toolbar / filtros ──────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.toolbar .search { width: 280px; max-width: 100%; }
.toolbar .search .input { min-height: 36px; padding-top: 7px; padding-bottom: 7px; font-size: 13.5px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  font-size: 13px; font-weight: 550; color: var(--ink-2);
  border: 1px solid var(--border); background: var(--surface); border-radius: 99px;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--ink); }
.chip .count { font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.active .count { background: rgba(255,255,255,.16); color: #fff; }

/* ── Tabela ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  position: sticky; top: 0; z-index: 1;
  padding: 11px 16px; text-align: left; white-space: nowrap;
  font-size: 12px; font-weight: 550; color: var(--ink-3);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--ink-2); }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fafbf9; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-clickable { cursor: pointer; }
.table tr.is-current { background: var(--brand-50); }
.table .cell-strong { color: var(--ink); font-weight: 550; }
.table .cell-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .cell-center { text-align: center; }
.table .cell-actions { width: 1%; white-space: nowrap; text-align: right; }
.table .cell-sub { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.table .w-1 { width: 1%; white-space: nowrap; }
.row-actions { display: inline-flex; gap: 2px; justify-content: flex-end; opacity: .75; transition: opacity .15s; }
.table tr:hover .row-actions, .row-actions:focus-within { opacity: 1; }
.table-empty td { padding: 0 !important; }
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--ink-3); }

.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person .who { min-width: 0; }
.person .who strong { display: block; color: var(--ink); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .who span { display: block; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 24px; gap: 6px; }
.empty .empty-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 10px; border-radius: 14px; color: var(--brand); background: var(--brand-50); border: 1px solid var(--brand-100); }
.empty .empty-icon svg { width: 24px; height: 24px; }
.empty strong { font-size: 15px; font-weight: 600; color: var(--ink); }
.empty p { font-size: 13.5px; color: var(--ink-3); max-width: 40ch; }
.empty .btn { margin-top: 12px; }

/* ── KPI / stat tiles ───────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr; } }
.kpi { position: relative; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); overflow: hidden; }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); font-weight: 500; }
.kpi-label svg { width: 16px; height: 16px; color: var(--ink-4); }
.kpi-value { margin-top: 10px; font-size: 28px; line-height: 1.1; font-weight: 650; letter-spacing: -.025em; color: var(--ink); }
.kpi-meta { margin-top: 6px; font-size: 12.5px; color: var(--ink-3); }
.kpi-meta strong { color: var(--ink-2); font-weight: 600; }

.hero-kpi {
  position: relative; overflow: hidden; color: #eaf3ec;
  padding: 24px 26px; border-radius: var(--r-xl);
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(201,162,39,.28), transparent 50%),
    radial-gradient(60% 80% at 0% 100%, rgba(45,157,78,.35), transparent 60%),
    linear-gradient(135deg, #123a20, #0d1c13);
  box-shadow: var(--shadow-md);
}
.hero-kpi .kpi-label { color: rgba(234,243,236,.7); }
.hero-kpi .kpi-label svg { color: var(--gold); }
.hero-kpi .hero-value { margin-top: 10px; font-size: 48px; line-height: 1; font-weight: 650; letter-spacing: -.035em; color: #fff; }
.hero-kpi .hero-value .cents { font-size: 24px; opacity: .6; letter-spacing: -.01em; }
.hero-kpi .hero-value small { font-size: 22px; font-weight: 600; opacity: .7; margin-right: 4px; letter-spacing: 0; }
.hero-kpi .hero-meta { margin-top: 14px; display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; color: rgba(234,243,236,.7); }
.hero-kpi .hero-meta strong { display: block; color: #fff; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }

/* Barras horizontais (distribuição) — uma única cor, valores sempre rotulados */
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.bar-row .bar-label { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.bar-row .bar-value { font-size: 13px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.bar-row .bar-value span { color: var(--ink-3); font-weight: 400; margin-left: 4px; }
.bar-track { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--brand-50); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--brand); min-width: 4px; transition: width .6s var(--ease); }

/* Lista de ranking */
.rank { display: flex; flex-direction: column; }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.rank-item:last-child { border-bottom: 0; }
.rank-pos { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; font-size: 12px; font-weight: 650; color: var(--ink-3); background: var(--surface-3); flex-shrink: 0; }
.rank-item:first-child .rank-pos { color: #6b5206; background: var(--gold-50); }
.rank-main { flex: 1; min-width: 0; }
.rank-main strong { display: block; font-size: 13.5px; }
.rank-value { text-align: right; font-weight: 650; font-size: 15px; font-variant-numeric: tabular-nums; }
.rank-value span { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 400; }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 22px; width: fit-content; max-width: 100%; overflow-x: auto; background: var(--surface-3); border: 1px solid var(--border); border-radius: 12px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px;
  border: 0; border-radius: 9px; background: transparent; white-space: nowrap;
  font-size: 13.5px; font-weight: 550; color: var(--ink-3);
  transition: background .15s, color .15s, box-shadow .15s;
}
.tab svg { width: 16px; height: 16px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.tab .count { font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: rgba(0,0,0,.06); font-variant-numeric: tabular-nums; }
.tab-panel[hidden] { display: none; }
.tab-panel { animation: fadeUp .25s var(--ease); }

/* ── Dialog: modal e drawer ─────────────────────────────────────────────── */
dialog { padding: 0; border: 0; color: inherit; background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(13, 28, 19, .42); backdrop-filter: blur(3px); }
.modal[open] { animation: modalIn .22s var(--ease); }
.modal[open]::backdrop { animation: fadeIn .2s ease; }
.modal { width: min(560px, calc(100vw - 32px)); margin: auto; }
.modal.modal-sm { width: min(440px, calc(100vw - 32px)); }
.modal.modal-lg { width: min(720px, calc(100vw - 32px)); }
/* Tela cheia: ocupa toda a página; o conteúdo fica centralizado com largura legível */
.modal.modal-full { width: 100vw; height: 100vh; height: 100dvh; margin: 0; }
.modal.modal-full .modal-box { height: 100%; max-height: none; border-radius: 0; }
.modal.modal-full .modal-head,
.modal.modal-full .modal-foot { padding-left: max(22px, calc((100% - 1280px) / 2)); padding-right: max(22px, calc((100% - 1280px) / 2)); }
.modal.modal-full .modal-head { border-bottom: 1px solid var(--border); }
.modal.modal-full .modal-body { flex: 1; padding-top: 18px; }
.modal.modal-full .modal-body > * { max-width: 1280px; margin-left: auto; margin-right: auto; }
.modal-box { display: flex; flex-direction: column; max-height: calc(100vh - 48px); background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 16px; }
.modal-head .modal-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; color: var(--brand); background: var(--brand-50); border: 1px solid var(--brand-100); }
.modal-head .modal-icon svg { width: 20px; height: 20px; }
.modal-head .modal-icon.danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.modal-title { font-size: 16.5px; font-weight: 650; letter-spacing: -.015em; color: var(--ink); }
.modal-desc { margin-top: 3px; font-size: 13.5px; color: var(--ink-3); }
.modal-head .icon-btn { margin: -4px -6px 0 auto; }
.modal-body { padding: 4px 22px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal-foot.between { justify-content: space-between; }

.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(560px, 100vw); }
.drawer[open] { animation: drawerIn .3s var(--ease); }
.drawer[open]::backdrop { animation: fadeIn .2s ease; }
.drawer .modal-box { height: 100%; max-height: 100vh; border-radius: 0; }
.drawer .modal-head { border-bottom: 1px solid var(--border); padding-bottom: 18px; }
.drawer .modal-body { flex: 1; padding-top: 20px; }

@keyframes fadeIn  { from { opacity: 0; } }
@keyframes fadeUp  { from { opacity: 0; transform: translateY(6px); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } }

/* Lista de definição (detalhes) */
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.dl > div { min-width: 0; }
.dl dt { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.dl dd { margin: 0; font-size: 14px; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.dl .full { grid-column: 1 / -1; }
.kv { display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; font-size: 13.5px; border-bottom: 1px dashed var(--border); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; color: var(--ink); font-weight: 500; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kv .total { padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--border-strong); border-bottom: 0; }
.kv .total dt { color: var(--ink); font-weight: 600; }
.kv .total dd { font-size: 17px; font-weight: 650; color: var(--brand); }
.panel { padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.panel + .panel { margin-top: 14px; }
.panel-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.panel-title svg { width: 15px; height: 15px; }
.panel.tint-ok { background: var(--ok-bg); border-color: var(--ok-line); }
.panel.tint-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.panel.tint-info { background: var(--info-bg); border-color: var(--info-line); }
.codebox { display: flex; gap: 8px; align-items: flex-start; }
.codebox code { flex: 1; padding: 10px 12px; font-size: 12px; line-height: 1.55; word-break: break-all; border-radius: var(--r-sm); background: rgba(255,255,255,.7); border: 1px solid rgba(0,0,0,.06); }

/* Citação (depoimentos / FAQ) */
.quote { position: relative; padding: 16px 18px 16px 44px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; line-height: 1.7; color: var(--ink-2); white-space: pre-wrap; }
.quote svg { position: absolute; left: 16px; top: 16px; width: 18px; height: 18px; color: var(--brand-200); }
.stars { display: inline-flex; gap: 1px; color: #f5b70a; }
.stars svg { width: 15px; height: 15px; }
.stars .off { color: #dfe3dc; }

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; position: relative; overflow: hidden;
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  animation: toastIn .35s var(--ease);
}
.toast.is-leaving { animation: toastOut .25s ease forwards; }
.toast .toast-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.toast .toast-icon svg { width: 16px; height: 16px; }
.toast.success .toast-icon { color: var(--ok); background: var(--ok-bg); }
.toast.error .toast-icon { color: var(--danger); background: var(--danger-bg); }
.toast .toast-body { flex: 1; min-width: 0; padding-top: 3px; }
.toast .toast-body strong { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.toast .toast-body p { font-size: 13px; color: var(--ink-2); margin-top: 1px; }
.toast .icon-btn { width: 26px; height: 26px; margin: -2px -4px 0 0; }
.toast .toast-progress { position: absolute; left: 0; bottom: 0; height: 2px; background: currentColor; opacity: .35; animation: toastTimer linear forwards; }
.toast.success .toast-progress { color: var(--ok); }
.toast.error .toast-progress { color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }
@keyframes toastTimer { from { width: 100%; } to { width: 0; } }

/* ── Command palette ────────────────────────────────────────────────────── */
.palette { width: min(560px, calc(100vw - 32px)); margin: 12vh auto auto; }
.palette[open] { animation: modalIn .18s var(--ease); }
.palette .modal-box { max-height: 70vh; }
.palette-search { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.palette-search svg { width: 18px; height: 18px; color: var(--ink-3); }
.palette-search input { flex: 1; height: 54px; border: 0; outline: none; font-size: 15px; background: transparent; }
.palette-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.palette-list li a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); font-size: 14px; color: var(--ink-2); }
.palette-list li a svg { width: 18px; height: 18px; color: var(--ink-3); }
.palette-list li a small { margin-left: auto; font-size: 12px; color: var(--ink-4); }
.palette-list li.is-active a { background: var(--brand-50); color: var(--brand-strong); }
.palette-list li.is-active a svg { color: var(--brand); }
.palette-empty { padding: 28px; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12px; color: var(--ink-3); }

/* ── Tooltip simples ([data-tip]) ───────────────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  padding: 5px 9px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 20;
  font-size: 12px; font-weight: 500; color: #fff; background: #17211b; box-shadow: var(--shadow-md);
  animation: fadeIn .12s ease;
}

/* ── Galeria / mídia ────────────────────────────────────────────────────── */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.media-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-xs); transition: box-shadow .2s, transform .2s; }
.media-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.media-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--surface-3); overflow: hidden; }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.media-card:hover .media-thumb img { transform: scale(1.04); }
.media-thumb .fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-4); }
.media-thumb .fallback svg { width: 28px; height: 28px; }
.media-thumb .badge { position: absolute; top: 10px; right: 10px; box-shadow: var(--shadow-xs); }
.media-thumb .order { position: absolute; top: 10px; left: 10px; padding: 3px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: #fff; background: rgba(13,28,19,.6); backdrop-filter: blur(4px); }
.media-thumb .play { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.35)); }
.media-thumb .play span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.92); color: var(--ink); box-shadow: var(--shadow-md); }
.media-thumb .play svg { width: 18px; height: 18px; margin-left: 2px; }
.media-thumb .actions { position: absolute; inset: auto 10px 10px 10px; display: flex; justify-content: flex-end; gap: 6px; opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
.media-card:hover .actions, .media-card:focus-within .actions { opacity: 1; transform: none; }
.media-thumb .actions .icon-btn { background: rgba(255,255,255,.95); color: var(--ink-2); box-shadow: var(--shadow-sm); }
.media-thumb .actions .icon-btn.danger:hover { background: var(--danger); color: #fff; }
.media-info { padding: 12px 14px; }
.media-info strong { display: block; font-size: 13.5px; font-weight: 550; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-info span { display: block; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-preview { border-radius: var(--r-lg); overflow: hidden; background: #0d1c13; aspect-ratio: 16 / 9; display: grid; place-items: center; color: var(--ink-4); }
.media-preview img, .media-preview video { width: 100%; height: 100%; object-fit: cover; }
.media-preview.light { background: var(--surface-3); }

/* Itens reordenáveis / lista de cartões */
.list-cards { display: flex; flex-direction: column; gap: 10px; }
.list-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.list-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.list-card .lc-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #0f2416; color: var(--gold); flex-shrink: 0; }
.list-card .lc-icon svg { width: 22px; height: 22px; }
.list-card .lc-main { flex: 1; min-width: 0; }
.list-card .lc-main strong { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.list-card .lc-main p { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-card .lc-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-4); }
.list-card .lc-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.order-pill { display: inline-grid; place-items: center; min-width: 28px; height: 24px; padding: 0 7px; font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--surface-3); border-radius: 6px; font-variant-numeric: tabular-nums; }

/* Icon picker */
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; }
.icon-picker label { position: relative; display: grid; place-items: center; height: 46px; border: 1px solid var(--border-strong); border-radius: var(--r); cursor: pointer; color: var(--ink-2); background: var(--surface); transition: all .15s; }
.icon-picker input { position: absolute; opacity: 0; }
.icon-picker svg { width: 20px; height: 20px; }
.icon-picker label:hover { border-color: var(--brand); color: var(--brand); }
.icon-picker label:has(input:checked) { background: #0f2416; border-color: #0f2416; color: var(--gold); box-shadow: var(--ring); }
.icon-picker label:has(input:focus-visible) { box-shadow: var(--ring); }

/* Barra de progresso */
.progress { height: 8px; border-radius: 99px; background: var(--brand-50); overflow: hidden; }
.progress > div { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--brand), #2d9d4e); transition: width .3s var(--ease); }
.log { max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); font-family: var(--mono); font-size: 12px; }
.log-row { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--border); }
.log-row:last-child { border-bottom: 0; }
.log-row .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.log-row.is-up { background: var(--ok-bg); }
.log-row.is-err { background: var(--danger-bg); }
.stat-mini { padding: 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); text-align: center; }
.stat-mini strong { display: block; font-size: 24px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-mini span { font-size: 12px; color: var(--ink-3); }

/* Callout */
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-lg); border: 1px solid var(--info-line); background: var(--info-bg); color: #1849a9; font-size: 13.5px; }
.callout svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.callout.warn { border-color: var(--warn-line); background: var(--warn-bg); color: #93370d; }
.callout a { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* Barra de ações fixa (formulários longos) */
.savebar {
  position: sticky; bottom: 16px; z-index: 20; margin-top: 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px 12px 18px; border-radius: var(--r-lg);
  background: rgba(18, 26, 21, .94); color: #e6ece8; box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
  transform: translateY(8px); opacity: .0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.savebar.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.savebar p { font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.savebar p::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(201,162,39,.2); }
.savebar .btn-ghost { color: #c6d0ca; }
.savebar .btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Login ──────────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-aside {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  padding: 44px; color: #e8f0ea;
  background:
    radial-gradient(70% 60% at 85% 10%, rgba(201,162,39,.30), transparent 60%),
    radial-gradient(60% 70% at 0% 100%, rgba(45,157,78,.35), transparent 60%),
    linear-gradient(160deg, #143d22, #0b170f);
}
.auth-aside::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, transparent, #000 40%, transparent);
}
.auth-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.auth-brand img { height: 40px; filter: brightness(1.9); }
.auth-brand strong { display: block; font-size: 17px; font-weight: 650; color: #fff; }
.auth-brand span { display: block; font-size: 12.5px; color: var(--gold); }
.auth-pitch { position: relative; z-index: 1; max-width: 440px; }
.auth-pitch h2 { font-size: 34px; line-height: 1.15; font-weight: 650; letter-spacing: -.03em; color: #fff; }
.auth-pitch h2 em { font-style: normal; color: var(--gold); }
.auth-pitch p { margin-top: 14px; font-size: 15px; color: rgba(232,240,234,.72); line-height: 1.6; }
.auth-foot { position: relative; z-index: 1; font-size: 12.5px; color: rgba(232,240,234,.5); }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 26px; font-weight: 650; letter-spacing: -.025em; }
.auth-card .lead { margin-top: 6px; color: var(--ink-3); font-size: 14.5px; }
.auth-card form { margin-top: 28px; display: flex; flex-direction: column; gap: 18px; }
.auth-back { display: inline-flex; align-items: center; gap: 6px; margin-top: 26px; font-size: 13px; color: var(--ink-3); }
.auth-back:hover { color: var(--brand); }
.auth-back svg { width: 15px; height: 15px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); font-size: 13.5px; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-error { background: var(--danger-bg); border: 1px solid var(--danger-line); color: #912018; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}

/* ── Movimento reduzido ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ── FAQ (acordeão) ─────────────────────────────────────────────────────── */
.faq-item { position: relative; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.faq-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.faq-item.is-off { background: var(--surface-2); }
.faq-item.is-off .faq-q { color: var(--ink-3); }
.faq-item summary { display: flex; align-items: center; gap: 12px; padding: 14px 140px 14px 14px; cursor: pointer; list-style: none; border-radius: var(--r-lg); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:focus-visible { outline: none; box-shadow: var(--ring); }
.faq-q { flex: 1; min-width: 0; font-size: 14px; font-weight: 550; color: var(--ink); }
.faq-chevron { display: grid; place-items: center; color: var(--ink-4); transition: transform .2s var(--ease); }
.faq-chevron svg { width: 16px; height: 16px; }
.faq-item details[open] .faq-chevron { transform: rotate(90deg); color: var(--brand); }
.faq-a { padding: 0 20px 18px 82px; font-size: 14px; line-height: 1.7; color: var(--ink-2); animation: fadeUp .2s var(--ease); }
.faq-actions { position: absolute; top: 10px; right: 10px; }
@media (max-width: 600px) { .faq-item summary { padding-right: 14px; flex-wrap: wrap; } .faq-actions { position: static; padding: 0 10px 10px; } .faq-a { padding-left: 20px; } }

/* KPIs clicáveis */
a.kpi { transition: border-color .15s, box-shadow .15s, transform .15s; }
a.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
a.bar-row { border-radius: 6px; }
a.bar-row:hover .bar-label { color: var(--ink); }
a.bar-row:hover .bar-fill { background: var(--brand-hover); }

/* ── Depoimentos ────────────────────────────────────────────────────────── */
.dep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.dep-card { display: flex; flex-direction: column; gap: 14px; padding: 18px 18px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); transition: box-shadow .2s, border-color .2s; }
.dep-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.dep-card.is-off { background: var(--surface-2); }
.dep-card.is-off .dep-text { color: var(--ink-3); }
.dep-text { flex: 1; font-size: 14px; line-height: 1.65; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.dep-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.dep-foot .person { min-width: 0; }

/* ── Aparência: pré-visualizações ───────────────────────────────────────── */
.hero-preview { position: relative; overflow: hidden; min-height: 340px; border-radius: var(--r-xl); background: #0b170f; box-shadow: var(--shadow-md); isolation: isolate; }
.hp-media, .hp-media img, .hp-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hp-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,20,12,.92) 0%, rgba(8,20,12,.7) 45%, rgba(8,20,12,.25) 100%); }
.hp-content { position: relative; z-index: 1; max-width: 560px; padding: 36px 40px; color: #fff; }
.hp-badge { display: inline-flex; padding: 5px 12px; border-radius: 99px; font-size: 12px; font-weight: 500; color: #f5d77a; background: rgba(201,162,39,.16); border: 1px solid rgba(201,162,39,.35); }
.hp-badge:empty, .hp-desc:empty { display: none; }
.hp-title { margin-top: 16px; font-size: 34px; line-height: 1.12; font-weight: 750; letter-spacing: -.03em; }
.hp-title em, .sobre-titulo-preview em { font-style: normal; background: linear-gradient(90deg, #55b870, #f5c842); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sobre-titulo-preview em.gold { background: none; color: #b78a10; }
.hp-desc { margin-top: 12px; font-size: 14px; line-height: 1.6; color: rgba(255,255,255,.78); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hp-buttons { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.hp-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; font-size: 13px; font-weight: 650; color: #0b170f; background: linear-gradient(90deg, #f5c842, #d4a017); }
.hp-btn small { font-weight: 500; opacity: .7; }
.hp-btn.ghost { color: #fff; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); }
.hp-btn.ghost:empty { display: none; }
.hp-stats { display: flex; gap: 28px; margin-top: 24px; }
.hp-stats strong { display: block; font-size: 22px; font-weight: 750; color: #f5c842; letter-spacing: -.02em; }
.hp-stats span { font-size: 12px; color: rgba(255,255,255,.65); }
.hp-tag { position: absolute; top: 14px; right: 14px; z-index: 1; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 600; color: #fff; background: rgba(255,255,255,.12); backdrop-filter: blur(6px); }
.hp-tag svg { width: 14px; height: 14px; }
.sobre-titulo-preview { font-size: 15px; font-weight: 650; color: var(--ink); margin-top: 4px; }
.sobre-badge { position: absolute; left: 14px; bottom: 14px; padding: 8px 12px; border-radius: 12px; background: #fff; box-shadow: var(--shadow-md); line-height: 1.2; }
.sobre-badge strong { display: block; font-size: 15px; color: var(--brand); }
.sobre-badge span { font-size: 11.5px; color: var(--ink-3); }
@media (max-width: 700px) { .hp-content { padding: 26px 22px; } .hp-title { font-size: 26px; } }

/* ── Ajustes finos ──────────────────────────────────────────────────────── */
.brand-mark { display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border-radius: 11px; background: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 4px 12px -4px rgba(0,0,0,.5); overflow: hidden; }
.brand-mark img { width: 34px; height: 34px; object-fit: contain; filter: none !important; }
.brand-mark-lg { width: 46px; height: 46px; border-radius: 13px; }
.brand-mark-lg img { width: 42px; height: 42px; }
.sidebar-search svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }
.sidebar-search span { flex: 1; }
.bar-track, .bar-fill { display: block; }
.rank-main > span { display: block; font-size: 12.5px; color: var(--ink-3); }
.modal-box:focus { outline: none; }
.grid > .card + .card, .split > .card + .card, .kpis > .card + .card { margin-top: 0; }
.choice strong { color: var(--ink); }
.choice > span:last-child { min-width: 0; }

/* Barra de alterações não salvas: flutuante, não ocupa espaço */
.savebar {
  position: fixed; bottom: 18px; margin: 0; z-index: 45;
  left: calc(var(--sidebar-w) + 32px); right: 32px;
  max-width: 760px; margin-inline: auto;
  visibility: hidden;
}
.savebar.is-visible { visibility: visible; }
@media (max-width: 1024px) { .savebar { left: 16px; right: 16px; } }
body:has(.savebar.is-visible) .content { padding-bottom: 110px; }

/* Responsivo: colunas nunca crescem além da tela; grades inline colapsam */
@media (max-width: 900px) {
  .split, .split[style] { grid-template-columns: minmax(0, 1fr) !important; }
  .split > [style*="sticky"] { position: static !important; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .grid[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .page-header { align-items: flex-start; }
  .card-header { flex-wrap: wrap; }
  .toolbar .search { width: 100%; }
  .hero-kpi .hero-value { font-size: 40px; }
}

/* ── Gráficos ───────────────────────────────────────────────────────────── */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart-bar { fill: var(--brand); transition: opacity .15s, fill .15s; }
.chart-bar.is-dim { opacity: .35; }
.chart-hit { fill: transparent; cursor: default; }
.chart-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.chart-base { stroke: var(--border-strong); stroke-width: 1; }
.chart-axis { font-size: 11px; fill: var(--ink-3); font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; padding: 7px 10px; border-radius: 8px; background: #17211b; color: #fff; box-shadow: var(--shadow-md); white-space: nowrap; }
.chart-tip strong { display: block; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-tip span { font-size: 12px; opacity: .75; }
.chart-table { margin-top: 12px; }
.chart-table summary { cursor: pointer; font-size: 12.5px; color: var(--ink-3); width: fit-content; }
.chart-table summary:hover { color: var(--brand); }
.chart-table .table-wrap { max-height: 260px; overflow-y: auto; margin-top: 10px; border: 1px solid var(--border); border-radius: var(--r); }

/* ── Parceiros ──────────────────────────────────────────────────────────── */
.kpi-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 99px; margin-left: 6px; vertical-align: middle; }
.kpi-delta.up { color: var(--ok); background: var(--ok-bg); }
.kpi-delta.down { color: var(--danger); background: var(--danger-bg); }
.kpi-delta.flat { color: var(--ink-3); background: var(--surface-3); }
.link-box { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid var(--brand-200); background: var(--brand-50); border-radius: var(--r); }
.link-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--brand-strong); font-weight: 600; }
.qr-box { display: grid; place-items: center; padding: 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); }
.qr-box canvas, .qr-box img { width: 168px; height: 168px; image-rendering: pixelated; }
.channel-links { display: flex; flex-direction: column; gap: 6px; }
.channel-link { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border: 1px solid var(--border); border-radius: var(--r); font-size: 13px; }
.channel-link strong { width: 92px; flex-shrink: 0; font-weight: 600; color: var(--ink); }
.channel-link code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); font-size: 12px; }
.profile-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.profile-head .avatar { width: 64px; height: 64px; font-size: 22px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; font-size: 13px; color: var(--ink-3); }
.profile-meta a, .profile-meta span { display: inline-flex; align-items: center; gap: 5px; }
.profile-meta svg { width: 15px; height: 15px; }
.profile-meta a:hover { color: var(--brand); }
.funnel { display: flex; flex-direction: column; gap: 12px; }
.funnel-step { display: grid; grid-template-columns: 140px 1fr 90px; align-items: center; gap: 12px; font-size: 13px; }
.funnel-step .bar-track { height: 26px; border-radius: 7px; }
.funnel-step .bar-fill { border-radius: 7px; }
.funnel-step .fv { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.funnel-step .fv span { display: block; font-size: 11.5px; font-weight: 400; color: var(--ink-3); }
.verdict { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); }
.verdict .v-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; }
.verdict .v-icon svg { width: 20px; height: 20px; }
.verdict.ok .v-icon { color: var(--ok); background: var(--ok-bg); }
.verdict.warn .v-icon { color: var(--warn); background: var(--warn-bg); }
.verdict.info .v-icon { color: var(--info); background: var(--info-bg); }
.verdict strong { display: block; font-size: 15px; }
.verdict p { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.period-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; margin-bottom: 20px; }
.period-bar form { display: flex; align-items: center; gap: 6px; }
.period-bar .input { min-height: 32px; padding: 5px 10px; font-size: 13px; width: auto; }
.form-section { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; padding: 26px 0; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section > header h2 { font-size: 15px; font-weight: 600; }
.form-section > header p { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
@media (max-width: 900px) { .form-section { grid-template-columns: 1fr; gap: 14px; } .funnel-step { grid-template-columns: 100px 1fr 70px; } }
.input-prefix { display: flex; align-items: stretch; min-height: 40px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-xs); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.input-prefix:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.input-prefix.is-invalid { border-color: var(--danger); box-shadow: var(--ring-danger); }
.input-prefix > span { display: flex; align-items: center; padding: 0 10px 0 12px; background: var(--surface-3); border-right: 1px solid var(--border); color: var(--ink-3); font-size: 13px; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.input-prefix > input { flex: 1; min-width: 0; border: 0; outline: none; padding: 9px 12px; font-size: 14px; background: transparent; }
@media (max-width: 600px) { .kpis[style] { grid-template-columns: minmax(0, 1fr) !important; } }
.funnel-step .bar-track { grid-column: auto; }
.period-bar form { flex-wrap: wrap; }
@media (max-width: 900px) { .form-section { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .period-bar form .input { flex: 1; min-width: 0; } }

/* Abas dentro de modal */
.tabs-block { width: 100%; margin: 4px 0 20px; }
.tabs-block .tab { flex: 1 0 auto; justify-content: center; padding: 0 12px; }
.tab.has-error { color: var(--danger); }
.tab.has-error::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
#modal-parceiro .modal-body { min-height: 440px; }
@media (max-width: 700px) { .tabs-block .tab svg { display: none; } }
@media (max-width: 600px) {
  .modal-foot { flex-wrap: wrap; }
  #modal-parceiro .modal-foot .btn[data-close-modal] { display: none; }   /* o X já fecha */
  #modal-parceiro .modal-foot .btn { padding: 0 12px; }
}
#modal-parceiro .modal-foot > .row { margin-left: auto; }

/* ── Expedição (quadro kanban) ──────────────────────────────────────────── */
.cor-cinza   { --col: #98a2b3; } .cor-azul { --col: #2e90fa; } .cor-ambar { --col: #f79009; }
.cor-violeta { --col: #7a5af8; } .cor-verde { --col: #17b26a; } .cor-vermelho { --col: #f04438; }
.kb-toolbar { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); margin-bottom: 16px; }
.kb-dica { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.kb-dica svg { width: 15px; height: 15px; }
.kb-board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding: 2px 2px 18px; min-height: 420px; scroll-snap-type: x proximity; }
.kb-col { flex: 0 0 300px; display: flex; flex-direction: column; max-height: calc(100vh - 150px); background: var(--surface-3); border: 1px solid var(--border); border-top: 3px solid var(--col); border-radius: var(--r-lg); scroll-snap-align: start; transition: background .15s, box-shadow .15s, border-color .15s; }
.kb-col.is-over { background: color-mix(in srgb, var(--col) 9%, var(--surface-3)); border-color: var(--col); box-shadow: 0 0 0 3px color-mix(in srgb, var(--col) 22%, transparent); }
.kb-col-head { display: flex; align-items: center; gap: 8px; padding: 12px 10px 4px 14px; }
.kb-col-head h2 { font-size: 14px; font-weight: 650; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--col); flex-shrink: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--col) 20%, transparent); }
.kb-count { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.kb-col-actions { margin-left: auto; display: flex; gap: 0; opacity: 0; transition: opacity .15s; }
.kb-col:hover .kb-col-actions, .kb-col-actions:focus-within { opacity: 1; }
.kb-col-actions .icon-btn { width: 28px; height: 28px; }
.kb-col-actions .icon-btn svg { width: 15px; height: 15px; }
.kb-col-sub { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding: 0 14px 10px; font-size: 12px; color: var(--ink-3); border-bottom: 1px solid var(--border); }
.kb-col-sub svg { width: 13px; height: 13px; }
.kb-col-sub strong { color: var(--ink-2); font-weight: 600; }
.kb-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.kb-vazio { display: none; margin: 0; padding: 22px 10px; text-align: center; font-size: 12.5px; color: var(--ink-4); border: 1.5px dashed var(--border-strong); border-radius: var(--r); }
.kb-col.is-empty .kb-vazio, .kb-board.is-dragging .kb-col.is-over .kb-vazio { display: block; }
.kb-board.is-dragging .kb-col.is-over:not(.is-empty) .kb-vazio { border-color: var(--col); color: var(--col); }
.kb-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 11px 12px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-xs); cursor: grab; transition: box-shadow .15s, transform .15s, border-color .15s, opacity .15s; }
.kb-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.kb-card:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--brand); }
.kb-card:active { cursor: grabbing; }
.kb-card.is-dragging { opacity: .4; transform: scale(.98); }
.kb-card.is-late { border-left: 3px solid var(--danger); padding-left: 10px; }
.kb-card-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--ink-3); }
.kb-valor { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.kb-cliente { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.kb-meta { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; flex-wrap: wrap; gap: 0 4px; }
.kb-rastreio { display: inline-flex; align-items: center; gap: 3px; font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.kb-rastreio svg { width: 13px; height: 13px; }
.kb-tempo { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; }
.kb-desde { font-size: 11.5px; color: var(--ink-4); white-space: nowrap; }
.kb-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; color: var(--muted); background: var(--muted-bg); }
.kb-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.kb-chip.ok   { color: var(--ok); background: var(--ok-bg); }
.kb-chip.warn { color: var(--warn); background: var(--warn-bg); }
.kb-chip.late { color: var(--danger); background: var(--danger-bg); }
.kb-chip.done { color: var(--ok); background: var(--ok-bg); }
.kb-progress { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.kb-progress > div { height: 100%; width: 0; border-radius: 99px; background: var(--ok); transition: width .4s var(--ease); }
.kb-progress > div.warn { background: var(--warn); } .kb-progress > div.late { background: var(--danger); } .kb-progress > div.none { background: var(--ink-4); }
.kb-add { flex: 0 0 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 140px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); background: transparent; color: var(--ink-3); font-weight: 550; transition: all .15s; }
.kb-add:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }
.kb-add svg { width: 22px; height: 22px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
.timeline li { position: relative; display: flex; flex-direction: column; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -24px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.timeline li.is-current::before { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.timeline li strong { color: var(--ink); font-weight: 600; }
.timeline li span { color: var(--ink-3); font-size: 12.5px; }
.cor-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.cor-picker label { position: relative; cursor: pointer; }
.cor-picker input { position: absolute; opacity: 0; }
.cor-picker span:not(.sr-only) { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--col); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); transition: box-shadow .15s, transform .15s; }
.cor-picker input:checked + span { box-shadow: 0 0 0 2px var(--ink); transform: scale(1.06); }
.cor-picker input:focus-visible + span { box-shadow: var(--ring), 0 0 0 2px var(--ink); }
@media (max-width: 700px) { .kb-col { flex-basis: 84vw; } .kb-dica { display: none; } }

/* ── Integração Bling ───────────────────────────────────────────────────── */
.bling-logo { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0; font: 800 28px/1 var(--font); color: #fff; background: linear-gradient(135deg, #3fa452, #1c6e2d); box-shadow: var(--shadow-sm); letter-spacing: -.04em; }
.badge .badge-ic { width: 12px; height: 12px; }
a.badge:hover { filter: brightness(.96); }
.bling-erro { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--danger) !important; }
.steps { list-style: none; counter-reset: passo; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.steps li { counter-increment: passo; position: relative; padding-left: 44px; }
.steps li::before { content: counter(passo); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 650; color: var(--ink-2); background: var(--surface-3); border: 1px solid var(--border-strong); }
.steps li.done::before { content: "✓"; color: #fff; background: var(--brand); border-color: var(--brand); }
.steps li strong { display: block; font-size: 14px; color: var(--ink); }
.steps li p { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.btn.disabled { opacity: .5; pointer-events: none; }
.json-box { margin: 10px 0 0; padding: 12px; max-height: 340px; overflow: auto; font: 12px/1.5 var(--mono); background: #0f1a13; color: #d7f5dd; border-radius: var(--r); }

/* ── Análise de acessos ─────────────────────────────────────────────────── */
.link { color: var(--brand); font-weight: 600; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.subnav { margin-bottom: 16px; }
a.tab[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.select-sm { min-height: 34px; padding-top: 5px; padding-bottom: 5px; font-size: 13px; width: auto; }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:hover td { background: var(--surface-2); }
.table-click tbody tr:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.filter-note { padding: 10px 18px; font-size: 13px; color: var(--ink-2); background: var(--brand-50); border-bottom: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.bar-row .bar-extra { grid-column: 1 / -1; margin-top: -2px; font-size: 12px; color: var(--ink-3); }
.hint-icon { display: inline-flex; vertical-align: middle; color: var(--ink-4); cursor: help; }
.hint-icon svg { width: 14px; height: 14px; }

/* Controle segmentado (troca de métrica do gráfico) */
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border); flex-wrap: wrap; }
.segmented .seg { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 550; color: var(--ink-3); }
.segmented .seg:hover { color: var(--ink); }
.segmented .seg.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }

/* Agora no site */
.live-card { display: grid; grid-template-columns: auto minmax(160px, 1fr) minmax(220px, 1.2fr); gap: 20px 28px; align-items: center; padding: 18px 22px; }
.live-main { display: flex; gap: 14px; align-items: center; }
.live-dot { position: relative; width: 12px; height: 12px; border-radius: 50%; background: var(--ink-4); flex-shrink: 0; }
.live-dot.on { background: #12b76a; }
.live-dot.on::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid #12b76a; opacity: 0; animation: livePulse 1.8s ease-out infinite; }
@keyframes livePulse { 0% { transform: scale(.5); opacity: .8; } 100% { transform: scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .live-dot.on::after { animation: none; } }
.live-label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.live-value { font-size: 15px; color: var(--ink-2); }
.live-value strong { font-size: 30px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-right: 2px; }
.live-meta { font-size: 12.5px; color: var(--ink-3); }
.live-spark .chart-bar { fill: #12b76a; }
.live-spark-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-4); margin-top: 4px; }
.live-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.live-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); }
.live-page { font-weight: 600; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-list .text-muted { white-space: nowrap; font-size: 12px; }
@media (max-width: 900px) { .live-card { grid-template-columns: 1fr; } }

/* Mapa de calor (rampa sequencial de um só tom) */
.heatmap-wrap { overflow-x: auto; }
.heatmap { border-collapse: separate; border-spacing: 3px; width: 100%; min-width: 520px; table-layout: fixed; }
.heatmap th { font-size: 10.5px; font-weight: 500; color: var(--ink-3); text-align: left; padding: 0; height: 14px; }
.heatmap tbody th { width: 34px; font-size: 11.5px; }
.heatmap td { height: 20px; border-radius: 4px; padding: 0; }
.h0 { background: var(--surface-3); } .h1 { background: #d3ecd9; } .h2 { background: #a3d6b0; }
.h3 { background: #64b67e; } .h4 { background: #2e8a4b; } .h5 { background: #135c28; }
.heatmap td[data-tip]:hover { outline: 2px solid var(--ink); outline-offset: -1px; }
.heat-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 10px; font-size: 11px; color: var(--ink-3); }
.heat-legend i { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.heat-legend span { margin: 0 4px; }

/* Rolagem média */
.scroll-meter { display: inline-block; width: 54px; height: 6px; margin-right: 8px; vertical-align: middle; border-radius: 99px; background: var(--brand-50); overflow: hidden; }
.scroll-meter span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* Jornada da visita */
.jornada .ev-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.jornada .ev-list li { font-size: 12px; color: var(--ink-3); padding-left: 12px; position: relative; }
.jornada .ev-list li::before { content: ""; position: absolute; left: 0; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); border: 0; }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.check-list li { position: relative; padding-left: 26px; }
.check-list li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--ok); background: var(--ok-bg); }
.check-list.no li::before { content: "✕"; color: var(--danger); background: var(--danger-bg); }
.danger-zone { border-color: var(--danger-line); }
.danger-zone .card-title { color: var(--danger); }
.text-warn { color: var(--warn); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.stat-row > div { background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat-row span { font-size: 12px; color: var(--ink-3); }
.stat-row strong { font-size: 20px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

/* ── Cupons no cadastro do parceiro ───────────────────────────── */
.cupom-list { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px; background: var(--surface); }
.cupom-head, .cupom-row { display: grid; grid-template-columns: minmax(120px, 1.4fr) 104px 112px 142px 46px minmax(96px, auto); gap: 8px; align-items: center; }
.cupom-head { padding: 0 2px 8px; }
.cupom-head span { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.cupom-row + .cupom-row { margin-top: 8px; }
.cupom-row .switch { justify-content: center; }
.cupom-acoes { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.cupom-usos { min-width: 48px; text-align: right; margin-right: 4px; white-space: nowrap; }
.cupom-vazio { margin: 4px 2px; }
#mp-cupons-linhas:not(:empty) + .cupom-vazio { display: none; }
@media (max-width: 760px) {
  .cupom-head { display: none; }
  .cupom-row { grid-template-columns: 1fr 1fr; padding: 10px; border: 1px dashed var(--border); border-radius: var(--r-md, 10px); }
  .cupom-row > .input[data-campo="codigo"] { grid-column: 1 / -1; }
  .cupom-row .switch { justify-content: flex-start; }
}

/* ── Origem do pedido (site / app do revendedor) ──────────────── */
.origem-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.origem-tag svg { width: 14px; height: 14px; color: var(--ink-3); }
.origem-tag.origem-app, .origem-tag.origem-app svg { color: var(--brand); }
.kpi.is-active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.segmented a.seg { text-decoration: none; }

/* ── Dashboard ────────────────────────────────────────────────── */
.link-plain { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
a.link-plain:hover, a.rank-item:hover strong { color: var(--brand); }
.link-plain svg { width: 14px; height: 14px; color: var(--ink-3); }
a.rank-item { color: inherit; text-decoration: none; display: flex; }
.live-card.live-compact { grid-template-columns: 1fr; gap: 14px; }

/* ── Expedição: portal da fábrica, observações e atividades ────── */
.kb-card-top { justify-content: flex-start; gap: 8px; }
.kb-card-top .kb-valor { margin-left: auto; }
.kb-card-top .origem-tag { font-size: 11px; }
.kb-card-top .origem-tag svg { width: 12px; height: 12px; }
.kb-notas { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--ink-3); }
.kb-notas svg { width: 12px; height: 12px; }
.kb-board.is-readonly .kb-card { cursor: pointer; }
.notas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.notas li { padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.notas li p { margin: 0; white-space: pre-wrap; font-size: 13.5px; color: var(--ink); }
.notas li span { display: block; margin-top: 4px; font-size: 12px; color: var(--ink-3); }
.alert:not(.alert-error) { background: var(--info-bg); border: 1px solid var(--info-line); color: #1849a9; }
.avatar.is-online { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ok); }
.ativ-acao { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 550; white-space: nowrap; }
.ativ-acao svg { width: 15px; height: 15px; color: var(--ink-3); }
.ativ-acao.ok svg { color: var(--ok); }
.ativ-acao.warn, .ativ-acao.warn svg { color: var(--warn); }
.ativ-acao.danger, .ativ-acao.danger svg { color: var(--danger); }
.ativ-det summary { cursor: pointer; font-size: 12px; color: var(--brand); margin-top: 4px; }
.ativ-det pre { margin: 6px 0 0; padding: 8px 10px; font-size: 11.5px; background: var(--surface-2); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Portal da fábrica: sem menu lateral, barra simples no topo */
.fab-topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 24px; background: var(--brand-strong, #0f411b); color: #fff; }
.fab-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.fab-brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.fab-brand small { display: block; font-size: 12px; color: rgba(255,255,255,.7); }
.fab-user { display: flex; align-items: center; gap: 10px; }
.fab-user-meta strong { display: block; font-size: 13.5px; }
.fab-user-meta small { display: block; font-size: 12px; color: rgba(255,255,255,.7); }
.fab-user form { margin: 0; }
.fab-content { max-width: none; padding: 24px 24px 48px; }
@media (max-width: 640px) {
  .fab-topbar { padding: 10px 16px; }
  .fab-user-meta, .fab-user .btn span { display: none; }
  .fab-content { padding: 16px 16px 40px; }
}
@media (max-width: 560px) {
  .is-fabrica .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .is-fabrica .kpi { padding: 14px; }
  .is-fabrica .kpi-meta { display: none; }
}

/* ── Dashboard personalizável ─────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.dash-w { min-width: 0; display: flex; flex-direction: column; }
.dash-w > .card, .dash-w > .kpi, .dash-w > section { flex: 1; margin: 0; }
.dash-w.w-kpi { grid-column: span 3; }
.dash-w.w-tercio { grid-column: span 4; }
.dash-w.w-metade { grid-column: span 6; }
.dash-w.w-inteiro { grid-column: 1 / -1; }
@media (max-width: 1100px) {
  .dash-w.w-kpi { grid-column: span 6; }
  .dash-w.w-tercio { grid-column: span 6; }
}
@media (max-width: 760px) {
  .dash-grid { gap: 12px; }
  .dash-w.w-tercio, .dash-w.w-metade { grid-column: 1 / -1; }
}
@media (max-width: 420px) { .dash-w.w-kpi { grid-column: 1 / -1; } }

.drawer.drawer-lg { width: min(720px, 100vw); }
.pz-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pz-item { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); opacity: .7; cursor: grab; transition: opacity .15s, border-color .15s, box-shadow .15s; }
.pz-item.is-on { background: var(--surface); opacity: 1; border-color: var(--border-strong); }
.pz-item.is-dragging { opacity: .35; box-shadow: var(--shadow-md); }
.pz-alca { color: var(--ink-4, #9aa49e); display: flex; }
.pz-alca svg { width: 16px; height: 16px; }
.pz-texto strong { display: block; font-size: 13.5px; color: var(--ink); }
.pz-texto span { display: block; font-size: 12px; color: var(--ink-3); }
.pz-grupo { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--brand); }
.pz-tam { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.pz-mover { display: flex; gap: 2px; }
.pz-mover svg { transform: rotate(90deg); }
@media (max-width: 600px) {
  .pz-item { grid-template-columns: auto minmax(0, 1fr) auto; }
  .pz-alca { display: none; }
  .pz-item select, .pz-tam { grid-column: 2 / -1; }
}
