/* ============================================================
   Pessoas — 9-Box & Clima · Design system
   ============================================================ */

:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --panel-2: #fbfbfd;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --separator: rgba(0, 0, 0, 0.08);
  --chip: rgba(0, 0, 0, 0.05);
  --chip-strong: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.12);
  --danger: #d70015;
  --danger-soft: rgba(255, 59, 48, 0.12);
  --success: #248a3d;
  --success-soft: rgba(52, 199, 89, 0.14);
  --warning: #9a6b00;
  --warning-soft: rgba(255, 149, 0, 0.16);
  --grid-line: #e5e5ea;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 9px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 10px 30px rgba(0, 0, 0, 0.05);
  --shadow-pop: 0 4px 12px rgba(0, 0, 0, 0.10), 0 24px 60px rgba(0, 0, 0, 0.16);
  --ring: 0 0 0 4px rgba(0, 113, 227, 0.25);
  --topbar-bg: rgba(251, 251, 253, 0.82);
  --page-max: 1480px;
  --gutter: 20px;
}

.theme-dark {
  --bg: #000000;
  --panel: #1c1c1e;
  --panel-2: #161618;
  --text: #f5f5f7;
  --muted: #98989d;
  --separator: rgba(255, 255, 255, 0.12);
  --chip: rgba(255, 255, 255, 0.08);
  --chip-strong: rgba(255, 255, 255, 0.14);
  --accent: #2997ff;
  --accent-soft: rgba(41, 151, 255, 0.20);
  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.18);
  --success: #30d158;
  --success-soft: rgba(48, 209, 88, 0.16);
  --warning: #ffd60a;
  --warning-soft: rgba(255, 159, 10, 0.18);
  --grid-line: #3a3a3c;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 4px 12px rgba(0, 0, 0, 0.5), 0 24px 60px rgba(0, 0, 0, 0.6);
  --ring: 0 0 0 4px rgba(41, 151, 255, 0.35);
  --topbar-bg: rgba(22, 22, 24, 0.82);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

a { color: var(--accent); text-decoration: none; }

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  backdrop-filter: saturate(1.8) blur(20px);
  border-bottom: 1px solid var(--separator);
}

.topbar-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 10px var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }

.brand {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
@media (max-width: 720px) { .brand { display: none; } }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--chip);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.2s, transform 0.15s;
}
.icon-btn:hover { background: var(--chip-strong); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

#themeToggle .icon-sun { display: none; }
.theme-dark #themeToggle .icon-sun { display: block; }
.theme-dark #themeToggle .icon-moon { display: none; }

/* ---------- Segmented control ---------- */

.seg {
  display: inline-flex;
  background: var(--chip);
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
}
.seg > button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.seg > button.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.seg > button:not(.active):hover { color: var(--text); }

.tabs > button { padding: 7px 18px; font-size: 14px; }

.tab-badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

/* ---------- Buttons ---------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 980px;
  padding: 9px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  color: var(--text);
  background: var(--chip);
  transition: background-color 0.2s, transform 0.15s, opacity 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn:hover { background: var(--chip-strong); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-plain { background: transparent; color: var(--accent); padding: 6px 10px; }
.btn-plain:hover { background: var(--accent-soft); }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-block { width: 100%; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
.btn:focus-visible, .icon-btn:focus-visible, .seg > button:focus-visible { box-shadow: var(--ring); }

/* ---------- Forms ---------- */

label {
  display: block;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--separator);
  border-radius: var(--radius-xs);
  padding: 9px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.theme-dark input, .theme-dark select, .theme-dark textarea { background: var(--panel-2); }

input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }

select[multiple] { min-height: 128px; padding: 6px; }
select[multiple] option { padding: 5px 8px; border-radius: 6px; }

textarea { resize: vertical; min-height: 60px; }

.field { min-width: 0; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field-desc { font-size: 12px; color: var(--muted); margin: -2px 0 7px; line-height: 1.4; }
.form-error {
  color: var(--danger);
  font-size: 13px;
  margin: 10px 0 0;
  min-height: 18px;
}

/* Switch (checkbox estilo iOS) */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  user-select: none;
  padding: 4px 0;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  flex: none;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: var(--chip-strong);
  position: relative;
  transition: background-color 0.25s;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.switch input:checked + .track { background: #34c759; }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* ---------- Layout ---------- */

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--gutter);
}

.view { display: none; }
.view.active { display: block; animation: viewIn 0.3s ease; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--gutter);
  align-items: start;
}
.layout.sidebar-hidden { grid-template-columns: minmax(0, 1fr); }
.layout.sidebar-hidden .sidebar { display: none; }

