:root {
    --text-navy: #0f2846;
    --text-light: #60758a;
    --bg-notebook: #fdfdfd;
    --line-color: #e7edf4;
    --margin-line: #fca5a5;
    --theme-green: #2ab673;
    --theme-green-bg: #eaf8f0;
    --theme-blue: #3b82f6;
    --theme-blue-bg: #eff6ff;
    --theme-purple: #8b5cf6;
    --theme-purple-bg: #f3e8ff;
    --theme-yellow: #f59e0b;
    --theme-yellow-bg: #fffbeb;
    --theme-orange: #ea580c;
    --theme-red: #dc2626;
    --surface: #ffffff;
    --border: #dbe4ee;
    --shadow: 0 12px 35px rgba(15, 40, 70, .08);
    --hl-blue: #dbeafe;
    --hl-blue-text: #1e3a8a;
    --hl-purple: #f3e8ff;
    --hl-purple-text: #581c87;
    --hl-orange: #ffedd5;
    --hl-orange-text: #9a3412;
    --hl-green: #dcfce7;
    --hl-green-text: #166534;
    --hl-red: #fee2e2;
    --hl-red-text: #991b1b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background-color: #fffdf7; background-image: repeating-linear-gradient(0deg, transparent, transparent 31px, #ece7dc 32px); color: var(--text-navy); font-family: 'Inter', sans-serif; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
.material-symbols-rounded { font-size: 22px; line-height: 1; vertical-align: middle; }
.icon-blue { color: var(--theme-blue); }
.icon-green { color: var(--theme-green); }
.icon-purple { color: var(--theme-purple); }
.icon-orange { color: var(--theme-orange); }
.icon-red { color: var(--theme-red); }
.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; }

