/*
 * This is a manifest file that'll be compiled into application.css.
 */

:root {
  --sidebar-width: 270px;
  --topbar-height: 64px;
  --primary: #557a8a;
  --primary-hover: #355d6d;
  --secondary: #71863f;
  --accent: #ffca56;
  --text-color: #26313a;
  --muted-color: #707873;
  --surface: #ffffff;
  --border-color: #dadfd9;
  --danger: #c43d4b;
  --success: #557333;
  --sidebar-bg: #fcfdfb;
  --sidebar-border: #dadfd9;
  --topbar-bg: #26313a;
  --content-bg: #f6f3ec;
  --nav-active-border: var(--secondary);
  --nav-active-bg: #e8efdf;
  --nav-hover-bg: #f2f6f2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text-color);
  background: var(--content-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

/* ─── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  color: white;
  box-shadow: 0 2px 12px rgba(38,49,58,.12);
  z-index: 1000;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  color: white;
  font-size: 16px;
}
.topbar-toggle:hover { background: rgba(255,255,255,.1); }

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 16px;
  color: white;
  text-decoration: none;
}

.topbar-logo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.topbar-brand-name { white-space: nowrap; }

.topbar-right { display: flex; align-items: center; }

/* ─── User Dropdown ──────────────────────────────────────────── */
.user-dropdown { position: relative; }

.user-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.08);
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  color: white;
  font-size: 14px;
}
.user-dropdown-toggle:hover { background: rgba(255,255,255,.14); }

.user-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 160px;
  z-index: 1100;
  overflow: hidden;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: var(--text-color);
  text-decoration: none;
}
.dropdown-item:hover { background: var(--nav-hover-bg); }

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 4px 0 18px rgba(38,49,58,.05);
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.2s ease;
  z-index: 900;
}

html.sidebar-collapsed .sidebar {
  width: 0;
}

html.sidebar-collapsed .main-content {
  margin-left: 0;
}

/* ─── Sidebar Nav ────────────────────────────────────────────── */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-bottom: 4px;
  padding: 10px 14px;
  color: #526063;
  text-decoration: none;
  border-left: 3px solid transparent;
  white-space: nowrap;
  background: none;
  border-top: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 550;
}
.nav-item:hover { background: var(--nav-hover-bg); }
.nav-item.active {
  border-left-color: var(--nav-active-border);
  background: var(--nav-active-bg);
  font-weight: 600;
}
.nav-item.nav-subitem {
  padding-left: 40px;
  font-size: 13px;
}

.nav-icon { width: 20px; text-align: center; color: var(--primary); font-size: 18px; }
.nav-item.active .nav-icon { color: #445527; }

.nav-arrow {
  margin-left: auto;
  font-size: 11px;
  color: #999;
  transition: transform 0.2s;
}
.nav-arrow.rotated { transform: rotate(90deg); }

.nav-section { border-left: 3px solid transparent; }

.hidden { display: none !important; }

/* ─── Main Content ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  padding-top: var(--topbar-height);
  min-height: 100vh;
  background: var(--content-bg);
  transition: margin-left 0.2s ease;
}

/* ─── Color Strip ────────────────────────────────────────────── */
.color-strip {
  height: 3px;
  background: linear-gradient(to right, var(--primary) 0 48%, var(--secondary) 48% 76%, var(--accent) 76% 100%);
}

/* ─── Page Header ────────────────────────────────────────────── */
.page-header {
  background: transparent;
  padding: 24px 24px 8px;
  border-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.page-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-color);
}

.page-actions { display: flex; gap: 8px; align-items: center; }
.card-report-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border-color); }
.table-icon-cell { text-align: center; }
.report-total { padding: 10px 14px; border-top: 1px solid var(--border-color); text-align: right; }

