@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("./assets/fonts/manrope-latin-variable.woff2") format("woff2");
}

@font-face {
  font-family: "Noto Serif";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./assets/fonts/noto-serif-latin-variable.woff2") format("woff2");
}

@font-face {
  font-family: "Dancing Script";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./assets/fonts/dancing-script-latin-variable.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --color-primary: #34134c;
  --color-primary-container: #4b2a63;
  --color-primary-hover: #6a3f8c;
  --color-on-primary: #ffffff;
  --color-on-primary-soft: #d9c6e6;
  --color-secondary: #774b99;
  --color-accent: #c6a96b;
  --color-accent-soft: #f1e8d4;
  --color-accent-text: #76520c;
  --color-focus: #6a3f8c;
  --color-control-outline: #817782;
  --color-background: #fbf9f5;
  --color-surface: #ffffff;
  --color-surface-low: #f5f3ef;
  --color-surface-mid: #f0eeea;
  --color-surface-high: #eae8e4;
  --color-text: #1b1c1a;
  --color-text-soft: #4b444e;
  --color-muted: #6f6f6f;
  --color-outline: #cec3cf;
  --color-success: #39785f;
  --color-success-soft: #e9f3ed;
  --color-warning: #76520c;
  --color-warning-soft: #fff6df;
  --color-error: #ba1a1a;
  --color-error-soft: #fcebea;
  --font-heading: "Noto Serif", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-script: "Dancing Script", cursive;
  --space-1: .5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgb(52 19 76 / .06);
  --shadow-md: 0 8px 22px rgb(52 19 76 / .08);
  --shadow-lg: 0 22px 55px rgb(52 19 76 / .16);
  --control-height: 40px;
  --content-max: 1180px;
  --focus-ring: 0 0 0 3px rgb(106 63 140 / .45);
  --state-info: #355f8a;
  --state-info-soft: #edf5fc;
  --overlay: rgb(27 28 26 / .58);

  /* Compatibilidade com os nomes usados pela aplicação. */
  --ink: var(--color-text);
  --muted: var(--color-muted);
  --line: var(--color-outline);
  --paper: var(--color-surface);
  --canvas: var(--color-background);
  --green: var(--color-primary);
  --green-2: var(--color-secondary);
  --mint: var(--color-accent-soft);
  --gold: var(--color-accent);
  --red: var(--color-error);
  font-family: var(--font-body);
  font-synthesis: none;
}

* { box-sizing: border-box; }
/* Estados ocultos devem prevalecer sobre display: grid/flex dos componentes. */
[hidden] { display: none !important; }
/* A consulta de orcamentos nunca oculta o documento inteiro. A sessao Comercial observada em
   producao recebeu `display:none` no body e colapsou a pagina, embora o DOM estivesse completo. */
body.orcamentos-body, body.orcamentos-body[hidden] { display: block !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--color-background); color: var(--color-text); font-size: 16px; line-height: 1.55; }
body:not([data-papel]) [data-requer-papel] { visibility: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }

