/* =================================================================
   Registros SaaS - main stylesheet
   Cores do tenant são injetadas via CSS variables inline no <html>
   ================================================================= */

/* ============================= SAFETY NET =============================
   SVG sem width/height explícitos seria renderizado em 100% do parent.
   Limita tudo a no máximo 32px por padrão — casos específicos que
   precisam de mais, já declaram width/height na tag ou por classe.
======================================================================== */
svg {
  width: 1em;
  height: 1em;
  max-width: 32px;
  max-height: 32px;
  flex-shrink: 0;
}
svg[width], svg[height] {
  /* Quando declara explicitamente, respeita */
  max-width: none;
  max-height: none;
}

:root {
  --primary: #4F46E5;
  --secondary: #7C3AED;
  --primary-soft: rgba(79, 70, 229, 0.08);
  --bg: #f6f7fb;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --text-soft: #9ca3af;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 4px 14px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 35px rgba(0,0,0,0.12);
  --sidebar-w: 240px;
  --header-h: 60px;
  --bottom-nav-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* ============================= LAYOUT ============================== */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex; align-items: center; padding: 0 16px;
  box-shadow: var(--shadow-sm);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 12px; }
.topbar .brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 700; font-size: 15px;
  flex: 1; min-width: 0;
  overflow: hidden;
}
.topbar .brand img {
  max-height: 34px; max-width: 110px; object-fit: contain;
  flex-shrink: 0;
}
.topbar .brand-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.topbar .brand-name-compact {
  font-size: 14px;
}
@media (max-width: 640px) {
  .topbar .brand { font-size: 14px; }
  .topbar .brand img { max-height: 30px; max-width: 90px; }
}
@media (max-width: 480px) {
  .topbar .brand-name-compact { display: none; }
}

.menu-toggle {
  border: 0; background: transparent; cursor: pointer;
  padding: 6px; border-radius: 8px;
  display: none;
}
.menu-toggle:hover { background: var(--bg); }
.menu-toggle svg { width: 24px; height: 24px; }

.topbar .user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: var(--bg);
  cursor: pointer;
  border: 0;
}
.topbar .user-chip:hover { background: var(--primary-soft); }
.topbar .user-chip .user-name {
  font-weight: 500; font-size: 13px;
  max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.main-wrap { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
}
.sidebar a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.sidebar a.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.sidebar a svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-section {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-soft); font-weight: 600;
  padding: 16px 12px 6px;
}

.content {
  flex: 1; padding: 20px;
  min-width: 0;
  max-width: 100%;
}
.content-narrow { max-width: 720px; margin: 0 auto; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 22px; margin: 0; font-weight: 700; }
.page-header p { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }

/* Bottom nav (mobile) */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  height: var(--bottom-nav-h);
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-inner {
  display: flex; align-items: stretch; justify-content: space-around;
  height: var(--bottom-nav-h);
}
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 11px; gap: 2px;
  text-decoration: none;
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a svg { width: 22px; height: 22px; }

