:root {
  --bg: #eef3f5;
  --panel: #ffffff;
  --ink: #14262c;
  --muted: #5d727a;
  --primary: #0f4c5c;
  --primary-2: #16788f;
  --accent: #e36414;
  --line: #d5e0e5;
  --ok: #1b7f5a;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(15, 76, 92, 0.08);
  --radius: 16px;
  --font: "Segoe UI", "Candara", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: var(--font); color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.erro { color: var(--danger); min-height: 1.2em; }
.hint { font-size: 0.85rem; color: var(--muted); }

/* Scrollbar fina e discreta */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 76, 92, 0.35) transparent;
}
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(15, 76, 92, 0.28);
  border-radius: 99px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 76, 92, 0.48);
}
.sidebar,
.sidebar * {
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}
.sidebar::-webkit-scrollbar-thumb,
.sidebar *::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
}
.sidebar::-webkit-scrollbar-thumb:hover,
.sidebar *::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45);
}

.splash {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(227, 100, 20, 0.18), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(22, 120, 143, 0.25), transparent 35%),
    linear-gradient(160deg, #0b3a46, #0f4c5c 45%, #123a44);
}
.splash-card {
  text-align: center;
  color: #fff;
  padding: 32px;
}
.splash-logo { width: 96px; height: 96px; margin-bottom: 12px; object-fit: contain; border-radius: 18px; background: transparent; padding: 0; filter: drop-shadow(0 8px 18px rgba(0,0,0,.25)); }
.splash-card h1 { margin: 0; font-size: 2rem; letter-spacing: 0.02em; }
.splash-card p { margin: 8px 0; opacity: 0.9; }
.splash-ver { font-size: 0.95rem; opacity: 0.8 !important; }
.splash-bar {
  margin: 22px auto 0;
  width: 180px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255,255,255,.2);
  overflow: hidden;
}
.splash-bar span {
  display: block;
  height: 100%;
  width: 40%;
  background: var(--accent);
  animation: load 1.1s ease-in-out infinite;
}
@keyframes load {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(180deg, #e8f1f4, #eef3f5);
}
.login-card {
  width: min(440px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}
.login-card input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  width: 100%;
}
.login-card .field { display: grid; gap: 6px; text-align: left; font-size: 0.9rem; color: var(--muted); }
.pass-wrap { position: relative; display: flex; align-items: center; }
.pass-wrap input { padding-right: 48px; }
.pass-toggle {
  position: absolute;
  right: 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 6px;
  border-radius: 8px;
}
.pass-toggle:hover { background: #eef3f5; }

.app {
  display: block;
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 250px;
  z-index: 40;
  overflow: hidden;
  background: linear-gradient(180deg, #0d4453, #0f4c5c 60%, #0c3a46);
  color: #fff;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 8px; }
.brand img { width: 42px; height: 42px; }
.brand strong { display: block; }
.brand small { opacity: 0.75; }
.brand > div { flex: 1; min-width: 0; }
.sidebar-close { display: none !important; }
.sidebar nav {
  display: grid;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  margin-right: -2px;
}
.nav {
  text-align: left;
  border: 0;
  background: transparent;
  color: #dff0f5;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  min-height: 44px;
}
.nav:hover, .nav.active { background: rgba(255,255,255,.12); color: #fff; }
.logout { margin-top: 8px; flex-shrink: 0; }
.site-invite {
  display: grid;
  gap: 2px;
  margin: 10px 4px 0;
  padding: 12px 14px;
  border-radius: 14px;
  text-decoration: none;
  color: #fff;
  flex-shrink: 0;
  background:
    linear-gradient(135deg, rgba(227, 100, 20, 0.35), rgba(255,255,255,0.08)),
    rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.22);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.site-invite:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.35);
  background:
    linear-gradient(135deg, rgba(227, 100, 20, 0.32), rgba(255,255,255,0.1)),
    rgba(255,255,255,0.12);
}
.site-invite__eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
}
.site-invite strong {
  font-size: 0.98rem;
  letter-spacing: 0.01em;
}
.site-invite__url {
  font-size: 0.82rem;
  opacity: 0.9;
  color: #ffd7b8;
}
.site-invite--login {
  margin: 4px 0 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 76, 92, 0.08), rgba(227, 100, 20, 0.08)),
    #f7fbfc;
  border: 1px solid var(--line);
}
.site-invite--login:hover {
  border-color: var(--primary-2);
  background:
    linear-gradient(135deg, rgba(15, 76, 92, 0.12), rgba(227, 100, 20, 0.12)),
    #fff;
}
.site-invite--login .site-invite__eyebrow { color: var(--muted); opacity: 1; }
.site-invite--login .site-invite__url { color: var(--accent); opacity: 1; font-weight: 600; }
.site-invite--panel {
  margin: 12px 0 0;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(15, 76, 92, 0.07), rgba(227, 100, 20, 0.08)),
    #fff;
  border: 1px solid var(--line);
  max-width: 420px;
}
.site-invite--panel .site-invite__eyebrow { color: var(--muted); opacity: 1; }
.site-invite--panel .site-invite__url { color: var(--primary-2); opacity: 1; font-weight: 600; }
.sidebar-strata {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 8px 4px 4px;
  border-top: 1px solid rgba(255,255,255,.12);
}
.strata-logo {
  width: min(180px, 100%);
  height: auto;
  background: transparent;
  display: block;
  opacity: 0.95;
}
.strata-ver {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,.78);
  font-weight: 600;
}