.appbar {
    position: sticky; top: 0; z-index: 900;
    min-height: 72px; padding: 10px 2.5%;
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    background: rgba(255,255,255,.97); border-bottom: 1px solid #dbe4ee;
    box-shadow: 0 8px 28px rgba(15,40,70,.08); backdrop-filter: blur(12px);
}
.appbar-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.appbar-logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--theme-blue-bg); font-size: 28px; }
.appbar-brand h1 { font: 800 1.3rem/1.1 'Nunito', sans-serif; letter-spacing: -.02em; }
.appbar-brand p { color: var(--text-light); font-size: .82rem; margin-top: 4px; }
.appbar-actions { display: flex; align-items: center; gap: 8px; }
.appbar-action { border: 1px solid var(--border); background: #fff; min-height: 44px; padding: 8px 11px; border-radius: 11px; display: flex; align-items: center; gap: 7px; color: var(--text-navy); transition: .18s ease; }
.appbar-action:hover { transform: translateY(-1px); border-color: #b9c7d8; box-shadow: 0 5px 15px rgba(15,40,70,.08); }
.appbar-action.action-example { border-color: #d9c6ff; background: #faf7ff; }
.action-label { font-size: .82rem; font-weight: 700; }

.notebook-container { position: relative; width: 100%; max-width: 98%; margin: 18px auto 32px; background-color: var(--bg-notebook); background-image: repeating-linear-gradient(transparent, transparent 31px, var(--line-color) 31px, var(--line-color) 32px); background-size: 100% 32px; background-position: 0 8px; box-shadow: var(--shadow); min-height: calc(100vh - 122px); }
.binding-holes { position: absolute; left: 12px; top: 0; bottom: 0; width: 24px; background-image: repeating-linear-gradient(to bottom, #1e293b 0, #1e293b 6px, transparent 6px, transparent 32px); opacity: .72; }
.notebook-margin-line { position: absolute; left: 60px; top: 0; bottom: 0; width: 2px; background: var(--margin-line); opacity: .55; }
.content-wrapper { position: relative; z-index: 5; padding: 26px 34px 52px 86px; }
.intro-strip { display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin-bottom: 18px; background: rgba(239,246,255,.94); border: 1px solid #bfdbfe; border-radius: 12px; color: #36516d; font-size: .86rem; }

.form-grid { display: grid; grid-template-columns: 2.2fr 1.05fr 3fr; gap: 18px; margin-bottom: 22px; align-items: start; }
details.module-card { background: rgba(255,255,255,.97); border: 2px solid; border-radius: 16px; box-shadow: 0 8px 20px rgba(15,40,70,.04); overflow: visible; }
.theme-green { border-color: var(--theme-green); }
.theme-blue { border-color: var(--theme-blue); }
.theme-purple { border-color: var(--theme-purple); }
summary.module-header { display: flex; justify-content: space-between; align-items: center; padding: 17px 18px; cursor: pointer; user-select: none; list-style: none; }
summary.module-header::-webkit-details-marker { display: none; }
.header-title-group { display: flex; align-items: center; gap: 11px; }
.icon-box { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.theme-green .icon-box { background: var(--theme-green-bg); color: #158755; }
.theme-blue .icon-box { background: var(--theme-blue-bg); color: #2563eb; }
.theme-purple .icon-box { background: var(--theme-purple-bg); color: #7c3aed; }
.module-header h2 { font: 800 1.04rem/1.2 'Nunito', sans-serif; }
.chevron { color: var(--text-light); transition: transform .22s ease; }
details[open] > summary .chevron { transform: rotate(180deg); }
.module-content { border-top: 1px solid #edf2f7; padding: 15px 18px 18px; }
.module-desc { color: var(--text-light); font-size: .82rem; line-height: 1.5; margin-bottom: 15px; }

.dynamic-head, .dynamic-row { display: grid; grid-template-columns: minmax(145px,2fr) minmax(90px,1fr) 34px; gap: 8px; align-items: center; }
.dynamic-head { color: #7a8b9d; font-size: .67rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 6px; }
.dynamic-row { margin-bottom: 8px; }
input, select, textarea { width: 100%; border: 1px solid #cbd7e4; border-radius: 8px; background: #fff; color: var(--text-navy); padding: 10px 11px; outline: none; transition: border-color .16s, box-shadow .16s; }
input::placeholder, textarea::placeholder { color: #9badbd; opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--theme-blue); box-shadow: 0 0 0 3px rgba(59,130,246,.13); }
input[readonly] { background: #f7f9fc; color: #617486; }
select:disabled { background: #f3f5f8; cursor: not-allowed; }
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { display: flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 700; }
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-help { color: var(--text-light); font-size: .72rem; line-height: 1.4; }

.inline-info { font-size: 17px; cursor: help; }
.tooltip { position: relative; }
.tooltip::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 9px); right: 0; background: #172b44; color: #fff; padding: 9px 10px; border-radius: 8px; font-family: 'Inter', sans-serif !important; font-size: .75rem !important; font-style: normal; font-weight: 500 !important; font-variation-settings: normal; font-feature-settings: normal; letter-spacing: 0 !important; text-transform: none !important; word-spacing: normal; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 1500; width: max-content; max-width: min(330px, 72vw); white-space: normal; text-align: left; line-height: 1.45; box-shadow: 0 10px 25px rgba(0,0,0,.2); }
.tooltip:hover::after, .tooltip:focus-within::after { opacity: 1; }
.tooltip-bottom::after { bottom: auto; top: calc(100% + 8px); right: 50%; transform: translateX(50%); }

/* Competência: seletor robusto MM/AAAA */
.month-input-group { position: relative; }
.month-field { position: relative; }
.month-input-button {
    width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #cbd7e4; border-radius: 8px;
    background: #fff; color: var(--text-navy); display: flex; align-items: center; justify-content: space-between; gap: 10px;
    text-align: left; transition: border-color .16s, box-shadow .16s, background .16s;
}
.month-input-button:hover { border-color: #9fc7ae; background: #fbfffc; }
.month-input-button:focus-visible, .month-input-button[aria-expanded="true"] { border-color: var(--theme-green); box-shadow: 0 0 0 3px rgba(42,182,115,.14); outline: none; }
.month-display { font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: .015em; }
.month-display.is-placeholder { color: #9badbd; font-weight: 500; }
.month-format-help { margin-top: -1px; }
.month-picker-popover {
    position: absolute; top: calc(100% + 8px); left: 0; z-index: 2200; width: min(320px, calc(100vw - 32px));
    padding: 12px; border: 1px solid #cfe3d7; border-radius: 13px; background: #fff; box-shadow: 0 18px 45px rgba(15,40,70,.20);
}
.month-picker-popover[hidden] { display: none !important; }
.month-picker-header { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid #edf2f7; }
.month-picker-header strong { text-align: center; font: 800 1rem/1 'Nunito', sans-serif; color: #163d67; }
.month-nav-button { width: 36px; height: 34px; border: 1px solid #dbe4ee; border-radius: 8px; background: #f8fafc; color: #526a80; display: grid; place-items: center; }
.month-nav-button:hover { border-color: #86efac; background: #f0fdf4; color: #158755; }
.month-picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 11px 0; }
.month-option { min-height: 38px; border: 1px solid #e0e8ef; border-radius: 8px; background: #fff; color: #36516d; font-size: .74rem; font-weight: 750; }
.month-option:hover { border-color: #86efac; background: #f0fdf4; color: #166534; }
.month-option.is-selected { border-color: #22c55e; background: #dcfce7; color: #166534; box-shadow: inset 0 0 0 1px #22c55e; }
.month-option.is-current:not(.is-selected) { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.month-picker-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding-top: 10px; border-top: 1px solid #edf2f7; }
.month-footer-button { min-height: 36px; border-radius: 8px; border: 1px solid #dbe4ee; background: #f8fafc; color: #526a80; font-size: .7rem; font-weight: 750; display: flex; align-items: center; justify-content: center; gap: 5px; }
.month-footer-button .material-symbols-rounded { font-size: 17px; }
.month-footer-button.current:hover { border-color: #86efac; background: #f0fdf4; color: #166534; }
.month-footer-button.clear:hover { border-color: #fecaca; background: #fff7f7; color: #b91c1c; }
.material-symbols-rounded.tooltip::after { font-family: 'Inter', sans-serif !important; font-variation-settings: normal !important; }

.add-btn { width: 100%; border: 1px dashed #cbd7e4; background: #f7f9fc; color: #526a80; border-radius: 8px; padding: 9px 10px; font-size: .8rem; font-weight: 700; display: flex; justify-content: center; align-items: center; gap: 6px; }
.add-btn:hover { background: #f0f4f8; border-color: #aab9c9; }
.btn-remove { border: 0; background: transparent; color: var(--theme-red); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; }
.btn-remove:hover { background: #fff0f0; }
.section-divider { margin: 16px 0; border-top: 1px dashed #cbd7e4; }
.mt-2 { margin-top: 12px; }
.mb-2 { margin-bottom: 12px; }
.param-highlight { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 9px; border: 1px dashed #c4b5fd; }
.sum-box { background: var(--theme-purple-bg); font-size: .83rem; }
.hl-purple { background: #ede9fe; color: #5b21b6; padding: 4px 7px; border-radius: 7px; }

.divisor-container { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.div-box { min-width: 0; border: 1px solid #cbd7e4; border-radius: 10px; padding: 11px; background: #fff; }
.div-correto { border-color: #86efac; background: #fbfffc; }
.div-pago { border-color: #93c5fd; background: #fbfdff; }
.div-header { min-height: 27px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-bottom: 7px; }
.div-header label { font-size: .74rem; font-weight: 700; }
.badge-corr, .badge-pago { font-size: .57rem; line-height: 1; font-weight: 800; padding: 4px 5px; border-radius: 5px; letter-spacing: .04em; }
.badge-corr { background: #dcfce7; color: #166534; }
.badge-pago { background: #dbeafe; color: #1e40af; }
.toggle-manual { display: flex; align-items: center; }
.switch-container { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.switch { position: relative; width: 40px; height: 22px; flex: 0 0 40px; }
.switch input { opacity: 0; width: 0; height: 0; padding: 0; }
.slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; }
.slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.switch input:checked + .slider { background: var(--theme-blue); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch-text { display: flex; flex-direction: column; gap: 2px; }
.switch-text strong { font-size: .78rem; }
.switch-text small { color: var(--text-light); font-size: .68rem; }

.calendar-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; padding: 10px 5px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 9px; }
.cal-stat { text-align: center; display: flex; flex-direction: column; gap: 4px; }
.cal-stat + .cal-stat { border-left: 1px solid #e2e8f0; }
.cal-stat span { color: var(--text-light); font-size: .61rem; text-transform: uppercase; font-weight: 700; }
.cal-stat strong { color: #138a56; font-size: 1.16rem; }
.cal-stat.total strong { color: var(--text-navy); }

.quick-actions { display: flex; align-items: center; margin-bottom: 9px; }
.btn { border: 1px solid transparent; border-radius: 9px; padding: 9px 13px; font-size: .8rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; transition: .16s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--text-navy); color: #fff; }
.btn-primary:hover { background: #173b63; }
.btn-secondary { background: #f3f6f9; border-color: #d7e0ea; color: var(--text-navy); }
.btn-secondary:hover { background: #eaf0f5; }
.danger-outline { border-color: #fecaca; background: #fff; color: #991b1b; }

.verba-row { display: grid; grid-template-columns: minmax(155px,2.2fr) minmax(80px,1fr) minmax(92px,1fr) 30px; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid #eef2f6; }
.header-row { color: #73879a; font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; border-bottom: 2px solid #dde5ee; }
.v-col-name { font-size: .78rem; line-height: 1.35; }
.v-col-name strong { color: #27496b; }
.add-verba-container { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; border-top: 1px dashed #cbd7e4; padding-top: 12px; }
.highlight-dsr-row { background: var(--theme-yellow-bg); border: 1px dashed #fcd34d; border-radius: 9px; padding: 9px; }
.auto-dsr-label { display: flex; align-items: center; gap: 5px; color: #9a5a06; font-size: .68rem; margin-top: 4px; cursor: pointer; }
.auto-dsr-label input { width: auto; }

.table-section { background: #fff; border: 1px solid #dce5ee; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px; }
.table-header-bar { background: var(--text-navy); color: #fff; padding: 14px 19px; display: flex; align-items: center; justify-content: space-between; }
.table-header-bar h3 { font: 800 1.15rem 'Nunito',sans-serif; }
.table-header-bar .material-symbols-rounded { color: #7dd3fc; font-size: 28px; }
.eyebrow { display: block; font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; opacity: .75; margin-bottom: 3px; }
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 950px; }
.data-table th, .data-table td { padding: 13px 14px; text-align: left; border-bottom: 1px solid #edf2f7; vertical-align: top; }
.data-table th { background: #f7f9fc; color: #64798d; font-size: .69rem; text-transform: uppercase; letter-spacing: .035em; }
.data-table td { font-size: .82rem; }
.data-table th:nth-child(1) { width: 17%; }
.data-table th:nth-child(2) { width: 43%; }
.data-table th:nth-child(3), .data-table th:nth-child(4) { width: 13%; }
.data-table th:nth-child(5) { width: 14%; }
.text-right { text-align: right !important; }
.verba-name { display: block; font-weight: 800; }
.verba-ref { display: block; color: var(--text-light); font-size: .68rem; margin-top: 3px; }
.case-badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 7px; font-size: .63rem; font-weight: 800; margin-bottom: 6px; }
.case-adjust { background: #ede9fe; color: #6d28d9; }
.case-missing { background: #ffedd5; color: #9a3412; }
.case-complement { background: #dbeafe; color: #1d4ed8; }
.case-neutral { background: #f1f5f9; color: #64748b; }
.case-overpaid { background: #fee2e2; color: #b91c1c; }
.calc-line { line-height: 1.55; color: #405b73; }
.calc-reason { margin-top: 5px; color: #5e7183; font-size: .73rem; }
.val-simulado { font-weight: 800; font-size: .95rem; }
.val-pago { font-weight: 800; font-size: .95rem; color: #60758a; }
.ref-small { font-size: .67rem; color: #6c8093; font-weight: 500; }
.diff-positive, .diff-negative, .diff-zero { display: inline-block; padding: 5px 8px; border-radius: 7px; font-weight: 800; white-space: nowrap; }
.diff-positive { background: #dcfce7; color: #15803d; }
.diff-negative { background: #fee2e2; color: #b91c1c; }
.diff-zero { background: #f1f5f9; color: #64748b; }
tfoot { background: #f7f9fc; }
.total-label { text-align: right !important; font-weight: 800; }
.total-value { font-size: 1.35rem !important; font-weight: 900; color: #16803f; }
.empty-table td { text-align: center; padding: 35px 20px; color: #7b8da0; }
.empty-table .material-symbols-rounded { font-size: 34px; color: #9bb2c8; display: block; margin-bottom: 6px; }
.hl { display: inline-block; padding: 2px 5px; border-radius: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 800; font-size: .9em; }
.hl-blue { background: var(--hl-blue); color: var(--hl-blue-text); }
.hl-purple { background: var(--hl-purple); color: var(--hl-purple-text); }
.hl-orange { background: var(--hl-orange); color: var(--hl-orange-text); }
.hl-green { background: var(--hl-green); color: var(--hl-green-text); }
.hl-red { background: var(--hl-red); color: var(--hl-red-text); }

.modal-overlay { position: fixed; inset: 0; z-index: 1200; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(15,40,70,.62); backdrop-filter: blur(5px); }
.modal-box { position: relative; width: min(560px,96vw); max-height: 92vh; overflow-y: auto; background: #fff; border-radius: 16px; padding: 23px; box-shadow: 0 24px 70px rgba(0,0,0,.24); }
.modal-small { width: min(430px,96vw); }
.report-modal-box { width: min(930px,97vw); }
.calc-box { width: min(860px,97vw); }
.modal-close { position: absolute; top: 12px; right: 12px; z-index: 5; width: 35px; height: 35px; border: 0; border-radius: 9px; background: #f3f6f9; color: #5e7184; display: grid; place-items: center; }
.modal-close:hover { background: #e8eef4; }
.modal-title-row { display: flex; align-items: flex-start; gap: 12px; padding-right: 42px; margin-bottom: 18px; }
.modal-title-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; background: #f5f8fb; font-size: 27px; }
.modal-title-row h3, .modal-title-row h2 { font: 800 1.16rem 'Nunito',sans-serif; }
.modal-title-row p { color: var(--text-light); font-size: .78rem; line-height: 1.45; margin-top: 3px; }
.stack-actions { display: grid; gap: 9px; }
.stack-actions .btn { width: 100%; min-height: 46px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid #e6edf4; padding-top: 15px; margin-top: 18px; }
.helper-card { display: flex; align-items: flex-start; gap: 8px; padding: 10px; background: #f8fafc; border: 1px solid #e3eaf1; border-radius: 9px; color: #566b80; font-size: .75rem; line-height: 1.45; }

.calc-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
.calc-col-left, .calc-col-right { min-width: 0; }
#calc-textarea { min-height: 185px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1rem; line-height: 1.55; resize: vertical; }
.mini-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.calc-conversion-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 11px; }
.conversion-title { display: flex; align-items: center; gap: 6px; font-size: .77rem; margin-bottom: 6px; }
.validation-count { margin-left: auto; color: #6c8093; font-size: .67rem; }
.calc-lines-result { min-height: 70px; max-height: 170px; overflow-y: auto; font: .78rem/1.45 ui-monospace,SFMono-Regular,Menlo,monospace; color: #35516d; }
.calc-lines-result em { color: #94a3b8; }
.conversion-line { display: grid; grid-template-columns: 1fr auto; gap: 10px; border-bottom: 1px solid #e4eaf0; padding: 4px 0; }
.conversion-line:last-child { border-bottom: 0; }
.conversion-line .converted { color: #2563eb; font-weight: 800; }
.conversion-line.invalid { color: #b91c1c; }
.conversion-line.invalid .converted { color: #b91c1c; }
.calc-operation-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 11px; padding: 13px; }
.calc-operation-card > label { font-size: .72rem; font-weight: 800; }
.calc-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 7px 0 13px; }
.calc-mode { background: #edf2f7; color: #40576d; }
.calc-mode.active { background: var(--theme-green-bg); color: #166534; border-color: #86efac; }
#mode-sub.active { background: var(--theme-blue-bg); color: #1e40af; border-color: #93c5fd; }
.result-card { border: 1px solid #a7f3d0; background: #ecfdf5; border-radius: 11px; padding: 18px 12px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.result-card span { color: #08754b; font-size: .61rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.result-card strong { color: #064e3b; font-size: 2.7rem; line-height: 1.05; margin: 4px 0 14px; }
.result-card strong.decimal-result { color: #047857; font-size: 2rem; margin-bottom: 0; }
.copy-btn { width: 100%; margin-top: 9px; }
.calc-help { background: #f8fafc; border: 1px solid #dbe4ee; border-radius: 10px; overflow: hidden; }
.calc-help summary { padding: 11px 13px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; font-size: .78rem; font-weight: 800; }
.calc-help summary::-webkit-details-marker { display: none; }
.calc-help summary > span:first-child { display: flex; align-items: center; gap: 6px; }
.calc-help-grid { border-top: 1px solid #e2e8f0; padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.calc-help-grid > div { background: #fff; border: 1px solid #e1e8ef; border-radius: 8px; padding: 10px; }
.calc-help-grid h4 { margin: 7px 0 4px; font-size: .8rem; }
.calc-help-grid p { color: #5e7184; font-size: .72rem; line-height: 1.45; }
.format-badge { display: inline-block; border-radius: 5px; padding: 3px 6px; font-size: .58rem; font-weight: 900; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #6d28d9; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 1800; max-width: min(380px, calc(100vw - 44px)); display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-radius: 11px; background: #102e4f; color: #fff; box-shadow: 0 12px 30px rgba(15,40,70,.25); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; font-size: .79rem; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #991b1b; }
.toast .material-symbols-rounded { color: #86efac; }
.toast.error .material-symbols-rounded { color: #fecaca; }

.report-content { padding: 18px 8px 4px; background: #fff; color: #0f2846; }
.report-header { border-bottom: 2px solid #dfe7ef; padding-bottom: 13px; margin-bottom: 15px; }
.report-header h1 { font: 800 1.55rem 'Nunito',sans-serif; color: #163d67; }
.report-header p { color: #60758a; font-size: .78rem; margin-top: 4px; }
.report-section { margin-top: 18px; }
.report-section-title { display: flex; align-items: center; gap: 7px; border-bottom: 1px solid #e1e7ee; padding-bottom: 6px; margin-bottom: 9px; font: 800 1rem 'Nunito',sans-serif; }
.report-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.report-kpi { border: 1px solid #dde6ef; background: #f9fbfd; border-radius: 8px; padding: 9px 10px; }
.report-kpi span { display: block; color: #6d8092; font-size: .64rem; text-transform: uppercase; font-weight: 800; }
.report-kpi strong { display: block; margin-top: 3px; font-size: .88rem; }
.report-base-list { margin: 8px 0 0 18px; color: #455d74; font-size: .76rem; line-height: 1.55; }
.report-case { break-inside: avoid; border: 1px solid #dde6ef; border-radius: 9px; margin: 9px 0; overflow: hidden; }
.report-case-head { padding: 9px 10px; background: #f7f9fc; border-bottom: 1px solid #e5ebf1; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.report-case-head h3 { font-size: .83rem; }
.report-case-body { padding: 10px; font-size: .74rem; color: #41586d; line-height: 1.5; }
.report-case-body p { margin: 3px 0; }
.report-formula { background: #f8fafc; border-left: 3px solid #93c5fd; padding: 7px 8px; margin: 7px 0; font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-size: .7rem; }
.report-diagnosis { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 7px; padding: 7px 8px; margin-top: 7px; }
.report-total { margin-top: 18px; border: 1px solid #a7f3d0; background: #ecfdf5; border-radius: 10px; padding: 13px; text-align: center; }
.report-total span { color: #07734a; font-size: .66rem; font-weight: 900; text-transform: uppercase; }
.report-total strong { display: block; color: #15803d; font-size: 1.8rem; margin-top: 3px; }
.report-warning { border: 1px solid #fecaca; background: #fff7f7; color: #991b1b; border-radius: 8px; padding: 9px; font-size: .75rem; }

@media (max-width: 1320px) {
    .form-grid { grid-template-columns: 1fr 1fr; }
    .theme-blue { grid-column: 1 / -1; }
}
@media (max-width: 800px) {
    .appbar { padding: 9px 12px; align-items: flex-start; }
    .appbar-brand p { display: none; }
    .appbar-actions { gap: 5px; }
    .action-label { display: none; }
    .appbar-action { min-width: 42px; justify-content: center; padding: 8px; }
    .notebook-container { max-width: 100%; margin-top: 0; }
    .binding-holes, .notebook-margin-line { display: none; }
    .content-wrapper { padding: 16px 12px 35px; }
    .form-grid { grid-template-columns: 1fr; }
    .theme-blue { grid-column: auto; }
    .divisor-container, .input-grid, .calc-grid, .calc-help-grid, .report-grid { grid-template-columns: 1fr; }
    .verba-row { grid-template-columns: 1fr 1fr; }
    .verba-row .v-col-name { grid-column: 1 / -1; }
    .verba-row > div:last-child { grid-column: 2; justify-self: end; }
    .header-row { display: none; }
    .add-verba-container { grid-template-columns: 1fr; }
}

@media print {
    .appbar, .intro-strip, .modules-grid, .toast, .modal-overlay { display: none !important; }
    body { background: #fff; }
    .notebook-container { margin: 0; max-width: 100%; box-shadow: none; background: #fff; }
    .binding-holes, .notebook-margin-line { display: none; }
    .content-wrapper { padding: 0; }
    .table-section { box-shadow: none; border: 0; }
}

/* ===== Evolução v2: edição analítica, calendário manual e formatos de hora ===== */
.calendar-edit-toggle { padding-top: 2px; }
.calendar-manual-note { margin-top: 7px; padding: 8px 9px; border-radius: 8px; background: #f0fdf4; border: 1px solid #bbf7d0; color: #397155; font-size: .68rem; line-height: 1.4; }
.calendar-manual-input { width: 62px; margin: 0 auto; padding: 5px 6px; text-align: center; font-weight: 800; color: #138a56; }
.calendar-summary.manual-active { border-color: #86efac; background: #f0fdf4; }
.calendar-summary.manual-active .cal-stat strong { display: none; }
.calendar-summary.manual-active .cal-stat.total strong { display: block; }

.launch-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.launch-toolbar .quick-actions { margin-bottom: 0; flex: 0 0 auto; }
.hours-format-control { min-width: 260px; display: grid; gap: 5px; }
.hours-format-label { display: flex; align-items: center; gap: 5px; color: #526a80; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: #eef3f8; border: 1px solid #dbe4ee; border-radius: 10px; }
.segment { border: 0; background: transparent; color: #526a80; border-radius: 7px; padding: 7px 8px; font-size: .73rem; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 5px; }
.segment small { font-size: .61rem; font-weight: 700; opacity: .72; }
.segment.active { background: #fff; color: #1d4ed8; box-shadow: 0 2px 7px rgba(15,40,70,.09); }
.verba-row input[data-verba-ref], #ref-169 { font-variant-numeric: tabular-nums; }

.result-header-bar { gap: 18px; }
.result-header-actions { display: flex; align-items: center; gap: 14px; }
.result-edit-toggle { display: flex; align-items: center; gap: 8px; color: #fff; cursor: pointer; padding: 5px 7px; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; background: rgba(255,255,255,.07); }
.result-edit-toggle > span:last-child { display: flex; flex-direction: column; line-height: 1.15; }
.result-edit-toggle strong { font-size: .7rem; }
.result-edit-toggle small { color: #cbd9e7; font-size: .58rem; margin-top: 2px; }
.result-edit-toggle .switch input:checked + .slider { background: #22c55e; }
.result-direct-editor { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)) minmax(260px,1.3fr); gap: 10px; padding: 12px 14px; background: #f0f7ff; border-bottom: 1px solid #d7e7f7; }
.result-edit-field { display: flex; flex-direction: column; gap: 4px; }
.result-edit-field label { color: #36516d; font-size: .67rem; font-weight: 800; text-transform: uppercase; }
.result-edit-field input { padding: 7px 8px; background: #fff; }
.result-edit-field small { color: #71869a; font-size: .59rem; line-height: 1.3; }
.result-edit-hint { display: flex; align-items: flex-start; gap: 7px; padding: 8px 9px; border: 1px solid #bfdbfe; border-radius: 8px; background: #fff; color: #526a80; font-size: .65rem; line-height: 1.42; }
.result-edit-input { width: 92px; margin-left: auto; padding: 5px 6px; text-align: right; font-weight: 800; font-size: .78rem; }
.result-edit-stack { display: grid; gap: 5px; justify-items: end; }
.result-edit-stack label { display: grid; grid-template-columns: auto 92px; align-items: center; gap: 6px; color: #6c8093; font-size: .58rem; font-weight: 700; }
.result-edit-stack .computed-note { color: #7b8da0; font-size: .62rem; font-weight: 600; line-height: 1.3; }
.result-editing .data-table tbody tr { background: linear-gradient(90deg,#fff 0,#fbfdff 100%); }
.result-editing .data-table tbody tr:hover { background: #f4f9ff; }

/* Calculadora: soma verde e subtração em vermelho claro */
.calc-box { transition: border-color .2s, box-shadow .2s; border: 2px solid transparent; }
.calc-box.mode-sum { border-color: #86efac; box-shadow: 0 24px 70px rgba(22,163,74,.16); }
.calc-box.mode-sub { border-color: #fecaca; box-shadow: 0 24px 70px rgba(220,38,38,.14); }
.calc-box.mode-sum .calc-operation-card { background: #f0fdf4; border-color: #bbf7d0; }
.calc-box.mode-sub .calc-operation-card { background: #fff7f7; border-color: #fecaca; }
.calc-box.mode-sum #mode-sum.active { background: #dcfce7; color: #166534; border-color: #86efac; }
.calc-box.mode-sub #mode-sub.active { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
#mode-sub.active { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.calc-box.mode-sub .result-card { background: #fff1f2; border-color: #fecdd3; }
.calc-box.mode-sub .result-card span { color: #9f1239; }
.calc-box.mode-sub .result-card strong, .calc-box.mode-sub .result-card strong.decimal-result { color: #9f1239; }
.calc-box.mode-sub .conversion-line .converted { color: #b91c1c; }
.calc-help-didactic { border-top: 1px solid #e2e8f0; padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.help-concept, .help-wide { background: #fff; border: 1px solid #e1e8ef; border-radius: 9px; padding: 11px; }
.help-wide { grid-column: 1 / -1; }
.help-concept h4, .help-wide h4 { display: flex; align-items: center; gap: 5px; margin: 7px 0 5px; font-size: .82rem; }
.help-concept p, .help-wide p, .help-wide li { color: #5e7184; font-size: .72rem; line-height: 1.5; }
.help-example, .help-equation { margin-top: 8px; padding: 8px 9px; border-radius: 7px; background: #f8fafc; border-left: 3px solid #60a5fa; color: #36516d; font-size: .7rem; line-height: 1.45; }
.help-wide:not(.help-subtraction) .help-equation { border-left-color: #22c55e; background: #f0fdf4; }
.help-subtraction { background: #fffafa; border-color: #fecaca; }
.help-subtraction .help-equation { border-left-color: #ef4444; background: #fff1f2; }
.help-tips { background: #fffbeb; border-color: #fde68a; }
.help-tips ul { margin: 6px 0 0 18px; display: grid; gap: 4px; }

@media (max-width: 1050px) {
    .result-direct-editor { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .result-edit-hint { grid-column: 1 / -1; }
    .launch-toolbar { flex-direction: column; }
    .hours-format-control { width: 100%; min-width: 0; }
}
@media (max-width: 800px) {
    .result-header-bar { align-items: flex-start; }
    .result-header-actions { align-items: flex-end; flex-direction: column-reverse; }
    .result-edit-toggle small { display: none; }
    .result-direct-editor { grid-template-columns: 1fr; }
    .result-edit-hint { grid-column: auto; }
    .calc-help-didactic { grid-template-columns: 1fr; }
    .help-wide { grid-column: auto; }
}
.input-invalid { border-color: #ef4444 !important; box-shadow: 0 0 0 3px rgba(239,68,68,.12) !important; background: #fff7f7 !important; }

/* Integração com o shell da Apuração Trabalhista */
.analytics-page { padding-top: 68px; padding-bottom: 88px; }
.analytics-page .notebook-container { margin-top: 14px; }
.analytics-page .appbar { position: fixed; min-height: var(--appbar-h,64px); padding:0; }
.analytics-page .appbar .navbar-brand { color: inherit; }
@media (max-width:800px){.analytics-page{padding-top:64px}.notebook-container{margin-top:0}.analytics-page .content-wrapper{padding-bottom:100px}}

/* v4.7.1 — competência ativa preservada após integração ao shell compartilhado */
.analytics-competence-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin: 0 0 .75rem;
  padding: .38rem .65rem;
  border: 1px solid #cfe8dd;
  border-radius: 999px;
  background: #f3fbf7;
  color: #356452;
  font-size: .78rem;
  font-weight: 600;
}
.analytics-competence-chip .material-symbols-rounded {
  font-size: 1rem;
  color: #13996f;
}
.analytics-competence-chip strong {
  color: #0b6147;
  font-weight: 800;
}

/* v4.7.2 — isonomia visual e entradas numéricas */
body{background-color:#fffdf7!important;background-image:repeating-linear-gradient(0deg,transparent,transparent 31px,#ece7dc 32px)!important}.notebook-container{background-color:rgba(255,255,255,.84);box-shadow:0 10px 30px rgba(15,40,70,.06)}input[data-hours-flex],input[data-shell-decimals],input[type=number]{text-align:right;font-variant-numeric:tabular-nums}


/* ===== v4.7.3 — isonomia final, moeda e organização dos parâmetros ===== */
.analytics-page {
  --shell-paper: #f7f2e8;
  --shell-line: rgba(155, 121, 63, .11);
  background:
    linear-gradient(to bottom, var(--shell-line) 1px, transparent 1px) 0 0 / 100% 32px,
    var(--shell-paper) !important;
}
.analytics-page .notebook-container {
  width: min(1750px, calc(100% - 16px));
  max-width: 1750px;
  margin: 14px auto 32px;
  min-height: calc(100vh - 122px);
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}
.analytics-page .binding-holes,
.analytics-page .notebook-margin-line {
  display: none !important;
}
.analytics-page .content-wrapper {
  padding: 18px 4px 52px;
}

/* Ação e total da base na mesma linha. */
.base-action-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(245px, .82fr);
  gap: 10px;
  align-items: stretch;
  margin-top: 8px;
}
.base-action-summary .add-btn,
.base-action-summary .sum-box {
  min-height: 44px;
  margin: 0 !important;
}
.base-action-summary .sum-box {
  justify-content: space-between;
}

/* Competência e feriados extras lado a lado. */
.calendar-input-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(120px, .65fr);
  gap: 10px;
  align-items: start;
}
.calendar-input-grid > .input-group {
  min-width: 0;
}

/* Prefixo monetário consistente nos inputs editáveis. */
.money-input-wrap {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
  overflow: hidden;
  border: 1px solid #cbd7e4;
  border-radius: 8px;
  background: #fff;
  transition: border-color .16s, box-shadow .16s;
}
.money-input-wrap:focus-within {
  border-color: var(--theme-blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.13);
}
.money-prefix {
  min-width: 38px;
  padding: 0 9px;
  display: grid;
  place-items: center;
  border-right: 1px solid #dbe4ee;
  background: #f8fafc;
  color: #526a80;
  font-size: .75rem;
  font-weight: 850;
  white-space: nowrap;
}
.money-input-wrap > input,
.money-input-wrap > .result-edit-input {
  min-width: 0 !important;
  width: 100% !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #fff;
  text-align: right;
}
.money-input-wrap > input[readonly] {
  background: #f7f9fc;
}
.result-money-wrap {
  width: 112px;
}
.result-edit-stack label {
  grid-template-columns: auto 112px;
}

@media (max-width: 900px) {
  .base-action-summary,
  .calendar-input-grid {
    grid-template-columns: 1fr;
  }
  .analytics-page .notebook-container {
    width: 100%;
    margin-top: 0;
  }
  .analytics-page .content-wrapper {
    padding-inline: 8px;
  }
}


/* ===== v4.7.4 — wide, calendário compacto e edição bidirecional ===== */
.analytics-page .notebook-container {
  width: 100% !important;
  max-width: none !important;
  margin: 0 auto 32px !important;
}
.analytics-page .content-wrapper {
  padding: 8px 0 52px !important;
}
.month-input-button {
  min-height: 38px;
  padding: 7px 8px;
  gap: 5px;
}
.month-input-button .material-symbols-rounded { font-size: 1.05rem; flex: 0 0 auto; }
.month-display {
  min-width: 0;
  font-size: .78rem !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0 !important;
}
.month-display.is-placeholder { font-size: .74rem !important; }
.month-format-help { font-size: .62rem; line-height: 1.25; }
@media (max-width: 900px) {
  .analytics-page .notebook-container { width: 100% !important; }
}

/* r42 — memória explícita e cópia completa */
.analytic-memory-cell{min-width:320px}.analytic-memory-wrap{position:relative;padding-right:24px}.analytic-memory-info{position:absolute;right:0;top:0;display:inline-grid;place-items:center;width:20px;height:20px;padding:0;border:0;border-radius:0;background:transparent;color:#2563eb;box-shadow:none}.analytic-memory-info:hover,.analytic-memory-info:focus-visible{background:transparent;color:#174ea6;outline:0;box-shadow:none}.analytic-memory-info .material-symbols-rounded,.analytic-memory-info .material-icons-round{font-family:'Material Icons Round',sans-serif;font-size:17px}.auto-dsr-label.app-toggle{display:inline-flex;align-items:center;gap:.5rem;padding:.35rem .55rem;border:1px solid #dbe5ef;border-radius:12px;background:#fff}.auto-dsr-label .app-toggle-copy strong,.auto-dsr-label .app-toggle-copy small{display:block}