.main-col { display: flex; flex-direction: column; gap: var(--gutter); min-width: 0; }

.sidebar {
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 92px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
}

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; order: -1; }
}

/* ---------- Cards ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.card-sub { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.card-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.sidebar .card { padding: 16px; border-radius: var(--radius-sm); }
.sidebar .card h3 { margin-bottom: 10px; }

.side-section + .side-section { margin-top: 4px; }
.side-stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- KPIs ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--separator);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
}
.kpi b {
  display: block;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi span { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.kpi.kpi-wide b { font-size: 15px; padding-top: 5px; }

/* ---------- Charts ---------- */

.charts-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: var(--gutter);
  align-items: stretch;
}
@media (max-width: 1280px) { .charts-row { grid-template-columns: 1fr; } }

.chart { height: 540px; }
.chart-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 22px;
  margin-bottom: 2px;
}

.legend { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend .dot.open { background: transparent; border: 2px solid currentColor; }
.legend .legend-lbl.active { color: var(--text); }
.size-legend { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.size-legend .dot { display: inline-block; border-radius: 50%; background: var(--muted); }

.demo-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gutter);
  align-items: stretch;
}
.chart-sm { height: 280px; }

.bottom-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: var(--gutter);
  align-items: start;
}
@media (max-width: 1080px) { .bottom-row { grid-template-columns: 1fr; } }

.comments { max-height: 460px; overflow: auto; }
.comment { border-bottom: 1px solid var(--separator); padding: 12px 2px; }
.comment:last-child { border-bottom: none; }
.comment-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.hint { font-size: 12.5px; color: var(--muted); }
.help-list { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.help-list li { margin-bottom: 7px; }
.help-list code {
  background: var(--chip);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 12px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--chip);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 550;
  color: var(--text);
}

/* ---------- Status / diff chips ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-novo { background: var(--accent-soft); color: var(--accent); }
.badge-edicao { background: var(--warning-soft); color: var(--warning); }
.badge-redundante { background: var(--chip); color: var(--muted); }
.badge-invalido { background: var(--danger-soft); color: var(--danger); }
.badge-ativo { background: var(--success-soft); color: var(--success); }
.badge-desligado { background: var(--danger-soft); color: var(--danger); }

.diff-list { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.diff-list .diff-item { margin-bottom: 3px; }
.diff-item b { color: var(--text); font-weight: 600; }
.diff-arrow { opacity: 0.6; margin: 0 4px; }

/* ---------- Empty state ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 48px 20px;
  color: var(--muted);
}
.empty svg { width: 40px; height: 40px; opacity: 0.5; }
.empty p { margin: 0; font-size: 14px; max-width: 380px; }
.empty .btn { margin-top: 6px; }

/* ---------- Aba Dados ---------- */

.data-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: var(--gutter);
  align-items: start;
  margin-bottom: var(--gutter);
}
@media (max-width: 1080px) { .data-grid { grid-template-columns: 1fr; } }

.hero-card {
  max-width: 560px;
  margin: 8vh auto 0;
  text-align: center;
  padding: 44px 40px;
}
.hero-card h2 { font-size: 24px; letter-spacing: -0.02em; }
.hero-card p { color: var(--muted); font-size: 15px; margin: 12px 0 22px; }
.hero-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-icon svg { width: 30px; height: 30px; }
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hero-perks {
  margin: 22px auto 0;
  padding: 0;
  list-style: none;
  text-align: left;
  max-width: 380px;
  font-size: 13.5px;
  color: var(--muted);
}
.hero-perks li { display: flex; gap: 9px; align-items: baseline; margin-bottom: 8px; }
.hero-perks li::before { content: "✓"; color: var(--success); font-weight: 700; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

/* Dropzone */
.dropzone {
  border: 1.5px dashed var(--separator);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.005);
}
.dropzone svg { width: 34px; height: 34px; opacity: 0.55; margin-bottom: 8px; }
.dropzone b { color: var(--text); font-weight: 600; }
.dropzone p { margin: 4px 0 0; font-size: 13px; }

.tpl-links { display: flex; gap: 14px; margin-top: 10px; justify-content: center; flex-wrap: wrap; }
.tpl-links .btn-plain { font-size: 13px; }

/* Preview da importação */
.import-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin: 16px 0 12px;
}
.sum-tile {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--chip);
}
.sum-tile b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.sum-tile span { font-size: 12px; font-weight: 600; }
.sum-novo { background: var(--accent-soft); color: var(--accent); }
.sum-edicao { background: var(--warning-soft); color: var(--warning); }
.sum-redundante { background: var(--chip); color: var(--muted); }
.sum-invalido { background: var(--danger-soft); color: var(--danger); }