/* ============================= CARDS =============================== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

/* ============================= FORMS =============================== */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-weight: 500; font-size: 13px;
  margin-bottom: 6px; color: var(--text);
}
.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.textarea { min-height: 90px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px;
  border: 0; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px;
  cursor: pointer;
  transition: transform .05s, box-shadow .15s, background .15s;
  background: var(--primary); color: #fff;
}
.btn:hover { box-shadow: var(--shadow); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-secondary {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); color: var(--text); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn svg { width: 16px; height: 16px; }

/* ============================= AVATAR ============================== */
.avatar {
  border-radius: 50%; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.avatar-initials { color: #fff; font-weight: 600; }

/* ============================= FEED ================================ */
.feed {
  max-width: 640px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 22px;
  padding-bottom: 40px;
}


#feed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}


.composer {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.composer .composer-row { display: flex; align-items: flex-start; gap: 10px; }
.composer textarea {
  flex: 1; border: 0; padding: 8px;
  background: transparent; resize: none;
  min-height: 48px;
}
.composer textarea:focus { outline: 0; }
.composer-actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--border);
}
.composer .file-preview {
  margin-top: 10px; position: relative;
  border-radius: var(--radius); overflow: hidden; max-height: 300px;
}
.composer .file-preview img { width: 100%; max-height: 300px; object-fit: cover; }
.composer .file-preview .remove {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.6); color: #fff;
  border: 0; border-radius: 50%; width: 28px; height: 28px;
  cursor: pointer;
}
.icon-btn {
  background: transparent; border: 0; padding: 8px; border-radius: 8px;
  color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.icon-btn:hover { background: var(--bg); color: var(--primary); }
.icon-btn svg { width: 20px; height: 20px; }

/* Post card (estilo rede social) */
.post {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 0;
}
.feed > .post:last-child { margin-bottom: 0; }
.post-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
}
.post-header .names { flex: 1; min-width: 0; }
.post-header .author { font-weight: 600; font-size: 14px; color: var(--text); }
.post-header .meta { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.post-header .assisted-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-weight: 600;
}
.post-body {
  padding: 0 14px 12px;
  white-space: pre-wrap; word-wrap: break-word;
  font-size: 14.5px; line-height: 1.55;
}
.post-image { width: 100%; max-height: 480px; object-fit: cover; background: #000; }
.post-actions {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px; border-top: 1px solid var(--border);
}
.post-action {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 8px;
  background: transparent; border: 0;
  color: var(--text-muted); cursor: pointer; font-size: 13px; font-weight: 500;
}
.post-action:hover { background: var(--bg); color: var(--text); }
.post-action.liked { color: var(--danger); }
.post-action.liked svg { fill: var(--danger); }
.post-action svg { width: 20px; height: 20px; }

.comments {
  padding: 8px 14px 12px;
  border-top: 1px solid var(--border);
  background: #fafbfd;
  display: none;
}
.comments.open { display: block; }
.comment {
  display: flex; gap: 8px; padding: 8px 0;
}
.comment .bubble {
  background: #fff; border: 1px solid var(--border);
  border-radius: 14px; padding: 8px 12px;
  max-width: 100%;
  position: relative;
}
.comment-bubble-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.comment .bubble .author { font-weight: 600; font-size: 13px; }
.comment .bubble .text { font-size: 13.5px; white-space: pre-wrap; word-wrap: break-word; }
.comment-delete-btn {
  background: transparent;
  border: 0;
  padding: 4px;
  border-radius: 4px;
  color: var(--text-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}
.comment-delete-btn:hover {
  background: #fee2e2;
  color: var(--danger);
  opacity: 1;
}
.comment .meta { font-size: 11px; color: var(--text-soft); margin-top: 2px; padding-left: 4px; }

.comment-form {
  display: flex; gap: 8px; align-items: flex-end;
  margin-top: 8px;
}
.comment-form textarea {
  flex: 1; border: 1px solid var(--border); border-radius: 18px;
  padding: 8px 12px; resize: none; min-height: 38px; max-height: 120px;
  background: #fff;
}
.comment-form textarea:focus {
  outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ============================= ANNOUNCEMENTS ============================= */
.announcements { margin-bottom: 14px; }
.announcement {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  position: relative;
  text-align: left;
}
.announcement.ann-info     { border-left-color: #3b82f6; background: #eff6ff; }
.announcement.ann-schedule { border-left-color: #f59e0b; background: #fffbeb; }
.announcement.ann-request  { border-left-color: #a855f7; background: #faf5ff; }

.announcement.is-new {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
}
.announcement .new-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.ann-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.ann-type-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.ann-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.ann-pinned {
  font-size: 14px;
}
.ann-content {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  text-align: left;
}
.ann-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 8px;
}
.ann-actions .icon-action {
  background: transparent;
  border: 0;
  padding: 6px;
  border-radius: 6px;
  color: var(--text-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ann-actions .icon-action:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}

.old-announcements {
  margin-top: 14px;
  background: var(--bg);
  border: 1px dashed var(--border);
}
.old-announcements summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 4px;
  list-style: none;
  user-select: none;
}
.old-announcements summary::-webkit-details-marker { display: none; }
.old-announcements summary:hover { color: var(--text); }
.old-announcements[open] summary { margin-bottom: 10px; }
.old-ann-list .announcement { opacity: 0.85; }

/* ============================= TABELAS ============================= */
.table-wrap {
  background: var(--surface); border-radius: var(--radius); overflow-x: auto;
  border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
table.data {
  width: 100%; border-collapse: collapse; font-size: 14px;
  min-width: 600px; /* força horizontal scroll em mobile */
}
table.data th, table.data td {
  text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border);
}
table.data th { background: #fafbfd; font-weight: 600; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
table.data tbody tr:hover { background: var(--bg); }
table.data tbody tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-suspended { background: #fef3c7; color: #92400e; }
.badge-admin { background: #e0e7ff; color: #3730a3; }
.badge-caregiver { background: #dcfce7; color: #166534; }
.badge-client { background: #fef3c7; color: #92400e; }

/* Tags */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--primary-soft); color: var(--primary);
  border: 1px solid var(--primary);
}
.tag-remove { background: none; border: 0; cursor: pointer; color: inherit; padding: 0; opacity: 0.6; }
.tag-remove:hover { opacity: 1; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius);
  max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal header h2 { margin: 0; font-size: 18px; }
.modal .body { padding: 20px; }
.modal .footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.close-btn { background: transparent; border: 0; cursor: pointer; padding: 6px; border-radius: 6px; }
.close-btn:hover { background: var(--bg); }

/* ============================= AUTH ================================ */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}
.auth-card {
  background: var(--surface);
  width: 100%; max-width: 420px;
  padding: 32px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}
.auth-card .logo-wrap { text-align: center; margin-bottom: 22px; }
.auth-card .logo-wrap img { max-height: 56px; max-width: 220px; margin: 0 auto; }
.auth-card h1 { font-size: 20px; text-align: center; margin: 0 0 6px; }
.auth-card p.subtitle { text-align: center; color: var(--text-muted); font-size: 14px; margin: 0 0 22px; }
.auth-card .error {
  background: #fee2e2; color: #991b1b;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 14px;
}
.auth-card .info {
  background: #eff6ff; color: #1e40af;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 14px;
}

/* Flash toast */
.flash-wrap { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 12px 18px; border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  font-size: 14px;
  animation: slideIn .25s ease;
  max-width: 360px;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.flash-success { border-left-color: var(--success); }
.flash-error   { border-left-color: var(--danger); }
.flash-warning { border-left-color: var(--warning); }

/* ============================= GRID ================================ */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.stat-card {
  background: var(--surface); padding: 16px; border-radius: var(--radius);
  border: 1px solid var(--border);
}
.stat-card .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 4px; color: var(--primary); }

/* ============================= CAREGIVER CARD ====================== */
.caregiver-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s;
}
.caregiver-card:hover { box-shadow: var(--shadow); }
.caregiver-card .head { display: flex; gap: 10px; align-items: center; }
.caregiver-card .head .name { font-weight: 600; font-size: 14.5px; }
.caregiver-card .head .contact { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.caregiver-card .notes-preview { font-size: 13px; color: var(--text-muted); font-style: italic; line-height: 1.4; }

.search-bar {
  display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap;
}
.search-bar .input { flex: 1; min-width: 200px; }

/* ============================= UTILS =============================== */
.hstack { display: flex; gap: 10px; align-items: center; }
.vstack { display: flex; flex-direction: column; gap: 10px; }
.between { display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.hidden { display: none !important; }

.empty {
  text-align: center; padding: 40px 20px; color: var(--text-muted);
}
.empty svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.4; }

/* ============================= RESPONSIVE ========================== */
@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; left: -280px; top: var(--header-h);
    height: calc(100vh - var(--header-h));
    transition: left .25s;
    z-index: 50;
    width: 260px;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { left: 0; }
  .content { padding: 14px; padding-bottom: calc(var(--bottom-nav-h) + 20px); }
  .bottom-nav { display: block; }
  .topbar .user-chip .user-name { display: none; }
  .composer { border-radius: var(--radius); }
  .post { border-radius: var(--radius); }
}
@media (max-width: 480px) {
  .content { padding: 10px; padding-bottom: calc(var(--bottom-nav-h) + 20px); }
  .page-header h1 { font-size: 18px; }
  .auth-card { padding: 22px; }
}

/* ============================= FAB ================================= */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border: 0;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.12);
  display: flex; align-items: center; justify-content: center;
  z-index: 45;
  transition: transform .15s, box-shadow .15s;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(0,0,0,0.22); }
.fab:active { transform: translateY(1px); }
.fab svg { width: 26px; height: 26px; }
@media (max-width: 900px) {
  .fab { bottom: calc(var(--bottom-nav-h) + 14px + env(safe-area-inset-bottom)); }
}

/* ============================= LIGHTBOX ============================ */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  display: none;
  align-items: center; justify-content: center;
  z-index: 200;
  padding: 20px;
}
.lightbox.open {
  display: flex;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox-img {
  max-width: 100%;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 6px;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox-close {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,0.15); color: #fff;
  border: 0; border-radius: 50%;
  width: 44px; height: 44px;
  font-size: 28px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  z-index: 2;
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }
.post-image { cursor: zoom-in; }

/* ============================= POST ADMIN ACTIONS ================== */
.post-actions-inline {
  margin-left: auto;
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.post-actions-inline .icon-action {
  background: transparent;
  border: 0;
  padding: 8px;
  border-radius: 8px;
  color: var(--text-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  transition: background .12s, color .12s;
}
.post-actions-inline .icon-action:hover {
  background: var(--bg);
  color: var(--text);
}
.post-actions-inline .delete-btn:hover {
  background: #fee2e2;
  color: var(--danger);
}

/* Edited badge */
.edited-badge {
  font-size: 11px;
  color: var(--text-soft);
  font-style: italic;
  margin-left: 4px;
}

/* Date filter banner */
.date-filter-banner {
  background: var(--primary-soft);
  color: var(--primary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

/* ============================= BADGES NAV ========================== */
.sidebar .nav-badge,
.bottom-nav .nav-badge {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  box-shadow: 0 0 0 2px var(--surface);
}
.sidebar a {
  position: relative;
}
.sidebar .nav-badge {
  margin-left: auto;
}
.bottom-nav .nav-badge {
  position: absolute;
  top: 6px;
  left: 50%;
  margin-left: 6px;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
}
.bottom-nav a { position: relative; }

/* ============================= INLINE EDIT ========================= */
.post.editing .post-body { display: none; }
.post-body-edit {
  display: none;
  padding: 0 14px 12px;
}
.post.editing .post-body-edit { display: block; }
.post-body-edit textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  font: inherit;
  resize: vertical;
}
.post-body-edit .actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 8px;
}

/* ============================= MODAL LARGE ============================= */
.modal.modal-lg { max-width: 720px; }

/* Section label (inside modals/forms) */
.section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 18px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.section-label:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* ============================= ASSISTED INFO CARD ============================= */
.assisted-info-card {
  margin-bottom: 18px;
  padding: 0;
  overflow: hidden;
}
.assisted-info-card > summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
.assisted-info-card > summary::-webkit-details-marker { display: none; }
.assisted-info-card[open] > summary {
  border-bottom-color: var(--border);
}
.assisted-info-title {
  font-weight: 600;
  color: var(--text);
}
.assisted-info-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.info-block { }
.info-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.info-text {
  font-size: 14px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.5;
}
.info-admin {
  background: #fef3c7;
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid #fde68a;
}

/* ============================= SCHEDULE PAGE ============================= */
.schedule-wrap { max-width: 860px; margin: 0 auto; }
.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.week-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}
.week-nav button {
  background: transparent;
  border: 0;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
}
.week-nav button:hover { background: var(--bg); color: var(--text); }
.week-label {
  font-weight: 600;
  font-size: 14px;
  min-width: 200px;
  text-align: center;
}

.schedule-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.day-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  transition: box-shadow .15s;
}
.day-row.today {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.day-row.empty {
  background: var(--bg);
  border-style: dashed;
  color: var(--text-muted);
}
.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.day-name {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.day-today-tag {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.day-date {
  font-size: 12px;
  color: var(--text-muted);
}
.day-blocks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.shift-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg);
  border-left: 4px solid var(--primary);
  transition: background .15s;
}
.shift-block.clickable { cursor: pointer; }
.shift-block.clickable:hover { background: #f3f4f6; }
.shift-block.oneoff {
  background: linear-gradient(90deg, #fef3c715, transparent);
  border-left-style: dashed;
}
.shift-block.exception {
  background: linear-gradient(90deg, #fce7f315, transparent);
}
.shift-block.unassigned {
  border-left-color: var(--text-soft);
  color: var(--text-muted);
  font-style: italic;
}
.shift-bar {
  width: 6px;
  border-radius: 3px;
  align-self: stretch;
  min-height: 34px;
  flex-shrink: 0;
}
.shift-info {
  flex: 1;
  min-width: 0;
}
.shift-time {
  font-weight: 600;
  font-size: 14px;
}
.shift-caregiver {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.shift-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}
.shift-tag.tag-extra { background: #fef3c7; color: #92400e; }
.shift-tag.tag-sub   { background: #fce7f3; color: #9f1239; }
.shift-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.shift-actions button {
  background: transparent;
  border: 0;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-soft);
}
.shift-actions button:hover { background: rgba(0,0,0,0.06); color: var(--text); }

.schedule-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.schedule-empty-state h3 { margin: 0 0 6px; font-size: 16px; color: var(--text); }

.schedule-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  padding: 12px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 14px;
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch {
  width: 10px; height: 10px; border-radius: 3px;
  display: inline-block;
}

/* Mobile: shift block more compact */
@media (max-width: 640px) {
  .shift-block { padding: 7px 8px; gap: 8px; }
  .shift-time { font-size: 13px; }
  .shift-caregiver { font-size: 12px; }
}

/* Weekday checkbox picker */
.weekday-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.weekday-picker label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  transition: all .12s;
}
.weekday-picker input { display: none; }
.weekday-picker input:checked + span,
.weekday-picker label:has(input:checked) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ============================= ASSISTED LIST (SCHEDULE HOME) ============================= */
.asssch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.asssch-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  transition: all .12s;
}
.asssch-item:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(0,0,0,0.04);
  transform: translateY(-1px);
  text-decoration: none;
}
.asssch-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.asssch-info { flex: 1; min-width: 0; }
.asssch-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.asssch-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.asssch-arrow {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px;
  max-height: 18px;
  color: var(--text-soft);
  flex-shrink: 0;
}

/* ============================= WEEK NAVIGATOR (schedule page) ============================= */
.week-navigator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 14px;
}
.wn-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 8px;
  font-size: 22px;
  color: var(--text-muted);
  text-decoration: none;
}
.wn-arrow:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.wn-center { text-align: center; flex: 1; }
.wn-label { font-weight: 600; font-size: 14px; color: var(--text); }
.wn-today-link { font-size: 11.5px; color: var(--primary); text-decoration: none; }
.wn-today-link:hover { text-decoration: underline; }

/* ============================= WEEK GRID ============================= */
.schedule-wrap { max-width: 860px; margin: 0 auto; }
.schedule-page-header { flex-wrap: wrap; gap: 12px; }

.schedule-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
}

.week-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.wgrid-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color .15s, box-shadow .15s;
}
.wgrid-day.is-today {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.wgrid-day.is-past {
  opacity: 0.55;
}
.wgrid-day.is-empty {
  background: var(--bg);
  padding: 10px 14px;
}
.wgrid-day.is-empty .wgrid-day-head { margin-bottom: 0; }

.wgrid-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.wgrid-dayname {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.today-chip {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.wgrid-daydate { font-size: 12px; color: var(--text-muted); }

.wgrid-empty {
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 0;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.wgrid-day.is-empty .wgrid-empty {
  margin-top: 0;
  padding-left: 8px;
}
.wgrid-empty .btn-ghost { font-size: 12px; padding: 4px 10px; }

.wgrid-blocks { display: flex; flex-direction: column; gap: 6px; }

.sblock {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 10px;
  border-left: 4px solid var(--cg-color, var(--primary));
  position: relative;
}
.sblock.sb-unassigned { border-left-color: var(--text-soft); }
.sblock.sb-oneoff { background: linear-gradient(90deg, #fef3c722, transparent); }
.sblock.sb-exception { background: linear-gradient(90deg, #fdf2f822, transparent); }
.sblock-main { flex: 1; min-width: 0; }
.sblock-time { font-weight: 600; font-size: 14px; color: var(--text); }
.sblock-cg {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.sblock-sub-info { font-size: 11px; opacity: 0.8; }
.sblock-notes { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; font-style: italic; }
.sblock-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.sblock-tag.t-extra { background: #fef3c7; color: #92400e; }
.sblock-tag.t-sub   { background: #fdf2f8; color: #9f1239; }
.sblock-tag.t-cancel { background: #f3f4f6; color: #6b7280; text-decoration: line-through; }

/* ============================= WEEKDAY PICKER ============================= */
.weekday-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.weekday-picker label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 40px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  transition: all .12s;
  color: var(--text-muted);
}
.weekday-picker input { position: absolute; opacity: 0; pointer-events: none; }
.weekday-picker label:has(input:checked) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.weekday-picker label:hover { border-color: var(--primary); }

/* ============================= MODAL ENHANCEMENTS ============================= */
.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  user-select: none;
  padding: 4px 0;
}
.time-fields {
  transition: opacity .15s;
}
.advanced-opts {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.advanced-opts summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 0;
  list-style: none;
  user-select: none;
}
.advanced-opts summary::-webkit-details-marker { display: none; }
.advanced-opts summary::before { content: '▸ '; }
.advanced-opts[open] summary::before { content: '▾ '; }

/* ============================= CARD LINKS (quick access) ============================= */
.card-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 14px;
}
.card-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .12s;
}
.card-link:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.card-link svg { flex-shrink: 0; opacity: 0.6; }

/* ============================= UNREAD HINT ============================= */
.unread-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 8px 10px;
  background: #fef3c7;
  border-radius: 8px;
  border-left: 3px solid #f59e0b;
}
.unread-hint strong { color: #92400e; }
.unread-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  color: var(--text);
  padding: 2px 8px 2px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  text-decoration: none;
  margin: 2px 4px 2px 0;
  border: 1px solid #fde68a;
}
.unread-chip:hover { background: #fef3c7; text-decoration: none; }
.unread-chip-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: #ef4444;
  color: #fff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

/* ============================= UNREAD DOT ============================= */
.unread-dot {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.announcement.is-new {
  box-shadow: none; /* overrides previous; use dot + background only */
}

/* ============================= SELECTOR CARD ============================= */
.selector-card { padding: 12px 14px; }

/* Responsive tweaks for schedule grid */
@media (max-width: 640px) {
  .wn-label { font-size: 13px; }
  .sblock { padding: 9px 10px; gap: 10px; }
  .sblock-time { font-size: 13px; }
  .sblock-cg { font-size: 12px; }
  .weekday-picker label { min-width: 38px; height: 36px; font-size: 12px; padding: 0 6px; }
}

/* Hide "novo" tag legacy */
.new-tag { display: none; }

/* ============================= OVERNIGHT BADGE ============================ */
.overnight-badge {
  display: inline-block;
  background: #1e293b;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  margin-left: 4px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: 2px;
}
.sblock.sb-overnight {
  background: linear-gradient(90deg, #1e293b0a, transparent);
}
.sblock.sb-overnight .sblock-time::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1e293b;
  margin-right: 6px;
  vertical-align: 2px;
}

/* ============================= PWA INSTALL BUTTON ============================ */
.install-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all .12s;
}
.install-btn:hover {
  background: var(--primary);
  color: #fff;
}
.install-btn svg { color: inherit; }
@media (max-width: 640px) {
  .install-btn .install-btn-text { display: none; }
  .install-btn { padding: 7px 9px; }
}

/* Hide "clique para expandir" hint when card is open */
.assisted-info-card[open] .expand-hint { display: none; }

/* ============================= SCHEDULE QUICK DELETE ============================ */
.sblock-quick-delete {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
.sblock-del-btn {
  background: transparent;
  border: 0;
  padding: 6px;
  border-radius: 6px;
  color: var(--text-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.sblock-del-btn:hover {
  background: #fee2e2;
  color: var(--danger);
}

/* ============================= DELETE OPTIONS ============================ */
.del-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}
.del-option { margin: 0; }
.del-option-btn {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all .12s;
  gap: 4px;
}
.del-option-btn strong { font-size: 14px; color: var(--text); }
.del-option-btn span { font-size: 12.5px; color: var(--text-muted); line-height: 1.4; }
.del-option-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.del-option-btn.del-option-danger:hover {
  border-color: var(--danger);
  background: #fee2e2;
}
.del-option-btn.del-option-danger:hover strong { color: var(--danger); }

/* ============================= ANNOUNCEMENTS PINNED CARD ============================ */
.announcements-pinned-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0;
  overflow: hidden;
}
.announcements-pinned-card > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.announcements-pinned-card > summary::-webkit-details-marker { display: none; }
.announcements-pinned-card > summary:hover { background: var(--bg); }
.announcements-pinned-card[open] > summary { border-bottom: 1px solid var(--border); }
.ann-summary-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ann-summary-text { flex: 1; min-width: 0; }
.ann-summary-text strong { display: block; font-size: 14px; color: var(--text); }
.ann-summary-types { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.ann-summary-chip {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
}
.ann-summary-chevron {
  transition: transform .2s;
  color: var(--text-soft);
  flex-shrink: 0;
}
.announcements-pinned-card[open] .ann-summary-chevron { transform: rotate(180deg); }
.announcements-pinned-card .announcements { margin: 12px 14px 14px; }
.announcements-pinned-card .announcement:last-child { margin-bottom: 0; }

/* ============================= LOADING STATES ============================ */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -3px;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Form sendo enviado: opacidade reduzida, sem clicks */
.is-submitting {
  opacity: 0.7;
  pointer-events: none;
  transition: opacity .15s;
}
.is-submitting button[type="submit"] {
  pointer-events: auto; /* só o botão de submit fica clicável (mas disabled) */
}

/* ============================= LOGO CROPPER ============================ */
.logo-cropper { margin-top: 4px; }
.logo-cropper-stage { margin-top: 12px; }
.logo-crop-canvas-wrap {
  position: relative;
  display: inline-block;
  border-radius: 12px;
  overflow: hidden;
  border: 2px dashed var(--border);
  background: #f8fafc;
  user-select: none;
  touch-action: none;
}
.logo-crop-canvas-wrap canvas {
  display: block;
  cursor: grab;
  max-width: 100%;
  height: auto;
}
.logo-crop-canvas-wrap canvas:active { cursor: grabbing; }
.logo-crop-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 12px;
  box-shadow: inset 0 0 0 9999px rgba(0,0,0,0.15);
}
.logo-zoom-slider {
  width: 100%;
  margin-top: 10px;
  accent-color: var(--primary);
}

/* ============================= AI REVIEW MODAL ============================ */
.ai-loading {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
}
.ai-loading-spin {
  width: 36px; height: 36px;
  border: 3px solid var(--primary-soft);
  border-right-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}
.ai-diff-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 12px 0;
}
@media (min-width: 720px) {
  .ai-diff-wrap { grid-template-columns: 1fr 1fr; }
}
.ai-side {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
}
.ai-side.ai-side-suggested {
  border-color: var(--primary);
  background: var(--surface);
}
.ai-side-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  background: rgba(0,0,0,0.03);
  color: var(--text-muted);
}
.ai-side.ai-side-suggested .ai-side-label {
  background: var(--primary-soft);
  color: var(--primary);
}
.ai-side-text {
  padding: 12px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 80px;
}
.ai-side-text[contenteditable="true"]:focus {
  outline: 2px solid var(--primary-soft);
  background: #fff;
}

/* AI Quota panel para admins (em settings/profile) */
.ai-quota-card {
  background: linear-gradient(135deg, var(--primary-soft), transparent);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 14px 16px;
}
.ai-quota-bar {
  height: 8px;
  background: rgba(0,0,0,0.06);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.ai-quota-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width .3s;
}

/* ============================= VISIBILITY PILLS ============================ */
.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  transition: all .12s;
}
.checkbox-pill:has(input:checked) {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.checkbox-pill input { margin: 0; }
.visibility-block {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 8px;
}

/* ============================= ASSISTED INFO CARD (refresh) ============================ */
.assisted-info-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.assisted-info-chevron {
  color: var(--text-soft);
  transition: transform .2s;
  margin-left: auto;
  flex-shrink: 0;
}
.assisted-info-card[open] .assisted-info-chevron { transform: rotate(180deg); }
.info-admin-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fef3c7;
  color: #92400e;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: 1px;
}
.info-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ============================= AI QUOTA CARD ============================ */
.ai-quota-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.ai-quota-info strong {
  font-size: 15px;
  color: var(--text);
}
.ai-quota-info .muted { font-size: 12px; }

/* ============================= CV CANDIDATES LIST ============================ */
.cv-candidates-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cv-candidate-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.cv-candidate-row:hover { border-color: var(--primary); background: var(--primary-soft); }
.cv-candidate-row.is-imported {
  background: var(--bg);
  cursor: not-allowed;
  opacity: 0.7;
}
.cv-candidate-row.is-imported:hover { border-color: var(--border); background: var(--bg); }
.cv-candidate-row > input[type="checkbox"] { margin-top: 4px; flex-shrink: 0; }
.cv-candidate-info { flex: 1; min-width: 0; }
.cv-candidate-name { font-weight: 600; font-size: 14px; color: var(--text); }
.cv-candidate-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  word-break: break-all;
}
.cv-candidate-email { word-break: break-all; }
.cv-candidate-status { flex-shrink: 0; text-align: right; min-width: 80px; }

@media (max-width: 600px) {
  .cv-candidate-row { padding: 9px 10px; gap: 8px; }
  .cv-candidate-status { min-width: 70px; }
  .cv-candidate-status .badge { font-size: 10px; padding: 2px 6px; }
}

/* ============================= INLINE TAG PICKER ============================ */
.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0 4px;
  position: relative;
  align-items: center;
}
.tag-pill {
  --tag-color: #3b82f6;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 4px 3px 10px;
  background: color-mix(in srgb, var(--tag-color) 15%, transparent);
  color: var(--tag-color);
  border: 1px solid color-mix(in srgb, var(--tag-color) 30%, transparent);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.tag-pill-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--tag-color);
}
.tag-pill-name { line-height: 1; }
.tag-pill-remove {
  background: transparent;
  border: 0;
  color: var(--tag-color);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  width: 18px; height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
  margin-left: 2px;
  opacity: 0.5;
  transition: opacity .12s, background .12s;
}
.tag-pill-remove:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--tag-color) 20%, transparent);
}

.tag-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: transparent;
  border: 1px dashed var(--text-soft);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .12s;
}
.tag-add-btn:hover {
  border-color: var(--primary);
  border-style: solid;
  color: var(--primary);
  background: var(--primary-soft);
}

.tag-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  margin-top: 4px;
  min-width: 220px;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 6px 0;
}
.tag-dropdown-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-soft);
  padding: 6px 14px 4px;
  letter-spacing: 0.06em;
}
.tag-dropdown-list {
  max-height: 240px;
  overflow-y: auto;
}
.tag-dropdown-empty {
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}
.tag-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: 0;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}
.tag-option:hover { background: var(--bg); }
.tag-option-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tag-create-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.tag-create-link:hover { background: var(--primary-soft); }

