/* Sistema MP — interface limpa: uma família de letras (Inter), uma cor de destaque (verde da marca). */

@font-face {
  font-family: "Inter";
  src: url("/assets/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f5f6f6;
  --surface: #ffffff;
  --text: #1b2421;
  --text-soft: #46514d;
  --muted: #6c7772;
  --line: #e3e7e5;
  --line-strong: #d0d7d4;
  --accent: #334741;
  --accent-hover: #26372f;
  --accent-soft: #edf2f0;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --ok: #067647;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 26, 0.04), 0 1px 3px rgba(20, 30, 26, 0.06);
  --ring: 0 0 0 3px rgba(51, 71, 65, 0.16);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
}
body { line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

/* ---------- tipografia: um só estilo para títulos ---------- */
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; color: var(--text); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.lede, .hint, .user-line, .org-line, small { color: var(--muted); }
.lede, .hint { font-size: 0.9rem; line-height: 1.55; margin: 0; }
small { font-size: 0.83rem; }

/* ---------- formulários ---------- */
label { display: grid; gap: 6px; font-size: 0.85rem; font-weight: 550; color: var(--text-soft); }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
}
input::placeholder, textarea::placeholder { color: #9aa4a0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input:disabled { background: #f3f5f4; color: var(--muted); }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; padding: 0; accent-color: var(--accent); }
.stack { display: grid; gap: 14px; }

.primary, .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-hover); }
.primary:disabled { opacity: 0.45; cursor: not-allowed; }
.ghost { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.ghost:hover { background: #f3f5f4; }
.ghost.danger { color: var(--danger); }
.ghost.danger:hover { background: var(--danger-soft); border-color: #f4c7c3; }
a.ghost, a.primary { cursor: pointer; }
.primary:focus-visible, .ghost:focus-visible, .sheet-nav button:focus-visible { outline: none; box-shadow: var(--ring); }

.form-error, .form-ok {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
}
.form-error { background: var(--danger-soft); color: var(--danger); }
.form-ok { background: #ecfdf3; color: var(--ok); }
p.hint:not([hidden]):not(.empty) { padding: 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; }

/* ---------- entrada (login, cadastro, convite) ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

.gate {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  background:
    radial-gradient(900px 520px at 0% 0%, rgba(214, 232, 220, 0.22), transparent 58%),
    radial-gradient(700px 480px at 100% 100%, rgba(255, 244, 220, 0.14), transparent 55%),
    linear-gradient(155deg, #1b2e28 0%, #334741 48%, #3d5a50 100%);
}
.gate::before,
.gate::after {
  content: "";
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
}
.gate::before {
  width: 540px;
  height: 540px;
  left: -180px;
  top: -200px;
  background: radial-gradient(circle, rgba(198, 224, 208, 0.42), transparent 68%);
  animation: entry-drift 16s ease-in-out infinite alternate;
}
.gate::after {
  width: 460px;
  height: 460px;
  right: -140px;
  bottom: -180px;
  background: radial-gradient(circle, rgba(255, 236, 196, 0.22), transparent 70%);
  animation: entry-drift 22s ease-in-out infinite alternate-reverse;
}
@keyframes entry-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(28px, 20px, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .gate::before, .gate::after { animation: none; }
}

.entry {
  position: relative;
  z-index: 1;
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 420px);
  gap: 48px;
  align-items: center;
}
.entry-side { color: #f3f7f4; }
.entry-logo {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  background: #fff;
  padding: 5px;
  box-shadow: 0 16px 40px rgba(8, 16, 12, 0.28);
}
.entry-mark {
  margin: 18px 0 0;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}
.entry-side h2 {
  margin-top: 10px;
  max-width: 14ch;
  color: #fff;
  font-size: clamp(2rem, 4vw, 2.7rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.08;
}
.entry-lead {
  max-width: 36ch;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.02rem;
  line-height: 1.55;
}
.entry-points {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.entry-points li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-weight: 550;
}
.entry-points li::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d7ebe0;
  box-shadow: 0 0 0 6px rgba(215, 235, 224, 0.16);
  flex: none;
}

.gate-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 32px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(8, 16, 12, 0.28);
  gap: 16px;
  align-content: start;
}
.gate-card h1 { font-size: 1.7rem; margin-bottom: 6px; color: var(--accent); }
.gate-card .eyebrow { color: var(--accent); }
.gate-card .primary, .gate-card .ghost { width: 100%; }
.entry-card .primary { min-height: 48px; border-radius: 12px; font-size: 1rem; }
.entry-card .lede { color: var(--text-soft); }
.entry-foot {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: baseline;
  gap: 0 6px;
  margin: 2px 0 0;
  font-size: 0.84rem;
  color: var(--text-soft);
  white-space: nowrap;
}
.entry-foot .linkish {
  font-weight: 650;
  font-size: inherit;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- estrutura ---------- */
.shell {
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top" "rail work";
}
.topbar { grid-area: top; }
.rail { grid-area: rail; }
.workspace { grid-area: work; }

.rail {
  position: static;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand { display: none; }
.brand > div { min-width: 0; }
.brand img { width: 38px; height: 38px; border-radius: 10px; flex: none; }
.brand strong { display: block; font-size: 0.95rem; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.brand span { display: block; font-size: 0.78rem; color: var(--muted); overflow-wrap: anywhere; }

.sheet-nav { display: grid; gap: 2px; overflow: auto; align-content: start; }
.sheet-nav button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
}
.sheet-nav button:hover { background: #f3f5f4; color: var(--text); }
.sheet-nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sheet-nav .count { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.workspace { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.topbar {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 16px 22px;
  background: #2a403a;
  color: #fff;
}
.identity { min-width: 0; flex: 1; display: flex; gap: 14px; align-items: center; }
.top-logo {
  width: 48px;
  height: 48px;
  padding: 4px;
  border-radius: 14px;
  background: #fff;
  flex: none;
}
.identity h1 { color: #fff; font-size: 1.45rem; letter-spacing: -0.03em; }
.org-line, .user-line { margin: 0; font-size: 0.84rem; color: rgba(255, 255, 255, 0.72); }
.org-line { margin-top: 2px; }
.user-line { margin-top: 1px; }
.switch-card {
  display: grid;
  gap: 2px;
  min-width: 190px;
  margin: 0;
  padding: 8px 14px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.switch-card select {
  width: 100%;
  min-height: 28px;
  padding: 0 22px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}
.top-meta { display: flex; align-items: center; gap: 14px; flex: none; }
.updated-line { margin: 0; max-width: 220px; text-align: right; font-size: 0.8rem; color: rgba(255, 255, 255, 0.72); }
.account-menu { position: relative; }
.account-menu summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu[open] summary { background: rgba(255, 255, 255, 0.1); }
.account-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 6;
  display: grid;
  min-width: 190px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(20, 30, 26, 0.16);
}
.account-panel button {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
}
.account-panel button:hover { background: #f3f5f4; }
.account-panel button.danger { color: var(--danger); }
.menu-btn {
  display: none;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 650;
}

.banner {
  margin: 16px 32px 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.88rem;
}
.main { padding: 28px 32px 56px; max-width: 1120px; width: 100%; }

/* ---------- blocos ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.master-head { margin: 36px 0 12px; }
.main > .master-head:first-child, .main > section.panel:first-child + .master-head,
.menu-view > .master-head:first-child { margin-top: 0; }
.master-head h2 { margin-bottom: 4px; }
.master-head p { margin: 0; max-width: 64ch; font-size: 0.9rem; color: var(--muted); }
.master-block { margin-bottom: 20px; }
.master-actions, .row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.panel .user-row, .panel .save-row { padding: 14px 20px; }
.user-row, .save-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.panel > .user-row:last-child, .panel > .save-row:last-child { border-bottom: 0; }
.user-row strong, .save-row strong { font-size: 0.95rem; font-weight: 600; }
.user-row div > small, .save-row div > small { display: block; margin-top: 2px; font-size: 0.86rem; overflow-wrap: anywhere; }
.save-row > small { white-space: nowrap; }
.user-row br, .save-row br { display: none; }
.user-row select { width: auto; min-width: 130px; min-height: 36px; }
.user-row .ghost, .user-row .primary { min-height: 36px; padding: 0 12px; }
.group-title { padding: 18px 20px 4px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0; }
.group-title + .user-row { border-top: 0; }
.panel > form.stack { padding: 14px 20px 18px; margin: 0; background: #fafbfa; border-bottom: 1px solid var(--line); }
.empty { padding: 20px; color: var(--muted); font-size: 0.9rem; margin: 0; }
.panel > p.hint, .panel > p.form-error { margin: 12px 20px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 16px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filters label { flex: 1 1 200px; min-width: 0; }
.filters .primary { flex: none; }

.master-grid, .org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.master-card, .org-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.org-card h3, .master-card h3 { font-size: 1.05rem; overflow-wrap: anywhere; }
.org-card p, .master-card p { margin: 0; font-size: 0.88rem; color: var(--text-soft); }
.org-card .hint { color: var(--muted); }
.org-card .org-name { margin: 4px 0 0; }
.org-card .row-actions { margin-top: 4px; }
.org-card .row-actions select { width: auto; min-height: 36px; }
.org-card .ghost, .org-card .primary { min-height: 36px; padding: 0 12px; }

.online-dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 99px; background: #b8c0bc; }
.online-dot.on { background: var(--ok); }

.checks { display: grid; gap: 10px; }
.checks-block { flex: 1 1 100%; margin: 0; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px; }
.checks-block legend { padding: 0 6px; font-size: 0.85rem; font-weight: 600; color: var(--text-soft); }
.check { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; font-weight: 450; color: var(--text); }
.hint a { color: var(--accent); }
.temp-password {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.9em;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}

.kpi-row, .result-list { display: flex; gap: 12px; flex-wrap: wrap; }
.kpi-row { margin-bottom: 20px; }
.kpi { min-width: 150px; padding: 14px 18px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.kpi strong { display: block; font-size: 1.6rem; font-weight: 650; letter-spacing: -0.02em; }
.kpi span { font-size: 0.85rem; color: var(--muted); }

.table-wrap { overflow: auto; max-height: min(70vh, 820px); }
table { width: 100%; border-collapse: collapse; }
.sheet-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f7f6;
}
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 0.9rem; }
th { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.sheet-table td:first-child { font-weight: 650; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f8faf9; }
tbody tr.row-late { background: var(--danger-soft); box-shadow: inset 3px 0 0 var(--danger); }
tbody tr.row-late:hover { background: #fde8e6; }
.sheet-note, .sheet-count { margin: 0 0 12px; color: var(--muted); font-size: 0.86rem; }
.sheet-filters {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
}
.sheet-filters label { flex: none; }
.sheet-filters .ghost { align-self: end; min-height: 42px; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}
.badge-ok { color: var(--ok); background: #ecfdf3; }
.badge-warn { color: #b54708; background: #fff7ed; }
.badge-late, .badge-danger { color: var(--danger); background: #fff; }
.more { margin: 12px; }
.group { margin-top: 20px; }
.group h3 { margin-bottom: 8px; }

/* ---------- janela de registro ---------- */
.record-dialog { width: min(760px, calc(100vw - 24px)); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 24px 60px rgba(20, 30, 26, 0.22); }
.record-dialog::backdrop { background: rgba(20, 30, 26, 0.45); }
.record-dialog form { padding: 24px; background: var(--surface); }
.record-dialog header, .record-dialog footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.record-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 20px 0; max-height: min(62vh, 640px); overflow: auto; }
.record-fields label.wide { grid-column: 1 / -1; }
.record-dialog footer { justify-content: flex-end; }
.record-dialog footer .spacer { flex: 1; }
/* ---------- configuração do médico (etapas e colunas) ---------- */
.cfg-block { margin: 16px 0; }
.cfg-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}
.cfg-row .cfg-name { flex: 1 1 220px; min-height: 36px; }
.cfg-row .cfg-count, .cfg-row .cfg-type { flex: 0 0 130px; color: var(--muted); font-size: 0.82rem; }
.cfg-row .check { flex: none; }
.cfg-row .row-actions { margin-left: auto; }
.cfg-row .row-actions .ghost { min-height: 32px; padding: 0 10px; }
.cfg-row .wide { flex: 1 1 100%; }
.cfg-block > form.stack { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.cfg-block > form.stack label { flex: 1 1 200px; }
.cfg-block > form.stack .check, .cfg-block > form.stack .wide { flex: 1 1 100%; }
.cfg-block > form.stack .primary { flex: none; }

.record-dialog .form-error { margin: 0 0 14px; }
[hidden] { display: none !important; }
.record-dialog form { max-height: 94vh; overflow: auto; }
.record-fields { max-height: min(46vh, 480px); }
.record-files { border-top: 1px solid var(--line); padding-top: 16px; margin-bottom: 16px; }
.record-files h3 { margin: 0 0 8px; }
.file-list { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
.file-list .hint { padding: 12px 14px; margin: 0; }
.file-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.file-row:last-child { border-bottom: 0; }
.file-row strong { font-size: 0.92rem; font-weight: 600; overflow-wrap: anywhere; }
.file-row small { display: block; margin-top: 2px; }
.file-row .btn { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; text-decoration: none; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.72rem; font-weight: 600; }
.file-add { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.file-add input[type="file"] { flex: 1 1 220px; min-width: 0; min-height: 0; padding: 6px; font-size: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 16px; }
.page-head h2 { margin: 0; }
.sheet-nav button.sep { margin-top: 12px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; padding-top: 12px; }

/* ---------- celular ---------- */
.shell.nav-open .rail { transform: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "top" "work"; }
  .rail {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
    grid-area: auto;
    height: auto;
    width: min(300px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 40px rgba(20, 30, 26, 0.18);
  }
  .menu-btn { display: inline-flex; align-items: center; }
  .topbar { flex-wrap: wrap; gap: 12px; padding: 14px 16px; }
  .identity { flex: 1 1 180px; }
  .switch-card, .top-meta { flex: 1 1 100%; }
  .top-meta { justify-content: space-between; }
  .updated-line { text-align: left; }
  .main { padding: 20px 16px 48px; }
  .banner { margin: 12px 16px 0; }
  .record-fields, .master-grid, .org-grid, .org-tiles { grid-template-columns: 1fr; }
  .sheet-filters { grid-template-columns: 1fr; }
  .user-row, .save-row { flex-wrap: wrap; align-items: flex-start; }
  .entry { grid-template-columns: 1fr; gap: 22px; }
  .entry-side h2 { max-width: none; font-size: 1.7rem; }
  .entry-lead, .entry-points { display: none; }
  .entry-foot { flex-wrap: wrap; white-space: normal; }
  .entry-logo { width: 56px; height: 56px; border-radius: 14px; }
  .entry-mark { margin-top: 12px; }
  .gate-card { padding: 24px; }
}

.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.access-pick { align-items: flex-start; margin: 8px 0; }
.access-pick small { display: block; color: var(--muted); }
.view-switch { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.view-switch button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.view-switch button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.menu-view { display: grid; gap: 16px; }
.menu-view > .master-head { margin: 0; }
.menu-view > .panel, .menu-view > .fold { margin: 0; }
.org-back { justify-self: start; }

.org-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.org-tile {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 16px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.org-tile:hover { border-color: var(--accent); box-shadow: var(--ring); }
.org-tile-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.org-tile-top strong { font-size: 1.02rem; }
.org-tile-mail { font-size: 0.84rem; color: var(--muted); overflow-wrap: anywhere; }
.org-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px 18px; margin: 0; padding: 4px 20px 16px; }
.org-facts div { display: grid; gap: 2px; }
.org-facts dt { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.org-facts dd { margin: 0; font-weight: 650; }
.pay-history { margin: 0; padding: 0 20px 8px 36px; color: var(--text-soft); font-size: 0.88rem; }
.org-profile-actions, .org-profile-note { margin: 0 20px 16px; }
.org-stats b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}
.chip-em_dia { color: var(--ok); background: #ecfdf3; }
.chip-pendente { color: var(--text-soft); background: var(--accent-soft); }
.chip-atrasado { color: var(--danger); background: var(--danger-soft); }

.fold {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.fold > summary {
  padding: 14px 16px;
  font-weight: 650;
  cursor: pointer;
}
.fold > .stack, .fold > form.stack { padding: 0 16px 16px; }
.fold > p { margin: 0 16px 16px; }
.row-fold { margin-top: 8px; }
.row-fold summary { width: fit-content; color: var(--muted); font-size: 0.8rem; cursor: pointer; }
.row-fold .row-actions { margin-top: 8px; }

.group-link {
  display: block;
  width: 100%;
  padding: 16px 20px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}
.group-link:hover { color: var(--accent); }