.main {
  margin-left: 250px;
  padding: 22px;
  padding-bottom: max(22px, env(safe-area-inset-bottom));
  min-height: 100vh;
  min-width: 0;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 18px;
}
.top-text { flex: 1; min-width: 0; }
.top h2 { margin: 0 0 4px; font-size: clamp(1.15rem, 4vw, 1.5rem); }
.menu-toggle { display: none; }
.btn-icon {
  border: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  gap: 5px;
  padding: 10px;
  color: var(--primary);
  font-size: 1.4rem;
  line-height: 1;
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 30, 36, 0.45);
  z-index: 35;
}
.pill {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.9rem;
  color: var(--primary);
  max-width: min(280px, 42vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  min-height: 42px;
  cursor: pointer;
  background: #dfe8eb;
  color: var(--ink);
  touch-action: manipulation;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.accent { background: var(--accent); color: #fff; }
.btn.ghost { background: #e8eef1; color: var(--ink); }
.sidebar .btn.ghost { background: rgba(255,255,255,.08); color: #fff; }
.btn.danger { background: #f8e4e2; color: var(--danger); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card .label { color: var(--muted); font-size: 0.85rem; }
.card .value { font-size: 1.8rem; font-weight: 700; margin-top: 6px; color: var(--primary); }
.card .value.accent { color: var(--accent); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow-x: auto;
}
.panel h3 { margin: 0 0 12px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
.table-wrap table { min-width: 560px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 12px; }
.field { display: grid; gap: 6px; flex: 1 1 160px; }
.field input, .field select, .field textarea {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
  width: 100%;
  background: #fff;
  box-sizing: border-box;
}
.field textarea { min-height: 80px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
th, td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  background: #f3f8fa;
  color: var(--primary);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
tr:hover td { background: #f8fbfc; }
.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #e7f3f6;
  color: var(--primary);
}
.tag.ok { background: #e5f6ef; color: var(--ok); }
.tag.warn { background: #fff1e7; color: var(--accent); }
.tag.danger { background: #fdeceb; color: var(--danger); }
.modo-toggle {
  display: inline-flex;
  gap: 6px;
  margin: 0 0 12px;
  padding: 4px;
  border-radius: 12px;
  background: #e8f1f4;
  border: 1px solid var(--line);
}
.conf-resumo .tag { margin-right: 6px; }
.btn.active-conf {
  box-shadow: 0 0 0 2px rgba(15, 76, 92, 0.35);
  font-weight: 700;
}

.ajuda-chat {
  max-height: 320px;
  overflow-y: auto;
  display: grid;
  gap: 10px;
  padding: 12px;
  margin: 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(15, 76, 92, 0.04), transparent),
    #f7fbfc;
}
.ajuda-msg {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}
.ajuda-msg.user {
  background: #e7f2f6;
  border-color: #c5dbe3;
}
.ajuda-msg.bot {
  background: #fff;
}
.ajuda-msg strong {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ajuda-ask {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ajuda-ask input {
  flex: 1;
  min-width: 200px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.ajuda-lista { display: grid; gap: 8px; }
.ajuda-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0;
  overflow: hidden;
}
.ajuda-item summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  font-weight: 600;
}
.ajuda-item summary::-webkit-details-marker { display: none; }
.ajuda-body {
  padding: 0 14px 14px;
  color: var(--ink);
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.ficha-form textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font: inherit;
  resize: vertical;
}

.dash-hero {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.dash-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 14px;
  background: transparent;
  padding: 0;
}
.dash-hero h3 { margin: 0 0 4px; }
.card.visual { display: grid; gap: 10px; }
.bar {
  height: 10px;
  border-radius: 999px;
  background: #e4eef1;
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0f4c5c, #16788f);
  border-radius: 999px;
}
.ring {
  --p: 0;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  margin: 4px auto 0;
  display: grid;
  place-items: center;
  background: conic-gradient(#0f4c5c calc(var(--p) * 1%), #e4eef1 0);
  position: relative;
}
.ring::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #fff;
}
.ring strong { position: relative; z-index: 1; color: var(--primary); font-size: 1.1rem; }
.ring.accent { background: conic-gradient(#e36414 calc(var(--p) * 1%), #e4eef1 0); }
.ring.accent strong { color: var(--accent); }
.ring.warn { background: conic-gradient(#b42318 calc(var(--p) * 1%), #e4eef1 0); }
.ring.warn strong { color: var(--danger); }
.dash-bars { display: grid; gap: 10px; }
.dash-bar-row { display: grid; gap: 4px; }
.dash-bar-meta { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--muted); }

.escala-wrap { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 12px; }
.escala-table { min-width: 1100px; }
.escala-table th { position: sticky; top: 0; z-index: 1; background: #1f6f84; color: #fff; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.03em; }
.escala-table input {
  width: 100%;
  min-width: 70px;
  border: 1px solid transparent;
  background: transparent;
  padding: 6px;
  border-radius: 8px;
}
.escala-table input:focus {
  outline: none;
  border-color: var(--primary-2);
  background: #fff;
}
.escala-table tr.destaque td { background: #e7f2f6; }
.esc-posto { display: grid; gap: 6px; min-width: 120px; }
.esc-posto strong { font-size: 0.85rem; }
.esc-confirmar { display: flex; flex-wrap: wrap; gap: 4px; }
.btn-sm { padding: 4px 8px !important; font-size: 0.75rem !important; }
.ficha-form { display: grid; gap: 10px; }
.ficha-form .row { margin: 0; }
@media (max-width: 720px) {
  .escala-table--public { min-width: 0; width: 100%; }
  .escala-table--public thead { display: none; }
  .escala-table--public tr {
    display: grid;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }
  .escala-table--public td {
    display: grid;
    gap: 4px;
  }
  .escala-table--public td::before {
    content: attr(data-label);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .esc-confirmar .btn { flex: 1; min-width: 90px; }
}
.escala-header-preview {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #f7fbfc, #fff);
  margin-top: 8px;
}
.escala-header-preview img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; }
.escala-header-preview strong { display: block; color: var(--primary); margin-bottom: 4px; }
.escala-header-preview #esc-titulo {
  width: 100%;
  font-weight: 700;
  font-size: 1.05rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 8px;
}
.escala-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.escala-meta label { display: grid; gap: 4px; font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.escala-meta input { padding: 8px; border: 1px solid var(--line); border-radius: 8px; font-weight: 600; color: var(--ink); }

.rel-table { width: 100%; border-collapse: collapse; }
.rel-table th, .rel-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.rel-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.rel-table td:last-child { text-align: right; white-space: nowrap; }
.rel-table select {
  width: 100%;
  max-width: 360px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

#view-relatorios { width: 100%; }
.rel-page { display: grid; gap: 18px; width: 100%; max-width: none; }
.rel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.rel-toolbar__label {
  display: block;
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}
.rel-toolbar__hint { margin: 8px 0 0; font-size: 0.85rem; }
.rel-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 20px 22px;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(15, 76, 92, 0.08), rgba(227, 100, 20, 0.06)),
    var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.rel-hero h3 { margin: 4px 0 6px; font-size: 1.35rem; color: var(--primary); }
.rel-hero .muted { margin: 0; }
.rel-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.rel-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.9rem;
  color: var(--muted);
}
.rel-status.ok { color: var(--ok); font-weight: 600; }
.rel-group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.rel-group__title {
  margin: 0;
  padding: 12px 18px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(90deg, #0f4c5c, #16788f);
}
.rel-group__hint {
  margin: 0;
  padding: 10px 18px 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.rel-list { display: grid; }
.rel-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}
.rel-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.rel-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f4fafc;
}
.rel-card h4 {
  margin: 0;
  font-size: 1.02rem;
  color: var(--primary);
}
.rel-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
  flex: 1;
}
.rel-card .rel-select {
  margin-top: 2px;
  max-width: none;
}
.rel-card .rel-item__actions {
  margin-top: auto;
  justify-content: flex-start;
}
.rel-pick {
  display: grid;
  grid-template-columns: minmax(200px, 1.1fr) minmax(240px, 2fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
}
.rel-pick h4 {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 1.02rem;
}
.rel-pick p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}
.rel-pick .rel-select {
  margin: 0;
  max-width: none;
}
.rel-pick .rel-item__actions {
  justify-content: flex-end;
}
.rel-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
}
.rel-item:first-child { border-top: 0; }
.rel-item:hover { background: #f7fbfc; }
.rel-item__text h4 {
  margin: 0 0 4px;
  font-size: 1rem;
  color: var(--ink);
}
.rel-item__text p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}
.rel-select {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.rel-item__btn {
  min-width: 88px;
}
.rel-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.rel-periodo {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
}
.rel-periodo .field { min-width: 160px; margin: 0; }
.dash-alertas {
  border-left: 4px solid var(--accent);
  background: #fff8f2;
}
.dash-alertas ul {
  margin: 8px 0 0;
  padding-left: 1.2rem;
  color: var(--ink);
}

@media (max-width: 1100px) {
  .rel-grid,
  .rel-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rel-pick { grid-template-columns: 1fr 1fr; }
  .rel-pick .rel-item__actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 700px) {
  .rel-toolbar { flex-direction: column; align-items: stretch; }
  .rel-grid,
  .rel-grid--3 { grid-template-columns: 1fr; }
  .rel-pick { grid-template-columns: 1fr; }
  .rel-hero { flex-direction: column; align-items: start; }
  .rel-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .rel-item__btn { width: 100%; }
  .rel-item__actions { width: 100%; }
  .rel-item__actions .btn { flex: 1; }
  .rel-select { max-width: none; }
}

@media (max-width: 1100px) {
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-toggle { display: inline-grid; }
  .sidebar-close {
    display: inline-grid !important;
    margin-left: auto;
    background: rgba(255,255,255,.1);
    border-color: transparent;
    color: #fff;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 86vw);
    height: 100%;
    max-height: 100dvh;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: none;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(0,0,0,.28);
  }
  .nav-backdrop {
    display: block;
  }
  body.nav-open .nav-backdrop {
    display: block;
  }
  .nav-backdrop[hidden] { display: none !important; }
  .main {
    margin-left: 0;
    padding: 14px;
    padding-top: max(14px, env(safe-area-inset-top));
  }
  .top {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(238, 243, 245, 0.94);
    backdrop-filter: blur(8px);
    margin: -14px -14px 14px;
    padding: 12px 14px;
    align-items: center;
    border-bottom: 1px solid var(--line);
  }
  .top .muted { display: none; }
  .pill { display: none; }
  .sidebar nav { display: grid; grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 700px) {
  .grid-cards { grid-template-columns: 1fr; }
  .main { padding: 12px; }
  .top { margin: -12px -12px 12px; padding: 10px 12px; }
  .card .value { font-size: 1.45rem; }
  .dash-hero { flex-direction: column; align-items: flex-start; }
  .row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
  .row-actions .btn { flex: 1 1 auto; }
  table { font-size: 0.86rem; }
  th, td { padding: 10px 6px; }
  .login-card { padding: 22px 16px; }
  .splash-card h1 { font-size: 1.45rem; }
  .escala-toolbar, .busca-toolbar { flex-direction: column; align-items: stretch; }
  .busca-actions { width: 100%; }
  .busca-actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .splash-bar span { animation: none; width: 100%; }
  .sidebar { transition: none; }
}

.busca-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.busca-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.busca-bloco { margin-top: 18px; }
.busca-bloco h3 { margin: 0 0 10px; }
.busca-bloco .btn { margin-right: 6px; margin-bottom: 4px; }

.rede-urls {
  margin: 10px 0 0;
  padding-left: 1.2rem;
  word-break: break-all;
}
.rede-urls a {
  color: var(--primary);
  font-weight: 600;
}
body.nav-open {
  overflow: hidden;
}

@media print {
  body.printing-busca .splash,
  body.printing-busca #login,
  body.printing-busca .sidebar,
  body.printing-busca .top,
  body.printing-busca .busca-form,
  body.printing-busca .no-print {
    display: none !important;
  }
  body.printing-busca .app,
  body.printing-busca .main {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
  }
  body.printing-busca .panel {
    box-shadow: none !important;
    border: 0 !important;
    padding: 0 !important;
  }
  body.printing-busca #view-busca {
    display: block !important;
  }
  body.printing-busca .view.hidden {
    display: none !important;
  }
}

/* Anuário */
tr.cal-ceia td { background: rgba(227, 100, 20, 0.08); }
#form-register.hidden, #form-login.hidden { display: none !important; }


/* Blindagem UX — troca obrigatória + mobile */
#must-change-box { max-width: 420px; }
#must-change-box .erro { color: #b42318; min-height: 1.2em; }
@media (max-width: 700px) {
  .escala-wrap { max-height: none; }
  .table-wrap table { min-width: 480px; }
  .topbar { flex-wrap: wrap; gap: 8px; }
  input, select, textarea { font-size: 16px; }
  .modal-root { padding: 0; place-items: stretch; }
  .modal-card {
    width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }
  .modal-card .escala-wrap { max-height: min(48dvh, 380px); }
  .ceia-card { align-items: flex-start; }
  .modal-foot { justify-content: stretch; }
  .modal-foot .btn { flex: 1; }
}

/* Modal Santa Ceia */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(12, 32, 38, 0.55);
}
.modal-root[hidden] { display: none !important; }
.modal-card {
  width: min(1180px, 100%);
  max-height: min(94vh, 920px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 76, 92, 0.28);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 1.1rem; color: var(--primary); }
.modal-body { padding: 14px 18px; overflow: auto; }
.escala-datas { margin-bottom: 8px; }
.escala-datas .field { flex: 1 1 140px; }
.escala-datas .field--dia { flex: 0 0 88px; max-width: 88px; }
.escala-datas .field--data { flex: 0 0 168px; max-width: 200px; }
.escala-datas .field--mes { flex: 0 0 150px; max-width: 170px; }
.escala-datas .field--ano { flex: 0 0 100px; max-width: 110px; }
.escala-datas input[type="date"] { min-height: 38px; }
.modal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: #f7fbfc;
}
.modal-card .escala-wrap { max-height: min(62vh, 560px); }
.ceia-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.ceia-lista { display: grid; gap: 8px; }
.ceia-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.ceia-card strong { display: block; color: var(--primary); }
.ceia-card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ceia-ctas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.dist-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border: 2px dashed #2f7ea0;
  border-radius: 14px;
  background: #f3f9fb;
  color: inherit;
  cursor: pointer;
  font: inherit;
}
.dist-cta:hover,
.dist-cta:focus-visible {
  background: #e5f2f6;
  border-color: #0f4c5c;
  outline: none;
}
.dist-cta strong {
  color: #0f4c5c;
  font-size: 1.05rem;
}
.dist-cta span {
  color: #4a5c62;
  font-size: 0.88rem;
}
.dist-cta--extra {
  border-color: #c9a227;
  background: #fffbeb;
}
.dist-cta--extra:hover,
.dist-cta--extra:focus-visible {
  background: #fff4cc;
  border-color: #8a7018;
}
.dist-sheet-head {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}
.dist-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
}
.dist-sheet-head h4 {
  margin: 6px 0 4px;
  color: #0f4c5c;
  font-size: 1.05rem;
}
.dist-sheet-head p { margin: 0; font-weight: 600; }
.dist-table {
  width: 100%;
  border-collapse: collapse;
}
.dist-table th {
  background: #1f6f84;
  color: #fff;
  text-align: left;
  padding: 8px 10px;
}
.dist-table td {
  border: 1px solid #9db6c0;
  padding: 6px 8px;
}
.dist-table--edit .dist-n { width: 40px; text-align: center; }
.dist-table--edit input,
.dist-table--edit select { width: 100%; }
.modal-card--dist { width: min(900px, 100%); }
body.modal-open { overflow: hidden; }
.sugestoes-nome {
  position: fixed;
  z-index: 4000;
  max-height: 260px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(15, 76, 92, 0.18);
  padding: 4px;
}
.sugestoes-nome[hidden] { display: none !important; }
.sugestoes-nome button {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink);
}
.sugestoes-nome button.is-on,
.sugestoes-nome button:hover {
  background: #e7f2f6;
}
.sugestoes-nome small {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}
.sugestoes-nome__vazio {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.88rem;
}
@media (max-width: 720px) {
  .ceia-ctas { grid-template-columns: 1fr; }
}
