/* =========================================================
   Relatório de Oportunidades — estética botânica-editorial
   Paleta: verde-floresta + creme + acentos terracota
   ========================================================= */

:root {
  /* paleta */
  --bg: #f6f3ec;
  --bg-2: #efeae0;
  --paper: #fcfaf4;
  --ink: #1d2a23;
  --ink-2: #4a574f;
  --ink-3: #7a857d;
  --moss: #2f4a3a;
  --moss-dark: #213328;
  --moss-soft: #5a7a64;
  --leaf: #79986b;
  --terracotta: #c66e4e;
  --terracotta-soft: #e8c4b3;
  --gold: #b88847;
  --rose: #b56575;
  --line: #d9d1bf;
  --line-2: #e8e1ce;
  --shadow-sm: 0 1px 2px rgba(33,51,40,.06);
  --shadow-md: 0 8px 24px -8px rgba(33,51,40,.18), 0 2px 6px rgba(33,51,40,.06);
  --shadow-lg: 0 24px 60px -20px rgba(33,51,40,.28), 0 4px 12px rgba(33,51,40,.08);
  /* tipografia */
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Textura sutil de papel */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .035;
  background-image:
    radial-gradient(circle at 25% 25%, #2f4a3a 1px, transparent 1px),
    radial-gradient(circle at 75% 75%, #2f4a3a 1px, transparent 1px);
  background-size: 4px 4px, 6px 6px;
}

button, input, select, textarea { font: inherit; color: inherit; }
em { font-style: italic; font-family: var(--serif); }

/* =========================================================
   TELAS
   ========================================================= */

.screen { display: none; min-height: 100vh; position: relative; z-index: 1; }
.screen.active { display: block; }

/* =========================================================
   TELA DE SELEÇÃO DE OPERADOR
   ========================================================= */

#screen-operator, #screen-pin {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}
#screen-operator.active, #screen-pin.active { display: flex; }

.op-bg {
  position: absolute; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(121,152,107,.22), transparent 55%),
    radial-gradient(circle at 85% 90%, rgba(198,110,78,.14), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.op-bg::before, .op-bg::after {
  content: "";
  position: absolute;
  width: 800px; height: 800px;
  background: radial-gradient(circle, rgba(47,74,58,.08) 0%, transparent 60%);
  border-radius: 50%;
}
.op-bg::before { top: -400px; left: -200px; }
.op-bg::after { bottom: -400px; right: -300px; }

.op-card {
  width: 100%;
  max-width: 480px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 44px 36px 28px;
  position: relative;
}
.op-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  pointer-events: none;
}

.op-header { text-align: center; margin-bottom: 28px; }
.op-logo {
  width: 84px; height: 84px;
  border-radius: 14px;
  object-fit: cover;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(47,74,58,.18);
}
.leaf { color: var(--moss); display: inline-flex; margin-bottom: 10px; }
.op-eyebrow {
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: 11px;
  color: var(--ink-3);
  margin: 0 0 8px;
  font-weight: 600;
}
.op-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 2.3rem;
  line-height: 1.05;
  margin: 0;
  color: var(--moss-dark);
  letter-spacing: -.01em;
}
.op-title em { font-style: normal; font-weight: 700; color: var(--moss-dark); }
.op-sub { color: var(--ink-2); margin: 14px 0 0; font-size: .95rem; }

.op-search { margin: 0 0 16px; position: relative; }
.op-search input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.op-search input:focus {
  border-color: var(--moss-soft);
  box-shadow: 0 0 0 4px rgba(121,152,107,.18);
}

.op-list {
  max-height: 360px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
  padding: 4px;
  margin: -4px;
}
.op-list::-webkit-scrollbar { width: 6px; }
.op-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.op-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background .15s, border-color .15s, transform .15s;
}
.op-item:hover {
  background: var(--bg-2);
  border-color: var(--line-2);
}
.op-item:active { transform: scale(.99); }
.op-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--moss);
  color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 14px;
  flex: 0 0 36px;
}
.op-item-info { flex: 1; min-width: 0; }
.op-item-name { font-weight: 500; color: var(--ink); display: block; }
.op-item-role { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; }
.op-item-pin {
  font-size: 10px; padding: 2px 6px; background: var(--gold); color: white;
  border-radius: 4px; letter-spacing: .08em; text-transform: uppercase;
}