.topbar {
  min-height: 78px;
  padding: 12px max(28px, calc((100vw - 1360px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgb(251 249 245 / .96);
  border-bottom: 1px solid rgb(198 169 107 / .38);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-logo { display: block; width: 158px; height: auto; }
.brand-mark { width: 48px; height: 48px; border-radius: 50%; background: var(--color-primary); color: white; border: 2px solid var(--color-accent); display: grid; place-items: center; font-family: var(--font-heading); font-size: 17px; font-weight: 600; letter-spacing: .04em; box-shadow: 0 0 0 4px rgb(198 169 107 / .12); }
.brand strong, .brand span { display: block; }
.brand strong { color: var(--color-primary); font-family: var(--font-heading); font-size: 16px; letter-spacing: .04em; }
.brand span { color: var(--color-muted); font-size: 12px; margin-top: 1px; letter-spacing: .08em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.draft-save-state {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  padding: 6px 9px;
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  background: var(--color-surface);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}
.draft-save-state[data-state="dirty"], .draft-save-state[data-state="saving"] {
  border-color: var(--color-accent);
  color: var(--color-warning);
  background: var(--color-warning-soft);
}
.draft-save-state[data-state="saved"] {
  border-color: var(--color-success);
  color: var(--color-success);
  background: var(--color-success-soft);
}
.local-badge { display: inline-flex; align-items: center; gap: 8px; color: var(--color-text-soft); font-size: 12px; font-weight: 700; margin-right: 8px; letter-spacing: .04em; }
.local-badge i, .live-dot { width: 7px; height: 7px; background: var(--color-success); border-radius: 50%; box-shadow: 0 0 0 4px rgb(57 120 95 / .14); }

.button { min-height: var(--control-height); width: auto; align-self: center; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 15px; font-weight: 700; font-size: 12px; line-height: 1.2; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; white-space: nowrap; transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .15s ease, opacity .2s ease; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.button[aria-busy="true"] { cursor: progress; opacity: .72; transform: none; }
.button.dark { background: var(--color-primary); color: white; box-shadow: var(--shadow-md); }
.button.dark:hover { background: var(--color-primary-hover); }
.button.ghost { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.button.ghost:hover { background: rgb(52 19 76 / .06); }
.button.danger { color: var(--color-error); border-color: var(--color-error); background: transparent; box-shadow: none; }
.button.danger:hover { background: var(--color-error-soft); }
.button.full { width: 100%; }
.action-group, .form-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
.form-actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--color-surface-high); }

main { width: min(1360px, calc(100% - 56px)); margin: 0 auto; }
.hero { position: relative; padding: 44px 0 30px; display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 56px; align-items: center; }
.hero::before { content: ""; position: absolute; width: 310px; height: 310px; right: 3%; top: -150px; z-index: -1; border-radius: 50%; background: rgb(198 169 107 / .10); }
.eyebrow { margin: 0 0 10px; color: var(--color-accent-text); font-family: var(--font-script); font-size: 20px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.hero h1 { max-width: 720px; margin: 0; color: var(--color-primary); font-family: var(--font-heading); font-size: clamp(32px, 3.4vw, 46px); font-weight: 700; line-height: 1.15; letter-spacing: .025em; text-wrap: balance; }
.hero-copy { max-width: 790px; margin: 22px 0 0; color: var(--color-text-soft); font-size: 14px; line-height: 1.75; }
.budget-hero { display: block; padding: 30px 0 18px; }
.budget-hero-content { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; min-width: 0; }
.budget-hero-copy { min-width: 0; }
.budget-hero #orcamento-identidade { max-width: 760px; margin: 7px 0 0; color: var(--color-text-soft); font-size: 13px; }
.budget-hero .draft-save-state { flex: 0 0 auto; margin: 0 0 4px; }
.confidence-note { border: 1px solid rgb(198 169 107 / .52); border-left: 4px solid var(--color-accent); background: var(--color-surface); border-radius: var(--radius-md); padding: 20px 22px; box-shadow: var(--shadow-sm); }
.confidence-note span, .confidence-note strong, .confidence-note small { display: block; }
.confidence-note span { color: var(--color-accent-text); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; }
.confidence-note strong { color: var(--color-primary); margin: 8px 0; font-family: var(--font-heading); font-size: 15px; }
.confidence-note small { color: var(--color-text-soft); line-height: 1.55; }

.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--color-surface); border: 1px solid rgb(198 169 107 / .35); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.metric-strip article { padding: 20px 22px; border-right: 1px solid rgb(198 169 107 / .28); }
.metric-strip article:last-child { border: 0; }
.metric-strip article.accent { background: var(--color-primary); color: white; }
.metric-strip span, .metric-strip strong, .metric-strip small { display: block; }
.metric-strip span { color: var(--color-text-soft); font-size: 12px; text-transform: uppercase; font-weight: 700; letter-spacing: .09em; }
.metric-strip strong { color: var(--color-primary); font-family: var(--font-heading); font-size: 23px; margin: 6px 0 3px; }
.metric-strip small { color: var(--color-muted); font-size: 12px; }
.metric-strip .accent strong { color: white; }
.metric-strip .accent span, .metric-strip .accent small { color: var(--color-on-primary-soft); }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 22px; align-items: start; padding: 24px 0; }
.workspace-main { min-width: 0; display: grid; gap: 18px; }
.panel, .results-panel { background: var(--color-surface); border: 1px solid rgb(198 169 107 / .3); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.panel { padding: 25px; transition: border-color .2s ease, box-shadow .2s ease; }
.panel:hover { border-color: rgb(198 169 107 / .7); box-shadow: var(--shadow-md); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.panel-heading > div { display: flex; align-items: flex-start; gap: 13px; min-width: 0; }
.panel-heading-main { flex: 1 1 auto; }
.panel-heading-copy { min-width: 0; }
.panel-heading h2 { color: var(--color-primary); font-family: var(--font-heading); font-size: 19px; margin: 0 0 3px; letter-spacing: .02em; }
.panel-heading p { color: var(--color-muted); font-size: 12px; line-height: 1.45; margin: 0; overflow-wrap: anywhere; }
.step { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; background: var(--color-primary); color: var(--color-accent); border: 1px solid var(--color-accent); border-radius: 50%; font-family: var(--font-heading); font-size: 12px; font-weight: 700; }
.panel-kpi { flex: 0 0 auto; background: var(--color-accent-soft); color: var(--color-primary); border-radius: var(--radius-sm); padding: 8px 11px; font-size: 12px; font-weight: 700; white-space: nowrap; }

.procedure-grid { display: grid; grid-template-columns: minmax(360px, 2fr) 1fr 1fr; gap: 13px; align-items: stretch; }
.item-picker { display: grid; grid-template-columns: minmax(0, 1fr) 190px auto; gap: 13px; margin-top: 13px; align-items: end; }
.budget-item-picker { grid-template-columns: minmax(0, 1fr) 190px 216px; }
.item-picker .add-budget-item { height: 43px; align-self: end; }
.item-picker-help { display: grid; grid-template-columns: minmax(0, 1fr) 190px 216px; align-items: start; gap: 13px; min-height: 26px; padding-top: 7px; }
.selection-help, .field-rule { margin: 0; color: var(--color-muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.field-rule { grid-column: 2; text-align: left; }
.supply-action { height: 43px; white-space: nowrap; }
.active-procedure-card { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 14px; border: 1px solid rgb(198 169 107 / .55); border-radius: var(--radius-md); background: var(--color-surface-low); }
.active-procedure-card > div { min-width: 0; }
.active-procedure-card span, .active-procedure-card strong, .active-procedure-card small { display: block; }
.active-procedure-card span { color: var(--color-accent-text); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.active-procedure-card strong { color: var(--color-primary); margin-top: 4px; font-family: var(--font-heading); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.active-procedure-card small { margin-top: 4px; color: var(--color-muted); font-size: 12px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.active-procedure-card .button { flex: 0 0 auto; padding: 8px 11px; font-size: 12px; }
.active-procedure-card.empty { background: #fffaf0; border-color: var(--color-accent); }
.field { display: grid; gap: 7px; min-width: 0; }
.field[hidden] { display: none !important; }
.composition-confirmed { color: var(--success, #18794e); font-weight: 700; }
.no-supplies-field { margin-bottom: 18px; }
.field > span { color: var(--color-text-soft); font-size: 12px; font-weight: 700; letter-spacing: .01em; }
.field small { color: var(--color-muted); font-size: 12px; margin-top: -2px; }
.field input, .field select, .field textarea { width: 100%; background: var(--color-background); color: var(--color-text); border: 1px solid var(--color-control-outline); border-radius: var(--radius-sm); outline: none; padding: 0 12px; font-size: 14px; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.field input, .field select { height: 43px; }
.field textarea { padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgb(52 19 76 / .1); background: white; }
.field input[aria-invalid="true"] { border-color: var(--color-error); background: var(--color-error-soft); }
.field input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgb(186 26 26 / .16); }
.field input[readonly] { color: var(--color-primary); background: var(--color-surface-mid); font-weight: 700; }
.input-suffix, .percent-input, .money-input { position: relative; width: 100%; min-width: 0; }
.input-suffix input { padding-right: 48px; }
.input-suffix em, .percent-input b, .money-input b { position: absolute; top: 50%; transform: translateY(-50%); color: var(--color-secondary); font-size: 12px; font-style: normal; pointer-events: none; }
.input-suffix em, .percent-input b { right: 12px; }
.money-input b { left: 12px; }
.money-input input { padding-left: 35px; }
.percent-input input { padding-right: 31px; }
.search-field { position: relative; }
.search-field > label { color: var(--color-text-soft); font-size: 12px; font-weight: 700; letter-spacing: .01em; }
.search-results { display: none; position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 5px); background: white; border: 1px solid var(--color-outline); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); max-height: 320px; overflow: auto; }
.search-results.open { display: block; }
.search-result { width: 100%; border: 0; border-bottom: 1px solid var(--color-surface-high); background: white; display: grid; grid-template-columns: 1fr auto; gap: 15px; text-align: left; padding: 12px 14px; }
.search-result[role="option"] { cursor: pointer; }
.search-result:last-child { border: 0; }
.search-result:hover, .search-result.is-active, .search-result[aria-selected="true"] { background: var(--color-surface-low); box-shadow: inset 3px 0 0 var(--color-secondary); }
.search-result strong, .search-result small { display: block; }
.search-result strong { color: var(--color-primary); font-family: var(--font-heading); font-size: 12px; }
.search-result small { color: var(--color-muted); margin-top: 4px; }
.search-result em { color: var(--color-secondary); font-size: 12px; font-style: normal; font-weight: 700; white-space: nowrap; }
.search-no-result { color: var(--color-muted); padding: 18px; font-size: 12px; text-align: center; }
.search-result-tools { position: sticky; bottom: 0; padding: 8px; border-top: 1px solid var(--color-surface-high); background: white; }
.search-result-tools[hidden] { display: none; }
.search-result-tools .button { width: 100%; }

.empty-state { margin-top: 18px; border: 1px dashed var(--color-accent); background: var(--color-surface-low); border-radius: var(--radius-md); min-height: 118px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--color-muted); }
.empty-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: var(--color-primary); background: var(--color-accent); font-size: 19px; margin-bottom: 8px; }
.empty-state strong { color: var(--color-primary); font-family: var(--font-heading); font-size: 12px; }
.empty-state span { font-size: 12px; margin-top: 4px; }
.table-wrap { margin-top: 18px; overflow-x: auto; }
.items-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.items-table th { color: var(--color-primary); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; text-align: left; background: var(--color-surface-low); padding: 10px; }
.items-table td { border-bottom: 1px solid var(--color-surface-high); padding: 10px; vertical-align: middle; }
.items-table td > small { display: block; margin-top: 4px; color: var(--color-muted); line-height: 1.45; }
.items-table th:nth-child(n+2), .items-table td:nth-child(n+2) { text-align: right; }
.items-table input { width: 72px; height: 34px; padding: 5px 7px; border: 1px solid var(--color-outline); border-radius: var(--radius-sm); text-align: right; }
.item-name { min-width: 230px; }
.item-name strong, .item-name small { display: block; }
.item-name strong { color: var(--color-primary); }
.item-name small { color: var(--color-muted); margin-top: 4px; max-width: 420px; }
.remove-item { border: 1px solid rgb(186 26 26 / .2); background: var(--color-error-soft); color: var(--color-error); width: 28px; height: 28px; border-radius: var(--radius-sm); font-weight: 700; }
.composition-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--color-surface-high); }
.composition-actions span { color: var(--color-muted); font-size: 12px; line-height: 1.5; }
/* Aviso de item defasado: informa a diferença, nunca a corrige por baixo. */
.composition-notice { margin-top: 14px; background: var(--color-warning-soft); border: 1px solid var(--color-accent); border-radius: var(--radius-md); padding: 11px 14px; }
.composition-notice strong { display: block; color: var(--color-primary); font-size: 12px; line-height: 1.5; }
.composition-notice ul { margin: 6px 0 0; padding-left: 15px; color: var(--color-muted); font-size: 12px; line-height: 1.6; }
.promote-target { color: var(--color-muted); font-size: 12px; margin: 0 0 8px; }
.promote-diff { margin: 0; padding-left: 16px; color: var(--color-muted); font-size: 12px; line-height: 1.7; }

.form-grid { display: grid; gap: 13px; }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-context-note { grid-column: 4; display: flex; align-items: center; gap: 7px; min-width: 0; margin: -3px 0 0; color: var(--color-muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.form-context-note::before { content: ""; width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: var(--color-accent); }
.cost-bar { display: flex; align-items: center; gap: 18px; margin-top: 20px; background: var(--color-surface-low); border-left: 3px solid var(--color-accent); border-radius: var(--radius-md); padding: 14px 17px; }
.cost-bar div { min-width: 110px; }
.cost-bar span, .cost-bar strong { display: block; }
.cost-bar span { color: var(--color-muted); font-size: 12px; text-transform: uppercase; font-weight: 700; letter-spacing: .07em; }
.cost-bar strong { color: var(--color-primary); font-family: var(--font-heading); font-size: 14px; margin-top: 4px; }
.cost-bar > i { color: var(--color-accent); font-style: normal; }
.cost-bar .total { margin-left: auto; text-align: right; }
.cost-bar .total strong { color: var(--color-secondary); font-size: 17px; }
.link-button { border: 0; background: transparent; color: var(--color-secondary); text-decoration: underline; text-underline-offset: 3px; font-size: 12px; font-weight: 700; }
.rate-breakdown { margin-top: 15px; border-left: 3px solid var(--color-accent); background: var(--color-accent-soft); color: var(--color-text-soft); border-radius: 0 var(--radius-md) var(--radius-md) 0; padding: 11px 13px; font-size: 12px; line-height: 1.5; }

.results-panel { position: sticky; top: 98px; overflow: hidden; }
.results-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; background: var(--color-surface-low); border-bottom: 1px solid rgb(198 169 107 / .3); }
.results-head > div { display: flex; align-items: center; gap: 9px; color: var(--color-primary); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.results-head small { color: var(--color-muted); font-size: 12px; }
.result-primary { position: relative; background: var(--color-primary); color: white; padding: 27px 22px; overflow: hidden; }
.result-primary::after { content: ""; position: absolute; width: 140px; height: 140px; right: -70px; top: -70px; border-radius: 50%; border: 1px solid rgb(198 169 107 / .35); }
.result-primary span, .result-primary strong, .result-primary small { position: relative; z-index: 1; display: block; }
.result-primary span { color: var(--color-accent); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.result-primary strong { font-family: var(--font-heading); font-size: 39px; letter-spacing: .01em; margin: 7px 0 2px; }
.result-primary small { color: var(--color-on-primary-soft); }
.price-grid { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--color-surface-high); }
.price-grid article { padding: 15px 17px; border-right: 1px solid var(--color-surface-high); border-bottom: 1px solid var(--color-surface-high); }
.price-grid article:nth-child(even) { border-right: 0; }
.price-grid article:nth-child(n+3) { border-bottom: 0; }
.price-grid span, .price-grid strong, .price-grid small { display: block; }
.price-grid span { color: var(--color-muted); font-size: 12px; text-transform: uppercase; font-weight: 700; letter-spacing: .06em; }
.price-grid strong { color: var(--color-primary); margin: 4px 0 2px; font-family: var(--font-heading); font-size: 17px; }
.price-grid small { color: var(--color-muted); font-size: 12px; }
.price-grid .campaign strong { color: var(--color-secondary); }
.price-grid .floor strong { color: var(--color-warning); }
.commercial-status { margin: 16px 17px 0; border-radius: var(--radius-md); padding: 12px 13px; background: var(--color-surface-low); border-left: 3px solid var(--color-outline); }
.commercial-status.safe { background: var(--color-success-soft); border-color: var(--color-success); }
.commercial-status.warn { background: var(--color-warning-soft); border-color: var(--color-accent); }
.commercial-status.danger { background: var(--color-error-soft); border-color: var(--color-error); }
.commercial-status strong, .commercial-status span { display: block; }
.commercial-status strong { color: var(--color-primary); font-size: 12px; }
.commercial-status span { color: var(--color-muted); font-size: 12px; margin-top: 3px; line-height: 1.5; }
.result-breakdown { padding: 18px 18px 8px; }
.result-breakdown h3 { color: var(--color-primary); font-family: var(--font-heading); font-size: 12px; margin: 0 0 10px; }
.result-breakdown dl { margin: 0; }
.result-breakdown dl > div { display: flex; justify-content: space-between; gap: 15px; padding: 5px 0; font-size: 12px; color: var(--color-muted); }
.result-breakdown dl > div.profit { margin-top: 5px; padding-top: 10px; border-top: 1px solid var(--color-surface-high); color: var(--color-primary); font-weight: 700; }
.result-breakdown dd { margin: 0; font-weight: 700; }
.package-summary { margin: 5px 17px 17px; padding: 14px; border-radius: var(--radius-md); background: var(--color-accent-soft); border: 1px solid rgb(198 169 107 / .4); }
.package-summary span, .package-summary strong, .package-summary small { display: block; }
.package-summary span { color: var(--color-secondary); font-size: 12px; text-transform: uppercase; font-weight: 700; letter-spacing: .08em; }
.package-summary strong { color: var(--color-primary); font-family: var(--font-heading); font-size: 20px; margin: 4px 0; }
.package-summary small { color: var(--color-text-soft); font-size: 12px; }

.guardrails { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 5px 0 22px; }
.guardrails article { display: flex; gap: 13px; padding: 18px; border-top: 1px solid var(--color-accent); background: rgb(255 255 255 / .45); }
.guardrails > article > span { color: var(--color-accent-text); font-family: var(--font-heading); font-size: 12px; font-weight: 700; }
.guardrails strong { color: var(--color-primary); font-family: var(--font-heading); font-size: 12px; }
.guardrails p { color: var(--color-muted); font-size: 12px; line-height: 1.5; margin: 4px 0 0; }

.procedure-directory { background: white; border: 1px solid rgb(198 169 107 / .35); border-radius: var(--radius-lg); margin: 0 0 30px; overflow: hidden; box-shadow: var(--shadow-sm); }
.procedure-directory-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; padding: 24px 25px; border-bottom: 1px solid rgb(198 169 107 / .3); }
.procedure-directory-heading h2 { color: var(--color-primary); font-family: var(--font-heading); margin: 0 0 4px; font-size: 25px; letter-spacing: .03em; }
.procedure-directory-heading p:not(.eyebrow) { color: var(--color-muted); font-size: 12px; margin: 0; }
.procedure-directory-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.procedure-directory-actions > span { color: var(--color-secondary); font-size: 12px; background: var(--color-accent-soft); padding: 8px 10px; border-radius: var(--radius-sm); font-weight: 700; }
.procedure-directory-tools { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 13px; padding: 16px 24px; background: var(--color-surface-low); border-bottom: 1px solid var(--color-surface-high); }
.procedure-list { display: grid; grid-template-columns: 1fr 1fr; max-height: 720px; overflow: auto; }
.procedure-list-empty { grid-column: 1 / -1; color: var(--color-muted); text-align: center; font-size: 12px; padding: 32px; }
.procedure-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 92px; padding: 15px 18px; border-right: 1px solid var(--color-surface-high); border-bottom: 1px solid var(--color-surface-high); transition: background .18s ease, box-shadow .18s ease; }
.procedure-row:nth-child(even) { border-right: 0; }
.procedure-row:only-child { grid-column: 1 / -1; border-right: 0; }
.procedure-row:hover { background: var(--color-surface-low); }
.procedure-row.active { background: var(--color-accent-soft); box-shadow: inset 3px 0 0 var(--color-accent); }
.procedure-code strong, .procedure-code span, .procedure-name strong, .procedure-name small { display: block; }
.procedure-code strong { color: var(--color-secondary); font-family: var(--font-heading); font-size: 12px; }
.procedure-code span { color: var(--color-muted); font-size: 12px; margin-top: 5px; text-transform: uppercase; font-weight: 700; }
.procedure-name { min-width: 0; }
.procedure-name strong { color: var(--color-primary); font-family: var(--font-heading); font-size: 12px; line-height: 1.35; }
.procedure-name small { color: var(--color-muted); font-size: 12px; margin-top: 5px; line-height: 1.4; }
.procedure-edit { border: 1px solid var(--color-primary); border-radius: var(--radius-sm); background: white; color: var(--color-primary); padding: 8px 10px; font-weight: 700; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.procedure-edit:hover { background: rgb(52 19 76 / .06); }
.procedure-edit:disabled { cursor: default; color: var(--color-primary); background: var(--color-accent); border-color: var(--color-accent); }
.procedure-edit.danger { color: #8b1e2d; border-color: rgb(139 30 45 / .55); }
.procedure-edit.danger:hover { background: rgb(139 30 45 / .08); }

dialog { width: min(650px, calc(100% - 30px)); border: 1px solid rgb(198 169 107 / .5); border-radius: var(--radius-lg); padding: 0; box-shadow: var(--shadow-lg); color: var(--color-text); background: var(--color-surface); }
dialog::backdrop { background: rgb(52 19 76 / .66); backdrop-filter: blur(4px); }
.dialog-card { margin: 0; }
.dialog-head { display: flex; justify-content: space-between; gap: 20px; padding: 23px 25px 17px; border-bottom: 1px solid rgb(198 169 107 / .3); }
.dialog-head h2 { color: var(--color-primary); font-family: var(--font-heading); margin: 0 0 5px; font-size: 22px; }
.dialog-head p:not(.eyebrow) { margin: 0; color: var(--color-muted); font-size: 12px; }
.close-button { align-self: flex-start; width: 32px; height: 32px; border: 1px solid var(--color-outline); border-radius: 50%; background: transparent; font-size: 19px; color: var(--color-primary); }
.rate-table-wrap { padding: 15px 25px; max-height: 48vh; overflow: auto; }
.rate-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rate-table th { text-align: left; color: var(--color-primary); background: var(--color-surface-low); padding: 8px 10px; }
.rate-table td { border-bottom: 1px solid var(--color-surface-high); padding: 7px 10px; }
.rate-table input { width: 100%; border: 1px solid var(--color-outline); border-radius: var(--radius-sm); height: 32px; padding: 6px 28px 6px 8px; text-align: right; }
.rate-input { position: relative; }
.rate-input span { position: absolute; right: 9px; top: 8px; color: var(--color-muted); }
.dialog-note { margin: 0 25px 16px; padding: 11px 13px; border-radius: var(--radius-md); border-left: 3px solid var(--color-accent); background: var(--color-accent-soft); color: var(--color-text-soft); font-size: 12px; line-height: 1.45; }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; padding: 15px 25px; border-top: 1px solid var(--color-surface-high); }
.settings-body { display: grid; gap: 16px; padding: 20px 25px; }
.settings-dialog-card { max-height: 90vh; display: flex; flex-direction: column; }
.settings-dialog-card .settings-body { overflow-y: auto; }
.settings-body.two-columns { grid-template-columns: 1fr 1fr; }
.settings-body.two-columns .full { grid-column: 1 / -1; }
.source-card { padding: 16px; border-radius: var(--radius-md); background: var(--color-primary); border: 1px solid var(--color-accent); }
.source-card span, .source-card strong, .source-card small { display: block; }
.source-card span { color: var(--color-accent); font-size: 12px; text-transform: uppercase; font-weight: 700; letter-spacing: .08em; }
.source-card strong { color: white; font-family: var(--font-heading); font-size: 23px; margin: 5px 0 3px; }
.source-card small { color: var(--color-on-primary-soft); font-size: 12px; }
.source-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 12px; }
.source-months div { background: rgb(255 255 255 / .09); border: 1px solid rgb(198 169 107 / .35); border-radius: var(--radius-sm); padding: 8px; }
.source-months div span { font-size: 12px; color: var(--color-accent); }
.source-months div strong { font-size: 12px; margin: 3px 0 0; }
.fixed-expenses-section { border: 1px solid var(--color-outline); border-radius: var(--radius-md); overflow: hidden; }
.fixed-expenses-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 12px 14px; background: var(--color-surface-low); border-bottom: 1px solid var(--color-surface-high); }
.fixed-expenses-heading strong, .fixed-expenses-heading small { display: block; }
.fixed-expenses-heading strong { color: var(--color-primary); font-family: var(--font-heading); font-size: 12px; }
.fixed-expenses-heading small { color: var(--color-muted); font-size: 12px; margin-top: 3px; }
.fixed-expenses-heading > span { color: var(--color-secondary); font-family: var(--font-heading); font-weight: 700; font-size: 13px; white-space: nowrap; }
.fixed-expenses-editor { display: grid; grid-template-columns: 1fr 1fr; }
.fixed-overhead-total { max-width: none; margin: 0; padding: 22px; border-bottom: 1px solid var(--color-surface-high); }
.fixed-overhead-total .money-input { max-width: 420px; }
.fixed-expense-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, 125px); align-items: center; gap: 10px; min-width: 0; min-height: 58px; padding: 9px 12px; border-bottom: 1px solid var(--color-surface-high); }
.fixed-expense-row:nth-child(odd) { border-right: 1px solid var(--color-surface-high); }
.fixed-expense-row label, .fixed-expense-row small { display: block; }
.fixed-expense-row label { min-width: 0; color: var(--color-primary); font-size: 12px; font-weight: 700; line-height: 1.25; }
.fixed-expense-row small { color: var(--color-muted); font-size: 12px; margin-top: 3px; }
.fixed-expense-row .money-input, .fixed-expense-row .money-input input { min-width: 0; max-width: 100%; }
.fixed-expense-row .money-input input { width: 100%; height: 34px; border: 1px solid var(--color-outline); border-radius: var(--radius-sm); text-align: right; }
.confirm-field { display: grid; grid-template-columns: 18px 1fr; gap: 9px; align-items: start; padding: 12px; border: 1px solid var(--color-outline); border-radius: var(--radius-md); background: var(--color-surface-low); color: var(--color-text-soft); font-size: 12px; line-height: 1.5; }
.confirm-field input { margin: 1px 0 0; accent-color: var(--color-primary); }

.toast { position: fixed; right: 25px; bottom: 25px; z-index: 50; background: var(--color-primary); color: white; border: 1px solid var(--color-accent); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 12px 16px; font-size: 12px; font-weight: 700; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--color-error); border-color: transparent; }
footer { text-align: center; color: var(--color-muted); font-size: 12px; letter-spacing: .05em; padding: 8px 20px 30px; }

/* Tela principal */
.home-body { min-height: 100vh; background: var(--color-background); }
.home-topbar { position: relative; }
.home-page { position: relative; width: min(1360px, calc(100% - 56px)); min-height: calc(100vh - 78px); padding: clamp(52px, 8vh, 96px) 0 42px; overflow: hidden; }
.home-page::before { content: ""; position: absolute; z-index: -1; width: 440px; height: 440px; right: -110px; top: -210px; border-radius: 50%; background: rgb(198 169 107 / .11); }
.home-welcome { max-width: 800px; }
.home-welcome h1 { max-width: 760px; margin: 0; color: var(--color-primary); font-family: var(--font-heading); font-size: clamp(36px, 4vw, 58px); line-height: 1.12; letter-spacing: .035em; text-wrap: balance; }
.home-welcome > p:last-child { margin: 16px 0 0; color: var(--color-text-soft); font-size: 15px; }
.home-primary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 34px; }
.home-primary-action { display: grid; grid-template-columns: 1fr auto; gap: 4px 18px; align-items: center; padding: 23px 25px; border: 1px solid var(--color-accent); border-radius: 12px; background: var(--color-primary); color: white; text-decoration: none; box-shadow: var(--shadow-md); }
.home-primary-action.secondary { background: var(--color-surface); color: var(--color-primary); }
.home-primary-action:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.home-primary-action:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }
.home-primary-action span { font-family: var(--font-heading); font-size: 21px; font-weight: 700; }
.home-primary-action small { grid-column: 1; color: var(--color-on-primary-soft); }
.home-primary-action.secondary small { color: var(--color-muted); }
.home-primary-action b { grid-column: 2; grid-row: 1 / 3; color: var(--color-accent); font-size: 24px; }
.commercial-dashboard { display: grid; gap: 18px; margin-top: 28px; }
.commercial-dashboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.commercial-dashboard-heading h2 { margin: 2px 0 0; color: var(--color-primary); font-family: var(--font-heading); font-size: clamp(24px, 3vw, 34px); }
.commercial-dashboard-heading > div > p:last-child { margin: 6px 0 0; color: var(--color-text-soft); font-size: 13px; }
#commercial-dashboard-content { display: grid; gap: 16px; }
.commercial-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.commercial-kpi { min-width: 0; padding: 18px; border: 1px solid var(--color-surface-high); border-top: 3px solid var(--color-outline); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.commercial-kpi span, .commercial-kpi strong, .commercial-kpi small { display: block; }
.commercial-kpi span { color: var(--color-muted); font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.commercial-kpi strong { margin-top: 8px; color: var(--color-primary); font-family: var(--font-heading); font-size: clamp(24px, 2.6vw, 34px); line-height: 1.05; overflow-wrap: anywhere; }
.commercial-kpi small { margin-top: 7px; color: var(--color-text-soft); font-size: 12px; line-height: 1.4; }
.commercial-kpi.success { border-top-color: var(--color-success); }
.commercial-kpi.primary { border-top-color: var(--color-secondary); }
.commercial-kpi.warning { border-top-color: var(--color-accent); background: var(--color-warning-soft); }
.commercial-kpi.danger { border-top-color: var(--color-error); background: var(--color-error-soft); }
.commercial-dashboard-columns { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); gap: 16px; align-items: start; }
.commercial-dashboard-side { display: grid; gap: 16px; }
.commercial-panel { min-width: 0; padding: 20px; border: 1px solid rgb(198 169 107 / .42); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.commercial-panel > header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--color-surface-high); }
.commercial-panel h3 { margin: 2px 0 0; color: var(--color-primary); font-family: var(--font-heading); font-size: 20px; }
.commercial-panel > header > a { color: var(--color-secondary); font-size: 12px; font-weight: 800; }
.commercial-action-list, .commercial-cancellation-list, .commercial-funnel { display: grid; gap: 9px; margin-top: 12px; }
.commercial-action-item, .commercial-cancellation-item { min-width: 0; color: inherit; text-decoration: none; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.commercial-action-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); }
.commercial-action-item:hover, .commercial-cancellation-item:hover { border-color: var(--color-accent); background: var(--color-surface-low); }
.commercial-action-item:hover { transform: translateY(-1px); }
.commercial-action-item:focus-visible, .commercial-cancellation-item:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.commercial-action-main { display: grid; justify-items: start; gap: 4px; min-width: 0; }
.commercial-action-main > strong, .commercial-cancellation-item strong { color: var(--color-primary); overflow-wrap: anywhere; }
.commercial-action-main > small, .commercial-cancellation-item small { color: var(--color-muted); font-size: 12px; }
.commercial-followup-status { padding: 3px 7px; border-radius: var(--radius-pill); background: var(--color-surface-mid); color: var(--color-text-soft); font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.commercial-followup-status.danger { color: var(--color-error); background: var(--color-error-soft); }
.commercial-followup-status.warning { color: var(--color-warning); background: var(--color-warning-soft); }
.commercial-followup-status.info { color: var(--state-info); background: var(--state-info-soft); }
.commercial-action-value { display: grid; justify-items: end; gap: 5px; flex: 0 0 auto; text-align: right; }
.commercial-action-value strong { color: var(--color-primary); font-family: var(--font-heading); }
.commercial-action-value small { color: var(--color-secondary); font-size: 12px; font-weight: 800; }
.commercial-funnel-row { display: grid; gap: 6px; }
.commercial-funnel-row > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--color-text-soft); font-size: 12px; }
.commercial-funnel-row strong { color: var(--color-primary); }
.commercial-funnel-track { height: 8px; overflow: hidden; border-radius: var(--radius-pill); background: var(--color-surface-mid); }
.commercial-funnel-track i { display: block; height: 100%; border-radius: inherit; background: var(--color-secondary); }
.commercial-cancellation-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 3px; border-bottom: 1px solid var(--color-surface-high); }
.commercial-cancellation-item:last-child { border-bottom: 0; }
.commercial-cancellation-item > span { display: grid; gap: 3px; min-width: 0; }
.commercial-cancellation-item b { flex: 0 0 auto; color: var(--color-error); font-size: 12px; white-space: nowrap; }
.commercial-empty { display: grid; gap: 4px; padding: 24px 18px; border: 1px dashed var(--color-outline); border-radius: var(--radius-md); color: var(--color-muted); text-align: center; }
.commercial-empty strong { color: var(--color-primary); }
.commercial-empty.compact { padding: 18px 12px; }
.commercial-dashboard-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
.commercial-goal-status { padding: 6px 10px; border-radius: var(--radius-pill); background: var(--color-surface-mid); color: var(--color-text-soft); font-size: 12px; font-weight: 800; }
.commercial-goal-status.success { background: var(--color-success-soft); color: var(--color-success); }
.commercial-goal-status.warning { background: var(--color-warning-soft); color: var(--color-warning); }
.commercial-goal-summary { display: grid; gap: 14px; margin-top: 16px; }
.commercial-goal-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.commercial-goal-values span { min-width: 0; padding: 13px 15px; border-radius: var(--radius-md); background: var(--color-surface-low); }
.commercial-goal-values small, .commercial-goal-values strong { display: block; }
.commercial-goal-values small { color: var(--color-muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.commercial-goal-values strong { margin-top: 5px; color: var(--color-primary); font-family: var(--font-heading); font-size: 21px; overflow-wrap: anywhere; }
.commercial-goal-progress { display: grid; gap: 7px; }
.commercial-goal-track { position: relative; height: 14px; border-radius: var(--radius-pill); background: var(--color-surface-mid); }
.commercial-goal-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--color-secondary), var(--color-success)); }
.commercial-goal-track b { position: absolute; top: -4px; width: 2px; height: 22px; background: var(--color-primary); transform: translateX(-1px); }
.commercial-goal-progress p { display: flex; justify-content: space-between; gap: 14px; margin: 0; color: var(--color-text-soft); font-size: 12px; }
.commercial-goal-progress p strong { color: var(--color-primary); }
.commercial-chart-heading { display: flex; justify-content: space-between; gap: 14px; margin-top: 22px; color: var(--color-text-soft); font-size: 12px; }
.commercial-chart-heading strong { color: var(--color-primary); }
.commercial-chart-scroll { margin-top: 10px; overflow-x: auto; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); background: var(--color-surface-low); }
.commercial-chart-scroll svg { display: block; width: 100%; min-width: 680px; height: auto; }
.commercial-chart-scroll text { fill: var(--color-muted); font-family: var(--font-body); font-size: 12px; }
.commercial-chart-axis { stroke: var(--color-outline); stroke-width: 1; }
.commercial-chart-bars rect { fill: var(--color-secondary); opacity: .88; }