/* Color swatch picker no modal de nova etiqueta */
.tag-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.tag-color-swatch {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  position: relative;
  transition: transform .15s;
}
.tag-color-swatch:hover { transform: scale(1.1); }
.tag-color-swatch.is-selected::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* ============================= DASHBOARD ============================ */
.dashboard { max-width: 1100px; margin: 0 auto; }

.period-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.period-tab {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: all .12s;
}
.period-tab:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.period-tab.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-card {
  display: block;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.05);
  border-color: var(--primary);
  text-decoration: none;
}
.kpi-card.kpi-primary { border-color: var(--primary); }
.kpi-card.kpi-accent { background: linear-gradient(135deg, var(--primary-soft), transparent); }
.kpi-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.kpi-value { font-size: 32px; font-weight: 700; line-height: 1; margin: 4px 0; color: var(--text); }
.kpi-foot { display: flex; gap: 6px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (min-width: 880px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
}

.engagement-row { display: flex; gap: 16px; flex-wrap: wrap; }
.engagement-item { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 130px; }
.engagement-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.engagement-value { font-size: 18px; font-weight: 700; line-height: 1; }
.engagement-label { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 50px;
  padding: 4px 0;
}
.spark-bar {
  flex: 1;
  background: var(--primary-soft);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
}
.spark-bar-today { background: var(--primary); }

.ai-panel { background: linear-gradient(135deg, var(--primary-soft), transparent); border-color: var(--primary); }
.ai-progress {
  height: 8px;
  background: rgba(0,0,0,0.06);
  border-radius: 999px;
  overflow: hidden;
}
.ai-progress-fill { height: 100%; transition: width .3s; }

.top-list, .today-list { display: flex; flex-direction: column; gap: 8px; }
.top-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
}
.top-list-name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.top-list-count { font-size: 14px; font-weight: 700; color: var(--primary); flex-shrink: 0; }