.op-foot { margin-top: 22px; text-align: center; }
.op-foot small { color: var(--ink-3); font-size: 12px; font-style: italic; }

/* PIN */
.op-card-pin { max-width: 380px; text-align: center; }
.pin-back {
  position: absolute; top: 16px; left: 16px;
  background: transparent; border: none; color: var(--ink-3);
  cursor: pointer; font-size: 13px; padding: 6px 10px;
}
.pin-back:hover { color: var(--moss); }

.pin-input { margin: 24px 0 8px; }
.pin-input input {
  width: 100%;
  padding: 18px;
  font-size: 1.6rem;
  letter-spacing: .8em;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font-family: var(--serif);
  outline: none;
  padding-left: calc(.4em + 18px);
}
.pin-input input:focus { border-color: var(--moss-soft); }
.pin-err { color: var(--terracotta); font-size: 13px; min-height: 18px; margin-bottom: 10px; }

/* =========================================================
   APP — TOPBAR
   ========================================================= */

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 16px 32px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--serif);
  color: var(--moss-dark);
}
.brand-logo {
  width: 40px; height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.brand-text-wrap { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text {
  font-weight: 500;
  font-size: 1.05rem;
}
.brand-sub {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 2px;
}
.brand-text::after { display: none; }

.tabs { display: flex; gap: 4px; justify-content: center; }
.tab {
  background: transparent;
  border: none;
  color: var(--ink-2);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: .01em;
  transition: background .15s, color .15s;
  position: relative;
}
.tab:hover { background: var(--bg-2); color: var(--ink); }
.tab.active {
  background: var(--moss-dark);
  color: var(--paper);
}
.tab.admin-only { display: none; }
body.role-admin .tab.admin-only,
body.role-gerencia .tab.admin-only,
body.role-diretoria .tab.admin-only { display: inline-block; }

.op-pill {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 6px 8px 6px 14px;
  border-radius: 999px;
}
.op-pill-info { display: flex; flex-direction: column; line-height: 1.1; }
.op-pill-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: .2em;
  color: var(--ink-3); font-weight: 600;
}
.op-pill-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.op-pill-btn {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  cursor: pointer;
  color: var(--ink-2);
}
.op-pill-btn:hover { background: var(--moss); color: var(--paper); border-color: var(--moss); }

/* =========================================================
   VIEWS / PÁGINA
   ========================================================= */

.view { display: none; }
.view.active { display: block; }

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.page-head { margin-bottom: 32px; max-width: 760px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .25em;
  font-size: 11px;
  color: var(--terracotta);
  font-weight: 600;
  margin: 0 0 10px;
}
.page-head h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-style: normal;
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  margin: 0 0 12px;
  color: var(--moss-dark);
  letter-spacing: -.015em;
  line-height: 1.05;
}
.page-head h1 em { font-style: normal; font-weight: 600; }
.page-lead { color: var(--ink-2); margin: 0; max-width: 580px; }

/* =========================================================
   FORM CARD
   ========================================================= */

.form-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-md);
  margin-bottom: 32px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 24px;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-3);
  font-weight: 600;
}

.field input[type="date"],
.field input[type="time"],
.field input[type="text"],
.field input[type="search"],
.field input[type="password"],
.field select,
.field textarea {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  font-size: 14px;
  width: 100%;
}
.field textarea { resize: vertical; font-family: var(--sans); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--moss-soft);
  background: var(--paper);
  box-shadow: 0 0 0 3px rgba(121,152,107,.15);
}