.commercial-report-dialog { width: min(980px, calc(100% - 32px)); max-width: none; max-height: 92vh; }
.commercial-report-dialog[open] { display: block; }
.commercial-report-dialog-layout { display: flex; max-height: 92vh; flex-direction: column; }
.commercial-report-dialog .dialog-head { flex: 0 0 auto; }
.commercial-report-toolbar { display: flex; align-items: end; gap: 12px; padding: 16px 25px; border-bottom: 1px solid var(--color-surface-high); background: var(--color-surface-low); }
.commercial-report-toolbar .field { min-width: 220px; }
.commercial-report-state { margin: 22px; }
.commercial-report-editor { min-height: 0; overflow-y: auto; padding: 20px 25px; }
.commercial-report-progress { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); background: var(--color-surface-low); }
.commercial-report-progress strong { color: var(--color-primary); }
.commercial-report-progress span { color: var(--color-text-soft); font-size: 12px; text-align: right; }
.commercial-report-rows { display: grid; gap: 13px; }
.commercial-report-row { padding: 16px; border: 1px solid var(--color-outline); border-radius: var(--radius-md); background: var(--color-surface); }
.commercial-report-row[data-saved="true"] { border-color: var(--color-success); }
.commercial-report-row > header { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.commercial-report-row > header div { display: grid; gap: 2px; min-width: 0; }
.commercial-report-row > header strong { color: var(--color-primary); overflow-wrap: anywhere; }
.commercial-report-row > header span { color: var(--color-muted); font-size: 12px; }
.commercial-report-row > header b { flex: 0 0 auto; color: var(--color-primary); font-family: var(--font-heading); }
.commercial-report-row textarea { resize: vertical; }
.commercial-report-row-actions { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 12px; margin-top: 10px; }
.commercial-report-row-feedback { min-height: 20px; margin: 8px 0 0; color: var(--color-text-soft); font-size: 12px; }
.commercial-report-row-feedback.success { color: var(--color-success); }
.commercial-report-row-feedback.error { color: var(--color-error); }
.commercial-report-dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 25px; border-top: 1px solid var(--color-surface-high); background: var(--color-surface-low); }
.commercial-report-dialog-actions p { margin: 0; color: var(--color-text-soft); font-size: 12px; }
.commercial-report-print { display: none; }
.operational-pending { margin-top: 28px; }
.operational-pending-head, .home-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.operational-pending-head h2, .home-section-heading h2 { margin: 2px 0 0; color: var(--color-primary); font-family: var(--font-heading); }
.operational-pending-list { display: grid; gap: 9px; margin-top: 16px; }
.operational-pending-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 16px; border: 1px solid var(--color-surface-high); border-radius: 8px; color: inherit; text-decoration: none; }
.operational-pending-item:hover { border-color: var(--color-accent); background: var(--color-surface-low); }
.operational-pending-item span { display: grid; gap: 4px; }
.operational-pending-item strong { color: var(--color-primary); }
.operational-pending-item small { color: var(--color-muted); }
.operational-pending-item b { color: var(--color-primary); white-space: nowrap; }
.operational-pending-item.unavailable { border-style: dashed; }
.home-secondary { margin-top: 38px; }
.home-section-help { max-width: 760px; margin: 10px 0 0; color: var(--color-text-soft); line-height: 1.65; }
.home-modules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: clamp(38px, 6vh, 64px); }
@media (min-width: 801px) { .home-module:last-child:nth-child(3n + 1) { grid-column: 2; } }
.home-section-help + .home-modules { margin-top: 22px; }
.home-module { min-width: 0; min-height: 225px; display: flex; flex-direction: column; padding: 22px; color: var(--color-primary); background: var(--color-surface); border: 1px solid rgb(198 169 107 / .42); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); text-decoration: none; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.home-module:hover { transform: translateY(-4px); border-color: var(--color-accent); box-shadow: var(--shadow-md); }
.home-module:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }
.home-module.featured { color: white; background: var(--color-primary); border-color: var(--color-accent); }
.home-module-icon { width: 48px; height: 48px; display: grid; place-items: center; color: var(--color-secondary); background: var(--color-accent-soft); border-radius: 50%; }
.home-module.featured .home-module-icon { color: var(--color-primary); background: var(--color-accent); }
.home-module-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.home-module-step { margin-top: 20px; color: var(--color-accent-text); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.home-module-copy { display: block; margin-top: 25px; }
.home-module-step + .home-module-copy { margin-top: 8px; }
.home-module-copy strong, .home-module-copy small { display: block; }
.home-module-copy strong { font-family: var(--font-heading); font-size: 18px; line-height: 1.25; }
.home-module-copy small { margin-top: 8px; color: var(--color-muted); font-size: 12px; line-height: 1.55; }
.home-module.featured .home-module-copy small { color: var(--color-on-primary-soft); }
.home-module-arrow { margin-top: auto; align-self: flex-end; color: var(--color-accent-text); font-family: var(--font-heading); font-size: 22px; transition: transform .18s ease; }
.home-module:hover .home-module-arrow { transform: translateX(4px); }
.home-note { display: flex; align-items: center; justify-content: center; gap: 11px; margin-top: 32px; color: var(--color-muted); text-align: center; }
.home-note span { padding: 5px 8px; color: var(--color-secondary); background: var(--color-accent-soft); border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.home-note p { margin: 0; font-size: 12px; }

/* Tela dedicada: Base de cálculo */
.brand { color: inherit; text-decoration: none; }
.settings-page { padding-bottom: 48px; }
.settings-hero { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 48px; padding: 54px 0 34px; }
.settings-hero::before { content: ""; position: absolute; width: 260px; height: 260px; right: 8%; top: -150px; z-index: -1; border-radius: 50%; background: rgb(198 169 107 / .1); }
.settings-hero h1 { margin: 0; color: var(--color-primary); font-family: var(--font-heading); font-size: clamp(36px, 4vw, 54px); line-height: 1.1; letter-spacing: .035em; }
.settings-hero > div:first-child > p:last-child { max-width: 760px; margin: 16px 0 0; color: var(--color-text-soft); line-height: 1.7; }
.settings-status { min-width: 280px; padding: 16px 18px; border-left: 3px solid var(--color-outline); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.settings-status span, .settings-status strong { display: block; }
.settings-status span { color: var(--color-muted); font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.settings-status strong { margin-top: 5px; color: var(--color-primary); font-family: var(--font-heading); font-size: 13px; }
.settings-status.complete { border-color: var(--color-success); background: var(--color-success-soft); }
.settings-status.complete span { color: var(--color-success); }
.settings-status.pending { border-color: var(--color-accent); background: var(--color-warning-soft); }
.settings-status.danger { border-color: var(--color-error); background: var(--color-error-soft); }

.settings-summary { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 24px; background: var(--color-surface); border: 1px solid rgb(198 169 107 / .35); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.settings-summary article { padding: 19px 21px; border-right: 1px solid rgb(198 169 107 / .28); }
.settings-summary article:last-child { border: 0; }
.settings-summary article.accent { background: var(--color-primary); }
.settings-summary span, .settings-summary strong, .settings-summary small { display: block; }
.settings-summary span { color: var(--color-text-soft); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.settings-summary strong { margin: 5px 0 2px; color: var(--color-primary); font-family: var(--font-heading); font-size: 20px; }
.settings-summary small { color: var(--color-muted); font-size: 12px; }
.settings-summary .accent span, .settings-summary .accent small { color: var(--color-on-primary-soft); }
.settings-summary .accent strong { color: white; }

.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: start; }
.settings-sidebar, .settings-form-content { display: grid; gap: 18px; }
.settings-sidebar { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.settings-guide, .settings-formula, .settings-card { background: var(--color-surface); border: 1px solid rgb(198 169 107 / .3); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.settings-guide { padding: 22px; }
.settings-guide h2 { margin: 0; color: var(--color-primary); font-family: var(--font-heading); font-size: 18px; line-height: 1.35; }
.settings-guide ol { display: grid; gap: 13px; margin: 18px 0 0; padding: 0; list-style: none; }
.settings-guide li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.settings-guide li span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--color-accent-soft); color: var(--color-secondary); font-family: var(--font-heading); font-size: 12px; font-weight: 700; }
.settings-guide li p { margin: 3px 0 0; color: var(--color-text-soft); font-size: 12px; line-height: 1.5; }
.settings-formula { padding: 17px 18px; border-left: 3px solid var(--color-accent); }
.settings-formula span, .settings-formula strong, .settings-formula small { display: block; }
.settings-formula span { color: var(--color-accent-text); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.settings-formula strong { margin: 5px 0; color: var(--color-primary); font-family: var(--font-heading); font-size: 12px; }
.settings-formula small { color: var(--color-muted); font-size: 12px; line-height: 1.45; }
.settings-card { overflow: hidden; }
.settings-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; background: var(--color-surface-low); border-bottom: 1px solid rgb(198 169 107 / .28); }
.settings-card-heading > div { display: flex; align-items: center; gap: 12px; }
.settings-card-heading h2 { margin: 0 0 3px; color: var(--color-primary); font-family: var(--font-heading); font-size: 17px; }
.settings-card-heading p { margin: 0; color: var(--color-muted); font-size: 12px; }
.settings-card-heading > strong { color: var(--color-secondary); font-family: var(--font-heading); font-size: 17px; white-space: nowrap; }
.settings-expenses-grid { grid-template-columns: 1fr 1fr; }
.settings-fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 22px; }
.settings-capacity-grid { grid-template-columns: minmax(0, 1fr); }
.settings-capacity-grid .field, .settings-single-field-grid .field { max-width: 620px; }
.settings-single-field-grid { grid-template-columns: minmax(0, 1fr); }
.settings-card-help { margin: 0 22px 22px; padding: 13px 15px; border-left: 3px solid var(--color-accent); border-radius: 0 var(--radius-md) var(--radius-md) 0; background: var(--color-surface-low); color: var(--color-text-soft); font-size: 12px; line-height: 1.55; }
.settings-card-heading > div, .settings-card-heading > div > div, .settings-form-content { min-width: 0; }
.settings-card-heading h2, .settings-card-heading p, .field > span, .field small { overflow-wrap: anywhere; }
.settings-confirm-field { margin: 0 22px 22px; }
.settings-confirm-field span strong { display: block; margin-bottom: 2px; color: var(--color-primary); font-size: 12px; }
.settings-savebar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 17px 20px; background: var(--color-surface); border: 1px solid var(--color-accent); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.settings-savebar > div:first-child span, .settings-savebar > div:first-child strong, .settings-savebar > div:first-child small { display: block; }
.settings-savebar > div:first-child span { color: var(--color-muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.settings-savebar > div:first-child strong { color: var(--color-primary); font-family: var(--font-heading); font-size: 20px; }
.settings-savebar > div:first-child small { color: var(--color-muted); font-size: 12px; }
.settings-save-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }

/* Diretório de fornecedores: aplica os mesmos contratos visuais das demais
   áreas administrativas sem esconder tabelas densas em telas estreitas. */
.suppliers-page { width: min(var(--content-max), calc(100% - 48px)); }
.module-tabs { display: flex; gap: 6px; margin-bottom: 18px; padding: 6px; overflow-x: auto; border: 1px solid rgb(198 169 107 / .35); border-radius: 12px; background: var(--color-surface); box-shadow: var(--shadow-sm); }
.module-tabs .tab { min-height: var(--control-height); flex: 1 0 max-content; padding: 10px 16px; border: 0; border-radius: 7px; background: transparent; color: var(--color-muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.module-tabs .tab:hover { background: var(--color-surface-low); color: var(--color-primary); }
.module-tabs .tab:focus-visible, .procedure-tabs [role="tab"]:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.module-tabs .tab.is-active { background: var(--color-primary); color: white; box-shadow: var(--shadow-sm); }
.suppliers-panel { overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; color: var(--color-primary); font-family: var(--font-heading); }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 0 0 18px; overflow: hidden; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); background: var(--color-surface-high); }
.detail-grid > div { min-width: 0; padding: 13px; background: var(--color-surface-low); }
.detail-grid dt { color: var(--color-muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.detail-grid dd { margin: 4px 0 0; color: var(--color-primary); font-weight: 700; overflow-wrap: anywhere; }
.suppliers-page .table-wrap { width: 100%; max-width: 100%; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); }
.suppliers-page .items-table { min-width: 760px; }
.suppliers-page .items-table th, .suppliers-page .items-table td { padding: 12px; }
.suppliers-page .items-table td:first-child { min-width: 190px; }
.suppliers-page .items-table td.acoes { flex-wrap: wrap; min-width: 190px; }
.suppliers-page .pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.suppliers-page .pagination span { color: var(--color-muted); font-size: 12px; }
.suppliers-page .hint { color: var(--color-text-soft); line-height: 1.65; }
.suppliers-page [data-painel="importacao"] > h2 { margin-top: 0; color: var(--color-primary); font-family: var(--font-heading); }
.suppliers-page #arquivos-importacao { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.suppliers-page #arquivos-importacao .field:last-child { grid-column: 1 / -1; }
.suppliers-page #arquivos-importacao .field { padding: 16px; border: 1px solid var(--color-surface-high); border-radius: 10px; background: var(--color-surface-low); }
.suppliers-page #arquivos-importacao input[type="file"] { min-height: 46px; height: auto; padding: 5px; background: var(--color-surface); }
.suppliers-page #arquivos-importacao input[type="file"]::file-selector-button { min-height: 34px; margin-right: 10px; padding: 7px 11px; border: 1px solid var(--color-primary); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-primary); font: inherit; font-weight: 700; cursor: pointer; }
.suppliers-page #arquivos-importacao input[type="file"]::file-selector-button:hover { background: rgb(52 19 76 / .06); }
.suppliers-page #arquivos-importacao .link-button { justify-self: start; }
.suppliers-page .panel-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.suppliers-page #conferencia { margin-top: 22px; }
.suppliers-page .panel-inner { padding: 20px; border: 1px solid rgb(198 169 107 / .38); border-radius: 12px; background: var(--color-surface-low); }
.suppliers-page .panel-inner > h3 { margin: 0 0 14px; color: var(--color-primary); font-family: var(--font-heading); font-size: 19px; }
.suppliers-page .panel-inner > .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.suppliers-page .panel-inner .datum { min-width: 0; padding: 13px; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); background: var(--color-surface); }
.suppliers-page .panel-inner .datum span, .suppliers-page .panel-inner .datum strong { display: block; }
.suppliers-page .panel-inner .datum span { color: var(--color-muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.suppliers-page .panel-inner .datum strong { margin-top: 4px; color: var(--color-primary); font-family: var(--font-heading); font-size: 20px; }
.suppliers-page .panel-inner details { margin-top: 10px; overflow: hidden; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); background: var(--color-surface); }
.suppliers-page .panel-inner summary { padding: 12px 14px; color: var(--color-primary); font-weight: 700; cursor: pointer; }
.suppliers-page .panel-inner details > ul { display: grid; gap: 8px; margin: 0; padding: 0 18px 14px 34px; color: var(--color-text-soft); }
.suppliers-page .panel-inner details li { overflow-wrap: anywhere; }
.suppliers-page .panel-inner details li > small, .suppliers-page .panel-inner details li > strong { display: block; }
.suppliers-page .notice { margin: 14px 0; padding: 14px 16px; border: 1px solid var(--color-outline); border-left-width: 4px; border-radius: var(--radius-md); background: var(--color-surface); }
.suppliers-page .notice h3 { margin: 0 0 6px; color: var(--color-primary); }
.suppliers-page .notice p { margin: 0; color: var(--color-text-soft); }
.suppliers-page .notice > ul { display: grid; gap: 12px; margin-bottom: 0; }
.suppliers-page .notice.is-warning { border-color: var(--color-warning); background: var(--color-warning-soft); }
.status-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: var(--radius-pill); background: var(--color-surface-high); color: var(--color-text-soft); font-size: 12px; font-weight: 700; }
.status-badge.is-warning { background: var(--color-warning-soft); color: #72500d; }
.is-up { color: var(--color-error); font-weight: 700; }
.is-down { color: var(--color-success); font-weight: 700; }
.items-table tr.is-inactive { opacity: .62; }
.items-table td.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }

@media (max-width: 1240px) and (min-width: 801px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .topbar-actions { flex: 1 1 100%; justify-content: flex-end; flex-wrap: wrap; }
}

@media (max-width: 1120px) {
  .workspace { grid-template-columns: 1fr; }
  .results-panel { position: static; }
  .form-grid.four { grid-template-columns: repeat(2, 1fr); }
  .budget-patient-grid .form-context-note { grid-column: 2; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .settings-sidebar .source-card { grid-column: 1 / -1; }
  .settings-expenses-grid { grid-template-columns: 1fr; }
  .settings-expenses-grid .fixed-expense-row:nth-child(odd) { border-right: 0; }
}

@media (max-width: 800px) {
  .topbar { position: static; padding: 14px 16px; align-items: stretch; flex-direction: column; gap: 12px; }
  .topbar-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .topbar-actions .button { width: 100%; min-width: 0; white-space: normal; }
  .topbar-actions .session-chip { grid-column: 1 / -1; width: 100%; margin: 0; padding: 8px 0 0; border-left: 0; border-top: 1px solid rgb(198 169 107 / .42); display: grid; grid-template-columns: minmax(0, 1fr) auto auto; }
  .topbar-actions .session-user { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  .topbar-actions .session-chip .button { width: auto; min-width: 64px; }
  .action-group, .form-actions, .dialog-actions { width: 100%; }
  .local-badge { width: 100%; grid-column: 1 / -1; justify-content: flex-start; margin: 0 0 2px; }
  main { width: min(100% - 28px, 1360px); }
  .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 40px; }
  .budget-hero { padding: 28px 0 16px; }
  .budget-hero-content { align-items: flex-start; flex-direction: column; gap: 12px; }
  .budget-hero .draft-save-state { margin: 0; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric-strip article:nth-child(2) { border-right: 0; }
  .metric-strip article:nth-child(-n+2) { border-bottom: 1px solid rgb(198 169 107 / .28); }
  .procedure-grid { grid-template-columns: 1fr 1fr; }
  .procedure-grid .wide { grid-column: 1 / -1; }
  .item-picker { grid-template-columns: 1fr 1fr; }
  .item-picker .search-field { grid-column: 1 / -1; }
  .item-picker .add-budget-item { width: 100%; }
  .item-picker-help { display: flex; align-items: stretch; flex-direction: column; gap: 3px; }
  .field-rule { text-align: left; }
  .guardrails { grid-template-columns: 1fr; }
  .procedure-directory-heading { align-items: flex-start; }
  .procedure-directory-actions { align-items: flex-end; flex-direction: column; }
  .procedure-list { grid-template-columns: 1fr; }
  .procedure-row { border-right: 0; }
  .settings-nav { display: flex; }
  .settings-nav .local-badge { width: auto; }
  .settings-hero { align-items: stretch; flex-direction: column; gap: 20px; }
  .settings-status { min-width: 0; }
  .settings-summary { grid-template-columns: 1fr 1fr; }
  .settings-summary article:nth-child(2) { border-right: 0; }
  .settings-summary article:nth-child(-n+2) { border-bottom: 1px solid rgb(198 169 107 / .28); }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-sidebar { grid-template-columns: 1fr 1fr; }
  .settings-sidebar .source-card { grid-column: 1 / -1; }
  .home-page { width: min(1360px, calc(100% - 28px)); padding-top: 48px; }
  .commercial-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .commercial-goal-values { grid-template-columns: 1fr 1fr; }
  .commercial-goal-values span:first-child { grid-column: 1 / -1; }
  .commercial-dashboard-columns { grid-template-columns: 1fr; }
  .home-modules { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 38px; }
  .home-module { min-height: 200px; }
  .suppliers-page { width: min(100% - 28px, var(--content-max)); }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .panel-head .action-group { justify-content: flex-start; }
}

@media (max-width: 560px) {
  .home-primary-actions { grid-template-columns: 1fr; }
  .commercial-dashboard-heading { align-items: stretch; flex-direction: column; }
  .commercial-dashboard-heading .button, .commercial-dashboard-actions { width: 100%; }
  .commercial-dashboard-actions { display: grid; }
  .commercial-kpis { grid-template-columns: 1fr; }
  .commercial-panel { padding: 16px; }
  .commercial-goal-values { grid-template-columns: 1fr; }
  .commercial-goal-values span:first-child { grid-column: auto; }
  .commercial-goal-progress p, .commercial-chart-heading, .commercial-report-progress { align-items: flex-start; flex-direction: column; }
  .commercial-report-progress span { text-align: left; }
  .commercial-report-toolbar, .commercial-report-dialog-actions { align-items: stretch; flex-direction: column; }
  .commercial-report-toolbar .field { min-width: 0; }
  .commercial-report-row > header { align-items: flex-start; flex-direction: column; }
  .commercial-report-row-actions { grid-template-columns: 1fr; }
  .commercial-action-item { align-items: flex-start; flex-direction: column; }
  .commercial-action-value { justify-items: start; text-align: left; }
  .operational-pending-item { align-items: flex-start; flex-direction: column; }
  .brand-logo { width: 142px; }
  .topbar-actions .button { padding: 9px 10px; font-size: 12px; }
  .topbar-actions .session-chip { grid-template-columns: 1fr 1fr; }
  .topbar-actions .session-user { grid-column: 1 / -1; }
  .topbar-actions .session-chip .button { width: 100%; }
  .hero h1 { font-size: 36px; }
  .budget-hero h1 { font-size: 32px; }
  .metric-strip { grid-template-columns: 1fr; }
  .metric-strip article { border-right: 0; border-bottom: 1px solid rgb(198 169 107 / .28); }
  .panel { padding: 18px; }
  .panel-heading { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .panel-heading > .panel-heading-main { width: 100%; }
  .panel-heading p { margin-top: 2px; }
  .panel-kpi { justify-self: start; margin-left: 45px; }
  .item-card-head { flex-direction: column; }
  .item-card-head .item-card-selos { justify-content: flex-start; }
  .item-card-numeros, .item-edit-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item-card-acoes { align-items: stretch; flex-direction: column; }
  .item-card-acoes .button { width: 100%; white-space: normal; }
  .item-edit-grid { grid-template-columns: 1fr; }
  .procedure-grid, .form-grid.four { grid-template-columns: 1fr; }
  .budget-patient-grid .form-context-note { grid-column: 1; }
  .procedure-grid .wide { grid-column: auto; }
  .action-group .button, .form-actions .button, .dialog-actions .button { flex: 1 1 150px; min-width: 0; white-space: normal; }
  .item-picker { grid-template-columns: 1fr; }
  .item-picker .search-field { grid-column: auto; }
  .composition-actions { align-items: stretch; flex-direction: column; }
  .settings-body.two-columns { grid-template-columns: 1fr; }
  .settings-body.two-columns .full { grid-column: auto; }
  .fixed-expenses-editor { grid-template-columns: 1fr; }
  .fixed-expense-row:nth-child(odd) { border-right: 0; }
  .cost-bar { gap: 8px; padding: 12px; }
  .cost-bar div { min-width: 0; }
  .cost-bar > i { display: none; }
  .cost-bar .total { margin-left: auto; }
  .result-primary strong { font-size: 34px; }
  .active-procedure-card { align-items: stretch; flex-direction: column; }
  .active-procedure-card strong, .active-procedure-card small { white-space: normal; }
  .procedure-directory-heading { display: block; }
  .procedure-directory-actions { align-items: stretch; margin-top: 14px; }
  .procedure-directory-tools { grid-template-columns: 1fr; padding: 15px 17px; }
  .procedure-row { grid-template-columns: 72px minmax(0, 1fr); padding: 14px 17px; }
  .procedure-edit { grid-column: 1 / -1; width: 100%; }
  .settings-nav { display: grid; grid-template-columns: 1fr; }
  .settings-nav .local-badge { width: 100%; }
  .settings-hero { padding-top: 38px; }
  .settings-summary { grid-template-columns: 1fr; }
  .settings-summary article { border-right: 0; border-bottom: 1px solid rgb(198 169 107 / .28); }
  .settings-sidebar { grid-template-columns: 1fr; }
  .settings-sidebar .source-card { grid-column: auto; }
  .settings-fields-grid { grid-template-columns: 1fr; padding: 18px; }
  .settings-confirm-field { margin: 0 18px 18px; }
  .settings-card-heading { display: grid; grid-template-columns: minmax(0, 1fr); align-items: flex-start; gap: 10px; padding: 18px; }
  .settings-card-heading > strong { padding-top: 10px; border-top: 1px solid rgb(198 169 107 / .28); font-size: 14px; }
  .fixed-overhead-total { padding: 18px; }
  .fixed-expense-row { grid-template-columns: minmax(0, 1fr); gap: 8px; min-height: 0; padding: 12px 18px; }
  .fixed-expense-row .money-input { width: 100%; }
  .settings-card-help { margin: 0 18px 18px; }
  .settings-savebar { position: static; align-items: stretch; flex-direction: column; }
  .settings-save-actions { display: grid; grid-template-columns: 1fr; }
  .home-welcome h1 { font-size: 36px; }
  .home-welcome > p:last-child { font-size: 13px; }
  .home-modules { grid-template-columns: 1fr; }
  .home-module { min-height: 165px; padding: 19px; }
  .home-module-copy { margin-top: 18px; }
  .home-note { align-items: center; flex-direction: column; }
  .suppliers-page #arquivos-importacao, .detail-grid { grid-template-columns: 1fr; }
  .suppliers-page #arquivos-importacao .field:last-child { grid-column: auto; }
  .suppliers-page .pagination { justify-content: stretch; }
  .suppliers-page .pagination .button { flex: 1; }
}

@media print {
  .topbar, .guardrails, .procedure-directory, .composition-actions, .composition-notice, .button, footer { display: none !important; }
  body { background: white; }
  main { width: 100%; }
  .hero { padding-top: 0; }
  .workspace { grid-template-columns: 1fr 340px; }
  .panel, .results-panel { box-shadow: none; break-inside: avoid; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  .recebimentos-body { background: #fff; color: #222; }
  .recebimentos-body .topbar,
  .recebimentos-body .recebimentos-no-print,
  .recebimentos-body .pagination,
  .recebimentos-body .toast { display: none !important; }
  .recebimentos-body .recebimentos-page { width: 100%; margin: 0; padding: 0; }
  .recebimentos-body .settings-hero { margin-bottom: 8mm; padding: 0 0 5mm; border-bottom: 1px solid #3b1b50; }
  .recebimentos-body .settings-status { box-shadow: none; }
  .recebimentos-body .panel { padding: 0; border: 0; box-shadow: none; break-inside: auto; }
  .recebimentos-body .recebimentos-resumo { grid-template-columns: repeat(3, 1fr); break-inside: avoid; }
  .recebimentos-body .recebimentos-resumo article { padding: 4mm; }
  .recebimentos-body .table-wrap { overflow: visible; }
  .recebimentos-body .items-table { min-width: 0; font-size: 9pt; }
  .recebimentos-body .items-table th,
  .recebimentos-body .items-table td { padding: 2.5mm 2mm; }
  .recebimentos-body .items-table thead { display: table-header-group; }
  .recebimentos-body .items-table tr { break-inside: avoid; }
  .recebimentos-body .recebimentos-print-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 5mm; margin-bottom: 7mm; padding-bottom: 4mm; border-bottom: 1px solid #3b1b50; }
  .recebimentos-body .recebimentos-print-head img { width: 34mm; height: auto; }
  .recebimentos-body .recebimentos-print-head strong,
  .recebimentos-body .recebimentos-print-head span { display: block; }
  .recebimentos-body .recebimentos-print-head strong { color: #3b1b50; font-size: 10pt; }
  .recebimentos-body .recebimentos-print-head span,
  .recebimentos-body .recebimentos-print-head small { color: #555; font-size: 7.5pt; }
}

/* ---------- Acesso ---------- */
.login-body { min-height: 100vh; display: grid; place-items: center; background: var(--color-background); }
.login-page { position: relative; width: min(440px, calc(100% - 40px)); padding: 40px 0; overflow: hidden; }
.login-page::before { content: ""; position: absolute; z-index: -1; width: 380px; height: 380px; right: -150px; top: -180px; border-radius: 50%; background: rgb(198 169 107 / .11); }
.login-card { padding: clamp(28px, 5vw, 40px); background: var(--color-surface); border: 1px solid rgb(198 169 107 / .42); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.login-logo { width: 120px; height: auto; margin-bottom: 26px; }
.login-card h1 { margin: 6px 0 26px; color: var(--color-primary); font-family: var(--font-heading); font-size: 32px; line-height: 1.15; letter-spacing: .035em; }
.login-card form { display: grid; gap: 16px; }
.login-submit { width: 100%; margin-top: 6px; justify-content: center; }
.login-error { margin: 0; padding: 11px 13px; color: var(--color-danger, #a1262c); background: rgb(161 38 44 / .09); border: 1px solid rgb(161 38 44 / .28); border-radius: var(--radius-sm); font-size: 13px; line-height: 1.45; }
.login-note { display: block; margin-top: 22px; color: var(--color-muted); font-size: 12px; line-height: 1.55; }
.session-chip { display: inline-flex; align-items: center; gap: 10px; margin-left: 8px; padding-left: 12px; border-left: 1px solid rgb(198 169 107 / .42); }
.session-user { color: var(--color-muted); font-size: 12px; line-height: 1.4; white-space: nowrap; }
.home-topbar .session-chip { margin-left: auto; border-left: 0; }
.readiness-panel { margin: 30px 0 10px; padding: 24px; border: 1px solid rgb(198 169 107 / .38); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.readiness-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.readiness-head h2 { margin: 3px 0 0; color: var(--color-primary); font-family: var(--font-heading); font-size: 22px; }
.readiness-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 18px; background: var(--color-surface-high); border: 1px solid var(--color-surface-high); }
.readiness-metrics article { display: grid; gap: 4px; padding: 14px; background: var(--color-surface); }
.readiness-metrics span, .readiness-metrics small { color: var(--color-muted); font-size: 12px; }
.readiness-metrics strong { color: var(--color-primary); font-size: 12px; }
.readiness-list { display: grid; gap: 8px; margin-top: 14px; }
.readiness-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 13px; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); color: inherit; text-decoration: none; }
.readiness-item.bloqueante { border-color: rgb(161 38 44 / .35); background: rgb(161 38 44 / .05); }
.readiness-item span { display: grid; gap: 3px; }
.readiness-item strong { color: var(--color-primary); font-size: 12px; }
.readiness-item small { color: var(--color-muted); font-size: 12px; line-height: 1.45; }
.readiness-item b { color: var(--color-primary); font-size: 12px; white-space: nowrap; }
.readiness-ok { color: #1c6b4a; font-weight: 700; }
.items-table tr.inativo { opacity: .55; }
.items-table td.acoes { display: flex; gap: 6px; justify-content: flex-end; }
.access-guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-bottom: 20px; border: 1px solid var(--color-surface-high); background: var(--color-surface-high); }
.access-guide article { display: grid; gap: 6px; padding: 14px; background: var(--color-surface); }
.access-guide strong { color: var(--color-primary); font-size: 12px; }
.access-guide small { color: var(--color-muted); font-size: 12px; line-height: 1.55; }
.protected-account { display: inline-flex; min-height: 34px; align-items: center; padding: 7px 10px; border: 1px solid rgb(198 169 107 / .45); border-radius: var(--radius-pill); color: var(--color-primary); background: var(--color-warning-soft); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }

/* Comparador de ofertas: o mesmo ativo, lado a lado, comparado pela unidade certa. */
.offer-group {
  border: 1px solid var(--line, #e3e3e0);
  border-radius: 12px;
  margin: 6px 0;
  overflow: hidden;
}
.offer-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-muted, #f6f6f4);
}
.offer-group-head small { color: var(--muted, #6b6b66); }
.offer-note { flex-basis: 100%; color: var(--muted, #6b6b66); }
.offer-costs {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.offer-content { font-weight: 600; }
.offer-content.is-muted {
  font-weight: 400;
  font-style: italic;
  color: var(--muted, #6b6b66);
}
.search-result.is-best { background: var(--accent-soft, #eef6ef); }
.offer-badge {
  align-self: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--accent, #2f6f4f);
  color: #fff;
  white-space: nowrap;
}

/* ---------- Orçamento multi-procedimento ---------- */
/* Selo de vencimento: precisa ser lido antes de qualquer número da tela. */
.stamp { margin: 0 0 18px; border: 2px solid var(--color-error); border-radius: var(--radius-md); background: var(--color-error-soft); color: var(--color-error); padding: 13px 17px; font-weight: 800; font-size: 12px; line-height: 1.5; }
.retroactive-notice { display: grid; gap: 3px; margin: 0 0 18px; border: 1px solid var(--color-accent); border-radius: var(--radius-md); background: var(--color-warning-soft); color: var(--color-text-soft); padding: 13px 17px; font-size: 12px; line-height: 1.5; }
.retroactive-notice strong { color: var(--color-primary); }
.retroactive-summary { display: grid; gap: 3px; border-radius: var(--radius-md); background: var(--color-surface-low); padding: 14px 16px; }
.retroactive-summary strong { color: var(--color-primary); font-family: var(--font-heading); font-size: 15px; }
.retroactive-summary span { color: var(--color-muted); font-size: 12px; }

.itens-lista { display: grid; gap: 12px; margin-top: 16px; }
.item-card { border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); padding: 14px 16px; background: var(--color-surface-low); }
.item-card.alerta { border-color: var(--color-error); background: var(--color-error-soft); }
.item-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.item-card-head > div:first-child { min-width: 0; }
.item-card-head strong { display: block; color: var(--color-primary); font-size: 12px; }
.item-card-head small { display: block; color: var(--color-muted); font-size: 12px; margin-top: 3px; }
.item-card-numeros { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.item-card-numeros > div { min-width: 0; padding: 10px; border-radius: var(--radius-sm); background: var(--color-surface); }
.item-card-numeros span { display: block; color: var(--color-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.item-card-numeros strong { display: block; color: var(--color-primary); font-size: 12px; margin-top: 3px; overflow-wrap: anywhere; }
.item-card-numeros .total strong { color: var(--color-accent-text); }
.item-calculation-proof { display: grid; gap: 4px; margin-top: 10px; padding: 9px 11px; border-radius: var(--radius-sm); background: #fff; color: var(--color-muted); font-size: 12px; line-height: 1.45; }
.item-calculation-proof strong { color: var(--color-primary); }
.item-card-acoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.item-edit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.item-edit-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; padding: 14px; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); background: var(--color-surface-low); }
.item-edit-summary > div { min-width: 0; }
.item-edit-summary span, .item-edit-summary strong { display: block; }
.item-edit-summary span { color: var(--color-muted); font-size: 12px; font-weight: 700; }
.item-edit-summary strong { margin-top: 4px; color: var(--color-primary); font-size: 13px; overflow-wrap: anywhere; }
.item-edit-summary small { grid-column: 1 / -1; color: var(--color-muted); font-size: 12px; line-height: 1.5; }

/* Situação: a palavra faz o trabalho; a cor só reforça. */
.situacao { display: inline-block; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; background: var(--color-surface-high); color: var(--color-muted); white-space: nowrap; }
.situacao.acima, .situacao.aceito { background: var(--color-success-soft, #e6f4ee); color: #1c6b4a; }
.situacao.abaixo, .situacao.vencido, .situacao.cancelado { background: var(--color-error-soft); color: var(--color-error); }
.situacao.emitido { background: var(--color-warning-soft); color: var(--color-primary); }
.marca-defasado, .marca-excecao { display: inline-block; color: var(--color-error); font-size: 12px; font-weight: 700; }

.margem-por-item { padding: 0 18px 8px; display: grid; gap: 7px; }
.margem-linha { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 10px; border-radius: var(--radius-md); background: var(--color-surface-low); }
.margem-linha.alerta { background: var(--color-error-soft); }
.margem-linha span { color: var(--color-primary); font-size: 12px; font-weight: 700; }
.margem-linha strong { color: var(--color-primary); font-size: 12px; }
.margem-linha small { grid-column: 1 / -1; color: var(--color-muted); font-size: 12px; }

.excecao-box, .documentos-box { margin: 14px 18px 18px; padding: 14px; border-radius: var(--radius-md); border: 1px solid var(--color-surface-high); display: grid; gap: 9px; }
.excecao-box { border-color: var(--color-error); background: var(--color-error-soft); }
.excecao-box strong, .documentos-box strong { color: var(--color-primary); font-size: 12px; }
.excecao-box p { margin: 0; color: var(--color-muted); font-size: 12px; line-height: 1.5; }
.validation-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.validation-list li { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 11px; border: 1px solid rgb(186 26 26 / .28); border-radius: var(--radius-md); background: var(--color-surface); }
.validation-copy { min-width: 0; }
.validation-copy strong, .validation-copy span { display: block; overflow-wrap: anywhere; }
.validation-copy strong { color: var(--color-primary); font-size: 12px; }
.validation-copy span { margin-top: 3px; color: var(--color-text-soft); font-size: 12px; line-height: 1.45; }
.validation-list .button { justify-self: end; }
#paciente-nome, #paciente-telefone, #paciente-email, #procedimento-busca, #item-desconto, #itens-section { scroll-margin-top: 104px; }

.procedure-directory-tools.four { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.filtro-acoes { display: flex; align-items: flex-end; gap: 8px; }
.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; }
.orcamentos-selecao-barra { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: -4px 0 18px; padding: 13px 15px; border: 1px solid rgb(161 38 44 / .24); border-radius: var(--radius-md); background: rgb(161 38 44 / .045); }
.orcamentos-selecao-barra > div:first-child { display: grid; gap: 3px; }
.orcamentos-selecao-barra strong { color: var(--color-primary); font-size: 13px; }
.orcamentos-selecao-barra small { color: var(--color-muted); font-size: 12px; line-height: 1.45; }
.orcamentos-selecao-barra .action-group { justify-content: flex-end; flex-wrap: wrap; }
.orcamentos-selecao-coluna { width: 46px; min-width: 46px; text-align: center; }
.orcamento-selecao { display: inline-grid; width: 30px; height: 30px; place-items: center; cursor: pointer; }
.orcamento-selecao input { width: 18px; height: 18px; margin: 0; accent-color: var(--color-primary); cursor: pointer; }
.orcamento-selecao-indisponivel { color: var(--color-surface-high); }
.orcamentos-table td { vertical-align: middle; }
.orcamentos-table .acoes { display: flex; min-width: 255px; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.orcamentos-table .acoes .button { min-height: 36px; padding: 7px 10px; white-space: normal; }
.confirm-dialog.orcamento-historico-dialog { width: min(780px, calc(100% - 32px)); max-width: none; max-height: 90vh; }
.orcamento-historico-dialog[open] { display: flex; flex-direction: column; }
.orcamento-historico-dialog .confirm-dialog-body { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.orcamento-historico-dialog .dialog-head.compact, #descartar-rascunho-dialog .dialog-head.compact { margin: -24px -24px 18px; padding: 20px 24px 16px; }
.orcamento-historico-contexto { margin: 0 0 14px; color: var(--color-text-soft); font-size: 13px; line-height: 1.5; }
.orcamento-historico-lista { display: grid; min-height: 0; gap: 10px; overflow-y: auto; overscroll-behavior: contain; }
.orcamento-historico-card { display: grid; gap: 12px; padding: 15px; border: 1px solid var(--color-surface-high); border-left: 4px solid var(--color-surface-high); border-radius: var(--radius-md); background: var(--color-surface); }
.orcamento-historico-card.vigente { border-left-color: var(--color-success); }
.orcamento-historico-card.edicao, .orcamento-historico-card.proposta { border-left-color: var(--color-accent-text); }
.orcamento-historico-card.substituida { color: var(--color-muted); background: var(--color-surface-low); }
.orcamento-historico-card.encerrada { border-left-color: var(--color-error); }
.orcamento-historico-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.orcamento-historico-card > header strong, .orcamento-historico-card > header small { display: block; }
.orcamento-historico-card > header strong { color: var(--color-primary); font-size: 14px; }
.orcamento-historico-card > header small { margin-top: 3px; color: var(--color-muted); font-size: 12px; font-weight: 700; }
.orcamento-historico-dados { display: grid; grid-template-columns: 1.4fr repeat(3, minmax(90px, 1fr)); gap: 10px; }
.orcamento-historico-dados span { min-width: 0; }
.orcamento-historico-dados small, .orcamento-historico-dados strong { display: block; overflow-wrap: anywhere; }
.orcamento-historico-dados small { color: var(--color-muted); font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.orcamento-historico-dados strong { margin-top: 3px; color: var(--color-primary); font-size: 12px; }
.orcamento-historico-acoes { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.orcamento-historico-acoes .link-button { display: inline-flex; min-height: 36px; align-items: center; padding: 7px 8px; }
.orcamento-situacao .situacao-comercial-vigente { display: block; max-width: 180px; margin-top: 6px; color: var(--color-success); font-size: 12px; font-weight: 800; line-height: 1.35; }
.link-button.danger { color: var(--color-error); cursor: pointer; }
.prescricao-recebida-row { box-shadow: inset 4px 0 0 var(--color-accent); }
.prescricao-recebida {
  display: inline-flex;
  width: fit-content;
  margin-top: 7px;
  padding: 4px 8px;
  border: 1px solid rgb(198 169 107 / .55);
  border-radius: var(--radius-pill);
  background: var(--color-warning-soft);
  color: var(--color-accent-text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: .04em;
  text-transform: uppercase;
}
#descartar-rascunho-contexto { margin: 0 0 16px; color: var(--color-text-soft); font-size: 13px; line-height: 1.5; }
#descartar-rascunho-erro { margin-top: 13px; }
.confirm-dialog.excluir-orcamentos-dialog { width: min(720px, calc(100% - 32px)); max-width: none; max-height: 90vh; }
.excluir-orcamentos-dialog[open] { display: flex; flex-direction: column; }
.excluir-orcamentos-dialog form { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.excluir-orcamentos-dialog .confirm-dialog-body { min-height: 0; overflow-y: auto; }
.excluir-orcamentos-dialog .dialog-head.compact { margin: -24px -24px 18px; padding: 20px 24px 16px; }
#excluir-orcamentos-contexto { margin: 0 0 16px; color: var(--color-text-soft); font-size: 13px; line-height: 1.5; }
.excluir-orcamentos-analise { display: grid; gap: 12px; margin-bottom: 17px; }
.excluir-orcamentos-grupo { display: grid; gap: 8px; padding: 13px; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); background: var(--color-surface-low); }
.excluir-orcamentos-grupo.elegivel { border-color: rgb(34 116 79 / .35); background: rgb(34 116 79 / .045); }
.excluir-orcamentos-grupo.bloqueado { border-color: rgb(161 38 44 / .3); background: rgb(161 38 44 / .045); }
.excluir-orcamentos-grupo h3 { margin: 0; color: var(--color-primary); font-size: 13px; }
.excluir-orcamentos-grupo article { display: grid; grid-template-columns: minmax(110px, .75fr) minmax(130px, 1fr) minmax(180px, 1.7fr); gap: 10px; padding-top: 8px; border-top: 1px solid rgb(198 169 107 / .25); }
.excluir-orcamentos-grupo article strong, .excluir-orcamentos-grupo article span, .excluir-orcamentos-grupo article small { min-width: 0; overflow-wrap: anywhere; font-size: 12px; line-height: 1.4; }
.excluir-orcamentos-grupo article strong { color: var(--color-primary); }
.excluir-orcamentos-grupo article span, .excluir-orcamentos-grupo article small { color: var(--color-muted); }
#excluir-orcamentos-erro { margin-top: 13px; }
.dialog-card.wide { display: flex; max-width: 1040px; max-height: 90vh; flex-direction: column; }
.dialog-card.wide .settings-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.regeracao-diff small { display: block; color: var(--color-muted); font-size: 12px; margin-top: 3px; }
.regeracao-premissas { display: grid; gap: 8px; margin-top: 18px; }
.regeracao-premissas h3 { margin: 0; color: var(--color-primary); font-family: var(--font-heading); font-size: 16px; }
.regeracao-premissas > p { margin: 0 0 2px; color: var(--color-muted); font-size: 12px; }
.snapshot-diff { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.snapshot-diff li { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); background: var(--color-surface); }
.snapshot-diff strong { color: var(--color-primary); font-size: 12px; }
.snapshot-diff span { color: var(--color-text-soft); font-size: 13px; overflow-wrap: anywhere; }
.snapshot-diff i { padding: 0 5px; color: var(--color-accent-strong); font-style: normal; }
body.ocupado { cursor: progress; }

@media (max-width: 980px) {
  .item-card-numeros { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .procedure-directory-tools.four { grid-template-columns: 1fr; }
  .readiness-metrics { grid-template-columns: 1fr; }
  .orcamentos-selecao-barra { align-items: stretch; flex-direction: column; }
  .orcamentos-selecao-barra .action-group { justify-content: stretch; }
  .orcamentos-selecao-barra .button { flex: 1; }
  .excluir-orcamentos-grupo article { grid-template-columns: 1fr; gap: 3px; }
}
@media (max-width: 560px) {
  .item-card-head { flex-direction: column; }
  .item-card-head .item-card-selos { justify-content: flex-start; }
  .item-card-numeros, .item-edit-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item-card-acoes { align-items: stretch; flex-direction: column; }
  .item-card-acoes .button { width: 100%; white-space: normal; }
  .item-edit-grid { grid-template-columns: 1fr; }
}
.operacao-acao { display: flex; align-items: flex-end; }
.procedure-acoes { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.procedure-row.desativado { opacity: .62; }
.procedure-row.desativado .procedure-code strong { text-decoration: line-through; }
.procedure-workspace { max-width: 1180px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; padding: 22px 0 10px; color: var(--color-muted); font-size: 12px; }
.breadcrumbs a { color: var(--color-secondary); font-weight: 700; }
.procedure-detail-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 16px 0 22px; }
.procedure-detail-head h1 { margin: 3px 0 6px; color: var(--color-primary); font-family: var(--font-heading); }
.procedure-detail-head p:not(.eyebrow) { margin: 0; color: var(--color-muted); font-size: 12px; }
.procedure-tabs { display: flex; gap: 6px; margin-bottom: 18px; padding: 5px; border: 1px solid rgb(198 169 107 / .35); border-radius: var(--radius-md); background: var(--color-surface); }
.procedure-tabs a { flex: 1; padding: 11px 14px; border-radius: var(--radius-sm); color: var(--color-muted); text-align: center; font-size: 12px; font-weight: 700; cursor: pointer; }
.procedure-tabs a.active { color: white; background: var(--color-primary); }
.section-save-state { padding: 7px 10px; border-radius: 999px; background: var(--color-surface-high); color: var(--color-muted); font-size: 12px; font-weight: 700; }
.section-save-state[data-state="dirty"], .section-save-state[data-state="saving"] { background: #fff3cd; color: #755700; }
.section-save-state[data-state="saved"] { background: #dff3e6; color: #18643a; }
.section-save-state[data-state="error"] { background: #fce2e5; color: #8b1e2d; }
.detail-error, .detail-inline-error { padding: 24px; border: 1px solid #d99; border-radius: var(--radius-md); background: #fff6f6; color: #7f2430; }
.detail-error .button { margin-right: 8px; }
.procedure-section[hidden], .detail-error[hidden], .detail-inline-error[hidden] { display: none !important; }
@media (max-width: 680px) { .procedure-workspace { padding-left: 14px; padding-right: 14px; } .procedure-detail-head { align-items: flex-start; flex-direction: column; } .procedure-tabs { overflow-x: auto; } .procedure-tabs a { min-width: 125px; } }

/* Procedimentos: diretório leve e editor com hierarquia de produto, não de mockup. */
.settings-page:has(.procedure-directory), .procedure-workspace { width: min(1180px, calc(100% - 48px)); }
.settings-page:has(.procedure-directory) .settings-hero { padding: 44px 0 28px; }
.settings-page:has(.procedure-directory) .settings-hero h1 { font-size: clamp(34px, 4vw, 48px); }
.settings-page:has(.procedure-directory) .settings-hero > div:first-child > p:last-child { max-width: 650px; font-size: 14px; line-height: 1.65; }
.settings-page:has(.procedure-directory) .procedure-directory { overflow: visible; border: 0; background: transparent; box-shadow: none; }
.settings-page:has(.procedure-directory) .procedure-directory-heading { align-items: center; margin-bottom: 14px; padding: 0; border: 0; }
.settings-page:has(.procedure-directory) .procedure-directory-heading h2 { font-size: 22px; }
.settings-page:has(.procedure-directory) .procedure-directory-heading p:not(.eyebrow) { font-size: 12px; }
.settings-page:has(.procedure-directory) .procedure-directory-tools { grid-template-columns: minmax(280px, 1fr) 210px 180px; gap: 14px; margin-bottom: 14px; padding: 18px; border: 1px solid rgb(198 169 107 / .32); border-radius: 12px; background: white; box-shadow: var(--shadow-sm); }
.settings-page:has(.procedure-directory) .procedure-list { display: grid; grid-template-columns: 1fr; gap: 10px; max-height: none; overflow: visible; }
.settings-page:has(.procedure-directory) .procedure-row { grid-template-columns: 115px minmax(0, 1fr) auto; min-height: 78px; padding: 16px 20px; border: 1px solid rgb(198 169 107 / .28); border-radius: 10px; background: white; box-shadow: var(--shadow-sm); }
.settings-page:has(.procedure-directory) .procedure-row:hover { border-color: var(--color-accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.settings-page:has(.procedure-directory) .procedure-code strong { font-size: 14px; }
.settings-page:has(.procedure-directory) .procedure-code span { font-size: 12px; }
.settings-page:has(.procedure-directory) .procedure-name strong { font-size: 15px; }
.settings-page:has(.procedure-directory) .procedure-name small { margin-top: 4px; font-size: 12px; }
.settings-page:has(.procedure-directory) .procedure-edit { padding: 10px 16px; border-radius: 6px; font-size: 12px; text-decoration: none; }
.settings-page:has(.procedure-directory) .procedure-pagination { padding-top: 4px; }
.settings-page:has(.procedure-directory) .procedure-pagination[hidden] { display: none; }

.procedure-workspace { padding-bottom: 72px; }
.procedure-workspace .breadcrumbs { padding: 24px 0 14px; font-size: 12px; }
.procedure-detail-head { align-items: center; margin-bottom: 20px; padding: 26px 30px; border: 1px solid rgb(198 169 107 / .34); border-radius: 14px; background: linear-gradient(120deg, #34134c 0%, #4b2a63 72%, #604078 100%); box-shadow: var(--shadow-md); }
.procedure-detail-head .eyebrow { color: #e5c983; }
.procedure-detail-head h1 { color: white; font-size: clamp(26px, 4vw, 38px); line-height: 1.18; }
.procedure-detail-head p:not(.eyebrow) { color: var(--color-on-primary-soft); font-size: 13px; }
.procedure-detail-head #global-state { background: rgb(255 255 255 / .14); color: white; border: 1px solid rgb(255 255 255 / .24); }
.procedure-tabs { position: sticky; top: 90px; z-index: 12; gap: 8px; margin-bottom: 18px; padding: 7px; border-radius: 12px; box-shadow: var(--shadow-sm); }
.procedure-tabs a { padding: 13px 18px; border-radius: 7px; font-size: 12px; letter-spacing: .01em; }
.procedure-tabs a:not(.active):hover { background: var(--color-surface-low); color: var(--color-primary); }
.procedure-workspace .procedure-section.panel { min-height: 420px; padding: 0; overflow: visible; border-radius: 14px; box-shadow: var(--shadow-md); }
.procedure-workspace .procedure-section.panel:hover { border-color: rgb(198 169 107 / .3); box-shadow: var(--shadow-md); }
.procedure-workspace .procedure-section > .panel-heading { margin: 0; padding: 22px 26px; border-bottom: 1px solid rgb(198 169 107 / .25); background: var(--color-surface-low); border-radius: 14px 14px 0 0; }
.procedure-workspace .panel-heading h2 { font-size: 20px; }
.procedure-workspace .panel-heading p { font-size: 12px; }
.procedure-workspace .section-save-state { padding: 7px 12px; font-size: 12px; }
.procedure-workspace .settings-body { padding: 28px; }
.procedure-workspace .field > span { margin-bottom: 7px; font-size: 12px; }
.procedure-workspace .field input, .procedure-workspace .field select, .procedure-workspace .field textarea { min-height: 44px; border-radius: 7px; font-size: 13px; }
.procedure-workspace .field textarea { min-height: 110px; }
.procedure-workspace #composition-content, .procedure-workspace #pricing-content { padding: 26px; }
.procedure-workspace .composition-notice { display: none; }
.procedure-workspace .item-picker { margin: 0 0 22px; padding: 18px; border: 1px solid rgb(198 169 107 / .27); border-radius: 10px; background: var(--color-surface-low); }
.procedure-workspace .empty-state { min-height: 190px; border: 1px dashed var(--color-outline); border-radius: 10px; background: #fcfbf8; }
.procedure-workspace .empty-state strong { font-size: 16px; }
.procedure-workspace .empty-state span { font-size: 12px; }
.procedure-workspace .items-table th { padding: 12px 14px; font-size: 12px; }
.procedure-workspace .items-table td { padding: 14px; font-size: 12px; }
.procedure-workspace .items-table td strong { font-size: 13px; }
.procedure-workspace .items-table td small { font-size: 12px; }
.procedure-workspace .items-table input { min-width: 92px; height: 38px; border-radius: 6px; font-size: 13px; }
.procedure-workspace .composition-actions { margin-top: 20px; padding: 18px 0 0; border-top: 1px solid var(--color-surface-high); }
.procedure-workspace .composition-actions > span { font-size: 12px; }
.procedure-workspace .cost-bar { margin: 24px 0; padding: 18px; border-radius: 10px; }
.procedure-workspace .cost-bar span { font-size: 12px; }
.procedure-workspace .cost-bar strong { font-size: 14px; }
.procedure-workspace .faixas-bloco { margin-top: 30px; padding-top: 26px; border-top: 1px solid rgb(198 169 107 / .3); }
.pricing-policy-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.pricing-policy-summary > div { min-width: 0; padding: 14px 16px; border: 1px solid var(--color-surface-high); border-radius: var(--radius-sm); background: var(--color-surface-low); }
.pricing-policy-summary span, .pricing-policy-summary strong { display: block; }
.pricing-policy-summary span { margin-bottom: 5px; color: var(--color-muted); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.pricing-policy-summary strong { color: var(--color-primary); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.price-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; min-width: 160px; }
.price-minimum-action { min-height: 34px; padding: 7px 10px; font-size: 12px; white-space: nowrap; }

@media (max-width: 800px) {
  .settings-page:has(.procedure-directory), .procedure-workspace { width: min(100% - 28px, 1180px); }
  .settings-page:has(.procedure-directory) .procedure-directory-tools { grid-template-columns: 1fr; }
  .procedure-tabs { top: 8px; }
  .procedure-workspace #composition-content, .procedure-workspace #pricing-content, .procedure-workspace .settings-body { padding: 18px; }
  .pricing-policy-summary { grid-template-columns: 1fr; }
}
.faixas-bloco { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--color-surface-high); }
.faixas-table td:last-child { width: 44px; }
.faixas-table small { display: block; color: var(--color-muted); font-size: 12px; margin-top: 2px; }
.faixas-table .faixa-abaixo { background: var(--color-error-soft); }
.price-row { transition: background-color .16s ease, box-shadow .16s ease; }
.price-row.is-target { background: var(--color-success-soft); box-shadow: inset 4px 0 0 var(--color-success); }
.price-row.is-below-target { background: var(--color-error-soft); box-shadow: inset 4px 0 0 var(--color-error); }
.price-row.is-blocked { background: repeating-linear-gradient(-45deg, var(--color-error-soft), var(--color-error-soft) 8px, #f7dcda 8px, #f7dcda 16px); box-shadow: inset 5px 0 0 var(--color-error); }
.price-margin { min-width: 150px; text-align: left !important; }
.price-margin strong, .price-margin small { display: block; }
.price-margin strong { color: var(--color-primary); font-size: 12px; }
.price-margin small { margin-top: 3px; color: var(--color-muted); font-size: 12px; }
.price-row.is-target .price-margin strong { color: var(--color-success); }
.price-row.is-below-target .price-margin strong { color: var(--color-error); }
.price-row.is-blocked .price-margin strong { color: var(--color-error); }
.composition-missing { color: var(--color-error); font-weight: 700; }
.aviso-erro { color: var(--color-error); }
.item-faixa { display: inline-block; background: var(--color-surface-high); border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 700; color: var(--color-primary); }
.item-card-selos { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.excecao-box.sem-saida { border-style: dashed; }
.search-result-linha { display: flex; align-items: stretch; gap: 6px; }
.search-result-linha .search-result { flex: 1; }
.search-result.incompleto { opacity: .7; }
.search-result .sem-custo { color: var(--color-error); font-style: normal; font-weight: 700; }
.editar-insumo { align-self: center; font-size: 12px; padding: 6px 10px; }
.vigente-box { margin: 14px 18px 18px; padding: 14px; border-radius: var(--radius-md); border: 1px solid var(--color-accent); background: var(--color-warning-soft); display: grid; gap: 9px; }
.vigente-box strong { color: var(--color-primary); font-size: 12px; }
.vigente-box p { margin: 0; color: var(--color-muted); font-size: 12px; line-height: 1.5; }
.vigente-lista { display: grid; gap: 6px; }
.vigente-linha { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 7px 9px; border-radius: var(--radius-sm); background: var(--color-surface); }
.vigente-linha span { color: var(--color-primary); font-size: 12px; font-weight: 700; }
.vigente-linha strong { color: var(--color-muted); font-size: 12px; }
.vigente-linha.mudou strong { color: var(--color-primary); }
.vigente-linha small { grid-column: 1 / -1; color: var(--color-muted); font-size: 12px; }

/* Contratos operacionais compartilhados. Mantêm as telas administrativas
   previsíveis sem acoplar o componente a uma rota ou entidade específica. */
.app-shell { width: min(var(--content-max), calc(100% - 48px)); margin-inline: auto; padding-bottom: 64px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 28px 0 22px; }
.page-header h1 { margin: 0; color: var(--color-primary); font-family: var(--font-heading); font-size: clamp(28px, 4vw, 42px); line-height: 1.18; }
.page-header p { max-width: 720px; margin: 7px 0 0; color: var(--color-text-soft); }
.breadcrumbs a:hover { color: var(--color-primary); }
.breadcrumbs [aria-current="page"] { color: var(--color-text); font-weight: 700; }

.ui-card { padding: 22px; border: 1px solid rgb(198 169 107 / .32); border-radius: 12px; background: var(--color-surface); box-shadow: var(--shadow-sm); }
.ui-card:hover { border-color: rgb(198 169 107 / .72); box-shadow: var(--shadow-md); }
.filter-bar { display: grid; grid-template-columns: minmax(240px, 1fr) repeat(2, minmax(150px, 220px)) auto; gap: 12px; align-items: end; }
.responsive-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.responsive-list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 18px; border: 1px solid var(--color-surface-high); border-radius: 10px; background: var(--color-surface); color: inherit; text-decoration: none; }
.responsive-list-item > * { min-width: 0; }
.responsive-list-item strong { color: var(--color-primary); overflow-wrap: anywhere; }
.responsive-list-item small { color: var(--color-muted); overflow-wrap: anywhere; }

.form-help:not(.settings-card-help) { margin: 12px 0 0; color: var(--color-muted); font-size: 12px; line-height: 1.6; }
.filters-grid { display: grid; gap: 12px; align-items: end; margin-bottom: 18px; }
#recebimentos-filtros.filters-grid { grid-template-columns: repeat(4, minmax(140px, 1fr)) auto; margin: 0; }
#filtros.filters-grid { grid-template-columns: minmax(260px, 1fr) repeat(2, minmax(150px, 200px)) auto; }
#finance-filters.filters-grid { grid-template-columns: repeat(4, minmax(140px, 1fr)) auto; margin: 0 0 18px; }
.recebimentos-print-head { display: none; }
.recebimentos-formula { margin: 0 0 14px; color: var(--color-muted); font-size: 12px; }
.recebimentos-resumo article small,
.recebimentos-body .items-table td small { display: block; margin-top: 3px; color: var(--color-muted); font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.pagination span { color: var(--color-muted); font-size: 12px; }

.feedback, .validation-summary, .state-panel { padding: 14px 16px; border: 1px solid var(--color-outline); border-left-width: 4px; border-radius: var(--radius-md); background: var(--color-surface-low); color: var(--color-text-soft); }
.feedback strong, .validation-summary strong, .state-panel strong { display: block; color: var(--color-primary); }
.feedback.success, .state-panel.success { border-color: var(--color-success); background: var(--color-success-soft); }
.feedback.warning, .state-panel.warning { border-color: var(--color-warning); background: var(--color-warning-soft); }
.feedback.error, .validation-summary, .state-panel.error { border-color: var(--color-error); background: var(--color-error-soft); }
.dialog-inline-error { margin: 0; }
#supply-dialog .dialog-card { display: flex; max-height: 90vh; flex-direction: column; }
#supply-dialog .settings-body { overflow-y: auto; overscroll-behavior: contain; }
.calculation-preview { padding: 14px 16px; border: 1px solid var(--color-accent); border-radius: var(--radius-md); background: var(--color-accent-soft); }
.calculation-preview span, .calculation-preview strong, .calculation-preview small { display: block; }
.calculation-preview span { color: var(--color-secondary); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.calculation-preview strong { margin-top: 4px; color: var(--color-primary); font-family: var(--font-heading); font-size: 16px; }
.calculation-preview small { margin-top: 3px; color: var(--color-muted); font-size: 12px; }
.feedback.info, .state-panel.info { border-color: var(--state-info); background: var(--state-info-soft); }
.validation-summary:focus { outline: none; box-shadow: var(--focus-ring); }
.validation-summary ul { margin: 8px 0 0; padding-left: 20px; }
.validation-summary a { color: var(--color-error); font-weight: 700; }

/* Prescrição do parceiro: apenas paciente, procedimentos, sessões e retorno. */
.prescricao-page, .prescricoes-page, .planejamento-prescricao-page { width: min(1120px, calc(100% - 56px)); }
#prescricao-form { display: grid; gap: 18px; }
.prescricao-paciente-grid { display: grid; grid-template-columns: minmax(260px, 1.35fr) repeat(2, minmax(210px, 1fr)); gap: 14px; }
.prescricao-medica-config { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(230px, 320px); gap: 16px; align-items: end; }
.choice-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 13px; align-items: start; min-height: 76px; padding: 16px; border: 1px solid var(--color-outline); border-radius: var(--radius-md); background: var(--color-surface-low); cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--color-accent); background: var(--color-warning-soft); box-shadow: 0 0 0 2px rgb(198 169 107 / .16); }
.choice-card input { width: 19px; height: 19px; margin: 2px 0 0; accent-color: var(--color-primary); }
.choice-card span, .choice-card strong, .choice-card small { display: block; min-width: 0; }
.choice-card strong { color: var(--color-primary); font-family: var(--font-heading); font-size: 14px; }
.choice-card small { margin-top: 4px; color: var(--color-muted); font-size: 12px; line-height: 1.5; }
.prescricao-item-picker { display: grid; grid-template-columns: minmax(280px, 1fr) 150px auto; align-items: end; gap: 14px; }
.prescricao-item-picker .button { height: 43px; }
.prescricao-page .selection-help { min-height: 20px; margin-top: 8px; }
.prescricao-itens { display: grid; gap: 10px; margin-top: 20px; }
.prescricao-item { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; align-items: center; gap: 16px; padding: 16px; border: 1px solid rgb(198 169 107 / .38); border-radius: var(--radius-md); background: var(--color-surface-low); }
.prescricao-item-copy { min-width: 0; }
.prescricao-item-copy span, .prescricao-item-copy strong, .prescricao-item-copy small { display: block; }
.prescricao-item-copy span { color: var(--color-accent-text); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.prescricao-item-copy strong { margin-top: 3px; color: var(--color-primary); font-family: var(--font-heading); font-size: 14px; overflow-wrap: anywhere; }
.prescricao-item-copy small { margin-top: 4px; color: var(--color-muted); font-size: 12px; }
.prescricao-sessoes input { text-align: right; }
.prescricao-form-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 2px 0 28px; }
.prescricoes-filtros { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1fr) minmax(180px, .7fr) auto; align-items: end; gap: 14px; }
.prescricoes-table th:nth-child(2), .prescricoes-table td:nth-child(2) { text-align: left; }
.prescricoes-table td { vertical-align: middle; }
.prescricoes-table .acoes { min-width: 160px; }
.prescricoes-table td:nth-child(4) .situacao + .situacao { display: block; width: max-content; margin-top: 5px; }
.prescricao-list-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.situacao.prescricao-enviada { background: var(--color-warning-soft); color: var(--color-accent-text); }
.situacao.prescricao-em-atendimento { background: var(--state-info-soft); color: var(--state-info); }
.situacao.prescricao-aprovada { background: var(--color-success-soft); color: var(--color-success); }
.situacao.prescricao-encerrada { background: var(--color-surface-high); color: var(--color-muted); }

/* Planejamento clínico: os cartões representam sessões, nunca valores comerciais. */
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
.planejamento-conteudo { display: grid; gap: 18px; padding-bottom: 42px; }
.planejamento-resumo { grid-template-columns: 1.35fr repeat(3, 1fr); }
.planejamento-resumo article { min-width: 0; }
.planejamento-resumo strong { overflow-wrap: anywhere; }
.planejamento-instrucoes { margin-top: 2px; }
.planejamento-novo-grupo { display: grid; grid-template-columns: minmax(190px, 280px) auto; align-items: end; gap: 12px; }
.planejamento-board { display: grid; grid-template-columns: minmax(300px, .78fr) minmax(0, 1.5fr); gap: 18px; align-items: start; }
.planejamento-banco { position: sticky; top: 96px; }
.planejamento-banco .panel-heading { margin-bottom: 14px; }
.planejamento-grupos { display: grid; gap: 14px; min-width: 0; }
.planejamento-grupo { padding: 20px; }
.planejamento-grupo-cabecalho { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.planejamento-grupo-cabecalho > div:first-child { min-width: 0; }
.planejamento-grupo-cabecalho span, .planejamento-grupo-cabecalho strong { display: block; }
.planejamento-grupo-cabecalho > div:first-child span { color: var(--color-accent-text); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.planejamento-grupo-cabecalho > div:first-child strong { margin-top: 3px; color: var(--color-primary); font-family: var(--font-heading); font-size: 13px; overflow-wrap: anywhere; }
.planejamento-grupo-controles { display: flex; align-items: end; gap: 8px; }
.planejamento-semana { padding: 7px 10px; border-radius: var(--radius-pill); background: var(--color-accent-soft); color: var(--color-primary); font-size: 12px; font-weight: 800; white-space: nowrap; }
.planejamento-semana-select { min-width: 130px; }
.planejamento-semana-select select { height: 38px; }
.planejamento-dropzone { display: grid; gap: 9px; min-height: 92px; padding: 10px; border: 1px dashed var(--color-outline); border-radius: var(--radius-md); background: var(--color-surface-low); transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.planejamento-dropzone.sobre { border-color: var(--color-primary); background: var(--color-accent-soft); box-shadow: inset 0 0 0 2px rgb(52 19 76 / .1); }
.planejamento-dropzone.vazio { place-content: center; text-align: center; }
.planejamento-dropzone.vazio p { max-width: 360px; margin: 0; color: var(--color-muted); font-size: 12px; }
.planejamento-ocorrencia { min-width: 0; padding: 12px; border: 1px solid rgb(198 169 107 / .4); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.planejamento-ocorrencia[draggable="true"] { cursor: grab; }
.planejamento-ocorrencia[draggable="true"]:active { cursor: grabbing; }
.planejamento-ocorrencia.arrastando { opacity: .46; }
.planejamento-ocorrencia-cabecalho { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 9px; }
.planejamento-ocorrencia-cabecalho > div span, .planejamento-ocorrencia-cabecalho > div strong { display: block; }
.planejamento-ocorrencia-cabecalho > div span { color: var(--color-accent-text); font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.planejamento-ocorrencia-cabecalho > div strong { margin-top: 2px; color: var(--color-primary); font-family: var(--font-heading); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.planejamento-ocorrencia-cabecalho b { min-width: 42px; padding: 4px 7px; border-radius: var(--radius-pill); background: var(--color-accent-soft); color: var(--color-primary); font-size: 12px; text-align: center; }
.planejamento-ocorrencia > small { display: block; margin: 6px 0 0 22px; color: var(--color-muted); font-size: 12px; }
.drag-handle { color: var(--color-secondary); font-weight: 800; letter-spacing: -2px; line-height: 1.4; }
.planejamento-ocorrencia-acoes { display: flex; justify-content: flex-end; margin-top: 10px; }
.planejamento-ocorrencia-acoes .button { min-height: 36px; padding: 7px 10px; font-size: 12px; }
.planejamento-sem-grupos { min-height: 260px; margin: 0; }
.empty-state.compact { min-height: 92px; margin-top: 0; }
.agendamentos-lista { display: grid; gap: 10px; }
.acompanhamentos-lista { display: grid; gap: 10px; }
.acompanhamento-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 390px); align-items: center; gap: 18px; padding: 16px; border: 1px solid rgb(198 169 107 / .52); border-radius: var(--radius-md); background: var(--color-warning-soft); }
.acompanhamento-copy { min-width: 0; }
.acompanhamento-copy span, .acompanhamento-copy strong, .acompanhamento-copy small { display: block; }
.acompanhamento-copy span { color: var(--color-accent-text); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.acompanhamento-copy strong { margin-top: 4px; color: var(--color-primary); font-family: var(--font-heading); font-size: 14px; overflow-wrap: anywhere; }
.acompanhamento-copy small { margin-top: 5px; color: var(--color-muted); font-size: 12px; }
.acompanhamento-controles { display: grid; grid-template-columns: minmax(180px, 1fr) auto; align-items: end; gap: 12px; }
.acompanhamento-realizado { display: flex; align-items: center; gap: 8px; min-height: 43px; padding: 0 10px; border: 1px solid var(--color-outline); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-primary); font-size: 12px; font-weight: 800; white-space: nowrap; }
.acompanhamento-realizado input { width: 18px; height: 18px; margin: 0; accent-color: var(--color-primary); }
.acompanhamento-bloqueado { justify-self: end; padding: 8px 11px; border-radius: var(--radius-pill); background: var(--color-surface); color: var(--color-primary); font-size: 12px; font-weight: 800; white-space: nowrap; }
.agendamento-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); align-items: center; gap: 18px; padding: 14px 16px; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); background: var(--color-surface-low); }
.agendamento-item > div { min-width: 0; }
.agendamento-item > div span, .agendamento-item > div strong { display: block; }
.agendamento-item > div span { color: var(--color-accent-text); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.agendamento-item > div strong { margin-top: 4px; color: var(--color-primary); font-family: var(--font-heading); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.planejamento-impressao { display: none; }

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body { background: white; color: #171717; font-size: 9pt; }
  body > .topbar,
  .planejamento-prescricao-page > .settings-hero,
  #planejamento-carregando,
  #planejamento-conteudo > :not(.planejamento-impressao),
  body > .toast { display: none !important; }
  .planejamento-prescricao-page { width: 100%; margin: 0; padding: 0; }
  .planejamento-conteudo { display: block; padding: 0; }
  .planejamento-impressao { display: block !important; color: #171717; }
  .planejamento-impressao-cabecalho { display: grid; grid-template-columns: 36mm minmax(0, 1fr) auto; align-items: center; gap: 7mm; margin-bottom: 7mm; padding-bottom: 5mm; border-bottom: 1.2pt solid #34134c; }
  .planejamento-impressao-cabecalho img { display: block; width: 36mm; height: auto; }
  .planejamento-impressao-cabecalho span { display: block; color: #76520c; font-size: 7.5pt; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
  .planejamento-impressao-cabecalho h2 { margin: 1mm 0; color: #34134c; font-family: var(--font-heading); font-size: 16pt; line-height: 1.15; }
  .planejamento-impressao-cabecalho p { margin: 0; font-size: 9pt; font-weight: 700; }
  .planejamento-impressao-cabecalho small { display: block; margin-top: 1mm; color: #555; font-size: 6.8pt; }
  .planejamento-impressao-cabecalho > strong { align-self: end; color: #34134c; font-size: 8.5pt; white-space: nowrap; }
  .planejamento-impressao table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .planejamento-impressao th, .planejamento-impressao td { padding: 3mm 2.5mm; border: .6pt solid #b9b1ba; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
  .planejamento-impressao th { background: #f1ece3; color: #34134c; font-size: 7.2pt; letter-spacing: .04em; text-transform: uppercase; }
  .planejamento-impressao th:nth-child(1) { width: 17mm; }
  .planejamento-impressao th:nth-child(2) { width: 23mm; }
  .planejamento-impressao th:nth-child(4) { width: 37mm; }
  .planejamento-impressao th:nth-child(5) { width: 29mm; }
  .planejamento-retorno-row td { background: #fbf5e7; border-top-width: 1.2pt; }
  .planejamento-impressao tr { break-inside: avoid; page-break-inside: avoid; }
  .planejamento-impressao td:nth-child(3) > strong,
  .planejamento-impressao td:nth-child(3) > span { display: block; }
  .planejamento-impressao td:nth-child(3) > span { margin-top: 1mm; color: #555; font-size: 7.5pt; line-height: 1.35; }
  .planejamento-impressao ul { display: grid; gap: 1mm; margin: 0; padding: 0; list-style: none; }
  .planejamento-impressao li strong, .planejamento-impressao li span { display: inline; }
  .planejamento-impressao li span { margin-left: 1.5mm; color: #555; font-size: 7.5pt; }
  .planejamento-confirmacao { margin-right: 1.5mm; font-size: 14pt; line-height: .7; vertical-align: -1pt; }
  .planejamento-impressao footer { display: flex !important; justify-content: space-between; gap: 5mm; margin-top: 5mm; padding-top: 2.5mm; border-top: .6pt solid #b9b1ba; color: #555; font-size: 7pt; }
  .planejamento-impressao footer span:last-child { text-align: right; }
}

.state-panel { min-height: 160px; display: grid; place-content: center; gap: 8px; text-align: center; }
.state-panel.loading { cursor: progress; }
.state-panel.loading::before { content: ""; width: 24px; height: 24px; margin-inline: auto; border: 3px solid var(--color-outline); border-top-color: var(--color-primary); border-radius: 50%; animation: ui-spin .8s linear infinite; }
@keyframes ui-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .state-panel.loading::before { animation: none; } }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-card { padding: 17px; border: 1px solid var(--color-surface-high); border-radius: 10px; background: var(--color-surface); }
.metric-card span, .metric-card strong, .metric-card small { display: block; }
.metric-card span { color: var(--color-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.metric-card strong { margin: 5px 0; color: var(--color-primary); font-family: var(--font-heading); font-size: 23px; }
.money-breakdown { display: grid; gap: 7px; margin: 0; }
.money-breakdown > div { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--color-surface-high); }
.money-breakdown dt, .money-breakdown dd { margin: 0; }
.money-breakdown dd { color: var(--color-primary); font-weight: 700; font-variant-numeric: tabular-nums; }
.money-breakdown .total { border-top: 2px solid var(--color-accent); border-bottom: 0; font-size: 1.08em; }

.action-menu { position: relative; display: inline-block; }
.action-menu-list { position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; min-width: 210px; margin: 0; padding: 6px; list-style: none; border: 1px solid var(--color-outline); border-radius: 8px; background: var(--color-surface); box-shadow: var(--shadow-lg); }
.action-menu-list[hidden] { display: none; }
.action-menu-list button, .action-menu-list a { width: 100%; display: flex; padding: 10px 11px; border: 0; border-radius: 5px; background: transparent; color: var(--color-text); text-align: left; text-decoration: none; }
.action-menu-list button:hover, .action-menu-list a:hover { background: var(--color-surface-low); }
.action-menu-list .danger { color: var(--color-error); }

.confirm-dialog { width: min(480px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 12px; color: var(--color-text); box-shadow: var(--shadow-lg); }
.confirm-dialog::backdrop { background: var(--overlay); }
.confirm-dialog-body { padding: 24px; }
.confirm-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 24px; border-top: 1px solid var(--color-surface-high); }

.button:disabled, .button[aria-disabled="true"], input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .52; transform: none; }
.action-menu-list button:focus-visible, .action-menu-list a:focus-visible, .breadcrumbs a:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }

@media (max-width: 800px) {
  .home-topbar .session-chip { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; min-width: 0; width: 100%; margin: 0; padding: 8px 0 0; border-top: 1px solid rgb(198 169 107 / .42); }
  .home-topbar .session-user { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  .app-shell { width: min(100% - 28px, var(--content-max)); }
  .page-header { align-items: flex-start; flex-direction: column; }
  .filter-bar, .metric-grid { grid-template-columns: 1fr 1fr; }
  #filtros.filters-grid, #finance-filters.filters-grid, #recebimentos-filtros.filters-grid { grid-template-columns: 1fr 1fr; }
  .orcamentos-table, .orcamentos-table tbody, .orcamentos-table tr, .orcamentos-table td { display: block; width: 100%; }
  .orcamentos-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  #lista-orcamentos { display: grid; gap: 12px; padding: 12px; }
  #lista-orcamentos tr { padding: 14px; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-sm); }
  #lista-orcamentos td { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 10px; padding: 7px 0; border: 0; text-align: left; overflow-wrap: anywhere; }
  #lista-orcamentos td::before { color: var(--color-muted); font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
  #lista-orcamentos td:nth-child(1)::before { content: "Orçamento"; }
  #lista-orcamentos td:nth-child(2)::before { content: "Paciente"; }
  #lista-orcamentos td:nth-child(3)::before { content: "Atualização"; }
  #lista-orcamentos td:nth-child(4)::before { content: "Situação"; }
  #lista-orcamentos td:nth-child(5)::before { content: "Total"; }
  #lista-orcamentos td.acoes { display: flex; min-width: 0; justify-content: stretch; padding-top: 12px; }
  #lista-orcamentos td.acoes::before { content: none; }
  #lista-orcamentos td.acoes .button { flex: 1 1 170px; }
}
@media (max-width: 560px) {
  .home-topbar .session-chip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-topbar .session-user { grid-column: 1 / -1; }
  .home-topbar .session-chip .button { min-width: 0; width: 100%; padding: 9px 10px; font-size: 12px; white-space: normal; }
  .filter-bar, .metric-grid { grid-template-columns: 1fr; }
  #filtros.filters-grid, #finance-filters.filters-grid, #recebimentos-filtros.filters-grid { grid-template-columns: 1fr; }
  .pagination { justify-content: stretch; }
  .pagination .button { flex: 1; }
  .pagination span { width: 100%; text-align: center; }
  .responsive-list-item { grid-template-columns: 1fr; }
  .validation-list li { grid-template-columns: 1fr; }
  .validation-list .button { width: 100%; justify-self: stretch; }
  .responsive-list-item .action-group { justify-content: stretch; }
  .responsive-list-item .action-group .button, .confirm-dialog-actions .button { flex: 1; }
  .confirm-dialog-actions { flex-wrap: wrap; }
  .orcamento-historico-card > header { flex-direction: column; }
  .orcamento-historico-dados { grid-template-columns: 1fr 1fr; }
  .orcamento-historico-acoes { align-items: stretch; flex-direction: column; }
  .orcamento-historico-acoes .link-button { width: 100%; min-height: 44px; justify-content: center; }
  table:has(#usuarios-lista), table:has(#usuarios-lista) tbody, table:has(#usuarios-lista) tr, table:has(#usuarios-lista) td { display: block; width: 100%; }
  table:has(#usuarios-lista) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  #usuarios-lista tr { margin-bottom: 12px; padding: 14px; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); background: var(--color-surface); }
  #usuarios-lista td { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 7px 0; border: 0; text-align: left; overflow-wrap: anywhere; }
  #usuarios-lista td::before { color: var(--color-muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
  #usuarios-lista td:nth-child(1)::before { content: "Usuário"; }
  #usuarios-lista td:nth-child(2)::before { content: "E-mail"; }
  #usuarios-lista td:nth-child(3)::before { content: "Papel"; }
  #usuarios-lista td:nth-child(4)::before { content: "Situação"; }
  #usuarios-lista td.acoes { display: flex; flex-wrap: wrap; justify-content: stretch; padding-top: 12px; }
  #usuarios-lista td.acoes::before { content: none; }
  #usuarios-lista td.acoes .button { flex: 1 1 130px; white-space: normal; }
  .procedure-row .procedure-acoes { grid-column: 1 / -1; display: flex; flex-wrap: wrap; width: 100%; }
  .procedure-row .procedure-acoes .button { flex: 1 1 130px; min-width: 0; white-space: normal; }
  .money-breakdown .decomposition, .decomposition { grid-template-columns: 1fr; }
  .settings-page:has(.procedure-directory) { width: min(100% - 28px, 1180px); }
  .settings-page:has(.procedure-directory) .procedure-row { grid-template-columns: 1fr; min-width: 0; padding: 14px; }
  .settings-page:has(.procedure-directory) .procedure-code,
  .settings-page:has(.procedure-directory) .procedure-meta { min-width: 0; overflow-wrap: anywhere; }
  .settings-page:has(.procedure-directory) .procedure-acoes { grid-column: 1; }
}

@media (max-width: 800px) {
  .prescricao-page, .prescricoes-page, .planejamento-prescricao-page { width: min(100% - 28px, 1120px); }
  .prescricao-paciente-grid { grid-template-columns: 1fr; }
  .prescricao-medica-config { grid-template-columns: 1fr; }
  .prescricao-item-picker { grid-template-columns: minmax(0, 1fr) 140px; }
  .prescricao-item-picker .search-field { grid-column: 1 / -1; }
  .prescricao-item-picker .button { width: 100%; }
  .prescricoes-filtros { grid-template-columns: 1fr 1fr; }
  .prescricoes-filtros .filtro-acoes { grid-column: 1 / -1; justify-content: flex-end; }
  .prescricoes-table, .prescricoes-table tbody, .prescricoes-table tr, .prescricoes-table td { display: block; width: 100%; }
  .prescricoes-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  #lista-prescricoes { display: grid; gap: 12px; padding: 12px; }
  #lista-prescricoes tr { padding: 14px; border: 1px solid var(--color-surface-high); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-sm); }
  #lista-prescricoes td { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 7px 0; border: 0; text-align: left; overflow-wrap: anywhere; }
  #lista-prescricoes td::before { color: var(--color-muted); font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
  #lista-prescricoes td:nth-child(1)::before { content: "Prescrição"; }
  #lista-prescricoes td:nth-child(2)::before { content: "Paciente"; }
  #lista-prescricoes td:nth-child(3)::before { content: "Atualização"; }
  #lista-prescricoes td:nth-child(4)::before { content: "Situação"; }
  #lista-prescricoes td:nth-child(5)::before { content: "Procedimentos"; }
  #lista-prescricoes td.acoes { display: flex; min-width: 0; justify-content: stretch; padding-top: 12px; }
  #lista-prescricoes td.acoes::before { content: none; }
  #lista-prescricoes td.acoes .button { flex: 1 1 170px; }
  .prescricao-list-actions { width: 100%; }
  .planejamento-resumo { grid-template-columns: 1fr 1fr; }
  .planejamento-board { grid-template-columns: 1fr; }
  .planejamento-banco { position: static; }
}

@media (max-width: 560px) {
  .prescricao-item-picker, .prescricoes-filtros { grid-template-columns: 1fr; }
  .prescricao-item-picker .search-field, .prescricoes-filtros .filtro-acoes { grid-column: auto; }
  .prescricao-item { grid-template-columns: 1fr; align-items: stretch; }
  .prescricao-item .button { width: 100%; }
  .prescricao-form-actions { align-items: stretch; flex-direction: column-reverse; }
  .prescricao-form-actions .button { width: 100%; }
  .planejamento-resumo { grid-template-columns: 1fr; }
  .planejamento-novo-grupo { grid-template-columns: 1fr; }
  .planejamento-novo-grupo .button { width: 100%; }
  .planejamento-grupo-cabecalho { align-items: stretch; flex-direction: column; }
  .planejamento-grupo-controles { align-items: stretch; flex-direction: column; }
  .planejamento-grupo-controles .button { width: 100%; }
  .planejamento-semana-select { width: 100%; }
  .planejamento-ocorrencia-acoes .button { width: 100%; }
  .acompanhamento-item, .acompanhamento-controles { grid-template-columns: 1fr; }
  .acompanhamento-bloqueado { justify-self: start; white-space: normal; }
  .agendamento-item { grid-template-columns: 1fr; }
}

/* Identidade institucional na aplicação web. Os valores chegam pelos
   placeholders renderizados no servidor; estas regras cuidam só da apresentação. */
.institutional-card {
  margin-bottom: 24px;
  overflow: hidden;
  border: 1px solid rgb(198 169 107 / .38);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}
.institutional-card-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--color-surface-high);
  background: var(--color-surface-low);
}
.institutional-card-heading .eyebrow { margin-bottom: 4px; font-size: 17px; }
.institutional-card-heading h2 {
  margin: 0;
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-size: 22px;
  line-height: 1.25;
}
.institutional-card-heading > p {
  max-width: 480px;
  margin: 0;
  color: var(--color-text-soft);
  font-size: 13px;
  text-align: right;
}
.institutional-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--color-surface-high);
}
.institutional-details > div { min-width: 0; padding: 16px 20px; background: var(--color-surface); }
.institutional-details .institutional-detail-wide { grid-column: span 2; }
.institutional-details .institutional-detail-address { grid-column: 1 / -1; }
.institutional-details dt {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.institutional-details dd {
  margin: 5px 0 0;
  color: var(--color-primary);
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.home-institutional {
  display: grid;
  grid-template-columns: minmax(260px, .85fr) minmax(0, 1.4fr);
  gap: 24px;
  width: min(1360px, calc(100% - 56px));
  margin: 0 auto 28px;
  padding: 20px 0 0;
  border-top: 1px solid rgb(198 169 107 / .45);
  color: var(--color-text-soft);
  font-size: 12px;
}
.home-institutional-brand, .home-institutional address { display: grid; gap: 4px; min-width: 0; }
.home-institutional-brand strong { color: var(--color-primary); font-family: var(--font-heading); font-size: 15px; }
.home-institutional address { margin: 0; font-style: normal; text-align: right; }
.home-institutional span { overflow-wrap: anywhere; }

@media (max-width: 800px) {
  .institutional-card-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .institutional-card-heading > p { max-width: none; text-align: left; }
  .institutional-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .institutional-details .institutional-detail-address { grid-column: 1 / -1; }
  .home-institutional {
    grid-template-columns: 1fr;
    gap: 12px;
    width: min(100% - 28px, 1360px);
  }
  .home-institutional address { text-align: left; }
}

@media (max-width: 560px) {
  .institutional-details { grid-template-columns: 1fr; }
  .institutional-details .institutional-detail-wide,
  .institutional-details .institutional-detail-address { grid-column: auto; }
  .institutional-details > div { padding: 14px 16px; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body.commercial-report-printing { background: #fff; color: #171717; font-size: 9pt; }
  body.commercial-report-printing > .topbar,
  body.commercial-report-printing > .home-institutional,
  body.commercial-report-printing .home-page > :not(.commercial-report-print) { display: none !important; }
  body.commercial-report-printing .home-page { width: 100%; margin: 0; padding: 0; }
  body.commercial-report-printing .commercial-report-print { display: block !important; }
  .commercial-report-print-head { display: grid; grid-template-columns: 36mm minmax(0, 1fr) auto; align-items: center; gap: 7mm; margin-bottom: 7mm; padding-bottom: 5mm; border-bottom: 1.2pt solid #34134c; }
  .commercial-report-print-head img { display: block; width: 36mm; height: auto; }
  .commercial-report-print-head span { display: block; color: #76520c; font-size: 7.5pt; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
  .commercial-report-print-head h1 { margin: 1mm 0; color: #34134c; font-family: var(--font-heading); font-size: 16pt; line-height: 1.15; }
  .commercial-report-print-head p { margin: 0; color: #444; font-size: 7.5pt; }
  .commercial-report-print-head > strong { align-self: end; color: #34134c; font-size: 8.5pt; white-space: nowrap; }
  .commercial-report-print-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2.5mm; margin-bottom: 6mm; break-inside: avoid; }
  .commercial-report-print-summary div { padding: 3mm; border: .6pt solid #c8c0ca; border-radius: 2mm; }
  .commercial-report-print-summary span, .commercial-report-print-summary strong { display: block; }
  .commercial-report-print-summary span { color: #666; font-size: 6.8pt; text-transform: uppercase; }
  .commercial-report-print-summary strong { margin-top: 1mm; color: #34134c; font-size: 10pt; }
  .commercial-report-print table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .commercial-report-print th, .commercial-report-print td { padding: 2.7mm 2.3mm; border: .6pt solid #b9b1ba; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
  .commercial-report-print th { background: #f1ece3; color: #34134c; font-size: 7pt; letter-spacing: .04em; text-transform: uppercase; }
  .commercial-report-print th:nth-child(1) { width: 43mm; }
  .commercial-report-print th:nth-child(2) { width: 23mm; }
  .commercial-report-print th:nth-child(3) { width: 27mm; }
  .commercial-report-print tr { break-inside: avoid; page-break-inside: avoid; }
  .commercial-report-print td { font-size: 7.7pt; line-height: 1.35; }
  .commercial-report-print td strong, .commercial-report-print td span { display: block; }
  .commercial-report-print td span { margin-top: .8mm; color: #666; font-size: 7pt; }
  .commercial-report-print footer { display: flex !important; justify-content: space-between; gap: 6mm; margin-top: 5mm; padding-top: 2.5mm; border-top: .6pt solid #b9b1ba; color: #555; font-size: 6.8pt; }
  .commercial-report-print footer span { max-width: 55%; }
  .commercial-report-print footer span:last-child { text-align: right; }
}
