:root {
  color-scheme: light;
  --forest: #2c3a1f;
  --forest-deep: #213016;
  --forest-soft: #46563a;
  --sage: #a6bd94;
  --sage-soft: #e5ecdf;
  --gold: #c99253;
  --gold-soft: #f3e4d2;
  --ivory: #f8f6ef;
  --paper: #fffefa;
  --ink: #263126;
  --muted: #6c7568;
  --line: #d9dfd3;
  --success: #367451;
  --success-soft: #e4f1e8;
  --warning: #9a5b12;
  --warning-soft: #fff2d7;
  --danger: #a64036;
  --danger-soft: #fbe9e6;
  --heading: Georgia, "Times New Roman", serif;
  --ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--ui);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--forest-deep); }
body { width: min(100%, 1160px); min-height: 100vh; margin: 0 auto; background: var(--ivory); color: var(--ink); box-shadow: 0 0 40px rgba(0,0,0,.18); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--heading); font-weight: 600; }
h1 { font-size: clamp(24px, 3vw, 32px); }
h2 { font-size: 21px; }
h3 { font-size: 16px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px clamp(18px, 4vw, 42px); background: linear-gradient(135deg, var(--forest-deep), var(--forest)); color: var(--ivory); border-bottom: 1px solid rgba(201,146,83,.38); }
.brand-lockup { display: flex; align-items: center; gap: 14px; }
.cadencia-mark { width: 62px; height: 62px; padding: 6px; border-radius: 16px; background: var(--ivory); }
.product-name { font-family: var(--heading); font-size: 27px; line-height: 1; letter-spacing: .16em; }
.cobrand { display: flex; align-items: center; gap: 6px; margin-top: 7px; color: var(--sage); font-family: var(--heading); font-size: 13px; letter-spacing: .04em; }
.cobrand .cobrand-mark { flex: 0 0 auto; width: 38px; height: 38px; object-fit: contain; filter: drop-shadow(0 1px 4px rgba(201,146,83,.32)); }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.date { color: var(--sage); font-size: 13px; }
.about-button { padding: 6px 10px; border: 1px solid rgba(166,189,148,.4); border-radius: 999px; background: transparent; color: var(--ivory); font-size: 11px; }