/* Tipo: pílulas */
.type-field { grid-column: span 2; }
.type-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.type-pills label { cursor: pointer; flex: 1 1 100px; }
.type-pills input { position: absolute; opacity: 0; pointer-events: none; }
.type-pills .tp {
  display: block;
  padding: 10px 14px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-weight: 500;
  font-size: 14px;
  transition: all .15s;
}
.type-pills label:hover .tp { background: var(--bg-2); }
.type-pills input:checked + .tp.tp-elogio { background: #d8e6cf; border-color: var(--leaf); color: #2c4a1e; }
.type-pills input:checked + .tp.tp-reclamacao { background: #f4d8cc; border-color: var(--terracotta); color: #7a3320; }
.type-pills input:checked + .tp.tp-sugestao { background: #f5e3c4; border-color: var(--gold); color: #6e4815; }

.form-foot {
  margin-top: 28px;
  display: flex; gap: 12px; justify-content: flex-end;
  padding-top: 20px;
  border-top: 1px solid var(--line-2);
}
.form-foot.full { grid-column: 1 / -1; }

/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  transition: all .15s;
  font-family: inherit;
}
.btn.primary { background: var(--moss-dark); color: var(--paper); }
.btn.primary:hover { background: var(--moss); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--bg-2); color: var(--ink); }
.btn.outline {
  background: var(--paper); color: var(--moss-dark);
  border-color: var(--moss-dark);
}
.btn.outline:hover { background: var(--moss-dark); color: var(--paper); }
.btn.danger { color: var(--terracotta); }
.btn.danger:hover { background: var(--terracotta); color: var(--paper); }
.btn.block { width: 100%; padding: 14px; font-size: 15px; }

/* =========================================================
   RECENT STRIP / RECENT LIST
   ========================================================= */

.recent-strip { margin-top: 8px; }
.recent-strip h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.2rem;
  margin: 0 0 16px;
  color: var(--moss-dark);
}

.recent-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.recent-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink-3);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.recent-item.Elogio { border-left-color: var(--leaf); }
.recent-item.Reclamação { border-left-color: var(--terracotta); }
.recent-item.Sugestão { border-left-color: var(--gold); }
.recent-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-3); font-weight: 600;
}
.recent-text { color: var(--ink); line-height: 1.4; }
.recent-meta {
  margin-top: 8px; font-size: 12px; color: var(--ink-3);
  display: flex; gap: 12px; flex-wrap: wrap;
}

/* =========================================================
   FILTER BAR
   ========================================================= */

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.filter-bar input, .filter-bar select {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: 13px;
  outline: none;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--moss-soft); }
.filter-bar .dash { color: var(--ink-3); }
.filter-bar .btn { padding: 8px 16px; font-size: 13px; }

/* =========================================================
   TABLE
   ========================================================= */

.table-wrap {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead {
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.data-table th {
  text-align: left;
  padding: 12px 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
  color: var(--ink-3);
}
.data-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: rgba(121,152,107,.04); }

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: var(--bg-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.tag.Elogio { background: #d8e6cf; color: #2c4a1e; }
.tag.Reclamação { background: #f4d8cc; color: #7a3320; }
.tag.Sugestão { background: #f5e3c4; color: #6e4815; }
.tag.status-resolvido {
  background: #16a34a;
  color: #ffffff;
  border: 1px solid #15803d;
  font-weight: 600;
}
.tag.status-pendente {
  background: #f59e0b;
  color: #ffffff;
  border: 1px solid #d97706;
  font-weight: 600;
}
.tag.status-naoresolvido {
  background: #dc2626;
  color: #ffffff;
  border: 1px solid #b91c1c;
  font-weight: 600;
}

.row-action {
  background: none; border: none; cursor: pointer;
  color: var(--moss); font-weight: 500; font-size: 12px;
  text-transform: uppercase; letter-spacing: .1em;
  padding: 4px 10px; border-radius: 999px;
}
.row-action:hover { background: var(--moss-dark); color: var(--paper); }

.cell-desc { max-width: 360px; }

/* =========================================================
   DASHBOARD
   ========================================================= */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.kpi {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--ink-3);
}
.kpi.elogio::before { background: var(--leaf); }
.kpi.recl::before { background: var(--terracotta); }
.kpi.sug::before { background: var(--gold); }
.kpi.pending::before { background: var(--rose); }
.kpi.resolved::before { background: var(--moss); }

.kpi-l {
  font-size: 11px; text-transform: uppercase; letter-spacing: .15em;
  color: var(--ink-3); font-weight: 600;
}
.kpi-v {
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 500;
  color: var(--moss-dark);
  line-height: 1;
}

.grid-charts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.chart-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.chart-card.span-2 { grid-column: span 2; }
.chart-card h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.05rem;
  margin: 0 0 16px;
  color: var(--moss-dark);
}
.chart-card canvas { max-height: 280px; }

/* =========================================================
   SETTINGS
   ========================================================= */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 20px;
}
.settings-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.settings-card h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.15rem;
  margin: 0 0 16px;
  color: var(--moss-dark);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-2);
}
.setting-list {
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 16px;
}
.setting-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--line-2);
}
.setting-row:hover { background: var(--bg-2); }
.setting-row-name { flex: 1; font-weight: 500; }
.setting-row-meta { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; }
.setting-row .row-action { padding: 4px 8px; font-size: 11px; }

