/* Colo de Mae - Design system
   Palette signature: cada etapa (Bercario/Maternal/Pre I/Pre II) tem uma cor
   propria, igual escolinha de verdade organiza por cor (mochila, sacola,
   varal de fotos). Essa cor aparece em badge, anel de foto e destaque de turma
   em todo o sistema - e o fio condutor visual do produto.
   Robenilson Rodrigues da Silva - Metamorph (https://metamorph.com.br/) */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --color-bg: #FBF8F2;
    --color-surface: #FFFFFF;
    --color-surface-alt: #FBF8F2;
    --color-border: #E9E2D3;
    --color-border-strong: #D8CDB6;
    --color-text: #2A2416;
    --color-text-muted: #746B57;
    --color-text-faint: #A79C84;

    --color-primary: #2F8FE0;
    --color-primary-dark: #1F6FBF;
    --color-primary-soft: #E4F1FD;

    --color-success: #1F9E6D;
    --color-success-soft: #E4F7EE;
    --color-warning: #DB8A15;
    --color-warning-soft: #FDF0DA;
    --color-danger: #E15A4D;
    --color-danger-soft: #FCE9E6;
    --color-info: #2F8FE0;
    --color-info-soft: #E4F1FD;

    /* Cores por etapa - usadas em badges, anel de foto, cartoes de turma */
    --stage-bercario: #B27FE0;
    --stage-bercario-soft: #F1E7FB;
    --stage-maternal: #2F8FE0;
    --stage-maternal-soft: #E4F1FD;
    --stage-jardim: #35B37E;
    --stage-jardim-soft: #E1F5EC;
    --stage-pre1: #E0A62F;
    --stage-pre1-soft: #FBF0DC;
    --stage-pre2: #E0562F;
    --stage-pre2-soft: #FBE5DC;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(42, 36, 22, 0.06);
    --shadow-md: 0 10px 28px -8px rgba(42, 36, 22, 0.16);
    --shadow-color: 0 10px 28px -10px rgba(47, 143, 224, 0.35);
    --sidebar-width: 264px;
    --topbar-height: 68px;

    --font-display: 'Fredoka', 'Inter', sans-serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; color: var(--color-text); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 8px; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--color-text-muted); }
img { max-width: 100%; }