/* ─── Cards / Panels ─────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(38,49,58,.07);
  margin: 16px 24px 24px;
  overflow: hidden;
}

.card-body { padding: 16px; }

.dashboard-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  max-width: 480px;
}

.tile-icon { flex-shrink: 0; }
.tile-content h2 { margin: 0 0 4px; font-size: 1.1rem; }
.tile-content p { margin: 0; color: var(--muted-color); }

/* ─── Alerts / Flash ─────────────────────────────────────────── */
.alert {
  padding: 10px 16px;
  margin: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ─── Breadcrumbs ───────────────────────────────────────────── */
.breadcrumbs { display: flex; align-items: center; gap: 8px; padding: 18px 24px 0; color: var(--muted-color); font-size: 13px; }
.breadcrumbs i { font-size: 9px; }
.breadcrumb-link { color: var(--primary); text-decoration: none; }
.breadcrumb-link:hover { text-decoration: underline; }
.breadcrumb-current[aria-current="page"] { color: var(--text-color); font-weight: 600; }

/* ─── Tables ─────────────────────────────────────────────────── */
.table-container { overflow: visible; }
.report-count { padding: 10px 16px; color: var(--muted-color); font-size: 13px; border-bottom: 1px solid var(--border-color); }
.report-filter { padding: 12px 24px; border-bottom: 1px solid var(--border-color); background: var(--surface); }

table.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 14px;
}