.setting-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line-2);
  align-items: end;
}
.setting-form input, .setting-form select {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 13px;
  outline: none;
}
.setting-form input:focus, .setting-form select:focus { border-color: var(--moss-soft); }
#formUser input[name="name"] { flex: 1; min-width: 120px; }
#formUser select[name="role"] { width: 130px; }
#formUser input[name="pin"]  { width: 100px; }
#formUser button { white-space: nowrap; }
#formVilla input, #formDept input { flex: 1; min-width: 140px; }

/* =========================================================
   MODAL
   ========================================================= */

.modal {
  display: none;
  position: fixed; inset: 0;
  background: rgba(33,51,40,.5);
  z-index: 100;
  align-items: center; justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.modal.active { display: flex; }
.modal-card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%; max-width: 760px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.modal-x {
  position: absolute; top: 16px; right: 16px;
  background: var(--bg-2); border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  color: var(--ink-2);
}
.modal-x:hover { background: var(--terracotta); color: white; }
.modal-card h2 {
  font-family: var(--serif);
  font-weight: 500;
  margin: 0 0 24px;
  color: var(--moss-dark);
}

/* =========================================================
   TOAST
   ========================================================= */

.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--moss-dark);
  color: var(--paper);
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  z-index: 200;
  transition: transform .25s, opacity .25s;
  max-width: 90vw;
  opacity: 0;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
.toast.error { background: var(--terracotta); }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 960px) {
  .topbar { grid-template-columns: 1fr auto; padding: 12px 16px; }
  .tabs { grid-column: 1 / -1; order: 3; overflow-x: auto; }
  .page { padding: 24px 16px 60px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .type-field { grid-column: 1 / -1; }
  .field.full { grid-column: 1 / -1; }
  .grid-charts { grid-template-columns: 1fr; }
  .chart-card.span-2 { grid-column: auto; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px; }
  .cell-desc { max-width: 200px; }
  #formUser { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .op-card { padding: 28px 22px 22px; }
  .op-title { font-size: 1.8rem; }
}

/* animação leve para os cards */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.recent-item, .kpi, .chart-card, .settings-card, .form-card {
  animation: fadeUp .3s ease-out backwards;
}
.kpi:nth-child(2) { animation-delay: .04s; }
.kpi:nth-child(3) { animation-delay: .08s; }
.kpi:nth-child(4) { animation-delay: .12s; }
.kpi:nth-child(5) { animation-delay: .16s; }
.kpi:nth-child(6) { animation-delay: .2s; }

/* ==================== REPORTS ==================== */
.reports-config {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.reports-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.reports-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.reports-quick .btn { font-size: 12px; padding: 5px 12px; }

.reports-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}
.reports-actions .ico {
  display: inline-block;
  margin-right: 4px;
  font-size: 13px;
}

.reports-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 6px;
}
.reports-summary:empty { display: none; }
.rpt-stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--moss);
  border-radius: 10px;
  padding: 12px 14px;
}
.rpt-stat.elogio   { border-left-color: var(--moss); }
.rpt-stat.reclamacao { border-left-color: var(--terracotta); }
.rpt-stat.sugestao { border-left-color: var(--gold); }
.rpt-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
}
.rpt-stat-value {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 500;
  color: var(--moss-dark);
  margin-top: 2px;
}