.today-item {
  display: flex; gap: 12px; align-items: center;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
}
.today-time { font-weight: 700; font-size: 13px; color: var(--primary); white-space: nowrap; flex-shrink: 0; }
.today-info { flex: 1; min-width: 0; }
.badge-mini {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: 1px;
}
.badge-mini.badge-extra { background: #fef3c7; color: #92400e; }

/* ============================= FILTER TAG (com indicador visual) ============================ */
.filter-tag {
  --tag-color: #3b82f6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border: 1.5px solid color-mix(in srgb, var(--tag-color) 30%, transparent);
  background: var(--surface);
  color: var(--text-muted);
  transition: all .12s;
  white-space: nowrap;
  margin: 3px 4px 3px 0;
}
.filter-tag:hover {
  border-color: var(--tag-color);
  color: var(--tag-color);
  text-decoration: none;
  transform: translateY(-1px);
}
.filter-tag .filter-tag-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--tag-color);
  flex-shrink: 0;
  opacity: 0.6;
}
.filter-tag.is-active {
  background: var(--tag-color);
  color: #fff !important;
  border-color: var(--tag-color);
  font-weight: 700;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--tag-color) 40%, transparent);
}
.filter-tag.is-active .filter-tag-dot {
  background: #fff;
  opacity: 1;
}
.filter-tag-check {
  font-weight: 700;
  font-size: 11px;
}

/* ============================= CHECKBOX LIST (substituto de select multiple) ============================ */
.checkbox-list {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.checkbox-list-search {
  border: 0 !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  background: var(--bg) !important;
}
.checkbox-list-search:focus { box-shadow: none !important; }
.checkbox-list-actions {
  display: flex;
  gap: 14px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  font-size: 11px;
  align-items: center;
}
.btn-link-mini {
  background: transparent; border: 0;
  color: var(--primary); cursor: pointer;
  font-size: 11.5px; font-weight: 600;
  padding: 0; text-decoration: underline;
}
.btn-link-mini:hover { opacity: 0.75; }
.checkbox-list-count { margin-left: auto; color: var(--text-muted); font-size: 11px; }
.checkbox-list-items {
  max-height: 220px;
  overflow-y: auto;
}
.checkbox-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  transition: background .12s;
}
.checkbox-list-item:last-child { border-bottom: 0; }
.checkbox-list-item:hover { background: var(--bg); }
.checkbox-list-item input[type="checkbox"] { flex-shrink: 0; cursor: pointer; }
.checkbox-list-item:has(input:checked) {
  background: var(--primary-soft);
}
.checkbox-list-item-info { flex: 1; min-width: 0; }
.checkbox-list-item-name {
  display: block;
  font-size: 13.5px;
  color: var(--text);
}
.checkbox-list-item:has(input:checked) .checkbox-list-item-name {
  font-weight: 600;
  color: var(--primary);
}
.checkbox-list-item-meta {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.checkbox-list-empty {
  padding: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--bg);
}

/* JS atualiza contador (count) — fallback CSS pra browsers que suportam :has */
@supports selector(:has(*)) {
  .checkbox-list:has(input:checked) [data-count]::before {
    content: attr(data-count);
  }
}

/* ============================= VITAL SIGNS ============================ */
.vitals-summary {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.vital-stat {
  flex: 1; min-width: 130px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.vital-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.vital-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-top: 4px;
}
.vital-stat-help {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
}
.vital-stat-row {
  display: flex; gap: 6px; flex-wrap: wrap;
}

.vitals-list { display: flex; flex-direction: column; gap: 14px; }
.vitals-day { background: var(--surface); border-radius: 12px; border: 1px solid var(--border); padding: 12px 14px; }
.vitals-day-header { margin: 0 0 10px; font-size: 14px; }
.vital-record {
  border-left: 3px solid var(--primary);
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.vital-record:last-child { margin-bottom: 0; }
.vital-record-head {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 13px;
}
.vital-period { font-weight: 600; }
.vital-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}
.vital-chips {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-bottom: 6px;
}
.vital-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  background: #f3f4f6;
  color: var(--text);
  white-space: nowrap;
}
.vital-chip .muted { font-weight: 400; font-size: 11px; }
.vital-chip.vital-ok      { background: #d1fae5; color: #065f46; }
.vital-chip.vital-warning { background: #fef3c7; color: #92400e; }
.vital-chip.vital-danger  { background: #fee2e2; color: #991b1b; }
.vital-checks {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}
.vital-notes {
  font-size: 12.5px;
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.02);
  border-radius: 6px;
  color: var(--text);
}

.vital-svg {
  width: 100% !important;
  max-width: none !important;
  max-height: none !important;
  height: 300px !important;
  min-height: 300px !important;
  display: block !important;
  overflow: visible !important;
}

.icon-btn-mini {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.icon-btn-mini:hover { color: var(--primary); border-color: var(--primary); }

/* Period radio (modal) */
.period-radio-group { display: flex; gap: 4px; }
.period-radio {
  flex: 1;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  transition: all .12s;
}
.period-radio input { display: none; }
.period-radio:hover { border-color: var(--primary); }
.period-radio.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 700;
}

.vitals-section-title {
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.vital-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 480px) {
  .vital-fields-grid { grid-template-columns: 1fr; }
}

.vital-checks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
  margin-top: 4px;
}
.vital-check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  transition: background .12s;
  user-select: none;
}
.vital-check-item:has(input:checked) {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

/* ============================= CARE PLAN ============================ */
.cp-progress-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.cp-category-block { margin-bottom: 18px; }
.cp-category-header {
  --cat-color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin: 14px 0 8px;
  padding-left: 10px;
  border-left: 3px solid var(--cat-color);
  color: var(--cat-color);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.cp-category-emoji { font-size: 16px; }

.cp-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: opacity .15s;
}
.cp-item.is-inactive,
.cp-item.is-out-of-range { opacity: 0.55; }

.cp-item-head {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.cp-item-info { flex: 1; min-width: 0; }
.cp-item-title {
  font-weight: 600;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cp-item-meta {
  font-size: 12.5px;
  margin-top: 2px;
}
.cp-item-meta strong { color: var(--primary); }
.cp-item-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* Slots de horário */
.cp-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.cp-slot {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: default;
  transition: all .12s;
  min-width: 80px;
  position: relative;
}
.cp-slot.is-actionable { cursor: pointer; }
.cp-slot.is-actionable:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}
.cp-slot.is-done {
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}
.cp-slot.is-done:hover {
  background: #a7f3d0;
}
.cp-slot-check {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 2px;
}
.cp-slot.is-done .cp-slot-check { color: #10b981; }
.cp-slot:not(.is-done) .cp-slot-check { color: var(--text-soft); }
.cp-slot-time {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.cp-slot-meta {
  font-size: 9.5px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
  text-align: center;
  line-height: 1.2;
}
.cp-slot.is-done .cp-slot-meta { color: #047857; }

/* ============================= CARE PLAN ============================ */
.cp-progress-card {
  background: linear-gradient(135deg, var(--primary-soft), transparent);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 12px 14px;
}

.cp-category-block {
  margin-bottom: 18px;
}
.cp-category-header {
  --cat-color: var(--primary);
  margin: 0 0 8px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--cat-color) 8%, transparent);
  border-left: 4px solid var(--cat-color);
  border-radius: 6px;
  font-size: 14px;
  color: var(--cat-color);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cp-category-emoji { font-size: 18px; }

.cp-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: opacity .15s;
}
.cp-item.is-inactive { opacity: 0.55; background: var(--bg); }
.cp-item.is-out-of-range { opacity: 0.45; }

.cp-item-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.cp-item-info { flex: 1; min-width: 0; }
.cp-item-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.cp-item-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.cp-item-meta strong { color: var(--text); }
.cp-item-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* Slots — botões dos horários */
.cp-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.cp-slot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: not-allowed;
  font-family: inherit;
  transition: all .12s;
}
.cp-slot.is-actionable { cursor: pointer; }
.cp-slot.is-actionable:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}
.cp-slot.is-done {
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}
.cp-slot.is-done:hover {
  background: #a7f3d0;
  border-color: #059669;
  color: #064e3b;
}
.cp-slot-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid currentColor;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.cp-slot.is-done .cp-slot-check {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}
.cp-slot-time { font-variant-numeric: tabular-nums; }
.cp-slot-meta {
  font-size: 10.5px;
  font-weight: 400;
  opacity: 0.75;
  margin-left: 4px;
}

/* Schedule times input chips no modal admin */
.cp-times-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 42px;
}
.cp-time-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.cp-time-chip-x {
  background: rgba(255,255,255,0.25);
  border: 0;
  color: #fff;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-weight: 700;
}
.cp-times-add {
  display: inline-flex;
  gap: 4px;
}
.cp-times-add input[type="time"] {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-variant-numeric: tabular-nums;
}