.preview-list {
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--separator);
  border-radius: var(--radius-sm);
}
.preview-row { padding: 11px 14px; border-bottom: 1px solid var(--separator); }
.preview-row:last-child { border-bottom: none; }
.preview-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.preview-row-head .who { font-weight: 600; font-size: 13.5px; }
.preview-row-head .meta { color: var(--muted); font-size: 12.5px; }
.preview-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

/* ---------- Tabela da base ---------- */

.table-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.table-tools .search { flex: 1; min-width: 200px; position: relative; }
.table-tools .search input { padding-left: 34px; }
.table-tools .search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--separator); border-radius: var(--radius-sm); }
table.records {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 1100px;
}
table.records th.sortable { cursor: pointer; user-select: none; transition: color 0.15s; }
table.records th.sortable:hover { color: var(--text); }
table.records th .arrow { font-size: 9px; margin-left: 4px; }
.table-tools select.filt { width: auto; max-width: 170px; font-size: 13px; padding: 8px 10px; }
table.records th, table.records td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--separator);
  white-space: nowrap;
}
table.records td.num { font-variant-numeric: tabular-nums; }
table.records th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  z-index: 1;
}
table.records tbody tr { transition: background-color 0.15s; }
table.records tbody tr:hover { background: var(--chip); }
table.records tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 4px; }
.row-actions .icon-btn { width: 30px; height: 30px; background: transparent; }
.row-actions .icon-btn:hover { background: var(--chip-strong); }
.row-actions .icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.row-actions .icon-btn svg { width: 15px; height: 15px; }

.table-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } }

.modal {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border-radius: 20px;
  box-shadow: var(--shadow-pop);
  padding: 28px;
  position: relative;
  animation: popIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: none; }
}
.modal h2 { text-align: center; font-size: 20px; margin-bottom: 4px; }
.modal .modal-sub { text-align: center; color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--chip);
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}
.modal-close:hover { background: var(--chip-strong); color: var(--text); }
.modal .seg { display: flex; margin: 0 0 18px; }
.modal .seg > button { flex: 1; }
.modal .field + .field { margin-top: 12px; }
.modal .btn-block { margin-top: 18px; }

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(28, 28, 30, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #f5f5f7;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 550;
  box-shadow: var(--shadow-pop);
  animation: toastIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.15);
  max-width: min(560px, 90vw);
}
.theme-dark .toast { background: rgba(58, 58, 60, 0.92); }
.toast.leaving { animation: toastOut 0.25s ease forwards; }
.toast .t-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.toast.ok .t-dot { background: #30d158; }
.toast.err .t-dot { background: #ff453a; }
.toast.info .t-dot { background: #2997ff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(0.95); } }

/* ---------- Cortes do 9-box ---------- */

.cuts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cuts-axis { font-size: 12.5px; font-weight: 600; color: var(--text); margin: 8px 0 6px; }
.cuts-axis:first-child { margin-top: 0; }

/* ---------- Utilidades ---------- */

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--separator); margin: 14px 0; border: none; }

.cell-sub { color: var(--muted); font-size: 12px; }

.data-grid-single { grid-template-columns: minmax(0, 640px); }

/* Perfil */
.profile-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 6px 0 16px;
}
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: none;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.account-chip .avatar { overflow: hidden; }
.account-chip .avatar img { width: 100%; height: 100%; object-fit: cover; }

.modal-form { display: flex; flex-direction: column; gap: 12px; }
.modal-lg { max-width: 560px; max-height: 88vh; overflow-y: auto; }
.modal-lg h2 { text-align: left; }
.modal-lg .modal-sub { text-align: left; }

/* Detalhe do funcionário */
table.records tbody tr { cursor: pointer; }
.detail-title { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.detail-title .avatar-lg {
  width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.detail-title h2 { font-size: 19px; margin: 0; }
.detail-meta { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.detail-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.detail-section { margin-top: 16px; }
.detail-section h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.hist-list { border: 1px solid var(--separator); border-radius: var(--radius-sm); overflow: hidden; }
.hist-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--separator); }
.hist-item:last-child { border-bottom: none; }
.hist-item .hist-main { min-width: 0; }
.hist-item .hist-val { font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.hist-item .hist-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.hist-item .hist-comment { color: var(--muted); font-size: 12px; margin-top: 4px; font-style: italic; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hist-empty { padding: 12px; color: var(--muted); font-size: 13px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.link-box { display: flex; gap: 8px; margin-top: 10px; }
.link-box input { flex: 1; font-size: 12.5px; }

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 200px;
}
.account-chip .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.account-chip .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
}

.footer {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 8px var(--gutter) 28px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
