:root {
  --page: #f4f7fb; --surface: #ffffff; --surface-soft: #f8fafc; --surface-blue: #f1f6ff;
  --line: #dce4ef; --line-strong: #cbd6e5; --text: #142033; --muted: #65748b; --muted-2: #8a97aa;
  --primary: #0f62da; --primary-dark: #084cae; --primary-soft: #eaf2ff;
  --success: #15803d; --success-soft: #e8f7ed; --warning: #b96b00; --warning-soft: #fff3df;
  --danger: #d92d20; --danger-soft: #fdeceb; --purple: #7e22ce; --purple-soft: #f4eafb;
  --shadow: 0 10px 30px rgba(30, 58, 95, .07); --shadow-soft: 0 4px 14px rgba(30, 58, 95, .055);
  --radius: 14px; --radius-sm: 9px;
  --sidebar-w: 276px; --sidebar-w-collapsed: 78px;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  background: radial-gradient(circle at 10% -10%, rgba(15, 98, 218, .07), transparent 27%), linear-gradient(180deg, #f8faff 0, var(--page) 210px);
  color: var(--text); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(15, 98, 218, .2); outline-offset: 1px; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-sm { width: 17px; height: 17px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.strong-cell { font-weight: 700; }
h1 { margin: 0; font-size: clamp(22px, 1.8vw, 28px); letter-spacing: -.035em; line-height: 1.1; }
.brand-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; color: var(--primary); background: linear-gradient(145deg, #eff5ff, #fff); border: 1px solid #d9e6fb; box-shadow: var(--shadow-soft); flex: none; }
.tab-cancel-hint { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; color: var(--danger); background: var(--danger-soft); border: 1px solid #f5c3bf; border-radius: 8px; font-size: 12px; font-weight: 750; line-height: 1.35; }
.tab-cancel-hint strong { font-weight: 900; }
.card { background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.window-card { display: grid; grid-template-columns: minmax(320px,1.45fr) repeat(3,minmax(170px,.75fr)); overflow: hidden; margin-bottom: 14px; }
.window-primary { display: flex; gap: 16px; align-items: center; padding: 20px 22px; }
.window-card.closed .window-primary { background: linear-gradient(90deg, #fff6f5, #fff); }
.window-card.open .window-primary { background: linear-gradient(90deg, #effaf2, #fff); }
.window-card.info .window-primary { background: linear-gradient(90deg, #eef5ff, #fff); }
.window-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; flex: none; }
.closed .window-icon { color: var(--danger); background: var(--danger-soft); }
.open .window-icon { color: var(--success); background: var(--success-soft); }
.info .window-icon { color: var(--primary); background: var(--primary-soft); }
.window-copy-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.window-copy h2 { margin: 0; font-size: 16px; }
.window-copy p { margin: 6px 0 0; color: var(--muted); line-height: 1.45; font-size: 12.5px; }
.window-stat { border-left: 1px solid var(--line); padding: 20px 22px; display: flex; flex-direction: column; justify-content: center; }
.window-stat .field { margin-top: 8px; }
.eyebrow { color: var(--muted); text-transform: uppercase; font-size: 10.5px; letter-spacing: .05em; font-weight: 800; }
.window-value { margin-top: 9px; font-size: 17px; font-weight: 800; letter-spacing: -.015em; }
.status-chip { display: inline-flex; align-items: center; justify-content: center; margin-top: 8px; border-radius: 999px; padding: 5px 10px; font-size: 11px; font-weight: 900; width: fit-content; }
.status-chip.closed { color: var(--danger); background: var(--danger-soft); }
.status-chip.open { color: var(--success); background: var(--success-soft); }
.status-chip.info { color: var(--primary); background: var(--primary-soft); }
.info-banner { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; margin-bottom: 14px; border: 1px solid #cfe0ff; border-radius: 11px; background: #edf5ff; color: #295488; font-size: 12.5px; }
.info-banner-main { display: flex; align-items: center; gap: 12px; }
.info-banner strong { color: #174888; }
.info-dot { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: white; flex: none; font-weight: 800; }
.launch-rules { padding: 12px 16px 13px; background: #fffaf0; color: #5b3a00; border: 1px solid #f3d39b; border-left: 4px solid var(--warning); border-radius: 9px; }
.launch-rules-title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--warning); font-size: 14px; font-weight: 850; }
.launch-rules-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 28px; margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.45; }
.launch-rules-list li::marker { color: var(--warning); }
.launch-rules .launch-rules-list strong { color: #4a2f00; }
.launch-rules-highlight { grid-column: 1 / -1; margin-top: 2px; font-weight: 700; }
.rule-code { display: inline-block; padding: 1px 9px; border-radius: 6px; background: white; border: 1px solid #efc77f; color: #7a4a00; font-size: 14px; font-weight: 900; letter-spacing: .06em; }
.day-legend { padding: 9px 12px 10px; background: rgba(255,255,255,.7); border: 1px dashed #efc77f; border-radius: 8px; font-weight: 500; margin-top: 8px; }
.day-legend p { margin: 0; }
.day-legend-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px 12px; margin-top: 8px; }
.day-legend-item { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; color: #7a4a00; font-size: 12.5px; }
.sheet-card { overflow: hidden; }
.card-header { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.card-title { display: flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 800; }
.card-title-meta { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.25; }
.card-title .icon { color: var(--primary); }
.card-actions, .footer-actions, .filter-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 9px; padding: 8px 13px; font-weight: 750; transition: .17s ease; white-space: nowrap; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn-primary { color: white; background: var(--primary); box-shadow: 0 5px 14px rgba(15,98,218,.2); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { color: #263750; background: white; border-color: var(--line-strong); }
.btn-secondary:hover:not(:disabled) { border-color: #9bb5d7; background: #f8fbff; }
.btn-danger { color: var(--danger); background: white; border-color: #ffc9c5; }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-success { color: var(--success); background: white; border-color: #bfe4ca; }
.btn-success:hover:not(:disabled) { background: var(--success-soft); }
.btn-small { min-height: 30px; padding: 5px 10px; font-size: 12px; }
button:disabled { opacity: .52; cursor: not-allowed; box-shadow: none; transform: none !important; }
.sheet-wrap { overflow: auto; max-height: clamp(320px, 52vh, 680px); background: white; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
.entry-grid th { position: sticky; top: 0; z-index: 4; height: 42px; padding: 0 10px; background: #f0f4f9; color: #46566e; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line-strong); font-size: 10.5px; text-transform: uppercase; letter-spacing: .025em; text-align: left; white-space: nowrap; }
.entry-grid th:first-child { width: 48px; text-align: center; }
.entry-grid th:last-child { border-right: 0; }
.visit-grid { min-width: 1330px; }
.visit-grid th:nth-child(2) { width: 175px; } .visit-grid th:nth-child(3) { width: 155px; }
.visit-grid th:nth-child(4), .visit-grid th:nth-child(5) { width: 120px; } .visit-grid th:nth-child(6) { width: 140px; }
.visit-grid th:nth-child(7) { width: 190px; } .visit-grid th:nth-child(8) { min-width: 220px; } .visit-grid th:last-child { width: 160px; }
.cons-grid { min-width: 1780px; }
.entry-grid td { height: 38px; padding: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: background .15s; }
.entry-grid td:last-child { border-right: 0; }
.entry-grid tr:hover td { background: #fbfdff; }
.entry-grid tr.row-ok td { background: rgba(232,247,237,.32); }
.entry-grid tr.row-blocked td { background: rgba(255,243,223,.36); }
.entry-grid tr.row-error td { background: rgba(253,236,235,.38); }
.row-number { text-align: center; color: var(--muted); font-size: 11px; background: #f5f8fc !important; font-weight: 700; }
.entry-grid input, .entry-grid select { width: 100%; height: 37px; border: 0; border-radius: 0; padding: 0 12px; color: var(--text); background: transparent; outline: 0; }
.entry-grid input:focus, .entry-grid select:focus { box-shadow: inset 0 0 0 2px var(--primary); background: white; }
.entry-grid input.upper { text-transform: uppercase; }
.entry-grid input::placeholder { color: var(--muted-2); text-transform: none; }
.validation-cell { padding: 0 10px !important; }
.validation-badge, .pill { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 5px 9px; font-size: 10.5px; font-weight: 850; white-space: nowrap; }
.validation-badge.neutral { background: #eef2f6; color: #78869a; }
.validation-badge.ok, .pill.ok { background: var(--success-soft); color: var(--success); }
.validation-badge.blocked, .pill.blocked, .pill.pending { background: var(--warning-soft); color: var(--warning); }
.validation-badge.error, .pill.error { background: var(--danger-soft); color: var(--danger); }
.pill.cancelled { background: #eceff3; color: #5b6676; text-decoration: line-through; }
.sheet-footer { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; background: #fbfcfe; }
.required-note { color: var(--muted); font-size: 11px; }
.summary-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 12px 0 14px; }
.summary-grid.four { grid-template-columns: repeat(4, 1fr); }
.summary-card { min-height: 80px; display: flex; align-items: center; gap: 14px; padding: 14px; background: white; border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow-soft); }
.metric-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; flex: none; }
.metric-icon.blue { color: var(--primary); background: var(--primary-soft); }
.metric-icon.green { color: var(--success); background: var(--success-soft); }
.metric-icon.orange { color: var(--warning); background: var(--warning-soft); }
.metric-icon.purple { color: var(--purple); background: var(--purple-soft); }
.metric-icon.red { color: var(--danger); background: var(--danger-soft); }
.metric-number { font-size: 21px; line-height: 1; font-weight: 850; letter-spacing: -.02em; }
.metric-label { margin-top: 7px; color: var(--muted); font-size: 11.5px; }
.validation-card { padding: 14px; }
.validation-layout { display: grid; grid-template-columns: minmax(0,1fr) 315px; gap: 14px; }
.validation-main { min-width: 0; }
.validation-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.validation-heading { display: flex; align-items: center; gap: 12px; }
.validation-heading-icon { width: 46px; height: 46px; display: grid; place-items: center; color: var(--success); background: var(--success-soft); border-radius: 14px; }
.validation-heading h2 { margin: 0; font-size: 18px; }
.validation-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11.5px; }
.validation-counts { display: flex; align-items: center; gap: 8px; }
.count-chip { min-width: 104px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 11px; border: 1px solid; border-radius: 8px; font-size: 11.5px; }
.count-chip strong { font-size: 18px; }
.count-chip.success { color: var(--success); border-color: #bfe4ca; background: #f1fbf4; }
.count-chip.warning { color: var(--warning); border-color: #f3d39b; background: #fff9ef; }
.count-chip.error { color: var(--danger); border-color: #f5c3bf; background: #fff6f5; }
.validation-banner { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 9px 13px; border: 1px solid; border-radius: 8px; font-weight: 750; margin-bottom: 9px; }
.validation-banner.success { color: var(--success); background: #effaf2; border-color: #b9e0c4; }
.validation-banner.warning { color: var(--warning); background: #fff8eb; border-color: #efd09a; }
.validation-banner.error { color: var(--danger); background: #fff3f2; border-color: #f3beba; }
.result-table-wrap, .history-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.result-table { min-width: 1080px; }
.result-table th, .history-table th { position: sticky; top: 0; z-index: 2; padding: 10px 12px; background: #f1f4f8; color: #44546b; border-bottom: 1px solid var(--line-strong); text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .025em; white-space: nowrap; }
.result-table td, .history-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
.result-table tr:last-child td, .history-table tr:last-child td { border-bottom: 0; }
.classification-tag { color: #394c65; font-weight: 700; white-space: nowrap; }
.reason-cell { min-width: 300px; }
.reason-box { display: block; border-radius: 7px; padding: 7px 10px; line-height: 1.4; }
.reason-box.ok { color: #24673a; background: #eef9f1; }
.reason-box.blocked { color: #915400; background: #fff7e8; }
.reason-box.error { color: #a32a22; background: #fff1f0; }
.note-cell { min-width: 180px; color: var(--muted); line-height: 1.4; }
.insight-panel { border: 1px solid #cfe0fa; border-radius: 12px; background: linear-gradient(160deg, #f5f9ff, #fff); padding: 13px; }
.insight-item { display: grid; grid-template-columns: 37px 1fr; gap: 10px; padding: 10px 2px; }
.insight-item + .insight-item { border-top: 1px solid #dce7f5; }
.insight-icon { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 10px; color: var(--primary); background: white; border: 1px solid #d9e6f8; }
.insight-title { color: var(--primary); font-size: 11.5px; font-weight: 850; }
.insight-value { margin-top: 4px; color: #40536c; font-size: 11.5px; line-height: 1.45; }
.risk-chip { display: inline-flex; margin-top: 5px; padding: 4px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 850; color: var(--warning); background: var(--warning-soft); }
.risk-chip.success { color: var(--success); background: var(--success-soft); }
.risk-chip.warning { color: var(--warning); background: var(--warning-soft); }
.risk-chip.error { color: var(--danger); background: var(--danger-soft); }
.history-filter-card { padding: 16px; margin-bottom: 14px; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 160px auto; gap: 11px; align-items: end; }
.status-filter-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 11px; align-items: end; }
.cons-filter-grid { display: grid; grid-template-columns: 170px 190px 170px minmax(0, 1fr) auto; gap: 11px; align-items: end; }
.status-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.status-count { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-soft); color: var(--muted); font-size: 12px; font-weight: 700; }
.status-count strong { font-size: 22px; letter-spacing: -.02em; }
.status-count.pending strong, .status-word.pending { color: var(--warning); }
.status-count.done strong, .status-word.done { color: var(--success); }
.status-count.other strong { color: var(--muted); }
.status-table { min-width: 1100px; }
.status-day-names, .cell-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
label { display: block; margin-bottom: 6px; color: #3b4b62; font-size: 11.5px; font-weight: 800; }
.field { width: 100%; min-height: 40px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; color: var(--text); background: white; }
.history-list-card { overflow: hidden; }
.history-list-head { min-height: 55px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.history-list-card .history-table-wrap { border: 0; border-radius: 0; max-height: clamp(360px, 62vh, 820px); }
.history-table { min-width: 1500px; }
.history-table tr:hover td { background: #f9fbfe; }
.history-table th.action-col, .history-table td.action-col { position: sticky; left: 0; z-index: 1; width: 130px; background: white; border-right: 1px solid var(--line); }
.history-table th.action-col { z-index: 3; background: #f1f4f8; }
.history-table tr.row-cancelled td { color: var(--muted-2); }
.action-note { color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.arrow { color: var(--muted-2); padding: 0 3px; }
.changed { color: var(--primary); font-weight: 800; }
.empty-cell { text-align: center !important; padding: 34px !important; color: var(--muted); }
.loading-cell { text-align: center !important; padding: 34px !important; color: var(--muted); }
.error-text { color: var(--danger) !important; }
.spinner { display: inline-block; width: 16px; height: 16px; margin-right: 7px; border: 2px solid #cfe0fa; border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

#toast { position: fixed; right: 22px; bottom: 22px; max-width: 430px; padding: 13px 16px; border-radius: 10px; background: #182538; color: white; box-shadow: 0 16px 44px rgba(0,0,0,.24); z-index: 80; }
.confirm-overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15,27,45,.45); backdrop-filter: blur(4px); z-index: 70; }
.confirm-box { width: min(500px,100%); padding: 22px; background: white; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 24px 70px rgba(10,25,48,.25); }
.confirm-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; color: var(--primary); background: var(--primary-soft); margin-bottom: 13px; }
.confirm-icon.danger { color: var(--danger); background: var(--danger-soft); }
.confirm-icon.success { color: var(--success); background: var(--success-soft); }
.confirm-box h2 { margin: 0; font-size: 20px; }
.confirm-box p { margin: 10px 0 0; color: var(--muted); white-space: pre-line; line-height: 1.55; }
.confirm-details { margin-top: 12px; padding: 10px 12px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 9px; font-size: 12.5px; line-height: 1.6; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.confirm-reason { width: 100%; min-height: 72px; resize: vertical; }

/* Layout novo: menu lateral com abas mãe e filhas */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; width: var(--sidebar-w); flex: none; display: flex; flex-direction: column; background: rgba(255,255,255,.94); backdrop-filter: blur(14px); border-right: 1px solid rgba(203,214,229,.9); transition: width .2s ease, transform .22s ease; z-index: 50; }
.sidebar-brand { padding: 14px; border-bottom: 1px solid var(--line); }
.brand-band { display: flex; align-items: center; justify-content: center; height: 62px; padding: 0 16px; border-radius: 14px; background: linear-gradient(135deg, #e3000f 0%, #b8000c 62%, #9b0009 100%); box-shadow: 0 8px 20px rgba(184, 0, 12, .22); }
.brand-logo { display: block; width: 100%; max-width: 216px; height: auto; }
.brand-mark { display: none; width: 30px; height: 30px; }
.sidebar-brand .brand-text { padding: 12px 4px 0; }
.brand-text strong { display: block; font-size: 16.5px; letter-spacing: -.02em; line-height: 1.15; }
.brand-text span { display: block; margin-top: 4px; color: var(--muted); font-size: 11.5px; }
.side-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-caption { padding: 4px 10px 8px; color: var(--muted-2); font-size: 10.5px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.nav-group + .nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.nav-parent { width: 100%; display: flex; align-items: center; gap: 11px; min-height: 46px; padding: 0 10px; border: 0; border-radius: 11px; background: transparent; color: #26364d; font-weight: 800; text-align: left; }
.nav-parent:hover { background: var(--surface-blue); color: var(--primary); }
.nav-parent-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-soft); border: 1px solid var(--line); color: var(--muted); flex: none; }
.nav-group.has-active .nav-parent { color: var(--primary); }
.nav-group.has-active .nav-parent-icon { color: var(--primary); background: var(--primary-soft); border-color: #cfe0fa; }
.nav-chevron { margin-left: auto; color: var(--muted-2); transition: transform .18s ease; }
.nav-group:not(.open) .nav-chevron { transform: rotate(-90deg); }
.nav-children { display: grid; gap: 2px; margin: 4px 0 4px 27px; padding-left: 14px; border-left: 1px solid var(--line); }
.nav-group:not(.open) .nav-children { display: none; }
.nav-child { position: relative; display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 0 10px; border-radius: 9px; color: var(--muted); font-weight: 700; font-size: 13.5px; text-decoration: none; }
.nav-child:hover { color: var(--primary); background: rgba(15,98,218,.045); }
.nav-child.active { color: var(--primary); background: var(--primary-soft); }
.nav-child.active::before { content: ''; position: absolute; left: -15px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--primary); }
.nav-new { margin-left: auto; padding: 2px 7px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: 9.5px; font-weight: 900; letter-spacing: .04em; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.collapse-btn { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--muted); font-weight: 750; font-size: 12.5px; }
.collapse-btn:hover { color: var(--primary); border-color: #9bb5d7; }
@media (min-width: 1025px) {
.app-shell.collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.app-shell.collapsed .brand-text, .app-shell.collapsed .nav-label, .app-shell.collapsed .nav-chevron, .app-shell.collapsed .nav-caption, .app-shell.collapsed .nav-new { display: none; }
.app-shell.collapsed .sidebar-brand { padding: 14px 12px; }
.app-shell.collapsed .brand-band { height: 52px; padding: 0; }
.app-shell.collapsed .brand-logo { display: none; }
.app-shell.collapsed .brand-mark { display: block; }
.app-shell.collapsed .side-nav { padding: 14px 10px; }
.app-shell.collapsed .nav-parent { justify-content: center; padding: 0; pointer-events: none; }
.app-shell.collapsed .nav-group:not(.open) .nav-children, .app-shell.collapsed .nav-children { display: grid; margin: 4px 0; padding-left: 0; border-left: 0; }
.app-shell.collapsed .nav-child { justify-content: center; padding: 0; }
.app-shell.collapsed .nav-child.active::before { display: none; }
.app-shell.collapsed .collapse-btn { justify-content: center; padding: 0; }
.app-shell.collapsed .collapse-btn .icon { transform: scaleX(-1); }
}
.drawer-backdrop { display: none; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 28px; background: rgba(255,255,255,.88); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(203,214,229,.8); }
.menu-btn { display: none; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line-strong); border-radius: 9px; background: white; color: #263750; }
.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 700; min-width: 0; }
.breadcrumb strong { color: var(--text); }
.main { width: min(1760px, 100%); margin: 0 auto; padding: 22px 28px 44px; }
.page-header { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.page-header .brand-icon { width: 50px; height: 50px; border-radius: 15px; }
.page-heading { min-width: 0; }
.page-header .page-heading { flex: 1 1 360px; }
.page-heading p { margin: 7px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.page-header .tab-cancel-hint { margin-left: auto; max-width: 430px; }
.page-header .page-side { margin-left: auto; text-align: right; }

@media (max-width: 1280px) {
  .window-card { grid-template-columns: 1.5fr repeat(3,1fr); }
  .window-primary { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .window-stat:nth-child(2) { border-left: 0; }
  .summary-grid, .summary-grid.four { grid-template-columns: repeat(3,1fr); }
  .validation-layout { grid-template-columns: 1fr; }
  .insight-panel { display: grid; grid-template-columns: repeat(3,1fr); }
  .insight-item + .insight-item { border-top: 0; border-left: 1px solid #dce7f5; }
  .filter-grid, .cons-filter-grid { grid-template-columns: repeat(2,1fr); }
  .page-header { flex-wrap: wrap; }
  .page-header .tab-cancel-hint { margin-left: 0; max-width: none; }
}
@media (max-width: 1024px) {
  .sidebar { position: fixed; left: 0; top: 0; width: min(300px, 86vw); transform: translateX(-102%); box-shadow: 0 24px 70px rgba(10,25,48,.25); }
  .app-shell.collapsed .sidebar { width: min(300px, 86vw); }
  .app-shell.drawer-open .sidebar { transform: none; }
  .app-shell.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,27,45,.45); z-index: 45; }
  .menu-btn { display: inline-grid; }
  .collapse-btn { display: none; }
  .topbar { padding: 0 16px; }
  .main { padding: 16px 14px 40px; }
}
@media (max-width: 760px) {
  .window-card { grid-template-columns: 1fr; }
  .window-primary { grid-column: auto; }
  .window-stat { border-left: 0; border-top: 1px solid var(--line); padding: 14px 18px; }
  .card-header, .sheet-footer, .validation-header { align-items: flex-start; flex-direction: column; padding-top: 13px; padding-bottom: 13px; }
  .card-actions, .footer-actions { width: 100%; }
  .card-actions .btn, .footer-actions .btn { flex: 1; }
  .summary-grid, .summary-grid.four { grid-template-columns: repeat(2,1fr); }
  .validation-counts { width: 100%; overflow: auto; }
  .insight-panel { display: block; }
  .insight-item + .insight-item { border-left: 0; border-top: 1px solid #dce7f5; }
  .filter-grid, .status-filter-grid, .cons-filter-grid, .status-summary, .launch-rules-list { grid-template-columns: 1fr; }
  .day-legend-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .breadcrumb > span { display: none; }
}
/* ===================== REVISÃO DE DESIGN (sobrescreve as regras acima) ===================== */
/* Acessibilidade: tokens com contraste AA e foco visível */
:root { --muted: #5b6a80; --muted-2: #7a879a; --warning: #a15c00; --danger: #c0261b; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.entry-grid input:focus-visible, .entry-grid select:focus-visible { outline: 0; }
.nav-caption, .entry-grid input::placeholder, .field::placeholder, .history-table tr.row-cancelled td, .validation-badge.neutral { color: var(--muted); }

/* Tipografia: pilha fixa e pesos 600/700 (no Windows, 800 a 900 viram Segoe UI Black) */
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; }
label, .btn, .nav-child, .collapse-btn, .breadcrumb, .sheet-tab, .action-note { font-weight: 600; }
.nav-parent, .nav-caption, .card-title, .eyebrow, .window-value, .metric-number, .launch-rules-title, .insight-title, .validation-badge, .pill, .status-chip, .rule-code, .day-legend-item, .info-dot, .count-chip strong, .status-count strong, .risk-chip { font-weight: 700; }

/* Marca: faixa plana na altura da barra do topo; interação continua azul */
.sidebar-brand { padding: 0 0 12px; }
.brand-band { height: 60px; padding: 0 22px; justify-content: flex-start; border-radius: 0; box-shadow: none; }
.brand-logo { max-width: 196px; }
.sidebar-brand .brand-text { padding: 12px 22px 0; }

/* Menu: selo NOVO sob o rótulo, para "Alterações Consultores" caber em 1 linha */
.nav-parent { gap: 10px; }
.nav-parent .nav-label { line-height: 1.2; }
.nav-label .nav-new { display: table; margin: 4px 0 0; font-size: 10px; }

/* Sem perfil: o rodapé do menu só tem o botão do administrador e o de recolher */
.admin-btn[aria-pressed="true"] { color: var(--primary); background: var(--primary-soft); border-color: #cfe0fa; }
body:not(.is-admin) .admin-only { display: none !important; }
.admin-badge { margin-left: auto; padding: 5px 11px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 700; white-space: nowrap; }
@media (max-width: 1024px) { .admin-btn { display: flex; } }

/* Recolhido (só desktop): cada módulo vira um grupo com fundo */
@media (min-width: 1025px) {
  .app-shell.collapsed .sidebar-brand { padding: 0; border-bottom: 0; }
  .app-shell.collapsed .brand-band { height: 60px; padding: 0; justify-content: center; }
  .app-shell.collapsed .nav-group + .nav-group { margin-top: 10px; padding-top: 0; border-top: 0; }
  .app-shell.collapsed .nav-group { padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
  .app-shell.collapsed .nav-group.has-active { background: #f3f7ff; border-color: #cfe0fa; }
  .app-shell.collapsed .nav-parent { min-height: 36px; }
  .app-shell.collapsed .nav-parent-icon { background: transparent; border-color: transparent; }
  .app-shell.collapsed .nav-children { margin-top: 2px; padding-top: 4px; border-top: 1px solid var(--line); }
}

/* Grades de lançamento: painéis congelados (# e Nome | Tipo e Validação) e larguras menores */
.cons-grid { min-width: 1582px; table-layout: fixed; }
.cons-grid th { height: 46px; line-height: 1.2; white-space: normal; }
@media (min-width: 1025px) {
  .entry-grid :is(th, td):first-child { position: sticky; left: 0; z-index: 2; }
  .entry-grid :is(th, td):last-child { position: sticky; right: 0; z-index: 2; box-shadow: -8px 0 10px -10px rgba(20, 32, 51, .55); }
  .cons-grid :is(th, td):nth-child(2) { position: sticky; left: 48px; z-index: 2; box-shadow: 8px 0 10px -10px rgba(20, 32, 51, .55); }
  .cons-grid :is(th, td):nth-last-child(3) { position: sticky; right: 112px; z-index: 2; box-shadow: -8px 0 10px -10px rgba(20, 32, 51, .55); }
  .entry-grid thead th:is(:first-child, :last-child), .cons-grid thead th:is(:nth-child(2), :nth-last-child(3)) { z-index: 6; }
  .entry-grid td:last-child, .cons-grid td:is(:nth-child(2), :nth-last-child(3)) { background: #fff; }
  .entry-grid tr.row-ok td:last-child, .cons-grid tr.row-ok td:is(:nth-child(2), :nth-last-child(3)) { background: #f8fcf9; }
  .entry-grid tr.row-blocked td:last-child { background: #fffbf3; }
  .entry-grid tr.row-error td:last-child, .cons-grid tr.row-error td:is(:nth-child(2), :nth-last-child(3)) { background: #fef8f7; }
}

/* Status: largura mínima certa (a regra .history-table vinha depois e ganhava) */
.history-table.status-table { min-width: 1100px; }
/* Listas: uma linha por registro; só observação e motivo quebram */
.history-table td { white-space: nowrap; }
.history-table td.note-cell, .history-table td.reason-cell { white-space: normal; min-width: 240px; }

/* Filtros de consultores: Unidade virou texto livre; a busca cobre a unidade */
.cons-filter-grid { grid-template-columns: 180px 180px minmax(0, 1fr) auto; }
@media (max-width: 1280px) { .cons-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .cons-filter-grid { grid-template-columns: 1fr; } }

/* Aviso de Alterar/Cancelar: VERMELHO, igual ao tab-cancel-hint do app atual (pedido do usuário) */
.tab-cancel-hint { color: var(--danger); background: var(--danger-soft); border-color: #f5c3bf; font-weight: 600; }
.tab-cancel-hint strong { color: var(--danger); font-weight: 700; }
.tab-cancel-hint a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 760px) {
  .page-header .brand-icon { display: none; }
  .btn-small { min-height: 40px; }
}
/* PV repetido no dia, ajuste e popup de alteração */
.dup-banner { display: grid; gap: 8px; padding: 10px 16px; color: #6b4200; background: #fff8eb; border-bottom: 1px solid #efd09a; font-size: 13px; line-height: 1.45; }
.dup-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dup-item > .icon { color: var(--warning); }
.dup-item .btn { margin-left: auto; }
.validation-badge.adjust, .pill.adjust { background: var(--primary-soft); color: var(--primary); }
.pill.replaced { background: #eef2f6; color: #4b5a70; }
.action-group { display: flex; gap: 6px; }
.edit-box { width: min(640px, 100%); }
.edit-table { margin-top: 14px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.edit-table th, .edit-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12.5px; vertical-align: middle; }
.edit-table th { background: #f1f4f8; color: #44546b; font-size: 10.5px; text-transform: uppercase; letter-spacing: .025em; white-space: nowrap; }
.edit-table tr:last-child :is(th, td) { border-bottom: 0; }
.edit-table td.was { color: var(--muted); }
.edit-table .field { min-height: 36px; padding: 6px 9px; }
/* Filtro Dia de visita | Rota no Status */
.segmented { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-soft); }
.segmented button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: #3b4b62; font-weight: 600; white-space: nowrap; }
.segmented button[aria-pressed="true"] { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(20, 32, 51, .16); }
.status-filter-grid { grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1fr) auto; }
@media (max-width: 760px) { .status-filter-grid { grid-template-columns: 1fr; } .segmented { display: flex; } .segmented button { flex: 1; } }
.admin-note { display: block; margin-top: 6px; color: var(--primary); font-size: 12.5px; font-weight: 600; line-height: 1.45; }

/* ===================== PRODUÇÃO (Cloudflare Pages) ===================== */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 9px 14px; border-radius: 9px; background: var(--primary); color: #fff; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; }
.confirm-box { max-height: calc(100vh - 40px); overflow: auto; }
.reason-wrap { margin-top: 14px; }
.btn .spinner { margin-right: 0; width: 14px; height: 14px; border-color: rgba(255,255,255,.55); border-top-color: currentColor; }
.btn-secondary .spinner, .btn-danger .spinner, .btn-success .spinner { border-color: #cfe0fa; border-top-color: currentColor; }
.is-busy { cursor: progress; }

/* Tela de configuração pendente (config.js sem URL ou chave) */
.setup-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.setup-card { width: min(640px, 100%); overflow: hidden; }
.setup-card .brand-band { height: 60px; padding: 0 22px; justify-content: flex-start; border-radius: 0; box-shadow: none; }
.setup-body { padding: 22px 24px 24px; }
.setup-body h1 { font-size: 22px; }
.setup-body p { margin: 10px 0 0; color: var(--muted); line-height: 1.55; }
.setup-steps { margin: 14px 0 0; padding-left: 20px; line-height: 1.7; color: #26364d; }
.setup-steps code, .setup-problem code { padding: 1px 6px; border-radius: 5px; background: var(--surface-soft); border: 1px solid var(--line); font-size: 12.5px; }
.setup-problem { margin-top: 14px; padding: 10px 12px; border: 1px solid #f3beba; border-radius: 9px; background: #fff3f2; color: #a32a22; font-weight: 600; line-height: 1.5; }

/* Janela de rota: linha da base atualizada */
.window-copy .base-info { margin-top: 4px; font-size: 11.5px; }

/* Legenda de status */
.status-legend { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px 18px; padding: 12px 16px; margin-bottom: 14px; }
.legend-item { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; color: #40536c; font-size: 12px; line-height: 1.45; }
.legend-item .pill { flex: none; }
.legend-item strong { color: var(--text); }
@media (max-width: 1280px) { .status-legend { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .status-legend { grid-template-columns: 1fr; } .legend-item { flex-direction: row; } .legend-item .pill { min-width: 92px; } }

/* Como alterar (Histórico) */
.howto { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; padding: 14px 16px; margin-bottom: 14px; border: 1px solid #cfe0ff; border-radius: 11px; background: #edf5ff; color: #295488; font-size: 12.5px; line-height: 1.5; }
.howto-title { margin: 0 0 6px; color: #174888; font-size: 14px; font-weight: 700; }
.howto ol { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.howto strong { color: #174888; }
.howto-note { margin: 8px 0 0; font-weight: 600; }

/* Popups de alteração e login */
.modal-alert { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; padding: 10px 12px; border: 1px solid; border-radius: 9px; font-size: 12.5px; line-height: 1.5; white-space: pre-line; }
.modal-alert .icon { margin-top: 1px; }
.modal-alert.error { color: #a32a22; background: #fff3f2; border-color: #f3beba; }
.modal-alert.warning { color: #7a4a00; background: #fff8eb; border-color: #efd09a; }
.modal-alert.info { color: #295488; background: #edf5ff; border-color: #cfe0ff; }
.edit-box.wide { width: min(860px, 100%); }
.edit-section-title { margin: 16px 0 0; color: #26364d; font-size: 13px; font-weight: 700; }
.edit-section-title + .edit-table { margin-top: 8px; }
.edit-table { width: 100%; }
.edit-table th[scope="row"] { width: 30%; text-transform: none; letter-spacing: 0; font-size: 12px; color: #3b4b62; background: #f7f9fc; }
.edit-table td.was { width: 30%; }
.edit-table td.gone { color: var(--muted); font-style: italic; }
.edit-table .field.upper { text-transform: uppercase; }
.login-form { margin-top: 16px; display: grid; gap: 12px; }
.login-form .field { min-height: 42px; }

/* Grade: validação automática em andamento */
.validating-note { display: inline-flex; align-items: center; color: var(--muted); font-size: 12px; font-weight: 600; }
.sheet-footer .footer-actions { flex-shrink: 0; }
.person-cell { min-width: 200px; white-space: nowrap; }

/* Larguras da grade de consultores (antes vinham em style inline) */
.cons-grid th:nth-child(2) { width: 216px; } .cons-grid th:nth-child(3) { width: 92px; } .cons-grid th:nth-child(4) { width: 100px; }
.cons-grid th:nth-child(5) { width: 150px; } .cons-grid th:nth-child(6), .cons-grid th:nth-child(7) { width: 84px; }
.cons-grid th:nth-child(8), .cons-grid th:nth-child(9) { width: 170px; } .cons-grid th:nth-child(10) { width: 196px; }
.cons-grid th:nth-child(11) { width: 160px; } .cons-grid th:nth-child(12) { width: 112px; }

/* Toast de erro */
#toast.toast-error { background: #4a1410; border-left: 4px solid #f97066; }
#toast { cursor: default; }
@media (max-width: 760px) { #toast { left: 12px; right: 12px; bottom: 12px; max-width: none; } }