table.data-table thead th {
  background: #fafaf7;
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

table.data-table tbody tr:hover { background: #f6faf7; }
table.data-table tbody td { padding: 12px 14px; border-right: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
table.data-table thead th { border-right: 1px solid var(--border-color); }
table.data-table thead th:last-child, table.data-table tbody td:last-child { border-right: 0; }
table.data-table thead th.actions-column, table.data-table tbody td.actions-column { width: 112px; text-align: center; white-space: nowrap; }
table.data-table thead th.numeric-column, table.data-table tbody td.numeric-column { text-align: right; }
table.data-table tbody td.table-row-actions, table.data-table tbody td.table-icon-cell { text-align: center; white-space: nowrap; }
table.data-table tfoot th, table.data-table tfoot td { padding: 12px 14px; border-right: 1px solid var(--border-color); border-top: 1px solid var(--border-color); background: #fafaf7; font-weight: 600; }
table.data-table tfoot th:last-child, table.data-table tfoot td:last-child { border-right: 0; }
table.data-table tfoot th[scope="row"] { text-align: left; }
table.data-table tfoot th.numeric-column, table.data-table tfoot td.numeric-column { text-align: right; }
.educandos-report-table { width: max-content; min-width: 100%; }
.educandos-report-table th, .educandos-report-table td { white-space: nowrap; }
.educando-name-column, .educando-cpf-column { white-space: nowrap; }
.educando-name-column { width: 1%; min-width: 190px; }
.educando-cpf-column { width: 1%; min-width: 130px; }
.educando-turmas-column { min-width: 150px; white-space: normal !important; }
.educando-turma-item { display: block; white-space: nowrap; }
/* Relatório de quatro colunas dentro do modal estreito: cabe sem rolagem
   horizontal, e a faixa etária (uma lista de idades) quebra em linhas. */
table.educando-turmas-table { min-width: 0; }
table.educando-turmas-table thead th, table.educando-turmas-table tbody td { white-space: normal; }
.wide-report-card { overflow: visible; }
.wide-report-card > :first-child { border-radius: 12px 12px 0 0; }
.educandos-report-scroll { overflow-x: auto; overflow-y: visible; scrollbar-width: none; }
.educandos-report-scroll::-webkit-scrollbar { display: none; }
.report-horizontal-scroll { position: sticky; bottom: 0; z-index: 20; width: 100%; height: 17px; overflow-x: auto; overflow-y: hidden; border-top: 1px solid var(--border-color); border-radius: 0 0 12px 12px; background: var(--surface); }
.report-horizontal-scroll[hidden] { display: none; }
.report-horizontal-scroll-content { height: 1px; }

/* ─── Table Toolbar ──────────────────────────────────────────── */
.table-toolbar {
  background: #f4f2ea;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar-spacer { flex: 1; }
.report-search { position: relative; display: flex; width: min(360px, 100%); align-items: center; }
.report-search > i { position: absolute; left: 12px; color: var(--muted-color); pointer-events: none; }
.report-search input { width: 100%; min-height: 40px; padding: 8px 12px 8px 38px; border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-color); background: var(--surface); }
.report-search input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary), transparent 78%); }
.sortable-header { display: inline-flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; font-weight: inherit; text-align: left; cursor: pointer; }
.sort-indicator { min-width: 12px; color: var(--primary); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.search-input {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  width: 200px;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 15px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { filter: brightness(.96); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary), transparent 60%); outline-offset: 2px; }

.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.page-actions .btn-primary, .card-report-header .btn-primary { background: var(--accent); color: #33270f; border-color: var(--accent); }
.table-toolbar .btn-primary { background: var(--accent); color: #33270f; border-color: var(--accent); }
.btn-secondary { background: var(--surface); color: var(--text-color); border-color: var(--border-color); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-warning { background: var(--accent); color: #33270f; border-color: var(--accent); }
.btn-save { background: var(--success); color: white; border-color: var(--success); }
.btn-cta { background: var(--accent); color: #33270f; border-color: var(--accent); }
.btn-sm { min-height: 36px; padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-link { background: none; border: none; color: var(--primary); padding: 4px 6px; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

/* ─── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-weight: 600; margin-bottom: 5px; color: var(--text-color); }
.form-control {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-color);
  background: var(--surface);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary), transparent 78%);
}
select.form-control {
  height: 40px;
  padding-right: 40px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23526063' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
}
.flatpickr-input[readonly] { background: white; cursor: pointer; }
.flatpickr-calendar { z-index: 1300; }

.educando-form-card { margin-top: 16px; }
.educando-form-tabs { padding-left: 0; }
.educando-form-tabs .tab-link { cursor: default; }
.educando-tab-button { background: transparent; border: 0; font: inherit; cursor: pointer !important; }
.educando-form-panel[hidden] { display: none; }
.form-grid, .educando-form-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.form-grid > .form-group, .educando-form-grid > .form-group { flex: 1 1 240px; min-width: min(240px, 100%); margin-bottom: 0; }
.form-grid > .form-group-wide, .educando-form-grid > .grid-span-12 { flex-basis: 100%; }
.educando-form-grid > .health-field { flex: 1 1 calc(50% - 8px); }
.educando-form-grid > .registration-status-field,
.educando-form-grid > .inactivation-reason-field { flex: 1 1 100%; }
.grid-span-2 { grid-column: span 2; }
.grid-span-4 { grid-column: span 4; }
.grid-span-5 { grid-column: span 5; }
.grid-span-6 { grid-column: span 6; }
.grid-span-12 { grid-column: span 12; }
.educando-form-grid > [class*="grid-span-"] { grid-column: auto; }
.oficinas-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface);
}
.oficina-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
}
.oficina-checkbox:hover { background: var(--nav-hover-bg); border-color: var(--primary); }
.oficina-checkbox input { width: 16px; height: 16px; margin: 0; }
.form-control:disabled { background: #f1f1f1; color: #777; cursor: not-allowed; }
.suggestion-field { position: relative; }
.suggestions-list {
  position: fixed;
  z-index: 2200;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(38,49,58,.16);
}
.suggestions-list[hidden] { display: none; }
.suggestions-list button { display: block; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border-color); color: var(--text-color); background: transparent; text-align: left; cursor: pointer; }
.suggestions-list button:last-child { border-bottom: 0; }
.suggestions-list button:hover, .suggestions-list button.active { background: var(--nav-hover-bg); }
.form-section-title { margin: 0 0 14px; font-size: 1rem; }
.form-hint { color: var(--muted-color); font-size: 13px; margin: 8px 0; }
.nested-form-list { display: flex; flex-direction: column; gap: 10px; }
.nested-form-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(140px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}
.nested-form-row-three { grid-template-columns: minmax(0, 2fr) minmax(120px, .6fr) minmax(0, 2fr) auto; }
.nested-form-row .form-group { margin-bottom: 0; }
.nested-form-row[hidden] { display: none; }
.nested-row-remove { margin-bottom: 2px; }
.nested-add-button { margin-top: 12px; }
.familiares-drafts { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.familiar-draft { padding: 14px; border: 1px solid var(--border-color); border-radius: 8px; background: #fafaf7; }
.familiar-draft[hidden] { display: none; }
.familiar-draft-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.familiar-draft-header h3 { margin: 0; font-size: 1rem; }
.familiar-fields-grid { margin-top: 12px; padding-top: 12px; border-top: 1px solid #e0e0e0; }
.familiares-add-button { margin-top: 14px; }
.nested-entry-storage { display: none; }
.nested-entry-report { margin-top: 16px; border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; }
.nested-entry-report .table-toolbar { border-bottom: 1px solid var(--border-color); }
.nested-entry-report .table-container { margin: 0; border: 0; border-radius: 0; }
.nested-entry-report .report-total { border-top: 1px solid var(--border-color); }
.nested-report-table { min-width: 620px; }
.nested-entry-modal { width: min(960px, calc(100vw - 32px)); max-width: 960px; }
dialog.modal.nested-entry-modal { width: min(960px, calc(100vw - 32px)); max-width: 960px; overflow: hidden; }
dialog.modal.nested-entry-modal[open] { display: flex; flex-direction: column; }
.nested-entry-modal-body { max-height: min(70vh, 720px); overflow: auto; }
.nested-entry-modal-body .nested-entry-source {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
}
.nested-entry-modal-body .nested-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  align-items: start;
  gap: 16px;
}
.nested-entry-modal-body .educando-form-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 16px;
}
.nested-entry-modal-body .educando-form-grid > [class*="grid-span-"] { grid-column: auto; }
.nested-entry-modal-body .familiar-fields-grid { margin-top: 16px; }
.nested-entry-modal-body .familiar-draft-header { display: none; }
.nested-entry-modal-body .nested-row-remove { display: none; }
.nested-entry-modal-body .form-group { min-width: 0; }
.nested-entry-modal-body .form-control { width: 100%; min-width: 0; }
.nested-entry-modal-body textarea.form-control { min-height: 88px; resize: vertical; }
.educando-form-actions {
  padding: 0 16px 16px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.document-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  border: 1px dashed var(--primary);
  border-radius: 10px;
  background: #fafaf7;
  text-align: center;
  cursor: pointer;
}
.document-dropzone > i { color: var(--secondary); font-size: 30px; }
.document-dropzone > span { color: var(--muted-color); font-size: 13px; }
.document-dropzone { position: relative; }
.document-file-picker { padding: 7px 12px; border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-color) !important; background: var(--surface); font-size: 13px !important; font-weight: 600; }
.document-file-name { max-width: 100%; color: var(--text-color) !important; overflow-wrap: anywhere; text-align: center; }
.document-file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.configuracao-card { max-width: 920px; }
.configuracao-header-preview-container { margin: 18px 0; padding: 16px; border: 1px solid var(--border-color); border-radius: 10px; background: #fafaf7; }
.configuracao-header-preview { display: block; width: 100%; max-width: 816px; height: auto; margin: 0 auto; }
.configuracao-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.branding-preview { display: flex; align-items: center; gap: 14px; margin: 18px 0 24px; padding: 18px; border: 1px solid color-mix(in srgb, var(--preview-primary), white 55%); border-radius: 12px; color: var(--preview-text); background: var(--preview-background); }
.branding-preview-logo { width: 72px; height: 72px; flex: 0 0 auto; border: 3px solid white; border-radius: 50%; box-shadow: 0 4px 12px rgba(38, 49, 58, 0.16); object-fit: cover; }
.branding-preview strong, .branding-preview span { display: block; }
.branding-preview strong { margin-bottom: 4px; font-size: 18px; }
.branding-preview span { color: color-mix(in srgb, var(--preview-text), transparent 28%); font-size: 13px; }
.branding-preview-swatches { display: flex; gap: 6px; margin-left: auto; }
.branding-swatch { width: 24px; height: 24px; border: 2px solid white; border-radius: 50%; box-shadow: 0 1px 4px rgba(38, 49, 58, 0.18); }
.branding-swatch.primary { background: var(--preview-primary); }
.branding-swatch.secondary { background: var(--preview-secondary); }
.branding-swatch.accent { background: var(--preview-accent); }
.branding-color-grid { display: flex; flex-wrap: wrap; gap: 0 18px; }
.branding-color-grid > .branding-color-field { flex: 1 1 140px; min-width: min(140px, 100%); }
.branding-color-control { display: flex; align-items: center; gap: 10px; }
.branding-color-control code { color: #555; font-size: 13px; }
.form-color { width: 56px; height: 38px; padding: 3px; border: 1px solid #bbb; border-radius: 6px; background: white; cursor: pointer; }
@media (max-width: 640px) {
  .topbar-brand-name { display: none; }
  .branding-preview { align-items: flex-start; flex-wrap: wrap; }
  .branding-preview-swatches { width: 100%; margin-left: 86px; }
  .branding-color-grid { grid-template-columns: 1fr; }
}
.weekday-checkbox-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; border: 1px solid var(--border-color); border-radius: 8px; }
.weekday-checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.turma-time-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid > .turma-time-grid { display: contents; }
.form-grid > .turma-time-grid > .form-group { flex: 1 1 240px; min-width: min(240px, 100%); margin-bottom: 0; }
.modal-footer-spacer { flex: 1; }
.enrollment-card { overflow: hidden; padding: 0; }
.report-section-heading { margin: 0; font-size: 1rem; }
.enrollment-toolbar { align-items: flex-end; margin: 0; }
.enrollment-toolbar .form-group { min-width: min(280px, 100%); margin-bottom: 0; }
.pagination-bar { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--border-color); }
.pagination-links { display: flex; gap: 4px; }
.pagination-link { min-width: 32px; padding: 7px 8px; border-radius: 7px; color: var(--text-color); text-align: center; text-decoration: none; }
.pagination-link.active { background: var(--primary); color: white; font-weight: 700; }
.pagination-ellipsis { min-width: 24px; padding: 7px 2px; text-align: center; }

/* Também é um popover (top layer) para aparecer acima de modais nativos <dialog>;
   por isso as propriedades do estilo padrão de popover são neutralizadas aqui. */
.toast-container { position: fixed; inset: auto 20px 20px auto; z-index: 3000; display: flex; width: min(420px, calc(100vw - 40px)); max-width: none; height: auto; max-height: none; flex-direction: column; gap: 10px; margin: 0; border: 0; padding: 0; overflow: visible; background: transparent; pointer-events: none; }
.toast { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 13px 14px; border-radius: 5px; color: white; box-shadow: 0 5px 18px rgba(0,0,0,.24); animation: toast-enter .2s ease-out; }
.toast-success { background: #218838; }
.toast-danger { background: #c82333; }
.toast-close { border: 0; background: transparent; color: inherit; font-size: 20px; cursor: pointer; }
.toast-leaving { opacity: 0; transform: translateX(15px); transition: opacity .18s, transform .18s; }
@keyframes toast-enter { from { opacity: 0; transform: translateY(-8px); } }

@media (max-width: 900px) {
  :root { --sidebar-width: min(84vw, 270px); }
  .main-content, html.sidebar-collapsed .main-content { margin-left: 0; }
  .sidebar { box-shadow: 8px 0 24px rgba(38,49,58,.2); }
  html.sidebar-collapsed .sidebar { width: var(--sidebar-width); transform: translateX(-105%); }
  .page-header { align-items: stretch; padding: 18px 16px 8px; }
  .breadcrumbs { padding: 14px 16px 0; }
  .page-actions { width: 100%; flex-wrap: wrap; }
  .page-actions .btn { flex: 1 1 auto; justify-content: center; }
  .card { margin: 12px 12px 20px; }
  .tabs { padding: 0 12px; }
  .table-toolbar { align-items: stretch; }
  .table-container { overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; }
  .report-search { width: 100%; }
  .toolbar-spacer { display: none; }
  table.data-table thead th:last-child, table.data-table tbody td:last-child { position: sticky; right: 0; z-index: 1; background: var(--surface); box-shadow: -1px 0 var(--border-color); }
  table.data-table thead th:last-child { z-index: 2; background: #fafaf7; }
  .educando-form-tabs { overflow-x: auto; }
  .educando-tab-button { white-space: nowrap; }
  .nested-form-row, .nested-form-row-three { grid-template-columns: 1fr; align-items: stretch; }
  .turma-time-grid { grid-template-columns: 1fr; }
}

/* ─── Login ──────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--content-bg);
}

.login-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(38,49,58,.12);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}

.login-header { text-align: center; margin-bottom: 28px; }
.login-logo { margin-bottom: 12px; }
.login-title { margin: 0 0 4px; font-size: 1.6rem; font-weight: 700; color: var(--text-color); }
.login-subtitle { margin: 0; color: var(--muted-color); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 4px; }

/* ─── Modal ──────────────────────────────────────────────────── */
dialog.modal {
  position: fixed;
  inset: 0;
  margin: auto;
  border: none;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  padding: 0;
  max-width: 560px;
  width: calc(100% - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
}
dialog.modal::backdrop { background: rgba(0,0,0,0.45); }
dialog.period-modal { overflow: visible; }
dialog.document-upload-modal { max-width: 720px; }
dialog.comprovante-modal { max-width: 1050px; height: calc(100dvh - 48px); overflow: hidden; }
dialog.confirmation-modal { max-width: 480px; }
.confirmation-message { padding: 32px 28px; font-size: 16px; line-height: 1.45; }
.comprovante-modal iframe { display: block; width: 100%; height: calc(100% - 58px); border: 0; background: white; }

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { margin: 0; font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted-color);
  padding: 2px 6px;
}
.modal-body { padding: 20px; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── Right Drawer ───────────────────────────────────────────── */
.right-drawer {
  position: fixed;
  right: -480px;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  width: 480px;
  background: white;
  box-shadow: -4px 0 16px rgba(0,0,0,0.12);
  z-index: 950;
  transition: right 0.25s ease;
  overflow-y: auto;
}
.right-drawer.open { right: 0; }

/* ─── Tabs ───────────────────────────────────────────────────── */
.tabs { display: flex; min-height: 48px; overflow: hidden; flex-wrap: wrap; align-items: stretch; border-bottom: 1px solid var(--border-color); margin: 0; padding: 0 24px; background: var(--surface); }
.tabs::-webkit-scrollbar { display: none; }
.tab-link {
  padding: 10px 16px;
  text-decoration: none;
  color: var(--muted-color);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 13px;
  font-weight: 500;
}
.tab-link.active { color: var(--text-color); border-bottom-color: transparent; box-shadow: inset 0 -3px 0 var(--primary); font-weight: 700; }
.tab-link:hover { color: var(--primary); }

/* ─── Warning box ────────────────────────────────────────────── */
.atencao-box {
  background: color-mix(in srgb, var(--accent), white 65%);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.atencao-box strong { color: #856404; }

/* ─── Inline editable table ──────────────────────────────────── */
.table-row-actions { text-align: center; white-space: nowrap; }
.table-row-actions > a, .table-row-actions > form { display: inline-block; margin: 0 2px; vertical-align: middle; }
.action-group { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.action-group > form { display: inline-flex; margin: 0; }
.floating-tooltip { position: fixed; z-index: 4000; max-width: calc(100vw - 16px); padding: 6px 9px; border-radius: 6px; background: #26313a; color: #fff; font-size: 12px; font-weight: 600; line-height: 1.2; pointer-events: none; transform: translateX(-50%); white-space: nowrap; }
td input.inline-input {
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 3px 6px;
  font-size: 13px;
  width: 100%;
}

/* ─── Misc ───────────────────────────────────────────────────── */
.text-muted { color: #6c757d; }
.text-danger { color: #dc3545; }
.text-center { text-align: center; }
.mb-3 { margin-bottom: 12px; }
.empty-state { padding: 32px; text-align: center; color: #999; }

.daily-bible-message { display: flex; max-width: 760px; gap: 18px; margin: 24px; padding: 24px; border: 1px solid color-mix(in srgb, var(--accent), var(--border-color) 55%); border-radius: 14px; background: color-mix(in srgb, var(--accent), white 88%); box-shadow: 0 8px 28px rgba(38,49,58,.06); }
.daily-bible-message > i { color: var(--secondary); font-size: 26px; }
.daily-bible-message span { color: var(--muted-color); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.daily-bible-message blockquote { margin: 8px 0; color: var(--text-color); font-size: clamp(18px, 2.4vw, 24px); font-weight: 650; line-height: 1.45; }
.daily-bible-message cite { color: var(--primary); font-size: 14px; font-style: normal; font-weight: 700; }

.page-modal-backdrop { position: fixed; inset: 0; z-index: 1800; display: grid; padding: 20px; place-items: center; background: rgba(22,31,35,.58); }
body:has(.page-modal-backdrop), body:has(dialog[open]) { overflow: hidden; }
.page-modal { display: flex; width: min(760px, 100%); max-height: calc(100dvh - 40px); flex-direction: column; overflow: hidden; border: 0; border-radius: 14px; background: var(--surface); box-shadow: 0 18px 50px rgba(22,31,35,.28); }
.page-modal-full { width: min(1400px, 100%); height: calc(100dvh - 40px); }
.page-modal-educando { width: min(1240px, 100%); max-height: calc(100dvh - 96px); }
.page-modal-educando .page-modal-content { flex: 0 1 auto; }
.page-modal-content { display: flex; flex: 1; min-height: 0; flex-direction: column; justify-content: flex-start; overflow: auto; }
.page-modal-content > .page-header, .page-modal-content > .card { flex: 0 0 auto; }
.page-modal-content .educando-form-card { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.modal-form-card { max-width: none !important; margin: 0 !important; border: 0; border-radius: 0; box-shadow: none; }

@media (max-width: 640px) {
  .daily-bible-message { margin: 16px 12px; padding: 18px; }
  .page-modal-backdrop { padding: 0; }
  .page-modal, .page-modal-full, .page-modal-educando { width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
}