.tabs { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: repeat(6, 1fr); border-bottom: 1px solid #cfd7c8; background: rgba(248,246,239,.97); backdrop-filter: blur(10px); }
.tab { padding: 14px 8px 12px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-weight: 750; }
.tab.is-active { border-color: var(--gold); color: var(--forest); }

.app-shell { position: relative; min-height: calc(100vh - 190px); overflow: hidden; padding: 26px clamp(16px, 4vw, 42px) 42px; background: linear-gradient(rgba(44,58,31,.94), rgba(33,48,22,.98)); }
.app-shell::before { content: ""; position: absolute; inset: 0; z-index: 0; background: url("assets/instituto-miranda-background-clean.png") center 7% / min(84vw, 900px) auto no-repeat; opacity: .52; pointer-events: none; }
.view { position: relative; z-index: 1; display: none; }
.view.is-active { display: block; }
#view-today > .section-heading { margin-bottom: 18px; }
.view > .section-heading h1, .view > .section-heading h2 { color: var(--ivory); }
.view > .support-copy { color: #d6e0cf; }
.section-heading, .subheading-row, .dialog-header, .dialog-actions, .task-row, .card-title-row, .calendar-toolbar, .preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.section-heading.compact { margin-bottom: 12px; }
.eyebrow { margin-bottom: 4px; color: var(--gold); font-size: 10px; font-weight: 850; letter-spacing: .13em; }
.support-copy { margin: 7px 0 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.stack { display: grid; gap: 12px; }

.directory-toolbar { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(190px, 240px) auto; align-items: end; gap: 10px; margin-bottom: 8px; padding: 13px; border: 1px solid rgba(217,223,211,.92); border-radius: 13px; background: rgba(255,254,250,.95); }
.directory-toolbar-wide { grid-template-columns: minmax(260px, 1.4fr) repeat(3, minmax(140px, .7fr)) auto; }
.directory-tabs { display: inline-flex; gap: 4px; margin-bottom: 14px; padding: 4px; border-radius: 11px; background: rgba(255,254,250,.92); }
.directory-tab { padding: 8px 16px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 800; }
.directory-tab.is-active { background: var(--forest); color: white; }
.search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.search-field, .compact-field { display: grid; gap: 5px; color: var(--forest); font-size: 10px; font-weight: 800; }
.search-field input, .compact-field select, .compact-field input { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid #c8d0c1; border-radius: 8px; background: white; color: var(--ink); outline: none; }
.search-field input:focus, .compact-field select:focus, .compact-field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.search-button, .sort-button { white-space: nowrap; }
.search-button span { margin-right: 3px; font-size: 17px; line-height: 0; }
.checkbox-control { display: flex; min-height: 38px; align-items: center; gap: 7px; color: var(--forest); font-size: 11px; font-weight: 750; white-space: nowrap; }
.checkbox-control input { accent-color: var(--forest); }
.result-copy { margin: 0 2px 10px; color: #d6e0cf; font-size: 10px; }

.button { min-height: 36px; padding: 8px 13px; border: 1px solid transparent; border-radius: 9px; font-weight: 750; font-size: 12px; }
.button-primary { background: var(--forest); color: white; }
.button-primary:hover { background: var(--forest-deep); }
.button-danger { background: var(--danger); color: white; }
.button-danger:hover { background: #842f28; }
.button-ghost { border-color: var(--line); background: rgba(255,255,255,.86); color: var(--ink); }
.button-small { min-height: 30px; padding: 5px 9px; }
.button-success { background: var(--success); color: white; }
.button[disabled], .text-button[disabled] { cursor: not-allowed; opacity: .45; }
.icon-button { display: inline-flex; width: 34px; height: 34px; flex: 0 0 auto; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--forest); font-family: Arial, sans-serif; font-size: 23px; line-height: 1; text-align: center; }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
#view-today > .summary-grid { grid-template-columns: repeat(4, 1fr); }
.summary-card { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,254,250,.94); }
.summary-card strong { display: block; color: var(--forest); font-family: var(--heading); font-size: 23px; }
.summary-card span { color: var(--muted); font-size: 11px; }

.group-card, .entity-card, .empty-state, .calendar-card, .day-panel { border: 1px solid var(--line); border-radius: 14px; background: rgba(255,254,250,.95); box-shadow: 0 2px 7px rgba(33,48,22,.05); }
.group-card { overflow: hidden; }
.group-card.is-complete { border-color: #abd0b7; }
.group-header { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.group-header.is-collapsible { cursor: pointer; }
.group-header.is-collapsible:hover { background: var(--sage-soft); }
.group-header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.collapse-indicator { color: var(--forest); font-size: 11px; font-weight: 800; }
.group-card.is-complete .group-header { background: var(--success-soft); }
.group-title { font-size: 16px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; background: var(--sage-soft); color: var(--forest); font-size: 10px; font-weight: 800; }
.badge-overdue { background: var(--warning-soft); color: var(--warning); }
.badge-review { background: var(--gold-soft); color: #7f4d19; }
.progress-copy { margin-top: 5px; color: var(--muted); font-size: 11px; }
.progress-track { height: 5px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: #e9ede6; }
.progress-bar { height: 100%; background: var(--gold); transition: width .2s ease; }
.is-complete .progress-bar { background: var(--success); }
.task-list { display: grid; }
.task-row { align-items: flex-start; padding: 13px 16px; border-top: 1px solid #edf0eb; }
.task-row:first-child { border-top: 0; }
.task-row.is-sent { background: #f7faf7; }
.task-row[draggable="true"] { cursor: grab; }
.task-row.is-dragging { opacity: .45; }
.task-info { min-width: 0; }
.task-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.task-meta { margin-top: 4px; color: var(--muted); font-size: 10px; }
.task-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

.entity-card { position: relative; overflow: hidden; padding: 15px 16px; }
.entity-card::after { content: ""; position: absolute; right: -18px; bottom: -24px; width: 100px; height: 94px; background: url("assets/instituto-miranda-mark.png") center/cover; opacity: .045; pointer-events: none; }
.entity-card.is-archived { border-style: dashed; opacity: .72; }
.entity-card p { margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.entity-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 13px; margin-top: 12px; }
.text-button, .text-danger, .text-delete { padding: 0; border: 0; background: transparent; font-size: 11px; font-weight: 750; color: var(--forest); }
.text-danger { color: var(--danger); }
.text-delete { color: #781f18; }
.schedule-details { position: relative; z-index: 1; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 11px; }
.schedule-details summary { cursor: pointer; color: var(--forest); font-size: 11px; font-weight: 750; }
.schedule-details .stage-preview { margin-top: 9px; }
.empty-state { padding: 30px 20px; text-align: center; color: var(--muted); }
.empty-state::before { content: ""; display: block; width: 58px; height: 58px; margin: 0 auto 10px; border-radius: 50%; background: url("assets/instituto-miranda-mark.png") center/cover; opacity: .18; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); font-family: var(--heading); }
.empty-state p { font-size: 12px; line-height: 1.5; }

.calendar-card { padding: 16px; }
.calendar-toolbar { margin-bottom: 14px; }
.calendar-toolbar h2 { color: var(--forest); }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays span { padding: 7px; text-align: center; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.calendar-grid { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); gap: 1px; }
.calendar-day { position: relative; min-height: 104px; padding: 8px; border: 0; background: var(--paper); text-align: left; color: var(--ink); }
.calendar-day.is-outside { background: #f1f1ec; color: #a0a69c; }
.calendar-day.is-weekend, .calendar-day.is-closed { background: #f1eee8; }
.calendar-day.is-today { box-shadow: inset 0 0 0 2px var(--gold); }
.calendar-day.is-selected { box-shadow: inset 0 0 0 3px var(--forest); }
.calendar-day.is-drop-target { background: var(--sage-soft); box-shadow: inset 0 0 0 3px var(--sage); }
.day-number { display: flex; align-items: flex-start; justify-content: space-between; gap: 5px; font-size: 12px; font-weight: 800; }
.closed-status { display: grid; min-width: 0; max-width: calc(100% - 24px); justify-items: end; gap: 1px; text-align: right; }
.closed-mark { color: var(--warning); font-size: 9px; font-weight: 700; }
.closed-reason { display: block; max-width: 100%; overflow: hidden; color: var(--muted); font-size: 8px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.day-counts { display: grid; gap: 4px; margin-top: 8px; }
.day-count { overflow: hidden; padding: 3px 5px; border-radius: 5px; background: var(--sage-soft); color: var(--forest); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.day-count.is-sent { background: var(--success-soft); color: var(--success); }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; color: var(--muted); font-size: 10px; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sage); }
.legend-dot.sent { background: var(--success); }
.legend-dot.closed { background: #d8c4a9; }
.legend-dot.reopened { background: var(--gold); }
.calendar-day.is-reopened { background: #fff8e9; }
.reopened-mark { color: var(--success); font-size: 9px; font-weight: 750; }
.day-panel { margin-top: 16px; padding: 16px; }

.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20,29,14,.62); backdrop-filter: blur(2px); }
.dialog { position: relative; z-index: 1; width: min(100%, 620px); max-height: 92vh; overflow: auto; padding: 20px; border: 1px solid rgba(201,146,83,.4); border-radius: 18px; background: var(--ivory); box-shadow: 0 18px 48px rgba(0,0,0,.26); }
.dialog-wide { width: min(100%, 820px); }
.dialog-header { gap: 8px; margin-bottom: 17px; }
.dialog-header > h2 { margin-right: auto; }
.dialog-header > .info-button, .dialog-header > .icon-button { flex: 0 0 auto; }
.field { display: grid; gap: 6px; margin-bottom: 13px; color: #3c4937; font-size: 11px; font-weight: 750; }
.field input, .field select, .field textarea { width: 100%; padding: 10px 11px; border: 1px solid #c8d0c1; border-radius: 8px; background: white; color: var(--ink); font-weight: 450; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.field-help, .choice-guidance { color: var(--muted); font-size: 10px; font-weight: 450; line-height: 1.45; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-box { display: grid; gap: 8px; margin: 4px 0 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.choice-box legend { padding: 0 4px; color: var(--forest); font-size: 11px; font-weight: 800; }
.choice-box label { display: flex; align-items: flex-start; gap: 8px; color: var(--ink); font-size: 11px; line-height: 1.4; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.choice-row label { white-space: nowrap; }
.subheading-row { align-items: flex-start; margin: 17px 0 10px; }
.subheading-row p { margin-top: 2px; color: var(--muted); font-size: 10px; }
.item-editor { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.72); }
.item-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 9px; }
.field-wide { grid-column: 1 / -1; }
.dialog-actions { justify-content: flex-end; margin-top: 19px; padding-top: 15px; border-top: 1px solid var(--line); }
.form-error { min-height: 16px; margin-top: 8px; color: var(--danger); font-size: 11px; }
.stage-preview { display: grid; gap: 7px; margin-top: 4px; }
.stage-option { display: flex; align-items: flex-start; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.64); font-size: 11px; }
.stage-option small { display: block; margin-top: 2px; color: var(--muted); }
.warning-box { margin: 10px 0; padding: 11px 12px; border-left: 4px solid var(--gold); border-radius: 7px; background: var(--gold-soft); color: #68431d; font-size: 11px; line-height: 1.5; }
.warning-box strong, .warning-box span { display: block; }
.warning-box span { margin-top: 3px; }
.warning-danger { border-left-color: var(--danger); background: var(--danger-soft); color: #702921; }
.context-card { margin-bottom: 13px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.context-card strong { display: block; }
.context-card span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.preview-toolbar { justify-content: flex-start; flex-wrap: wrap; margin: 12px 0; }
.preview-list { display: grid; gap: 7px; max-height: 330px; overflow: auto; }
.preview-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: white; font-size: 11px; }
.closure-choice { grid-template-columns: minmax(150px,1.2fr) minmax(190px,1fr) minmax(145px,.7fr); }
.closure-choice select, .closure-choice input { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 7px; }
.preview-item.is-locked { opacity: .55; }
.preview-item strong { display: block; }
.preview-item small { color: var(--muted); }
.preview-dates { font-weight: 750; white-space: nowrap; }

.about-dialog { text-align: center; }
.about-logo { width: 92px; height: 92px; }
.about-product { margin-top: 8px; color: var(--forest); font-family: var(--heading); font-size: 28px; letter-spacing: .15em; }
.about-copy { margin-top: 12px; font-size: 13px; }
.about-legal { margin: 12px auto 0; max-width: 480px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.version-copy { margin-top: 16px; color: var(--gold); font-size: 11px; font-weight: 800; }

.info-button { display: inline-grid; width: 24px; height: 24px; place-items: center; border: 1px solid var(--gold); border-radius: 50%; background: rgba(255,254,250,.92); color: var(--forest); font-family: Georgia,serif; font-size: 13px; font-weight: 800; line-height: 1; }
.label-with-info { display: flex; align-items: center; gap: 7px; }

.finance-toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
.finance-toolbar > * { min-width: 0; }
.account-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 22px; }
.account-summary .summary-card { min-width: 160px; flex: 0 1 210px; }
.financial-card { border-left: 4px solid var(--gold); }
.financial-card .finance-values { color: var(--forest); font-weight: 750; }
.finance-overdue { background: #f7d9d5; color: #8b2f28; }
.finance-partial { background: #fff0cf; color: #80530b; }
.finance-paid { background: #dfeedd; color: #285b2b; }
.allocation-row { display: grid; grid-template-columns: minmax(180px,1fr) minmax(110px,.45fr) minmax(110px,.5fr) auto; gap: 8px; align-items: center; }
.allocation-row select, .allocation-row input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.three-columns { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.transfer-history { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.finance-breakdowns { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 0 0 22px; }
.finance-breakdown { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.72); }
.finance-breakdown h3 { margin-bottom: 8px; font-size: 14px; }
.finance-breakdown .account-summary { margin: 0; }
.finance-breakdown .summary-card { min-width: 0; flex: 1 1 120px; }

@media (max-width: 860px) {
  .finance-toolbar { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .three-columns { grid-template-columns: 1fr; }
  .allocation-row { grid-template-columns: 1fr; }
  .finance-breakdowns { grid-template-columns: 1fr; }
}
.label-with-info .info-button { width: 20px; height: 20px; padding: 0; font-size: 11px; }
.help-content { display: grid; gap: 10px; color: var(--ink); font-size: 13px; line-height: 1.6; }
.help-section { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.7); }
.help-section h3 { color: var(--forest); font-size: 14px; }
.help-section p { margin-top: 4px; }
.help-example { color: var(--muted); font-size: 11px; }
.help-note { padding: 10px; border-radius: 8px; background: var(--sage-soft); color: var(--forest); font-size: 11px; }
.modal-copy { margin: -5px 0 14px; }
.patient-picker { position: relative; }
.patient-picker > input[type="search"] { width: 100%; padding: 10px 11px; border: 1px solid #c8d0c1; border-radius: 8px; background: white; color: var(--ink); }
.patient-picker > input[type="search"]:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); outline: none; }
.picker-results { position: absolute; z-index: 8; top: calc(100% + 3px); right: 0; left: 0; max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; background: white; box-shadow: 0 10px 24px rgba(20,29,14,.16); }
.picker-option { display: grid; width: 100%; padding: 9px 11px; border: 0; border-bottom: 1px solid #edf0eb; background: white; color: var(--ink); text-align: left; }
.picker-option:hover, .picker-option:focus { background: var(--sage-soft); outline: none; }
.picker-option strong { font-size: 11px; }
.picker-option span, .picker-empty, .picker-guidance { color: var(--muted); font-size: 10px; }
.picker-empty, .picker-guidance { padding: 10px 11px; }
.selected-patients { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.selected-patient { display: inline-grid; grid-template-columns: 1fr auto; column-gap: 7px; align-items: center; padding: 6px 8px; border: 1px solid #b6c9a7; border-radius: 9px; background: var(--sage-soft); }
.selected-patient strong { font-size: 10px; }
.selected-patient small { grid-column: 1; color: var(--muted); font-size: 9px; }
.selected-patient-remove { grid-column: 2; grid-row: 1 / 3; padding: 0 2px; border: 0; background: transparent; color: var(--danger); font-size: 16px; }
.compact-person-picker { min-width: 0; width: 100%; }
.compact-person-picker > input[type="search"] { min-width: 0; }
.compact-person-picker .selected-patients { margin-top: 4px; }
.compact-person-picker .selected-patient { width: 100%; }
.financial-origin-pair { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.description-presets { align-self: stretch; min-width: 0; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.58); }
.description-presets legend { padding: 0 4px; color: var(--forest); font-size: 10px; font-weight: 800; }
.description-preset-options { display: flex; min-height: 30px; flex-wrap: wrap; align-items: center; gap: 6px; }
.description-preset { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border: 1px solid #c8d0c1; border-radius: 8px; background: white; color: var(--forest); font-size: 10px; font-weight: 750; }
.description-preset-empty { color: var(--muted); font-size: 10px; line-height: 1.35; }
.financial-method-management, .financial-description-management { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.calendar-events { display: grid; gap: 3px; margin-top: 7px; }
.calendar-event-count { overflow: hidden; padding: 2px 5px; border-radius: 5px; background: var(--sage-soft); color: var(--forest); font-size: 8px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event-count.is-birthday { background: #f6e8d6; color: #7a4c1c; }
.calendar-event-count.is-reminder { background: #e7e4f3; color: #4d456f; }
.calendar-event-count.is-finance { background: #e2edf0; color: #315966; }
.calendar-event-count.is-draggable { cursor: grab; outline: 1px dashed transparent; transition: outline-color .15s, transform .15s; }
.calendar-event-count.is-draggable:hover { outline-color: currentColor; transform: translateY(-1px); }
.calendar-event-count.is-dragging { cursor: grabbing; opacity: .45; }
.today-finance-category + .today-finance-category { border-top: 1px solid var(--line); }
.today-finance-category > h4 { margin: 0; padding: 12px 16px 7px; color: var(--forest); font-family: var(--heading); font-size: 13px; }
.today-finance-category > .task-meta { margin: 0; padding: 0 16px 12px; }
.calendar-detail-section + .calendar-detail-section { margin-top: 14px; }
.calendar-detail-section > h3 { margin-bottom: 8px; color: var(--forest); }
.completed-section { display: grid; gap: 8px; }
.completed-section + .completed-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.completed-section > h3 { color: var(--forest); font-size: 15px; }
.protocol-tags { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.protocol-tag { display: inline-flex; align-items: center; overflow: hidden; border: 1px solid #b6c9a7; border-radius: 999px; background: var(--sage-soft); }
.protocol-tag-name, .protocol-tag-remove { border: 0; background: transparent; color: var(--forest); font-size: 10px; font-weight: 800; }
.protocol-tag-name { padding: 5px 5px 5px 9px; }
.protocol-tag-remove { padding: 4px 8px 5px 4px; color: var(--danger); font-size: 15px; line-height: 1; }
.no-protocol { padding: 5px 9px; border: 1px dashed var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; }
.birthday-fields { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 9px; }
.birthday-fields .field { margin-bottom: 0; }
.today-section { margin-bottom: 14px; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; }
.filter-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
.filter-columns fieldset { display: grid; gap: 7px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.filter-columns legend { color: var(--forest); font-size: 10px; font-weight: 800; }
.variable-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin: -5px 0 12px; }
.variable-buttons button { padding: 5px 8px; border: 1px solid var(--sage); border-radius: 999px; background: var(--sage-soft); color: var(--forest); font-size: 10px; font-weight: 750; }
.contact-editor .whatsapp-authorization { padding: 9px; border-radius: 8px; background: var(--sage-soft); }
.document-editor, .contact-editor { position: relative; }
.queue-row-opened { border-color: var(--gold); background: var(--gold-soft); }
.issue-card { padding: 10px 12px; border: 1px solid #e2c2bd; border-radius: 9px; background: var(--danger-soft); color: #702921; font-size: 11px; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 12px; }
.inline-form input { padding: 9px 10px; border: 1px solid #c8d0c1; border-radius: 8px; }
.backup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.backup-grid .context-card { margin: 0; }
.backup-grid h3 { margin-bottom: 12px; }

.app-footer { display: flex; justify-content: space-between; gap: 16px; padding: 14px clamp(18px,4vw,42px); border-top: 1px solid rgba(201,146,83,.25); background: var(--forest-deep); color: var(--sage); font-size: 10px; }
.app-footer button { padding: 0; border: 0; background: transparent; color: var(--gold); font-size: 10px; }
.toast { position: fixed; z-index: 40; right: 22px; bottom: 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 280px; max-width: 520px; padding: 12px 14px; border-radius: 10px; background: var(--forest-deep); color: white; font-size: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.22); }
.toast button { border: 0; background: transparent; color: var(--gold); font-weight: 800; }

@media (max-width: 720px) {
  .topbar { align-items: flex-start; padding: 14px 16px; }
  .cadencia-mark { width: 50px; height: 50px; }
  .product-name { font-size: 21px; }
  .date { display: none; }
  .tabs { overflow-x: auto; }
  .tab { min-width: 90px; font-size: 12px; }
  .app-shell { padding: 20px 12px 32px; }
  .calendar-card { padding: 8px; overflow-x: auto; }
  .calendar-weekdays, .calendar-grid { min-width: 650px; }
  .summary-grid { grid-template-columns: 1fr 1fr 1fr; }
  #view-today > .summary-grid { grid-template-columns: 1fr 1fr; }
  .directory-toolbar, .directory-toolbar-wide { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; }
  .heading-actions { max-width: 58%; }
  .search-form { grid-template-columns: minmax(0, 1fr) auto; }
  .checkbox-control { min-height: auto; padding: 4px 0; }
  .task-row { display: grid; }
  .task-actions { justify-content: flex-start; }
  .two-columns, .item-editor-grid, .backup-grid, .check-grid, .filter-columns, .closure-choice, .financial-origin-pair { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .app-footer { display: grid; }
}

/* Estilos de Autenticação (SaaS / Web App) */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #1b3528 0%, #0d1e16 100%);
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  color: #1a2a20;
}
.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
}
.auth-header h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #1a382b;
  margin: 0 0 4px 0;
}
.auth-header p {
  font-size: 13px;
  color: #617368;
  margin: 0;
}
.auth-card .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.auth-card .field span {
  font-size: 12px;
  font-weight: 600;
  color: #3b4e43;
}
.auth-card input {
  padding: 12px 14px;
  border: 1px solid #c8d3cb;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.auth-card input:focus {
  border-color: #2b5e47;
}
.auth-submit {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
  margin-top: 8px;
  cursor: pointer;
}
.auth-footer-copy {
  text-align: center;
  font-size: 11px;
  color: #8c9e93;
  margin-top: 24px;
  margin-bottom: 0;
}
.user-badge {
  font-size: 11px;
  color: var(--sage);
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