.reports-preview {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-top: 8px;
  max-height: 500px;
  overflow: auto;
}
.reports-preview:empty { display: none; }
.reports-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.reports-preview th, .reports-preview td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.reports-preview th {
  background: var(--cream);
  font-weight: 500;
  position: sticky;
  top: 0;
}

/* ==================== TOGGLE FIELD ==================== */
.toggle-field {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
}
.toggle-field input[type=checkbox] {
  width: 20px; height: 20px;
  accent-color: var(--moss);
  cursor: pointer;
}
.toggle-field span {
  font-size: 14px;
  color: var(--ink-1);
  margin: 0 !important;
}

/* ==================== SETTING ROW IMPROVEMENTS ==================== */
.setting-row.inactive {
  opacity: 0.55;
  background: transparent;
}
.setting-row.inactive .setting-row-name {
  text-decoration: line-through;
  text-decoration-color: var(--ink-3);
}
.row-actions { display: flex; gap: 6px; }
.row-action.danger { color: var(--terracotta); }
.row-action.success { color: var(--moss-dark); }

/* ==================== DASHBOARD FILTROS COMPLETOS ==================== */
.dash-filters {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.dash-filters-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.dash-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.dash-quick .btn { font-size: 12px; padding: 5px 12px; }
.field.compact { gap: 4px; }
.field.compact > span {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ==================== KPIs DE DESTAQUE ==================== */
.kpis-highlight {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi-h {
  background: linear-gradient(135deg, var(--paper) 0%, var(--cream) 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
}
.kpi-h::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--moss);
}
.kpi-h-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.kpi-h-content { flex: 1; min-width: 0; }
.kpi-h-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.kpi-h-value {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 500;
  color: var(--moss-dark);
  line-height: 1;
}
.kpi-h-value small {
  font-size: 1rem;
  color: var(--ink-3);
  margin-left: 2px;
}
.kpi-h-value-name {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--moss-dark);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-h-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
}
.kpi-h.trend-up::before { background: #dc2626; }
.kpi-h.trend-down::before { background: #16a34a; }
.kpi-h.trend-up .kpi-h-value { color: #dc2626; }
.kpi-h.trend-down .kpi-h-value { color: #16a34a; }

/* chart card subtitle */
.chart-card h3 small {
  font-size: 11px;
  font-weight: 400;
  font-family: var(--sans);
  color: var(--ink-3);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

/* ==================== EMAIL CONFIG ==================== */
.email-config-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 2px dashed var(--line);
}
.email-config-section h2 {
  font-family: var(--serif);
  font-size: 1.3rem;
  color: var(--moss-dark);
}
#emailMsg:empty { display: none; }
#emailMsg {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
}
#emailMsg.ok { background: #e1f5ee; color: #085041; }
#emailMsg.err { background: #fcebeb; color: #791f1f; }

.admin-only-strict { display: none; }
body.role-admin .admin-only-strict { display: block; }

/* ==================== TOOLTIP SETOR ==================== */
.sector-help {
  cursor: help;
  font-size: 14px;
  margin-left: 4px;
  vertical-align: middle;
  position: relative;
  display: inline-block;
}
.sector-help:hover::after {
  content: attr(title);
  position: absolute;
  left: 50%;
  bottom: 120%;
  transform: translateX(-50%);
  background: var(--moss-dark);
  color: #f6f3ec;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  white-space: pre-line;
  min-width: 180px;
  max-width: 280px;
  z-index: 999;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
  line-height: 1.6;
  pointer-events: none;
}
.sector-help:hover::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 110%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--moss-dark);
  z-index: 999;
}
