/* Alimentação Escolar SEMED — folha de estilos (sem dependências). Mobile-first, contraste AA, foco visível. */
:root {
  --bg: #f3f6f5; --surface: #fff; --ink: #1c2b33; --ink-2: #4a5b64; --muted: #6b7c85; --line: #dbe4e1;
  --brand: #14614d; --brand-2: #0f4b3b; --brand-soft: #e2f0eb; --accent: #b7791f;
  --ok: #1e7b3a; --ok-bg: #e3f4e8; --warn: #9a6200; --warn-bg: #fff3d6; --bad: #b3261e; --bad-bg: #fde8e6; --info: #1d5f9e; --info-bg: #e5f0fa;
  --side: #0f2f27; --side-2: #163d33; --side-ink: #cfe3dc;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,42,35,.06), 0 4px 14px rgba(16,42,35,.06);
  --font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; color: var(--ink); }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
a { color: var(--brand); } a:hover { color: var(--brand-2); }
:focus-visible { outline: 3px solid #2b8cff; outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 100; border-radius: 6px; }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.ico { flex: none; vertical-align: -3px; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--side); color: var(--side-ink); position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 40; transition: transform .2s; }
.brand { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 14px 14px 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-plate { display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 14px; padding: 8px 12px; box-shadow: 0 2px 10px rgba(0,0,0,.25); transition: transform .15s, box-shadow .15s; }
.brand-plate:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,.32); }
.brand-plate:focus-visible { outline: 3px solid #5eead4; outline-offset: 2px; }
.brand-plate img { display: block; width: 100%; max-width: 196px; height: auto; }
.brand-sub { text-align: center; color: #8fb3a7; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; }
.brand-mark { font-size: 1.6rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; color: #fff; } .brand-text small { color: #8fb3a7; letter-spacing: .12em; font-size: .72rem; }
.sidebar .sidebar-close { display: none; position: absolute; top: 8px; right: 8px; color: #0f2f27; background: rgba(255,255,255,.9); border-radius: 50%; padding: 4px; }
.sidebar nav { padding: 8px 8px 24px; }
.nav-group { --g: #86ab9f; margin: 4px 0; border-radius: 12px; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.nav-group summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; color: #d5e8e1; font-size: .93rem; font-weight: 600; user-select: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-group summary:focus-visible, .nav-group a:focus-visible { outline: 2px solid var(--g); outline-offset: 1px; }
.nav-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.08); color: var(--g); transition: background .15s, color .15s; }
.nav-title { flex: 1; min-width: 0; }
.nav-count { font-size: .68rem; font-weight: 700; color: #9fc2b6; background: rgba(255,255,255,.08); border-radius: 999px; padding: 1px 7px; }
.nav-group summary::after { content: ""; flex: none; width: 7px; height: 7px; margin: 0 4px 0 2px; border-right: 2px solid #86ab9f; border-bottom: 2px solid #86ab9f; transform: rotate(-45deg); transition: transform .18s, border-color .15s; }
.nav-group[open] { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.09); box-shadow: inset 3px 0 0 var(--g); }
.nav-group[open] > summary { color: #fff; }
.nav-group[open] > summary::after { transform: rotate(45deg); border-color: var(--g); }
.nav-group[open] .nav-ico { background: var(--g); color: #0b2620; }
.nav-group.has-active:not([open]) .nav-ico { background: var(--g); color: #0b2620; }
.nav-group.has-active:not([open]) > summary::before { content: ""; order: 5; width: 7px; height: 7px; border-radius: 50%; background: var(--g); }
.nav-group ul { list-style: none; margin: 0; padding: 2px 8px 8px 22px; position: relative; }
.nav-group ul::before { content: ""; position: absolute; left: 23px; top: 4px; bottom: 12px; width: 2px; border-radius: 2px; background: rgba(255,255,255,.1); }
.nav-group li { position: relative; }
.nav-group a { display: flex; align-items: center; gap: 9px; padding: 7px 10px 7px 16px; color: #bcd6cd; text-decoration: none; border-radius: 8px; font-size: .9rem; font-weight: 500; }
.nav-group a svg { opacity: .75; flex: none; }
.nav-group a:hover { background: rgba(255,255,255,.09); color: #fff; }
.nav-group a:hover svg { opacity: 1; }
.nav-group a.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.nav-group a.active::before { content: ""; position: absolute; left: 1px; top: 6px; bottom: 6px; width: 3px; border-radius: 3px; background: var(--g); }
.nav-group a.active svg { opacity: 1; color: var(--g); }
@media (prefers-reduced-motion: reduce) { .nav-group, .nav-group summary::after, .nav-ico { transition: none; } }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; }
.main-col { margin-left: 260px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 20px; }
.menu-btn { display: none; }
.global-search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; color: var(--muted); }
.global-search input { border: 0; background: transparent; flex: 1; padding: 6px 0; font: inherit; outline: none; min-width: 0; }
.global-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { background: transparent; border: 0; cursor: pointer; padding: 8px; border-radius: 8px; color: var(--ink-2); display: inline-flex; position: relative; text-decoration: none; }
.icon-btn:hover { background: var(--bg); }
.bell-count { position: absolute; top: 2px; right: 0; background: var(--accent); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.bell-count.crit { background: var(--bad); }
.user-menu { position: relative; } .user-menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; }
.user-menu summary::-webkit-details-marker { display: none; } .user-menu summary:hover { background: var(--bg); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.user-info { display: flex; flex-direction: column; line-height: 1.15; } .user-info small { color: var(--muted); font-size: .75rem; }
.user-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 50; }
.user-pop a, .user-pop button { display: flex; gap: 8px; align-items: center; width: 100%; padding: 9px 10px; border: 0; background: transparent; text-align: left; color: var(--ink); font: inherit; text-decoration: none; border-radius: 6px; cursor: pointer; }
.user-pop a:hover, .user-pop button:hover { background: var(--bg); }
main { padding: 22px 24px 32px; flex: 1; max-width: 1500px; width: 100%; }
main:focus { outline: none; }
.app-footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 24px; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 10px; font-size: .85rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line); }
.breadcrumbs a { color: var(--muted); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .sub { color: var(--muted); margin: 2px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-bottom: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.narrow { max-width: 520px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; border-left: 4px solid var(--brand); }
.kpi:hover { border-color: var(--brand); }
.kpi .kpi-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.kpi .kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.kpi .kpi-sub { color: var(--muted); font-size: .8rem; }
.kpi.warn { border-left-color: var(--accent); } .kpi.bad { border-left-color: var(--bad); } .kpi.ok { border-left-color: var(--ok); } .kpi.info { border-left-color: var(--info); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 38px; }
.btn:hover { background: var(--bg); border-color: #c4d1cd; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; } .btn-primary:hover { background: var(--brand-2); color: #fff; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; } .btn-danger:hover { background: #8f1d17; }
.btn-ghost { background: transparent; border-color: transparent; } .btn-sm { padding: 4px 10px; min-height: 30px; font-size: .85rem; } .btn-block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .65; cursor: progress; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); } .badge-warn { background: var(--warn-bg); color: var(--warn); } .badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); } .badge-neutral { background: #e8eeec; color: var(--ink-2); }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert-success { background: var(--ok-bg); color: #14532d; border-color: #b6e0c3; } .alert-error { background: var(--bad-bg); color: #7a1c17; border-color: #f4bcb7; }
.alert-warning { background: var(--warn-bg); color: #6b4300; border-color: #f0d28a; } .alert-info { background: var(--info-bg); color: #123e69; border-color: #b7d4ef; }
.hint-box { background: var(--info-bg); border: 1px solid #b7d4ef; color: #123e69; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: .9rem; }
.empty { text-align: center; padding: 34px 12px; color: var(--muted); }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; background: #f0f5f3; color: var(--ink-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.table th a { color: inherit; text-decoration: none; } .table th a:hover { text-decoration: underline; }
.table td { padding: 10px 12px; border-bottom: 1px solid #ebf0ee; vertical-align: top; }
.table tbody tr:hover { background: #f8fbfa; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .row-actions { display: flex; gap: 4px; justify-content: flex-end; white-space: nowrap; }
.table tr.row-bad td { background: #fff5f4; } .table tr.row-warn td { background: #fffaf0; }
.table tfoot td { font-weight: 700; background: #f7faf9; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; flex-wrap: wrap; border-top: 1px solid var(--line); font-size: .88rem; color: var(--muted); }
.pager .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a, .pager span.cur { padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--ink); background: var(--surface); }
.pager span.cur { background: var(--brand); color: #fff; border-color: var(--brand); } .pager a:hover { background: var(--bg); }

/* ---------- Formulários ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 18px; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
label, .label { font-weight: 600; font-size: .88rem; color: var(--ink-2); }
label .req { color: var(--bad); margin-left: 2px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=time], input[type=search], input[type=tel], input[type=url], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #b9c8c3; border-radius: 8px; font: inherit; background: #fff; color: var(--ink); min-height: 40px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 3px solid var(--brand-soft); }
input[readonly], input:disabled, select:disabled { background: #eef3f1; color: var(--muted); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: .82rem; }
.hint { color: var(--muted); font-size: .8rem; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; min-height: 40px; } .check input { width: 18px; height: 18px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fafcfb; }
.filters .field { min-width: 150px; flex: 1 1 150px; max-width: 260px; } .filters .field.grow { flex: 2 1 220px; max-width: 360px; }
.filters .btn { align-self: flex-end; }
.repeat-table { width: 100%; border-collapse: collapse; }
.repeat-table th { text-align: left; font-size: .78rem; color: var(--muted); padding: 4px 6px; text-transform: uppercase; }
.repeat-table td { padding: 4px 6px; vertical-align: top; }
.repeat-table td:last-child { width: 44px; }
.lookup { position: relative; }
.lookup-list { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); max-height: 240px; overflow-y: auto; }
.lookup-list button { display: block; width: 100%; text-align: left; padding: 8px 12px; border: 0; background: transparent; font: inherit; cursor: pointer; }
.lookup-list button:hover, .lookup-list button:focus { background: var(--brand-soft); }
.lookup-list .none { padding: 8px 12px; color: var(--muted); }
dl.detail { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 8px 16px; margin: 0; }
dl.detail dt { color: var(--muted); font-weight: 600; font-size: .88rem; } dl.detail dd { margin: 0; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.semaforo { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .85rem; }
.semaforo i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.semaforo .vencido i { background: #c62828; } .semaforo .laranja i { background: #ef6c00; } .semaforo .amarelo i { background: #f9a825; } .semaforo .ok i { background: #2e7d32; }
.progress { background: #e6eeeb; border-radius: 999px; height: 9px; overflow: hidden; } .progress > div { height: 100%; background: var(--brand); }
.diff-pos { color: var(--bad); font-weight: 700; } .diff-neg { color: var(--info); font-weight: 700; } .diff-zero { color: var(--ok); font-weight: 700; }
.chart { width: 100%; } .chart text { font-family: var(--font); fill: var(--ink-2); font-size: 13.5px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-2); margin-top: 6px; } .chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.calc-box { background: var(--brand-soft); border: 1px solid #bcdccf; border-radius: var(--radius); padding: 12px 14px; }
.calc-box code { font-size: .85rem; }
.list-plain { list-style: none; margin: 0; padding: 0; } .list-plain li { padding: 9px 0; border-bottom: 1px solid #ebf0ee; display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; } .list-plain li:last-child { border: 0; }
.alert-item { display: flex; gap: 10px; padding: 10px 12px; border-left: 4px solid var(--info); background: #fafcfb; border-radius: 6px; margin-bottom: 8px; align-items: flex-start; }
.alert-item.critico { border-left-color: var(--bad); background: #fff6f5; } .alert-item.aviso { border-left-color: var(--accent); background: #fffaf0; }
.alert-item .grow { flex: 1; min-width: 0; }
.school-tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 14px; text-align: center; text-decoration: none; color: var(--ink); font-weight: 700; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 108px; justify-content: center; }
.tile:hover { border-color: var(--brand); background: var(--brand-soft); } .tile .ico { width: 30px; height: 30px; color: var(--brand); }

/* ---------- Modal / toasts ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,30,25,.5); display: flex; align-items: center; justify-content: center; z-index: 90; padding: 16px; }
.modal-backdrop[hidden] { display: none; }
.modal { background: #fff; border-radius: 14px; padding: 22px; max-width: 440px; width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 95; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1c2b33; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); max-width: 360px; }
.toast.error { background: var(--bad); } .toast.success { background: var(--ok); }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.btn:not(.btn-primary):not(.btn-danger) .spinner { border-color: #b9c8c3; border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { opacity: .5; pointer-events: none; }

/* ---------- Convidado (login) ---------- */
body.guest { background: linear-gradient(160deg, #0f2f27 0%, #14614d 60%, #1f7a62 100%); }
.guest-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; gap: 14px; }
.guest-card { background: #fff; border-radius: 16px; padding: 28px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.guest-brand { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 18px; text-align: center; } .guest-logo { display: block; width: 100%; max-width: 280px; height: auto; } .guest-brand small { display: block; color: var(--muted); font-size: .8rem; }
.guest-title { font-size: 1.25rem; } .guest-foot { color: #bfd8cf; font-size: .8rem; text-align: center; max-width: 420px; margin: 0; }
.link-quiet { text-align: center; color: var(--muted); font-size: .9rem; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.35); } body.nav-open .sidebar { transform: none; }
  .sidebar .sidebar-close, .menu-btn { display: inline-flex; } .main-col { margin-left: 0; }
  main { padding: 16px 14px 28px; } .topbar { padding: 8px 12px; } .user-info { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  dl.detail { grid-template-columns: 1fr; gap: 2px; } dl.detail dd { margin-bottom: 8px; }
}
@media (max-width: 600px) {
  .global-search { display: none; } .page-head { flex-direction: column; } .filters .field { max-width: none; flex-basis: 100%; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; } .kpi .kpi-value { font-size: 1.3rem; }
  .table.stack thead { display: none; } .table.stack tr { display: block; border-bottom: 8px solid var(--bg); } .table.stack td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 6px 12px; }
  .table.stack td::before { content: attr(data-label); font-weight: 700; color: var(--muted); font-size: .8rem; }
  .repeat-table thead { display: none; } .repeat-table tr { display: block; border: 1px solid var(--line); border-radius: 8px; padding: 6px; margin-bottom: 8px; } .repeat-table td { display: block; width: 100% !important; }
}
@media print {
  .sidebar, .topbar, .app-footer, .actions, .filters, .pager, .no-print, .toasts { display: none !important; } .main-col { margin: 0; } main { padding: 0; max-width: none; }
  body { background: #fff; } .card { box-shadow: none; border-color: #bbb; break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Crédito (rodapé) ---------- */
.font-semibold { font-weight: 600; }
.app-footer p, .guest-credit p { margin: 0; }
.app-footer a.font-semibold { color: var(--brand); text-decoration: none; }
.app-footer a.font-semibold:hover { color: var(--brand-2); text-decoration: underline; }
.guest-credit { color: #bfd8cf; font-size: .85rem; text-align: center; }
.guest-credit a.text-slate-300 { color: #cbd5e1; text-decoration: none; }
.guest-credit a.hover\:text-white:hover { color: #fff; text-decoration: underline; }
@media print { .app-footer { display: none; } }

/* ---------- Guia rápido (gaveta de checklist) ---------- */
.guia-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--brand-soft); color: var(--brand-2); border-radius: 999px; padding: 5px 12px 5px 10px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.guia-btn:hover { background: #d3e8e0; }
.guia-btn .guia-badge { background: var(--brand); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .72rem; min-width: 34px; text-align: center; line-height: 18px; }
.guia-btn .guia-badge.done { background: var(--ok); }
.guia { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: -8px 0 28px rgba(15, 40, 35, .18); z-index: 60; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s ease; }
.guia.is-open { transform: none; }
.guia[hidden] { display: none; }
.guia-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.guia-head h2 { margin: 0; font-size: 1.05rem; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.guia-head p { margin: 4px 0 10px; color: var(--muted); font-size: .85rem; }
.guia-bar { height: 8px; background: var(--brand-soft); border-radius: 999px; overflow: hidden; }
.guia-bar > span { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 999px; transition: width .3s ease; }
.guia-progress-label { font-size: .8rem; color: var(--ink-2); margin-top: 6px; }
.guia-body { flex: 1; overflow-y: auto; padding: 10px 14px 20px; }
.guia-group { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; background: #fbfdfc; }
.guia-group > summary { cursor: pointer; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: .92rem; list-style: none; }
.guia-group > summary::-webkit-details-marker { display: none; }
.guia-gcount { background: var(--brand-soft); color: var(--brand-2); border-radius: 999px; padding: 0 8px; font-size: .75rem; }
.guia-step { display: flex; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); }
.guia-check { flex: none; width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--line); background: #fff; color: #fff; font-weight: 800; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; margin-top: 2px; }
.guia-step.is-done .guia-check { background: var(--ok); border-color: var(--ok); }
.guia-check:disabled { cursor: default; }
.guia-check:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 1px; border-color: var(--brand); }
.guia-text strong { display: block; font-size: .92rem; }
.guia-step.is-done .guia-text strong { color: var(--muted); text-decoration: line-through; }
.guia-text p { margin: 3px 0 8px; font-size: .82rem; color: var(--ink-2); }
.guia-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.guia-auto { font-size: .72rem; color: var(--ok); }
.guia-foot { border-top: 1px solid var(--line); padding: 12px 16px; display: flex; gap: 8px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { .guia, .guia-bar > span { transition: none; } }
@media (max-width: 640px) { .guia-btn .guia-label { display: none; } }
@media print { .guia, .guia-btn { display: none !important; } }

/* ---------- Central de Treinamento (área do aluno) ---------- */
.eyebrow { margin: 0 0 2px; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.pbar { height: 10px; background: var(--brand-soft); border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.pbar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.trilha-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.trilha-card h2 { margin: 6px 0 4px; font-size: 1.15rem; } .trilha-card p { margin: 0 0 6px; color: var(--ink-2); }
.trilha-ico { width: 48px; height: 48px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-2); display: flex; align-items: center; justify-content: center; }
.licao-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lic-item a { display: flex; gap: 14px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: inherit; }
.lic-item a:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.lic-num { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-2); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.lic-item.is-done .lic-num { background: var(--ok); color: #fff; }
.lic-txt { flex: 1; display: flex; flex-direction: column; } .lic-txt small { color: var(--muted); }
.lic-meta { color: var(--muted); font-size: .8rem; white-space: nowrap; } .lic-meta b { color: var(--ok); }
.licao { display: grid; gap: 14px; max-width: 900px; } .licao .card { margin-bottom: 0; } .licao h2 { font-size: 1.05rem; }
.callout { border-radius: var(--radius); padding: 12px 16px; border: 1px solid var(--line); background: var(--surface); } .callout p { margin: 4px 0 0; }
.callout-obj { background: var(--info-bg); border-color: #b7d4ef; color: #123e69; }
.callout-ok { background: var(--ok-bg); border-color: #b5deb9; color: #14501f; }
.callout-dica { background: var(--warn-bg); border-color: #f0d28a; color: #6b4300; font-size: .88rem; margin: 6px 0; padding: 8px 12px; }
.callout-warn-box { background: #fff8ea; border-color: #f0d28a; } .callout-warn-box ul { margin: 0; padding-left: 20px; }
.conceitos { margin: 0; display: grid; gap: 10px; } .conceitos dt { font-weight: 700; } .conceitos dd { margin: 0; color: var(--ink-2); }
.passos { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 12px; }
.passo { display: flex; gap: 12px; align-items: flex-start; }
.passo-chk { flex: none; position: relative; cursor: pointer; margin-top: 2px; } .passo-chk input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.passo-n { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--brand); color: var(--brand-2); display: flex; align-items: center; justify-content: center; font-weight: 800; background: #fff; }
.passo-chk input:focus-visible + .passo-n { outline: 3px solid var(--brand-soft); outline-offset: 2px; }
.passo.is-done .passo-n { background: var(--ok); border-color: var(--ok); color: #fff; }
.passo.is-done .passo-txt strong { text-decoration: line-through; color: var(--muted); }
.passo-txt p { margin: 3px 0 6px; color: var(--ink-2); }
.licao-nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .licao-nav .spacer { flex: 1; }
@media print { .licao-fim { display: none; } }

.guest-brand .guest-troca { font-size: .74rem; } .guest-brand .guest-troca a { color: var(--brand); text-decoration: underline; }

/* Importação da Tabela TACO */
.taco-import { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; justify-content: space-between; padding: 16px; border-top: 1px solid var(--line); background: #f7faf9; }
.taco-opts { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; } .taco-opts .field { min-width: 230px; } .taco-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.taco-fonte { margin-top: 14px; } td.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

/* Assistente (chat de ajuda com IA) */
.ia-fab { position: fixed; right: 20px; bottom: 20px; z-index: 55; display: inline-flex; align-items: center; gap: 8px; background: var(--brand); color: #fff; border: 0; border-radius: 999px; padding: 12px 18px; font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 6px 20px rgba(15, 75, 59, .35); }
.ia-fab:hover { background: var(--brand-2); } .ia-fab:focus-visible { outline: 3px solid #fbbf24; outline-offset: 2px; }
body.has-ia .toasts { bottom: 84px; }
.ia { position: fixed; right: 20px; bottom: 20px; z-index: 65; width: min(400px, calc(100vw - 24px)); height: min(600px, calc(100vh - 40px)); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 14px 44px rgba(15, 40, 35, .28); display: flex; flex-direction: column; overflow: hidden; }
.ia[hidden] { display: none; }
.ia-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: var(--brand); color: #fff; } .ia-head .icon-btn { color: #fff; }
.ia-tools { display: inline-flex; gap: 2px; }
.ia-note { margin: 0; padding: 8px 14px; font-size: .78rem; color: var(--muted); background: #f7faf9; border-bottom: 1px solid var(--line); }
.ia-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ia-msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: .92rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.ia-bot { align-self: flex-start; background: var(--brand-soft); color: var(--ink); border-bottom-left-radius: 4px; }
.ia-user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.ia-err { align-self: flex-start; background: #fdecea; color: #8a1c14; }
.ia-wait { color: var(--muted); font-style: italic; }
.ia-link { color: var(--brand-2); font-weight: 600; text-decoration: underline; }
.ia-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; } .ia-chips[hidden] { display: none; }
.ia-chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: .8rem; color: var(--ink-2); cursor: pointer; } .ia-chip:hover { border-color: var(--brand); color: var(--brand); }
.ia-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }
.ia-form textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: .92rem; }
.ia-form textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; }
@media (max-width: 520px) { .ia { right: 8px; bottom: 8px; width: calc(100vw - 16px); height: calc(100vh - 16px); } .ia-fab span { display: none; } .ia-fab { padding: 14px; } }
@media print { .ia, .ia-fab { display: none !important; } }

/* Botões flutuantes: feedback (pequeno) ao lado do Assistente */
.fab-dock { position: fixed; right: 20px; bottom: 20px; z-index: 55; display: flex; align-items: center; gap: 10px; } .fab-dock[hidden] { display: none; }
.fab-dock .ia-fab { position: static; }
.fb-fab { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--brand); background: #fff; color: var(--brand); cursor: pointer; box-shadow: 0 6px 20px rgba(15, 75, 59, .22); }
.fb-fab:hover { background: var(--brand-soft); } .fb-fab:focus-visible { outline: 3px solid #fbbf24; outline-offset: 2px; }
body:not(.has-ia) .toasts { bottom: 76px; }
dialog.fb { border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(15, 40, 35, .35); }
dialog.fb::backdrop { background: rgba(15, 30, 26, .5); }
.fb-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 16px 18px; background: var(--brand); color: #fff; } .fb-head h2 { margin: 0; font-size: 1.05rem; line-height: 1.3; } .fb-head .icon-btn { color: #fff; }
.fb-body { padding: 16px 18px 4px; display: grid; gap: 12px; max-height: calc(100vh - 220px); overflow-y: auto; }
.fb-lead { margin: 0; font-size: .92rem; color: var(--ink-2); }
.fb-tipos { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fb-tipo { display: flex; gap: 8px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; } .fb-tipo input { margin-top: 3px; } .fb-tipo small { display: block; color: var(--muted); font-size: .78rem; } .fb-tipo b { font-size: .9rem; }
.fb-tipo:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.fb-body .field label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 4px; } .fb-body .field input, .fb-body .field textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font: inherit; } .fb-body .field textarea { resize: vertical; min-height: 110px; }
.fb-body .field input:focus, .fb-body .field textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.fb-nota { margin: 0; font-size: .78rem; color: var(--muted); }
.fb-erro { background: #fdecea; color: #8a1c14; border-radius: 10px; padding: 9px 12px; font-size: .88rem; } .fb-erro[hidden], .fb-ok[hidden] { display: none; }
.fb-body[hidden], .fb-foot[hidden] { display: none; }
.fb-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }
.fb-ok { text-align: center; padding: 26px 22px 24px; } .fb-ok h3 { margin: 6px 0; font-size: 1.15rem; } .fb-ok p { color: var(--ink-2); margin: 0 0 16px; } .fb-ok-ico { font-size: 2.2rem; }
@media (max-width: 520px) { .fab-dock { right: 12px; bottom: 12px; } .fb-tipos { grid-template-columns: 1fr; } }
@media print { .fab-dock, dialog.fb { display: none !important; } }

/* Subtabela em cartões (def 'layout' => 'cartao'): cada linha vira um cartão com os campos lado a lado — usada nas alergias do aluno (7 campos não cabem numa tabela) */
.repeat-table.cards thead { display: none; }
.repeat-table.cards, .repeat-table.cards tbody { display: block; }
.repeat-table.cards tbody tr { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px 14px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fbfdfc; }
.repeat-table.cards td { display: block; width: auto !important; padding: 0; min-width: 0; }
.repeat-table.cards td[data-label]::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 3px; }
.repeat-table.cards td:last-child { grid-column: 1 / -1; text-align: right; }
.repeat-table.cards td:last-child::before { content: none; }

/* Incompatibilidades do cardápio por gravidade da alergia: grave (vermelho), moderada (laranja), leve (azul) */
.conflitos { margin-bottom: 14px; } .conflitos-head { margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.conflitos-resumo { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.conflito-chip { font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; border: 1px solid; }
.chip-grave { background: #fdecea; color: #8a1c14; border-color: #f4bcb7; } .chip-moderada { background: #fff1de; color: #8a4600; border-color: #f5c88f; } .chip-leve { background: #e8f1fb; color: #123e69; border-color: #b7d4ef; }
.conflitos .alert { margin-bottom: 8px; border-left-width: 6px; }
.alert-grave { background: #fdecea; color: #7a1c17; border-color: #e5483c; } .alert-moderada { background: #fff1de; color: #6b3600; border-color: #f08a24; } .alert-leve { background: #e8f1fb; color: #123e69; border-color: #4a90d9; }
.conflito-dica { font-weight: 400; opacity: .85; }

/* Filtros recolhíveis no celular (botão criado por app.js; no desktop o botão nem aparece) */
.filters-toggle { display: none; }
@media (max-width: 600px) {
  .filters-toggle { display: flex; width: calc(100% - 28px); margin: 10px 14px; justify-content: center; }
  .filters.collapsed { display: none; }
}

/* Siglas (core/Glossary.php): sublinhado pontilhado + ajuda ao passar o mouse; no toque, app.js mostra o significado */
abbr[title] { text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: help; }