/* ============================= NOTIFICATIONS ============================ */
.audience-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
@media (min-width: 600px) {
  .audience-options { grid-template-columns: 1fr 1fr; }
}
.audience-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all .12s;
  background: var(--surface);
}
.audience-option > div { flex: 1; }
.audience-option strong {
  display: block;
  font-size: 13.5px;
  margin-bottom: 2px;
  color: var(--text);
}
.audience-option .text-xs { display: block; }
.audience-option:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.audience-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.audience-option:has(input:checked) strong {
  color: var(--primary);
}

.notif-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notif-log {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 10px 14px;
}

/* ============================= WHATSAPP ICON ============================ */
.wa-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #25D366;
  color: #fff !important;
  margin-left: 4px;
  vertical-align: middle;
  text-decoration: none !important;
  transition: transform .12s, background .12s;
}
.wa-icon:hover {
  background: #128C7E;
  transform: scale(1.1);
}

/* ============================= MINI CHARTS ============================ */
.mini-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 600px) { .mini-charts-grid { grid-template-columns: 1fr; } }
.mini-chart {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
}
.mini-chart-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

/* ============================= INLINE CHARTS (vitals.php) ============================ */
.charts-grid-inline {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px) {
  .charts-grid-inline { grid-template-columns: 1fr 1fr; }
}
.charts-grid-inline .chart-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.charts-grid-inline .chart-card h4 {
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.charts-grid-inline .chart-empty {
  height: 100px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 12px; font-style: italic;
}
.charts-grid-inline .chart-legend {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-size: 11px; margin-top: 6px;
  color: var(--text-muted);
}
.charts-grid-inline .leg-item { display: inline-flex; align-items: center; gap: 4px; }
.charts-grid-inline .leg-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ============================= VITAL CHARTS FIX ============================= */
/* Impede que a regra global de SVGs trate os gráficos como ícones */
.chart-card svg.vital-svg,
.charts-grid svg.vital-svg,
.charts-grid-inline svg.vital-svg {
  width: 100% !important;
  max-width: none !important;
  max-height: none !important;
  height: 300px !important;
  min-height: 300px !important;
  display: block !important;
  overflow: visible !important;
  flex-shrink: 1 !important;
}

/* Relatório impresso/visualizado: um pouco maior */
.report .chart-card svg.vital-svg {
  height: 320px !important;
  min-height: 320px !important;
}

@media (max-width: 640px) {
  .chart-card svg.vital-svg,
  .charts-grid svg.vital-svg,
  .charts-grid-inline svg.vital-svg {
    height: 240px !important;
    min-height: 240px !important;
  }
}

@media print {
  .report .chart-card svg.vital-svg {
    height: 280px !important;
    min-height: 280px !important;
  }
}

/* ============================= VISIBILITY TABLE ============================ */
.vis-table {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.vis-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  align-items: center;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  gap: 8px;
}
.vis-row:first-child { border-top: 0; }
.vis-row.vis-head {
  background: #f9fafb;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}
.vis-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}
.vis-btn.vis-allowed {
  color: #065f46;
  background: #d1fae5;
  border-color: #6ee7b7;
}
.vis-btn.vis-allowed:hover { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.vis-btn.vis-blocked {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fca5a5;
}
.vis-btn.vis-blocked:hover { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.text-center { text-align: center; }

/* ============================= SUPER ADMIN POLISH ============================ */
/* Escopado em body.is-superadmin para não vazar para o header regular */
body.is-superadmin .topbar {
  background: #111827;
  color: #fff;
  padding: 14px 0;
  margin-bottom: 24px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
body.is-superadmin .topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
body.is-superadmin .topbar h2 { color: #fff; font-size: 18px; }
body.is-superadmin .topbar .btn-ghost {
  color: #d1d5db;
  border: 1px solid rgba(255,255,255,0.15);
}
body.is-superadmin .topbar .btn-ghost:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.3);
}
body.is-superadmin .container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* ============================= VITAL CHART SVG SIZING ============================ */
.charts-grid-inline,
.charts-grid {
  align-items: start; /* não estica cards para igualar altura */
}
.charts-grid-inline .chart-card,
.charts-grid .chart-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* Se um card tiver mais legenda, ele terá mais altura — sem espaço vazio */
}
.vital-svg {
  width: 100% !important;
  height: auto !important;
  display: block;
  aspect-ratio: 5 / 3;
}
@supports not (aspect-ratio: 1) {
  .vital-svg {
    aspect-ratio: auto;
    height: 240px !important;
  }
}
.charts-grid-inline .chart-card .chart-empty,
.charts-grid .chart-card .chart-empty {
  height: 200px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted, #6b7280); font-style: italic;
}
.leg-ref {
  background: #d1fae5;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  color: #065f46;
  font-weight: 600;
}

/* ============================= CARE PLAN SLOT NOTES ============================ */
.cp-slot-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.cp-slot-note {
  background: transparent;
  border: 1px dashed var(--border, #d1d5db);
  color: var(--text-muted, #6b7280);
  width: 28px; height: 28px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  padding: 0;
  flex-shrink: 0;
  transition: all .12s;
  opacity: 0.55;
}
.cp-slot-note:hover {
  border-style: solid;
  border-color: var(--primary, #3b82f6);
  color: var(--primary, #3b82f6);
  background: var(--primary-soft, #eff6ff);
  opacity: 1;
}
.cp-slot-note.has-note {
  opacity: 1;
  border-style: solid;
  border-color: #facc15;
  background: #fefce8;
}
.cp-slot-notes-preview {
  font-size: 11.5px;
  color: var(--text-muted, #6b7280);
  font-style: italic;
  width: 100%;
  margin-top: 2px;
  padding: 4px 8px;
  background: #fefce8;
  border-radius: 6px;
  border-left: 2px solid #facc15;
}

/* ============================= NOTIFICATION INBOX ============================ */
.notif-inbox {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notif-inbox-item {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 14px 16px;
  position: relative;
  transition: background .15s, border-color .15s;
}
.notif-inbox-item.is-unread {
  background: #eff6ff;
  border-color: #bfdbfe;
  box-shadow: 0 1px 0 rgba(59,130,246,0.05);
}
.notif-inbox-item.is-unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  background: var(--primary, #3b82f6);
  border-radius: 2px;
}
.notif-inbox-head { display: flex; gap: 8px; align-items: flex-start; }
.notif-inbox-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text, #111827);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 8px;
}
.notif-unread-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary, #3b82f6);
  flex-shrink: 0;
}
.notif-inbox-meta {
  font-size: 11.5px;
  color: var(--text-muted, #6b7280);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.notif-inbox-body {
  margin: 8px 0;
  font-size: 14px;
  color: var(--text, #111827);
  line-height: 1.45;
}
.notif-inbox-actions {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ============================= NOTIFICATION RECIPIENTS DRILL-DOWN ============================ */
.notif-recipients-toggle:hover {
  background: #dbeafe !important;
}
.recipients-grid {
  /* defined inline; just placeholder for cascade */
}

/* ============================= NOTIFICATION RECIPIENTS DRILLDOWN ============================ */
.notif-recipients-list { margin-top: 10px; }
.recipients-drilldown {
  background: #f9fafb;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid var(--border, #e5e7eb);
}
.recipients-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}
.recipients-filter-tabs {
  display: flex;
  gap: 4px;
}
.recipients-filter-tabs .period-tab {
  font-size: 12px;
  padding: 4px 10px;
}
.recipients-stats {
  background: #fff;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border, #e5e7eb);
  margin-bottom: 8px;
}
.recipients-stats-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.recipients-stats-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width .3s;
}
.recipients-stats-text { font-size: 12px; color: var(--text, #111827); }
.recipients-list {
  background: #fff;
  border-radius: 6px;
  border: 1px solid var(--border, #e5e7eb);
  max-height: 360px;
  overflow-y: auto;
}
.recipient-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px solid var(--border, #e5e7eb);
  font-size: 13px;
}
.recipient-row:first-child { border-top: 0; }
.recipient-row.is-unread { background: #fffbeb; }
.recipient-row.is-read { background: #fff; }
.recipient-info { display: flex; gap: 8px; align-items: baseline; min-width: 0; flex: 1; }
.recipient-info strong { font-weight: 600; }
.recipient-status {
  font-size: 12px;
  white-space: nowrap;
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.recipients-pagination {
  margin-top: 10px;
  text-align: center;
}

/* ============================= USER STATUS ICONS (caregivers/clients) ============================ */
.user-status-icon {
  display: inline-block;
  font-size: 11px;
  vertical-align: middle;
  margin-left: 4px;
  cursor: help;
  font-weight: normal;
}
.user-status-icon.push-on {
  color: #10b981;
  font-size: 13px;
  filter: saturate(1.4);
}
.user-status-icon.last-login {
  color: var(--text-muted, #6b7280);
  font-weight: 400;
  font-size: 11px;
}
.caregiver-card .name .user-status-icon {
  margin-left: 6px;
}

/* ============================= QUEUE PROGRESS ============================ */
.queue-progress {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 6px 0 10px;
  transition: opacity .5s;
}
.queue-progress-bar {
  height: 6px;
  background: #dbeafe;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.queue-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  transition: width .8s ease;
  border-radius: 3px;
}
.queue-progress-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #1e3a8a;
}
.queue-spinner {
  width: 12px; height: 12px;
  border: 2px solid #93c5fd;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: queueSpin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
.queue-spinner-done {
  animation: none;
  border-top-color: var(--success, #10b981);
  border-color: var(--success, #10b981);
}
@keyframes queueSpin { to { transform: rotate(360deg); } }

/* ===== Banner para habilitar notificações (push nudge) ===== */
#push-nudge {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, 140%);
  width: calc(100% - 32px);
  max-width: 460px;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 14px);
  box-shadow: var(--shadow-lg, 0 12px 40px rgba(0,0,0,0.18));
  transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .35s;
  opacity: 0;
}
#push-nudge.show { transform: translate(-50%, 0); opacity: 1; }
#push-nudge .push-nudge-inner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
}
#push-nudge .push-nudge-ico { font-size: 22px; line-height: 1; }
#push-nudge .push-nudge-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
#push-nudge .push-nudge-text strong { font-size: 14px; }
#push-nudge .push-nudge-text span { font-size: 12px; color: var(--text-muted); }
#push-nudge .push-nudge-actions { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 768px) {
  #push-nudge { bottom: calc(var(--bottom-nav-h) + 12px + env(safe-area-inset-bottom)); }
  #push-nudge .push-nudge-inner { flex-wrap: wrap; }
  #push-nudge .push-nudge-actions { width: 100%; justify-content: flex-end; }
}

/* ===== Desfechos do check no Plano de Cuidados ===== */
/* Slots por status (sobrescrevem .cp-slot.is-done legado) */
.cp-slot.cp-status-feito      { background:#d1fae5; border-color:#10b981; color:#065f46; }
.cp-slot.cp-status-feito .cp-slot-check, .cp-slot.cp-status-feito .cp-slot-meta { color:#047857; }
.cp-slot.cp-status-recusado   { background:#fee2e2; border-color:#ef4444; color:#991b1b; }
.cp-slot.cp-status-recusado .cp-slot-check, .cp-slot.cp-status-recusado .cp-slot-meta { color:#b91c1c; }
.cp-slot.cp-status-adiado     { background:#fef3c7; border-color:#f59e0b; color:#92400e; }
.cp-slot.cp-status-adiado .cp-slot-check, .cp-slot.cp-status-adiado .cp-slot-meta { color:#b45309; }
.cp-slot.cp-status-impossivel { background:#e2e8f0; border-color:#94a3b8; color:#475569; }
.cp-slot.cp-status-impossivel .cp-slot-check, .cp-slot.cp-status-impossivel .cp-slot-meta { color:#64748b; }
.cp-slot.cp-status-feito:hover      { background:#a7f3d0; }
.cp-slot.cp-status-recusado:hover   { background:#fecaca; }
.cp-slot.cp-status-adiado:hover     { background:#fde68a; }
.cp-slot.cp-status-impossivel:hover { background:#cbd5e1; }

/* Botões de escolha do desfecho no modal */
.cp-status-options { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.cp-status-opt {
  display:flex; align-items:center; gap:8px;
  padding:12px 14px; border:1.5px solid var(--border); background:var(--surface);
  border-radius:10px; font-size:14px; font-weight:600; color:var(--text);
  cursor:pointer; transition:all .12s; text-align:left;
}
.cp-status-opt .cp-status-opt-sym { font-size:18px; line-height:1; }
.cp-status-opt:hover { transform:translateY(-1px); }
.cp-status-opt.cp-status-feito.is-selected      { background:#d1fae5; border-color:#10b981; color:#065f46; }
.cp-status-opt.cp-status-recusado.is-selected   { background:#fee2e2; border-color:#ef4444; color:#991b1b; }
.cp-status-opt.cp-status-adiado.is-selected     { background:#fef3c7; border-color:#f59e0b; color:#92400e; }
.cp-status-opt.cp-status-impossivel.is-selected { background:#e2e8f0; border-color:#64748b; color:#334155; }
@media (max-width: 480px) { .cp-status-options { grid-template-columns:1fr; } }

/* ===== Plano de Cuidados: slots redesenhados (cards uniformes e alinhados) ===== */
.cp-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;          /* iguala a altura dos cards na mesma linha */
  margin-top: 10px;
}
.cp-slot {
  flex: 0 0 152px;
  width: 152px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  padding: 12px 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  text-align: center;
  color: var(--text);
  cursor: default;
  transition: transform .12s, box-shadow .12s, border-color .12s, background .12s;
  position: relative;
}
.cp-slot.is-actionable { cursor: pointer; }
.cp-slot.is-actionable:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
/* Ícone (badge circular) */
.cp-slot .cp-slot-icon {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 15px; font-weight: 700; line-height: 1;
  color: #fff;
  margin-bottom: 2px;
}
.cp-slot .cp-slot-time { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.cp-slot .cp-slot-status { font-size: 11px; font-weight: 700; letter-spacing: .01em; }
.cp-slot .cp-slot-meta { font-size: 10px; color: var(--text-muted); font-weight: 500; }
.cp-slot .cp-slot-note {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  width: 100%; margin-top: 5px; padding-top: 5px;
  border-top: 1px dashed rgba(0,0,0,0.10);
  font-size: 11px; font-style: italic; color: var(--text-muted); line-height: 1.3;
}

/* Variantes por status: fundo claro + borda + ícone colorido + rótulo colorido */
.cp-slot.cp-status-pending            { background: var(--surface); border-style: dashed; }
.cp-slot.cp-status-pending .cp-slot-icon { background: transparent; color: var(--text-soft); border: 1.5px solid var(--border); }
.cp-slot.cp-status-pending .cp-slot-status-empty { color: var(--text-soft); font-weight: 600; }
.cp-slot.cp-status-pending.is-actionable:hover { border-color: var(--primary); }

.cp-slot.cp-status-feito            { background: #ecfdf5; border-color: #a7f3d0; }
.cp-slot.cp-status-feito .cp-slot-icon   { background: #10b981; }
.cp-slot.cp-status-feito .cp-slot-status { color: #047857; }

.cp-slot.cp-status-recusado         { background: #fef2f2; border-color: #fecaca; }
.cp-slot.cp-status-recusado .cp-slot-icon   { background: #ef4444; }
.cp-slot.cp-status-recusado .cp-slot-status { color: #b91c1c; }

.cp-slot.cp-status-adiado           { background: #fffbeb; border-color: #fde68a; }
.cp-slot.cp-status-adiado .cp-slot-icon   { background: #f59e0b; }
.cp-slot.cp-status-adiado .cp-slot-status { color: #b45309; }

.cp-slot.cp-status-impossivel       { background: #f8fafc; border-color: #cbd5e1; }
.cp-slot.cp-status-impossivel .cp-slot-icon   { background: #94a3b8; }
.cp-slot.cp-status-impossivel .cp-slot-status { color: #64748b; }

@media (max-width: 520px) {
  .cp-slots { gap: 8px; }
  .cp-slot { flex: 1 1 calc(50% - 8px); width: auto; }
}

/* ===== Selo de status no detalhe somente-leitura (familiares) ===== */
.cp-view-badge {
  display: inline-flex; align-items: center;
  padding: 6px 14px; border-radius: 999px;
  font-weight: 700; font-size: 13px; border: 1.5px solid transparent;
}
.cp-view-badge.cp-status-feito      { background:#ecfdf5; border-color:#a7f3d0; color:#047857; }
.cp-view-badge.cp-status-recusado   { background:#fef2f2; border-color:#fecaca; color:#b91c1c; }
.cp-view-badge.cp-status-adiado     { background:#fffbeb; border-color:#fde68a; color:#b45309; }
.cp-view-badge.cp-status-impossivel { background:#f8fafc; border-color:#cbd5e1; color:#64748b; }

/* ===== Indicador de alocação na lista de profissionais ===== */
.cg-alloc { margin: 8px 0 2px; }
.cg-alloc-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; border: 1px solid transparent;
}
.cg-alloc-chip .cg-alloc-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.cg-alloc-chip.is-on  { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.cg-alloc-chip.is-on  .cg-alloc-dot { background: #10b981; }
.cg-alloc-chip.is-off { background: #f8fafc; border-color: #e5e7eb; color: #6b7280; }
.cg-alloc-chip.is-off .cg-alloc-dot { background: #cbd5e1; }

/* ===== Badge de registros + última atividade no card ===== */
.cg-alloc { margin: 8px 0 2px; display: flex; flex-wrap: wrap; gap: 6px; }
.cg-rec-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary); border: 1px solid transparent;
}
.cg-rec-chip svg { opacity: .85; }
.cg-rec-chip.is-zero { background: #f8fafc; color: #9ca3af; border-color: #e5e7eb; }
.cg-lastact { font-size: 11px; color: var(--text-muted); margin: 2px 0 2px; }

/* ===== Strip de KPIs no topo de Profissionais ===== */
.cg-kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-bottom: 16px;
}
.cg-kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; text-align: center;
}
.cg-kpi-val { font-size: 22px; font-weight: 800; line-height: 1.1; color: var(--text); }
.cg-kpi-val.cg-kpi-warn { color: #b45309; }
.cg-kpi-val.cg-kpi-ok   { color: #047857; }
.cg-kpi-label { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-top: 3px; text-transform: uppercase; letter-spacing: .03em; }
@media (max-width: 640px) { .cg-kpis { grid-template-columns: repeat(2, 1fr); } }

/* ===== Revezamento de plantão (escala) ===== */
.rot-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fffbeb; border-color: #fde68a;
}
.rot-banner.is-rotation { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.rot-banner-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rot-banner-icon { font-size: 18px; flex: 0 0 auto; }
.rot-banner-info strong { font-size: 13px; }
.rot-banner-action { flex: 0 0 auto; }
.rot-banner-action form { margin: 0; }

.sblock-rotation { font-size: 11px; color: var(--primary); font-weight: 600; margin-top: 2px; }
.sblock-tag.t-rotation { background: var(--primary-soft); color: var(--primary); }
@media (max-width: 560px) {
  .rot-banner { flex-direction: column; align-items: flex-start; }
}

/* ===== Editor "quem trabalha cada dia" ===== */
.byday-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.byday-row .byday-day { flex: 0 0 92px; font-weight: 600; font-size: 13px; color: var(--text); }
.byday-row .select { flex: 1; }

/* ===== Seleção de múltiplos cuidadores no plantão (um ou outro) ===== */
.cg-check-list {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 12px;
  max-height: 188px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
.cg-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; padding: 3px 0; }
.cg-check input { width: 16px; height: 16px; }
@media (max-width: 560px) { .cg-check-list { grid-template-columns: 1fr; } }

/* ===== Badge de registros clicável + página de registros do cuidador ===== */
.cg-rec-link { text-decoration: none; cursor: pointer; transition: background .15s, color .15s, transform .05s; }
.cg-rec-link:hover { background: var(--primary); color: #fff; }
.cg-rec-link:hover svg { stroke: #fff; }
.cg-rec-link:active { transform: scale(0.97); }

.cr-list { display: flex; flex-direction: column; gap: 12px; }
.cr-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.cr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.cr-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.cr-date { font-weight: 600; color: var(--text); }
.cr-assisted {
  background: var(--primary-soft); color: var(--primary); font-weight: 600;
  padding: 2px 10px; border-radius: 999px; font-size: 12px;
}
.cr-edited { font-style: italic; }
.cr-del-form { margin: 0; flex-shrink: 0; }
.cr-del {
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.cr-del:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.cr-body { white-space: pre-wrap; word-break: break-word; line-height: 1.55; color: var(--text); font-size: 14px; }
.cr-photo { display: block; max-width: 320px; width: 100%; margin-top: 10px; border-radius: 10px; border: 1px solid var(--border); }
.cr-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.cr-page-info { font-size: 13px; color: var(--text-muted); }
@media (max-width: 560px) {
  .cr-photo { max-width: 100%; }
  .page-header .btn-secondary { white-space: nowrap; }
}

/* ===== Atalho de visibilidade em massa (assistidos) ===== */
.vis-shortcut-btn { display: inline-flex; align-items: center; gap: 5px; }
.vis-grid {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px 18px;
  align-items: center; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.vis-grid-head { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; text-align: center; }
.vis-grid-head:first-child { text-align: left; }
.vis-count { font-weight: 500; text-transform: none; letter-spacing: 0; }
.vis-grid-label { font-weight: 600; font-size: 14px; color: var(--text); }
.vis-switch { position: relative; display: inline-block; width: 46px; height: 26px; justify-self: center; cursor: pointer; }
.vis-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.vis-slider { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #cbd5e1; border-radius: 999px; transition: background .18s; }
.vis-slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .18s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.vis-switch input:checked + .vis-slider { background: var(--primary); }
.vis-switch input:checked + .vis-slider::before { transform: translateX(20px); }
.vis-switch input:disabled + .vis-slider { opacity: .4; cursor: not-allowed; }
.vis-switch input:disabled { cursor: not-allowed; }

/* ===== Dias da semana (plano de cuidados) ===== */
.cp-days { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-day { cursor: pointer; user-select: none; }
.cp-day input { position: absolute; opacity: 0; width: 0; height: 0; }
.cp-day span {
  display: inline-block; padding: 6px 13px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--text-muted); background: var(--surface); transition: all .12s;
}
.cp-day input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.cp-day input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-soft); }

/* ===== Blindagem de responsividade: nada pode estourar a largura da tela =====
   Evita que qualquer elemento largo force scroll horizontal e "zoom out" no mobile.
   overflow-x: clip não cria container de rolagem, então NÃO quebra position: sticky. */
html, body { max-width: 100%; overflow-x: clip; }
.app-shell, .main-wrap, .content { max-width: 100%; min-width: 0; }
.content { overflow-x: clip; }
img, video, svg, canvas, iframe, table { max-width: 100%; }
/* Tabelas de dados devem rolar dentro do próprio bloco, nunca esticar a página */
.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* =====================================================================
   MOBILE — layout de app e dimensões legíveis para celular.
   Aplicado tanto pelo viewport (≤900px) quanto pela classe .force-mobile
   (definida via JS para celulares que renderizam em modo desktop).
   ===================================================================== */

/* Núcleo do layout mobile: sidebar vira drawer, menu inferior aparece, conteúdo em coluna */
@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; left: -300px; top: var(--header-h);
    height: calc(100vh - var(--header-h));
    transition: left .25s; z-index: 50; width: 280px;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { left: 0; }
  .content { padding: 14px 12px; padding-bottom: calc(var(--bottom-nav-h) + 24px); }
  .bottom-nav { display: block; }
  .topbar .user-chip .user-name { display: none; }
  .fab { bottom: calc(var(--bottom-nav-h) + 14px + env(safe-area-inset-bottom)); }
}
html.force-mobile .menu-toggle { display: inline-flex; }
html.force-mobile .sidebar {
  position: fixed; left: -300px; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  transition: left .25s; z-index: 50; width: 280px;
  box-shadow: var(--shadow-lg);
}
html.force-mobile .sidebar.open { left: 0; }
html.force-mobile .content { padding: 14px 12px; padding-bottom: calc(var(--bottom-nav-h) + 24px); }
html.force-mobile .bottom-nav { display: block; }
html.force-mobile .topbar .user-chip .user-name { display: none; }
html.force-mobile .fab { bottom: calc(var(--bottom-nav-h) + 14px + env(safe-area-inset-bottom)); }
html.force-mobile .grid-2,
html.force-mobile .grid-3,
html.force-mobile .dashboard-grid { grid-template-columns: 1fr !important; }
html.force-mobile .content > * { max-width: 100%; }

/* Fontes/espaçamentos legíveis para tela de celular (alta densidade) */
@media (max-width: 640px), (hover: none) and (pointer: coarse) {
  html, body { font-size: 16px; line-height: 1.55; }
  .topbar { height: 56px; padding: 0 12px; }
  .topbar .brand-name { font-size: 16px; }
  .topbar .brand img { max-height: 32px; max-width: 100px; }
  .menu-toggle svg { width: 24px; height: 24px; }
  .topbar .user-chip { padding: 4px; }
  .topbar .user-chip img,
  .topbar .user-chip .avatar { width: 34px; height: 34px; }

  .card { padding: 16px; border-radius: 14px; }
  .page-header h1 { font-size: 20px; }
  .page-header p { font-size: 14px; }

  .composer { padding: 14px; }
  .composer textarea { font-size: 16px; min-height: 64px; }
  .composer-actions .btn { padding: 10px 16px; font-size: 15px; }

  .post { padding: 14px; margin-bottom: 12px; border-radius: 14px; }
  .post .avatar,
  .post .post-header img { width: 42px; height: 42px; font-size: 15px; }
  .post-header .names { font-size: 15px; }
  .post-author, .post .post-header strong { font-size: 16px; font-weight: 700; }
  .post-meta, .post .post-header .meta { font-size: 13px; }
  .post-body { font-size: 15.5px; line-height: 1.55; }
  .post-actions .post-action,
  .post-action span { font-size: 14px; }
  .post-action svg { width: 22px; height: 22px; }

  .input, .textarea, .select { font-size: 16px; padding: 12px 14px; min-height: 44px; }
  .btn { font-size: 15px; padding: 11px 18px; min-height: 44px; }
  .btn-sm { font-size: 14px; padding: 9px 14px; min-height: 38px; }
  label { font-size: 14px; }

  .sidebar a { padding: 14px 14px; font-size: 16px; }
  .sidebar a svg { width: 22px; height: 22px; }
  .sidebar-section { font-size: 12px; padding-top: 18px; }

  .modal { padding: 18px; border-radius: 16px; max-height: 92vh; }
  .modal header h2 { font-size: 17px; }
  .close-btn { width: 36px; height: 36px; font-size: 22px; }

  .filter-row, .grid-2.filters { grid-template-columns: 1fr; gap: 10px; }
  .flash { max-width: calc(100% - 24px); right: 12px; }
}

/* Idem via classe (cobre celular em modo desktop) */
html.force-mobile { font-size: 16px; line-height: 1.55; }
html.force-mobile .topbar { height: 56px; padding: 0 12px; }
html.force-mobile .topbar .brand-name { font-size: 16px; }
html.force-mobile .topbar .user-chip img,
html.force-mobile .topbar .user-chip .avatar { width: 34px; height: 34px; }
html.force-mobile .card { padding: 16px; border-radius: 14px; }
html.force-mobile .post { padding: 14px; margin-bottom: 12px; border-radius: 14px; }
html.force-mobile .post .avatar { width: 42px; height: 42px; }
html.force-mobile .post-author, html.force-mobile .post .post-header strong { font-size: 16px; font-weight: 700; }
html.force-mobile .post-meta { font-size: 13px; }
html.force-mobile .post-body { font-size: 15.5px; line-height: 1.55; }
html.force-mobile .input, html.force-mobile .textarea, html.force-mobile .select { font-size: 16px; padding: 12px 14px; min-height: 44px; }
html.force-mobile .btn { font-size: 15px; padding: 11px 18px; min-height: 44px; }
html.force-mobile .btn-sm { font-size: 14px; padding: 9px 14px; }
html.force-mobile .sidebar a { padding: 14px 14px; font-size: 16px; }

/* Menu inferior — labels não quebram e ficam centralizados ("Plano de Cuidados" cabe) */
.bottom-nav { padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav-inner { gap: 2px; }
.bottom-nav a {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 6px 4px; gap: 3px;
  color: var(--text-muted); text-decoration: none;
  font-size: 11px; font-weight: 500; line-height: 1.15;
  overflow: hidden;
}
.bottom-nav a svg { width: 22px; height: 22px; flex-shrink: 0; }
.bottom-nav a span {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
  max-width: 100%;
}
@media (max-width: 380px) {
  .bottom-nav a { font-size: 10.5px; }
  .bottom-nav a svg { width: 20px; height: 20px; }
}

/* Última barreira: nada deve estourar a largura no celular */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  html, body { overflow-x: hidden; }
  .content { min-width: 0; max-width: 100%; }
  img, video, svg, iframe, canvas { max-width: 100%; height: auto; }
  pre, code { white-space: pre-wrap; word-break: break-word; }
}

/* =====================================================================
   CORREÇÃO FINAL MOBILE REAL
   ---------------------------------------------------------------------
   Esta camada fica no final do arquivo para vencer regras anteriores.
   Ela garante que, quando o JS adicionar .force-mobile, o layout não fique
   com largura de desktop escalada dentro do smartphone.
   ===================================================================== */
html.force-mobile,
html.force-mobile body {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.force-mobile .app-shell,
html.force-mobile .main-wrap,
html.force-mobile .content {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

html.force-mobile .main-wrap {
  display: block;
}

html.force-mobile .content {
  flex: none;
  margin: 0;
  padding: 14px 10px calc(var(--bottom-nav-h) + 28px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

html.force-mobile .feed,
html.force-mobile .content-narrow,
html.force-mobile .schedule-wrap,
html.force-mobile .dashboard-wrap,
html.force-mobile .page-wrap {
  width: 100%;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

html.force-mobile .card,
html.force-mobile .composer,
html.force-mobile .post,
html.force-mobile .modal,
html.force-mobile .table-wrap {
  width: 100%;
  max-width: 100%;
}

html.force-mobile .topbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
}

html.force-mobile .sidebar {
  position: fixed !important;
  left: -300px;
  top: 56px;
  width: min(82vw, 300px);
  height: calc(100dvh - 56px);
  max-width: 300px;
}

html.force-mobile .sidebar.open {
  left: 0;
}

html.force-mobile .bottom-nav {
  display: block !important;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
}

html.force-mobile .fab {
  right: 16px;
  bottom: calc(var(--bottom-nav-h) + 14px + env(safe-area-inset-bottom));
}

html.force-mobile .grid,
html.force-mobile .grid-2,
html.force-mobile .grid-3,
html.force-mobile .dashboard-grid,
html.force-mobile .filters,
html.force-mobile .filter-row {
  grid-template-columns: 1fr !important;
}

html.force-mobile .search-bar,
html.force-mobile .between,
html.force-mobile .page-header,
html.force-mobile .composer-actions {
  max-width: 100%;
}

html.force-mobile input,
html.force-mobile select,
html.force-mobile textarea,
html.force-mobile button {
  max-width: 100%;
}

html.force-mobile .post-header,
html.force-mobile .ann-head,
html.force-mobile .cr-head {
  min-width: 0;
}

html.force-mobile .post-header .names,
html.force-mobile .topbar .brand,
html.force-mobile .topbar .brand-name,
html.force-mobile .ann-title,
html.force-mobile .cr-meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

html.force-mobile .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

html.force-mobile table.data {
  min-width: 600px;
}


/* =====================================================================
   CORREÇÃO V2: CHROME ANDROID EM "SITE PARA COMPUTADOR"
   ---------------------------------------------------------------------
   Quando o Chrome usa viewport largo (aprox. 980px), o CSS responsivo até
   pode estar em modo mobile, mas toda a página é desenhada pequena demais.
   O JS adiciona html.desktop-viewport e define:
   --mobile-real-vw: largura real do aparelho em CSS px
   --mobile-viewport-ratio: quanto o navegador está reduzindo a página

   Com zoom + largura real, simulamos o viewport normal do celular.
   ===================================================================== */
html.force-mobile.desktop-viewport {
  width: 100% !important;
  min-width: 0 !important;
  overflow-x: hidden !important;
  background: var(--bg);
}

html.force-mobile.desktop-viewport body {
  width: var(--mobile-real-vw, 390px) !important;
  min-width: 0 !important;
  max-width: var(--mobile-real-vw, 390px) !important;
  min-height: calc(100vh / var(--mobile-viewport-ratio, 1)) !important;
  overflow-x: hidden !important;
  zoom: var(--mobile-viewport-ratio, 1);
  background: var(--bg);
}

html.force-mobile.desktop-viewport .app-shell {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  min-height: calc(100vh / var(--mobile-viewport-ratio, 1)) !important;
}

html.force-mobile.desktop-viewport .topbar,
html.force-mobile.desktop-viewport .bottom-nav {
  width: var(--mobile-real-vw, 390px) !important;
  max-width: var(--mobile-real-vw, 390px) !important;
  left: 0 !important;
  right: auto !important;
}

html.force-mobile.desktop-viewport .main-wrap,
html.force-mobile.desktop-viewport .content,
html.force-mobile.desktop-viewport .feed,
html.force-mobile.desktop-viewport .content-narrow,
html.force-mobile.desktop-viewport .schedule-wrap,
html.force-mobile.desktop-viewport .dashboard-wrap,
html.force-mobile.desktop-viewport .page-wrap {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

html.force-mobile.desktop-viewport .content {
  padding-left: 10px !important;
  padding-right: 10px !important;
}

html.force-mobile.desktop-viewport .post,
html.force-mobile.desktop-viewport .composer,
html.force-mobile.desktop-viewport .card,
html.force-mobile.desktop-viewport .filter-card,
html.force-mobile.desktop-viewport .table-wrap {
  width: 100% !important;
  max-width: 100% !important;
}

html.force-mobile.desktop-viewport .sidebar {
  top: var(--header-h) !important;
  width: min(84vw, 300px) !important;
  max-width: 300px !important;
  height: calc((100vh / var(--mobile-viewport-ratio, 1)) - var(--header-h)) !important;
}

html.force-mobile.desktop-viewport .modal-backdrop,
html.force-mobile.desktop-viewport .lightbox {
  width: var(--mobile-real-vw, 390px) !important;
  max-width: var(--mobile-real-vw, 390px) !important;
}

/* iOS/Safari não usa zoom; o fallback por transform evita tela minúscula caso
   algum WebView ignore o viewport. Chrome Android usará a regra com zoom acima. */
@supports not (zoom: 1) {
  html.force-mobile.desktop-viewport body {
    zoom: 1;
    transform: scale(var(--mobile-viewport-ratio, 1));
    transform-origin: top left;
  }
}


/* =====================================================================
   CORREÇÃO V3: MENU MOBILE E ESPAÇAMENTO DA TIMELINE
   ---------------------------------------------------------------------
   1) Backdrop transparente/suave para permitir fechar o menu ao tocar fora.
   2) Espaçamento entre posts menor, sem somar gap + margin-bottom.
   ===================================================================== */
.sidebar-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .sidebar-backdrop {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 49;
    display: block;
    background: rgba(17, 24, 39, 0.16);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }
  .sidebar-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }
  body.sidebar-is-open {
    overflow-x: hidden;
  }
}

html.force-mobile .sidebar-backdrop {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 49;
  display: block;
  background: rgba(17, 24, 39, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
html.force-mobile .sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
html.force-mobile body.sidebar-is-open {
  overflow-x: hidden;
}
html.force-mobile.desktop-viewport .sidebar-backdrop {
  width: var(--mobile-real-vw, 390px) !important;
  max-width: var(--mobile-real-vw, 390px) !important;
  right: auto !important;
  height: calc((100vh / var(--mobile-viewport-ratio, 1)) - var(--header-h)) !important;
}

/* Mantém o respiro do card de publicação, mas aproxima os posts entre si. */
html.force-mobile .feed {
  gap: 14px !important;
}
html.force-mobile #feed-list {
  gap: 8px !important;
}
html.force-mobile #feed-list .post,
html.force-mobile .feed > .post {
  margin-bottom: 0 !important;
}
html.force-mobile .post {
  margin-bottom: 0 !important;
}
html.force-mobile .composer + #feed-list {
  margin-top: 2px !important;
}

/* =====================================================================
   CORREÇÃO V4: MODAL ROLÁVEL NO CELULAR
   ---------------------------------------------------------------------
   No celular, em vez de prender o scroll dentro do .modal (que pode estourar
   a tela visível por causa da barra do navegador ou do zoom do
   desktop-viewport), o backdrop inteiro passa a rolar. O .modal cresce
   conforme o conteúdo e o respiro no topo/base é dado por margin.
   ===================================================================== */

/* Caso normal (celular com viewport correto) */
@media (max-width: 640px), (hover: none) and (pointer: coarse) {
  .modal-backdrop {
    align-items: flex-start;          /* começa do topo em vez de centralizar */
    padding: 10px;
    overflow-y: auto;                  /* o backdrop rola */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .modal-backdrop.open {
    /* fluxo vertical normal para permitir scroll do backdrop */
    display: block;
  }
  .modal {
    max-height: none;                  /* não limita; deixa o backdrop rolar */
    margin: 12px auto;                 /* respiro topo/base */
    width: 100%;
    overflow-y: visible;               /* já não precisa do scroll interno */
  }
}

/* Idem via classe (cobre celular em modo desktop) */
html.force-mobile .modal-backdrop {
  align-items: flex-start;
  padding: 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
html.force-mobile .modal-backdrop.open { display: block; }
html.force-mobile .modal {
  max-height: none;
  margin: 12px auto;
  width: 100%;
  overflow-y: visible;
}

/* Caso Chrome Android em "Site para computador" — backdrop ajustado ao zoom */
html.force-mobile.desktop-viewport .modal-backdrop {
  height: calc(100vh / var(--mobile-viewport-ratio, 1)) !important;
  max-height: calc(100vh / var(--mobile-viewport-ratio, 1)) !important;
  top: 0 !important;
  align-items: flex-start !important;
  padding: 10px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}
html.force-mobile.desktop-viewport .modal {
  max-height: none !important;
  margin: 12px auto !important;
}