/* ---------------------------- Layout ---------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: radial-gradient(120% 140% at 0% 0%, #223454 0%, #17223A 46%, #131B2E 100%);
    color: #C4CCE0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 40;
    transition: transform 0.2s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand img { width: 34px; height: 34px; border-radius: 11px; object-fit: cover; box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
.sidebar-brand span { font-family: var(--font-display); font-weight: 600; color: #fff; font-size: 1.08rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 10px 20px; }
.sidebar-group { margin-top: 20px; }
.sidebar-group:first-child { margin-top: 6px; }
.sidebar-group-title {
    font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em;
    color: #6E7AA0; padding: 0 10px 7px; font-weight: 700;
}
.sidebar-group-toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    background: none; border: none; cursor: pointer; font-family: inherit;
}
.sidebar-group-toggle .chevron { font-size: 0.7rem; transition: transform 0.18s ease; }
.sidebar-group-collapsible .sidebar-group-items {
    max-height: 0; overflow: hidden; transition: max-height 0.22s ease;
}
.sidebar-group-collapsible.is-open .sidebar-group-items { max-height: 400px; }
.sidebar-group-collapsible.is-open .sidebar-group-toggle .chevron { transform: rotate(-180deg); }
.sidebar-group-items > .sidebar-link { margin: 2px 0 2px 14px; padding-left: 10px; border-left: 2px solid rgba(196,204,224,0.15); border-radius: 0 12px 12px 0; }
.sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 12px;
    color: #C4CCE0; font-size: 0.9rem; font-weight: 500;
    transition: background 0.12s ease, color 0.12s ease;
}
.sidebar-link:hover { background: rgba(255,255,255,0.07); text-decoration: none; color: #fff; }
.sidebar-link.active { background: linear-gradient(135deg, var(--color-primary), #6BB6F2); color: #fff; box-shadow: 0 6px 16px -4px rgba(47,143,224,0.55); }
.sidebar-link .icon { width: 18px; text-align: center; opacity: 0.95; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 0.78rem; color: #7C88AA; }
.sidebar-footer a { color: #C4CCE0; }

.main-area { margin-left: var(--sidebar-width); flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: var(--topbar-height); background: var(--color-surface); border-bottom: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between; padding: 0 24px; gap: 16px;
    position: sticky; top: 0; z-index: 30;
}
.topbar-search { flex: 1; max-width: 420px; position: relative; }
.topbar-search input {
    width: 100%; padding: 9px 12px 9px 34px; border-radius: var(--radius-md);
    border: 1px solid var(--color-border); background: var(--color-surface-alt); font-size: 0.88rem;
}
.topbar-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--color-text-faint); }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.menu-toggle { display: none; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--color-text); }

.avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--color-primary-soft); color: var(--color-primary-dark);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem;
}
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-menu .meta { line-height: 1.25; }
.user-menu .meta strong { display: block; font-size: 0.85rem; }
.user-menu .meta small { font-size: 0.74rem; }

.content { position: relative; padding: 26px 28px 60px; flex: 1; }
.content-decor { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.content-inner { position: relative; z-index: 2; }
.content-cloud { position: absolute; opacity: 0.1; animation: content-drift 30s ease-in-out infinite; }
.content-cloud.cc1 { top: 8px; right: 6%; width: 90px; }
.content-cloud.cc2 { top: 220px; left: 2%; width: 60px; opacity: 0.08; animation-duration: 24s; animation-delay: -8s; }
@keyframes content-drift { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(18px); } }
.content-star { position: absolute; opacity: 0.16; animation: content-twinkle 3.2s ease-in-out infinite; }
.content-star.cs1 { top: 60px; right: 3%; width: 16px; height: 16px; }
.content-star.cs2 { top: 400px; right: 10%; width: 12px; height: 12px; animation-delay: .8s; opacity: 0.12; }
.content-star.cs3 { top: 140px; left: 8%; width: 14px; height: 14px; animation-delay: 1.6s; opacity: 0.1; }
@keyframes content-twinkle { 0%, 100% { opacity: 0.06; transform: scale(0.85); } 50% { opacity: 0.22; transform: scale(1.1); } }
@media (max-width: 900px) { .content-decor { display: none; } }
@media (prefers-reduced-motion: reduce) { .content-cloud, .content-star { animation-duration: 60s !important; } }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header .subtitle { color: var(--color-text-muted); font-size: 0.92rem; margin-top: 2px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.footer-credit { text-align: center; padding: 22px; color: var(--color-text-faint); font-size: 0.82rem; }
.footer-credit a { color: var(--color-text-muted); font-weight: 600; }

/* ---------------------------- Buttons ---------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border-radius: 999px; font-size: 0.87rem; font-weight: 600;
    border: 1px solid transparent; cursor: pointer; transition: all 0.14s ease; line-height: 1.2;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--color-primary), #5CAAEE); color: #fff; box-shadow: 0 6px 16px -6px rgba(47,143,224,0.6); }
.btn-primary:hover { background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary)); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border-strong); }
.btn-secondary:hover { background: var(--color-surface-alt); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #C44637; }
.btn-ghost { background: transparent; color: var(--color-text-muted); box-shadow: none; }
.btn-ghost:hover { background: var(--color-surface-alt); color: var(--color-text); transform: none; }
.btn-sm { padding: 7px 13px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.75; cursor: not-allowed; transform: none; }
.btn-spinner { display: inline-block; width: 13px; height: 13px; flex-shrink: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,0.45); border-top-color: #fff; animation: btn-spin 0.6s linear infinite; }
.btn-secondary .btn-spinner, .btn-ghost .btn-spinner { border-color: rgba(20,24,38,0.18); border-top-color: var(--color-text); }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------------------------- Cards / Surfaces ---------------------------- */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-tile { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 17px 19px; box-shadow: var(--shadow-sm); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-tile .label { font-size: 0.76rem; color: var(--color-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-tile .value { font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; margin-top: 4px; }
.stat-tile .hint { font-size: 0.78rem; color: var(--color-text-faint); margin-top: 2px; }
.stat-tile.accent-success .value { color: var(--color-success); }
.stat-tile.accent-warning .value { color: var(--color-warning); }
.stat-tile.accent-danger .value { color: var(--color-danger); }
.stat-tile.accent-primary .value { color: var(--color-primary); }

/* ---------------------------- Forms ---------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.83rem; font-weight: 600; margin-bottom: 6px; color: var(--color-text); }
.field .hint { font-size: 0.76rem; color: var(--color-text-faint); margin-top: 4px; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=date],
.field input[type=time], .field input[type=number], .field input[type=tel], .field select, .field textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm);
    font-size: 0.88rem; font-family: inherit; background: var(--color-surface); color: var(--color-text);
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.field-error { border-color: var(--color-danger) !important; }
.field .error-text { color: var(--color-danger); font-size: 0.78rem; margin-top: 4px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 8px; font-size: 0.87rem; }
.checkbox-row input { margin-top: 3px; }
.form-section-title { font-size: 0.95rem; font-weight: 700; margin: 22px 0 12px; padding-top: 16px; border-top: 1px solid var(--color-border); }
.form-section-title:first-child { border-top: none; padding-top: 0; margin-top: 0; }
fieldset { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 14px; margin-bottom: 14px; }
legend { font-size: 0.85rem; font-weight: 700; padding: 0 6px; }

/* ---------------------------- Alerts ---------------------------- */
.alert { padding: 12px 14px; border-radius: var(--radius-md); font-size: 0.87rem; margin-bottom: 16px; border: 1px solid transparent; }
.alert-danger { background: var(--color-danger-soft); color: var(--color-danger); border-color: #F3C7C3; }
.alert-success { background: var(--color-success-soft); color: var(--color-success); border-color: #BFE6D2; }
.alert-warning { background: var(--color-warning-soft); color: var(--color-warning); border-color: #F3DDB0; }
.alert-info { background: var(--color-info-soft); color: var(--color-info); border-color: #C1E4EF; }

/* ---------------------------- Central de ajuda ---------------------------- */
.help-video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.help-video-card { padding: 14px; }
.help-video-frame { position: relative; width: 100%; padding-top: 56.25%; border-radius: var(--radius-md); overflow: hidden; background: #14102A; }
.help-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.help-video-frame-link {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    color: #fff; font-weight: 600; text-decoration: none;
}
.help-video-frame-link:hover { text-decoration: none; opacity: 0.9; }

/* ---------------------------- Badges ---------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-info { background: var(--color-info-soft); color: var(--color-info); }
.badge-neutral { background: #EEF0F3; color: var(--color-text-muted); }
.badge-stage-bercario { background: var(--stage-bercario-soft); color: var(--stage-bercario); }
.badge-stage-maternal { background: var(--stage-maternal-soft); color: var(--stage-maternal); }
.badge-stage-jardim { background: var(--stage-jardim-soft); color: var(--stage-jardim); }
.badge-stage-pre1 { background: var(--stage-pre1-soft); color: var(--stage-pre1); }
.badge-stage-pre2 { background: var(--stage-pre2-soft); color: var(--stage-pre2); }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------------------------- Tables ---------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; min-width: 640px; }
table.data-table thead th {
    text-align: left; padding: 12px 16px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--color-text-muted); font-weight: 700; background: var(--color-surface-alt); border-bottom: 1px solid var(--color-border);
}
table.data-table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--color-surface-alt); }
.table-person { display: flex; align-items: center; gap: 10px; }
.table-photo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--color-primary-soft); flex-shrink: 0; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Anel colorido por etapa - fio condutor visual do sistema (mesma logica de creche real, que organiza por cor) */
.avatar-ring { border-radius: 50%; padding: 3px; flex-shrink: 0; background: var(--color-border); }
.avatar-ring img { display: block; border-radius: 50%; object-fit: cover; width: 100%; height: 100%; border: 2px solid var(--color-surface); }
.avatar-ring.ring-bercario { background: linear-gradient(135deg, var(--stage-bercario), var(--stage-bercario-soft)); }
.avatar-ring.ring-maternal { background: linear-gradient(135deg, var(--stage-maternal), var(--stage-maternal-soft)); }
.avatar-ring.ring-jardim { background: linear-gradient(135deg, var(--stage-jardim), var(--stage-jardim-soft)); }
.avatar-ring.ring-pre1 { background: linear-gradient(135deg, var(--stage-pre1), var(--stage-pre1-soft)); }
.avatar-ring.ring-pre2 { background: linear-gradient(135deg, var(--stage-pre2), var(--stage-pre2-soft)); }

/* ---------------------------- Empty / loading ---------------------------- */
.empty-state { text-align: center; padding: 56px 24px; color: var(--color-text-muted); }
.empty-state .icon { font-size: 2.2rem; margin-bottom: 10px; }
.empty-state h3 { color: var(--color-text); margin-bottom: 6px; }
.skeleton { background: linear-gradient(90deg, #EEF0F3 25%, #F6F7F9 37%, #EEF0F3 63%); background-size: 400% 100%; animation: skeleton-loading 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------------------- Pagination ---------------------------- */
.pagination { display: flex; gap: 6px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); font-size: 0.83rem; color: var(--color-text); }
.pagination a:hover { background: var(--color-surface-alt); text-decoration: none; }
.pagination .current { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* ---------------------------- Tabs ---------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin-bottom: 20px; overflow-x: auto; }
.tab-link { padding: 10px 14px; font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-link:hover { color: var(--color-text); text-decoration: none; }
.tab-link.active { color: var(--color-primary); border-color: var(--color-primary); }

/* ---------------------------- Modal / drawer ---------------------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(20,24,38,0.45); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--color-surface); border-radius: var(--radius-lg); max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 22px; box-shadow: var(--shadow-md); }

/* ---------------------------- Photo zoom lightbox ---------------------------- */
[data-zoomable] { cursor: zoom-in; }
.photo-zoom-overlay {
    position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
    padding: 24px; background: rgba(18,22,36,0.75); opacity: 0; pointer-events: none;
    transition: opacity 0.22s ease;
}
.photo-zoom-overlay.open { opacity: 1; pointer-events: auto; }
.photo-zoom-overlay img {
    width: min(70vw, 70vh, 440px); height: min(70vw, 70vh, 440px); border-radius: 50%;
    object-fit: cover; background: #fff; box-shadow: 0 24px 70px -12px rgba(0,0,0,0.55);
    transform: scale(0.25); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
}
.photo-zoom-overlay.open img { transform: scale(1); }

/* ---------------------------- Birthday congrats modal ---------------------------- */
.modal-birthday { max-width: 480px; padding: 0; overflow: hidden; }
.birthday-modal-header {
    position: relative; padding: 30px 22px 22px; text-align: center; overflow: hidden;
    background: linear-gradient(135deg, #FF7AC6 0%, #FFB84D 50%, #6EC6FF 100%); color: #fff;
}
.birthday-modal-header .confetti { position: absolute; font-size: 1.35rem; opacity: 0.9; animation: birthday-float 3.4s ease-in-out infinite; }
.birthday-modal-header .confetti:nth-child(1) { top: 10px; left: 10%; animation-delay: 0s; }
.birthday-modal-header .confetti:nth-child(2) { top: 18px; right: 12%; animation-delay: 0.6s; }
.birthday-modal-header .confetti:nth-child(3) { bottom: 14px; left: 20%; animation-delay: 1.1s; }
.birthday-modal-header .confetti:nth-child(4) { bottom: 20px; right: 18%; animation-delay: 1.7s; }
.birthday-modal-header .confetti:nth-child(5) { top: 46%; left: 5%; animation-delay: 0.3s; }
.birthday-modal-header .confetti:nth-child(6) { top: 40%; right: 6%; animation-delay: 0.9s; }
.birthday-modal-header .cake-icon { font-size: 2.6rem; display: block; margin-bottom: 6px; }
.birthday-modal-header h3 { margin: 0; font-size: 1.2rem; color: #fff; }
.birthday-modal-body { padding: 20px 22px 22px; }
@keyframes birthday-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(14deg); }
}

/* ---------------------------- Alert banners for health/allergy ---------------------------- */
.alert-chip { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius-md); font-size: 0.85rem; font-weight: 600; margin-bottom: 10px; }
.alert-chip.allergy { background: var(--color-danger-soft); color: var(--color-danger); }
.alert-chip.pickup { background: var(--color-info-soft); color: var(--color-info); }
.alert-chip.emergency { background: var(--color-warning-soft); color: var(--color-warning); }

/* ---------------------------- Attendance roster ---------------------------- */
.roster-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: 8px; background: var(--color-surface); }
.roster-row .name { flex: 1; font-weight: 600; }
.roster-toggle { display: flex; gap: 6px; }
.roster-toggle button { border: 1px solid var(--color-border-strong); background: var(--color-surface); border-radius: var(--radius-sm); padding: 7px 12px; font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.roster-toggle button.present.active { background: var(--color-success); color: #fff; border-color: var(--color-success); }
.roster-toggle button.absent.active { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.roster-toggle button.justified.active { background: var(--color-warning); color: #fff; border-color: var(--color-warning); }

/* ---------------------------- Dashboard hero (assinatura visual) ---------------------------- */
.hero {
    position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 30px 32px;
    margin-bottom: 22px; background: linear-gradient(120deg, #2F8FE0 0%, #4FA6E8 45%, #7BC4E0 100%); color: #fff;
    isolation: isolate;
}
.hero::before, .hero::after {
    content: ""; position: absolute; border-radius: 50%; z-index: -1; opacity: 0.5;
}
.hero::before { width: 260px; height: 260px; background: radial-gradient(circle, rgba(255,255,255,0.35), transparent 70%); top: -110px; right: -60px; }
.hero::after { width: 200px; height: 200px; background: radial-gradient(circle, var(--stage-pre1) , transparent 70%); bottom: -120px; left: 10%; opacity: 0.35; }
.hero h1 { color: #fff; font-size: 1.9rem; }
.hero .subtitle { color: rgba(255,255,255,0.92); font-size: 0.96rem; }
.hero .page-actions .btn-primary { background: #fff; color: var(--color-primary-dark); box-shadow: 0 6px 16px -6px rgba(0,0,0,0.25); }
.hero .page-actions .btn-primary:hover { background: #F3F8FF; }
.hero .page-actions .btn-secondary { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.4); }
.hero .page-actions .btn-secondary:hover { background: rgba(255,255,255,0.24); }

/* ---------------------------- Onboarding checklist (gaveta flutuante) ---------------------------- */
.onboarding-fab {
    position: fixed; right: 22px; bottom: 22px; z-index: 90;
    display: flex; align-items: center; gap: 10px; padding: 12px 18px 12px 14px; border-radius: 999px;
    background: linear-gradient(135deg, #1F2A44, #2F3F63); color: #fff; border: none; cursor: pointer;
    box-shadow: 0 12px 28px -8px rgba(31,42,68,0.55); font-weight: 600; font-size: 0.86rem;
}
.onboarding-fab .ring { position: relative; width: 30px; height: 30px; flex-shrink: 0; }
.onboarding-fab .ring svg { transform: rotate(-90deg); }
.onboarding-fab .ring circle { fill: none; stroke-width: 3; }
.onboarding-fab .ring .track { stroke: rgba(255,255,255,0.2); }
.onboarding-fab .ring .fill { stroke: var(--stage-pre1); stroke-linecap: round; transition: stroke-dashoffset 0.4s ease; }
.onboarding-fab .ring .count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.66rem; font-weight: 700; }
.onboarding-panel {
    position: fixed; right: 22px; bottom: 88px; z-index: 90; width: 320px; max-width: calc(100vw - 44px);
    background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border); padding: 18px; display: none;
}
.onboarding-panel.open { display: block; animation: onboarding-rise 0.18s ease; }
@keyframes onboarding-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.onboarding-panel h3 { font-size: 1rem; margin-bottom: 2px; }
.onboarding-panel .subtitle { font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 14px; }
.onboarding-step { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--color-border); }
.onboarding-step:last-child { border-bottom: none; }
.onboarding-step .check {
    width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700; margin-top: 1px; border: 2px solid var(--color-border-strong); color: transparent;
}
.onboarding-step.done .check { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.onboarding-step .step-label { font-size: 0.85rem; font-weight: 600; }
.onboarding-step.done .step-label { color: var(--color-text-muted); text-decoration: line-through; }
.onboarding-step a { font-size: 0.78rem; }

/* ---------------------------- Timeline (historico de turmas) ---------------------------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--color-border); }
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; left: -22px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--dot-color, var(--color-primary)); border: 2px solid var(--color-surface); box-shadow: 0 0 0 2px var(--dot-color, var(--color-primary)); }

/* ---------------------------- Utility ---------------------------- */
.text-muted { color: var(--color-text-muted); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.mt-0 { margin-top: 0; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.w-full { width: 100%; }
.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; }

/* ---------------------------- Auth pages ---------------------------- */
.auth-shell {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; position: relative; overflow: hidden;
    background: radial-gradient(90% 70% at 15% 10%, #E4F1FD 0%, transparent 55%),
                radial-gradient(70% 60% at 90% 90%, var(--stage-pre1-soft) 0%, transparent 55%),
                var(--color-bg);
}
.auth-card { width: 100%; max-width: 400px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 34px; box-shadow: var(--shadow-md); position: relative; z-index: 1; }
.auth-card:has(.kangaroo-mascot) { padding-top: 58px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 22px; text-align: center; }
.auth-brand img { width: 58px; height: 58px; border-radius: 18px; margin-bottom: 12px; object-fit: cover; box-shadow: var(--shadow-sm); }

/* ---------------------------- Floating shapes (login backdrop) ---------------------------- */
.auth-floaters { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.floater {
    position: absolute; border-radius: 50%; opacity: 0.55; filter: blur(0.5px);
    animation: floater-drift 9s ease-in-out infinite;
}
.floater.f1 { width: 46px; height: 46px; left: 8%; top: 18%; background: var(--stage-pre1); animation-duration: 7.5s; }
.floater.f2 { width: 26px; height: 26px; left: 18%; top: 68%; background: var(--stage-bercario); animation-duration: 9.5s; animation-delay: -2s; }
.floater.f3 { width: 60px; height: 60px; right: 10%; top: 12%; background: var(--stage-maternal); opacity: 0.4; animation-duration: 11s; animation-delay: -4s; }
.floater.f4 { width: 20px; height: 20px; right: 16%; top: 62%; background: var(--stage-pre2); animation-duration: 6.5s; animation-delay: -1s; }
.floater.f5 { width: 34px; height: 34px; right: 26%; bottom: 10%; background: var(--color-success); opacity: 0.35; animation-duration: 10s; animation-delay: -5s; }
.floater.star { border-radius: 0; background: none !important; opacity: 0.8; }
.floater.star::before { content: "\2605"; font-size: 1.4rem; color: var(--stage-pre1); }
@keyframes floater-drift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(10px, -18px) rotate(12deg); }
}
@media (prefers-reduced-motion: reduce) { .floater { animation: none; } }

/* ---------------------------- Kangaroo mascot (login) ---------------------------- */
.kangaroo-mascot { position: absolute; top: -84px; left: 50%; transform: translateX(-50%); width: 128px; height: 128px; z-index: 2; }
.kangaroo-mascot svg { width: 100%; height: 100%; overflow: visible; }
.kg-pupil { transition: transform 0.18s ease; transform-box: fill-box; transform-origin: center; }
.kg-paw { transition: transform 0.32s cubic-bezier(.34,1.56,.64,1); transform-box: fill-box; transform-origin: center; }
.kangaroo-mascot[data-state="email"] .kg-pupil { transform: translate(var(--pupil-x, 0px), 1px); }
.kangaroo-mascot[data-state="hidden"] .kg-paw-l { transform: translate(10px, -34px) rotate(-6deg); }
.kangaroo-mascot[data-state="hidden"] .kg-paw-r { transform: translate(-10px, -34px) rotate(6deg); }
.kangaroo-mascot[data-state="peek"] .kg-paw-r { transform: translate(-10px, -34px) rotate(6deg); }
@media (prefers-reduced-motion: reduce) { .kg-pupil, .kg-paw { transition: none; } }

/* ---------------------------- Password field with peek toggle ---------------------------- */
.field-password-wrap { position: relative; }
.field-password-wrap input { padding-right: 42px; }
.pw-toggle {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer;
    font-size: 1.05rem; color: var(--color-text-faint); padding: 6px; line-height: 1; border-radius: 8px;
}
.pw-toggle:hover { color: var(--color-text-muted); background: var(--color-surface-alt); }
.auth-brand h1 { font-size: 1.25rem; }

/* ---------------------------- Public registration (warmer palette) ---------------------------- */
.public-shell {
    min-height: 100vh;
    background: radial-gradient(70% 50% at 100% 0%, var(--stage-pre1-soft) 0%, transparent 60%),
                radial-gradient(60% 45% at 0% 100%, var(--stage-maternal-soft) 0%, transparent 60%),
                #FAF7F0;
}
.public-header { background: rgba(255,255,255,0.85); backdrop-filter: blur(6px); border-bottom: 1px solid var(--color-border); padding: 16px 20px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 10; }
.public-header img { width: 34px; height: 34px; border-radius: 10px; }
.public-wrap { max-width: 640px; margin: 0 auto; padding: 24px 18px 60px; position: relative; }
.step-indicator { display: flex; gap: 6px; margin-bottom: 20px; }
.step-indicator .dot { flex: 1; height: 5px; border-radius: 3px; background: var(--color-border); transition: background 0.2s ease; }
.step-indicator .dot.active { background: var(--color-primary); }
.public-card { background: var(--color-surface); border-radius: var(--radius-lg); border: 1px solid var(--color-border); padding: 24px; box-shadow: var(--shadow-sm); position: relative; z-index: 1; }

/* ---------------------------- Ficha de inscrição (identify screen, numbered steps, photo upload) ---------------------------- */
.ficha-steps { display: flex; justify-content: space-between; margin-bottom: 24px; position: relative; z-index: 1; }
.ficha-steps::before { content: ''; position: absolute; top: 17px; left: 6%; right: 6%; height: 2px; background: var(--color-border); z-index: 0; }
.ficha-steps .fstep { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; z-index: 1; flex: 1; }
.ficha-steps .fstep .num { width: 34px; height: 34px; border-radius: 50%; background: var(--color-surface); border: 2px solid var(--color-border); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; color: var(--color-text-muted); transition: all 0.2s ease; }
.ficha-steps .fstep .flabel { font-size: 0.66rem; color: var(--color-text-faint); text-align: center; max-width: 74px; line-height: 1.2; }
.ficha-steps .fstep.active .num { background: var(--color-primary); border-color: var(--color-primary); color: #fff; box-shadow: 0 0 0 4px var(--color-primary-soft); }
.ficha-steps .fstep.active .flabel { color: var(--color-primary); font-weight: 600; }
.ficha-steps .fstep.done .num { background: var(--color-success); border-color: var(--color-success); color: #fff; }
@media (max-width: 480px) { .ficha-steps .fstep .flabel { display: none; } }

.photo-upload { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 18px; }
.photo-upload-circle { width: 92px; height: 92px; border-radius: 50%; background: var(--color-surface-alt); border: 2px dashed var(--color-border-strong); display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; position: relative; transition: border-color 0.2s ease; }
.photo-upload-circle:hover { border-color: var(--color-primary); }
.photo-upload-circle img { width: 100%; height: 100%; object-fit: cover; display: none; }
.photo-upload-circle.has-image { border-style: solid; }
.photo-upload-circle.has-image img { display: block; }
.photo-upload-circle .icon { font-size: 1.9rem; color: var(--color-text-faint); }
.photo-upload-circle.has-image .icon { display: none; }
.photo-upload input[type="file"] { display: none; }
.photo-upload-label { font-size: 0.76rem; color: var(--color-text-muted); text-align: center; }

.resume-banner { display: flex; align-items: center; gap: 10px; background: var(--color-primary-soft); border: 1px solid var(--color-primary); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 18px; }
.resume-banner .icon { font-size: 1.4rem; }

/* ---------------------------- Search dropdown ---------------------------- */
.search-results {
    display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-md); max-height: 360px; overflow-y: auto; z-index: 50; padding: 8px;
}
.search-group { padding: 6px 8px; }
.search-group strong { display: block; font-size: 0.7rem; text-transform: uppercase; color: var(--color-text-faint); margin-bottom: 4px; }
.search-group a { display: block; padding: 6px 8px; border-radius: var(--radius-sm); color: var(--color-text); font-size: 0.87rem; }
.search-group a:hover { background: var(--color-surface-alt); text-decoration: none; }
.search-empty { padding: 14px; text-align: center; color: var(--color-text-muted); font-size: 0.85rem; }

.guardian-search { position: relative; }
.search-guardian-item { padding: 8px 10px; border-radius: var(--radius-sm); font-size: 0.87rem; cursor: pointer; }
.search-guardian-item:hover { background: var(--color-surface-alt); }

/* ---------------------------- Notifications ---------------------------- */
.notifications-wrap { position: relative; }
.notifications-bell { position: relative; background: none; border: none; cursor: pointer; font-size: 1.15rem; color: var(--color-text-muted); padding: 6px; }
.notifications-badge {
    display: none; position: absolute; top: 2px; right: 2px; background: var(--color-danger); color: #fff;
    font-size: 0.62rem; font-weight: 700; border-radius: 999px; padding: 1px 5px; min-width: 16px; text-align: center;
}
.notifications-panel {
    display: none; position: absolute; right: 0; top: calc(100% + 10px); width: 320px; max-height: 420px; overflow-y: auto;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); z-index: 60;
}
.notifications-panel.open { display: block; }
.notification-item { display: block; padding: 12px 14px; border-bottom: 1px solid var(--color-border); }
.notification-item:hover { background: var(--color-surface-alt); text-decoration: none; }
.notification-item.unread { background: var(--color-primary-soft); }
.notification-item strong { display: block; font-size: 0.85rem; color: var(--color-text); }
.notification-item small { color: var(--color-text-muted); }

/* ---------------------------- Responsive ---------------------------- */
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }
    .main-area { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .content { padding: 18px 16px 50px; }
    .topbar { padding: 0 14px; }
    .topbar-search { display: none; }
    table.data-table thead { display: none; }
    table.data-table, table.data-table tbody, table.data-table tr, table.data-table td { display: block; width: 100%; }
    .table-wrap table.data-table tr { border-bottom: 1px solid var(--color-border); padding: 10px 4px; }
    table.data-table td { border-bottom: none; padding: 5px 12px; }
    table.data-table td[data-label]::before { content: attr(data-label); display: block; font-size: 0.68rem; text-transform: uppercase; color: var(--color-text-faint); font-weight: 700; margin-bottom: 2px; }
}
