/* Painel e proposta clássica: componentes existentes recebem a paleta compartilhada. */
html[data-optical-panel] {
  --sans: var(--faces-sans);
  --serif: var(--faces-serif);
}
html[data-optical-panel][data-optical-theme] {
  color-scheme: light;
  --bg: var(--faces-ground);
  --bg-2: var(--faces-base);
  --ink: var(--faces-text);
  --ink-2: var(--faces-muted);
  --ink-3: var(--faces-muted);
  --gold: var(--faces-accent);
  --surface: var(--faces-base);
  --surface-2: color-mix(in srgb, var(--faces-base), var(--faces-ground) 35%);
  --surface-3: color-mix(in srgb, var(--faces-base), var(--faces-text) 9%);
  --line: var(--faces-cut);
  --line-2: var(--faces-cut);
  --teal: var(--faces-accent);
  --teal-soft: var(--faces-tile);
  --tile-a: var(--faces-base);
  --tile-b: var(--faces-ground);
  --btn-ink: #fff9ee;
  --btn-bg: linear-gradient(142deg, #534136, #211610 63%, #120d0b);
  --input-bg: var(--faces-base);
  --input-focus: var(--faces-base);
  --card-surface: var(--faces-glass);
  --card-border: 1px solid var(--faces-optic-edge);
  --card-shadow: 0 3px 7px -5px var(--faces-optic-shadow), 0 14px 28px -23px var(--faces-optic-shadow), inset 0 0 0 1px var(--faces-optic-near);
  --acc: 155 108 56;
  --acct: 111 73 32;
  --fill2: rgba(174,132,77,.13);
  --wall: radial-gradient(ellipse at 15% 0%, #fff9f2, transparent 61%), radial-gradient(ellipse at 90% 75%, #eed9c8, transparent 60%), #f7eee6;
  --neutral: #544e46;
  --neutral-bg: #efe7dc;
  --ok: #28533d;
  --ok-bg: #e5eddf;
  --warn: #744916;
  --warn-bg: #f1dfc6;
  --bad: #8b312a;
  --bad-bg: #f2dfd9;
  --lum: 224 202 195;
  --lum-hot: 255 253 249;
  --lum-in: 255 243 238;
  --lum-in-a: .28;
  --lum-tint: 218 190 181;
  --lum-blend: normal;
  --spill-a: .29;
  --lit-ink: var(--faces-text);
  --info: #275461;
  --info-bg: #e1ecec;
}
html[data-optical-panel][data-optical-theme="night"] {
  color-scheme: dark;
  --faces-ground: #0a1820;
  --faces-base: #122630;
  --faces-glass: radial-gradient(ellipse at 0 0, #2b4b56 0%, transparent 60%), linear-gradient(128deg, #193440, #0e222b 84%);
  --faces-hero: radial-gradient(ellipse at 74% 7%, #345364, transparent 51%), linear-gradient(119deg, #14303d, #0a2532 58%, #203b45);
  --faces-dock: linear-gradient(167deg, #294353, #122630 67%, #0c1921);
  --acc: 230 203 152;
  --acct: 238 211 161;
  --fill2: rgba(232,203,152,.12);
  --btn-bg: linear-gradient(142deg, #fff9ec, #efdbb4 80%, #e6c795);
  --btn-ink: #20160e;
  --wall: radial-gradient(ellipse at 26% 20%, #142a36, transparent 62%), #08161d;
  --neutral: #d1ccbf;
  --neutral-bg: #283840;
  --ok: #c6e4d1;
  --ok-bg: #213b36;
  --warn: #f1d1a0;
  --warn-bg: #3d3224;
  --bad: #ffcec0;
  --bad-bg: #4a2b2b;
  --lum: 239 211 161;
  --lum-hot: 255 247 230;
  --lum-in: 230 203 152;
  --lum-in-a: .16;
  --lum-tint: 230 203 152;
  --lum-blend: screen;
  --spill-a: .23;
  --info: #c6e0eb;
  --info-bg: #233f4e;
}

html[data-optical-panel] body { background: var(--wall); }
html[data-optical-panel] :is(.modal, .dialog, .drawer, .menu, .toast) {
  color: var(--ink);
  background: var(--faces-dialog);
  border-color: var(--faces-cut);
}
html[data-optical-panel][data-mode="admin"] .nt-pop {
  background: var(--faces-dialog) var(--faces-base);
  color: var(--faces-text);
  border-color: var(--faces-cut);
}
html[data-optical-panel] :is(.card:not(.list-card), .pcard, .doc-surface) {
  background: var(--card-surface);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}
html[data-optical-panel] :is(.doc-wrap, .public-page) { color: var(--ink); }
html[data-optical-panel] :is(.public-page .doc-card, .public-page .doc-hero) { background: var(--faces-glass); }
html[data-optical-panel] :focus-visible { outline-color: var(--faces-focus); }

.opt-rail { display: none; }
.opt-header {
  position: relative;
  max-width: none;
  width: auto;
  padding: 12px clamp(18px, 2.55vw, 37px);
  min-height: 77px;
  justify-content: space-between;
  background: transparent;
  border: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.opt-brand, .opt-header-tools, .opt-theme, .opt-dock, .opt-dock > a,
.opt-dock summary, .opt-popover :is(a, button), .opt-theme button {
  display: flex;
  align-items: center;
}
.opt-brand { gap: clamp(8px, 1.2vw, 19px); color: var(--faces-text); }
.opt-brand img { flex: none; width: clamp(28px, 3.4vw, 50px); }
.opt-brand .bp-sig { width: clamp(112px, 14vw, 204px); aspect-ratio: 2590 / 266; }
.opt-header-tools { gap: clamp(6px, 1.2vw, 20px); }
.opt-header-tools svg, .opt-dock svg, .opt-rail svg { width: 22px; height: 22px; flex: none; }
.opt-theme {
  border: 1px solid var(--faces-cut);
  background: var(--faces-tile);
  border-radius: 99px;
  padding: 4px;
  gap: 3px;
}
.opt-theme button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 99px;
  min-height: 40px;
  padding: 0 clamp(9px, 1.25vw, 19px);
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 650;
}
.opt-theme button[aria-pressed="true"] {
  background: var(--faces-selected);
  border-color: var(--faces-cut);
  color: var(--faces-accent);
  box-shadow: inset 0 1px 2px var(--faces-optic-near);
}
.opt-icon-button {
  border: 1px solid var(--faces-cut);
  background: transparent;
  color: var(--faces-text);
  border-radius: 50%;
  display: grid;
  place-items: center;
  width: clamp(42px, 3.9vw, 56px);
  height: clamp(42px, 3.9vw, 56px);
  position: relative;
  text-decoration: none;
}
.opt-icon-button[aria-current="page"], .opt-icon-button:hover,
.opt-account[open] summary { background: var(--faces-selected); }
.opt-header .bell-badge {
  position: absolute;
  right: 0;
  top: -3px;
  min-width: 19px;
  height: 19px;
  border-radius: 12px;
  padding: 0 3px;
  background: var(--faces-accent);
  color: var(--faces-ground);
  text-align: center;
  font-size: 10px;
  font-weight: 700;
}
.opt-header .opt-new { min-height: 50px; padding-inline: clamp(12px, 1.8vw, 27px); gap: 10px; }
.opt-header .opt-new::before, .opt-header .opt-new::after { pointer-events: none; }
.opt-account, .opt-dock details { position: relative; }
.opt-account summary::-webkit-details-marker, .opt-dock summary::-webkit-details-marker { display: none; }
.opt-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 2;
  min-width: max-content;
  padding: 7px;
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}
.opt-popover :is(a, button) {
  padding: 9px 12px;
  gap: 9px;
  min-height: 42px;
  width: 100%;
  border: 0;
  background: none;
  color: var(--ink);
  border-radius: 10px;
  text-align: left;
  text-decoration: none;
  font-weight: 600;
}
.opt-popover :is(a, button):hover, .opt-popover a[aria-current="page"] { background: var(--faces-selected); }
.opt-popover svg { width: 19px; height: 19px; }

body:has(#app > :is(.opt-dock, .wiz-bar)) { min-height: 0; }
#app:has(> :is(.opt-dock, .wiz-bar)) {
  display: grid;
  grid-template: minmax(0, 1fr) auto / minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}
.opt-panel-scroll {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior-y: contain;
  scroll-padding-block-end: 12px;
}
#app[inert] .opt-panel-scroll { overflow: hidden; }
.opt-dock {
  --opt-dock-offset: max(18px, env(safe-area-inset-bottom));
  justify-self: center;
  margin: 12px 0 var(--opt-dock-offset);
  z-index: 29;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 6px;
  gap: 3px;
  overflow: visible;
  border-radius: 999px;
}
.opt-dock > a, .opt-dock summary {
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 clamp(12px, 1.65vw, 28px);
  border: 1px solid transparent;
  color: var(--ink-2);
  text-decoration: none;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}
.opt-dock > a[aria-current="page"], .opt-dock details[open] summary {
  border-color: var(--faces-cut);
  color: var(--faces-accent);
  background: var(--faces-selected);
}
.opt-dock .opt-popover { top: auto; bottom: calc(100% + 12px); }
.is-wizard .opt-dock, .is-wizard .opt-new { display: none; }
html[data-optical-panel] .app-footer { padding-bottom: 8px; }
html[data-optical-panel][data-mode="admin"] .opt-panel-scroll > .page { padding-bottom: 32px; }


.opt-panel-scroll:has(> .page > .opt-module-head) > .opt-header {
  padding: 7px var(--gutter);
  min-height: 62px;
}
.opt-panel-scroll:has(> .page > .opt-module-head) .opt-new { min-height: 44px; }
.opt-panel-scroll > .page:has(> .opt-module-head) { padding-top: clamp(12px, 1.8vw, 22px); }
.opt-module-head {
  gap: 10px 16px;
  margin-bottom: 14px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--faces-cut);
}
.opt-module-head .h1 {
  margin-top: 0;
  font-size: clamp(33px, 4.75vw, 52px);
  line-height: 1.02;
}
.opt-module-head .sub {
  max-width: 76ch;
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.45;
}
.opt-module-actions, .opt-coupon-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.opt-operations-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}
.opt-operations-grid > .opt-module-card {
  min-width: 0;
  padding: clamp(14px, 2.2vw, 24px);
}
.opt-coupons > .wiz-panel + .wiz-panel { margin-top: 0; }
.opt-coupons .wiz-panel-head { margin-bottom: 12px; }
.opt-coupons .service-line { flex-wrap: wrap; }
.opt-module-card > .h3, .opt-module-card .wiz-panel-head > .h3 {
  font: italic 400 clamp(23px, 2.7vw, 31px)/1.1 var(--faces-serif);
}
.opt-heading-count {
  margin-inline-start: 4px;
  color: var(--faces-accent);
  font: 650 13px/1 var(--faces-sans);
}
.opt-proposals-kpis .kpi { padding: 11px clamp(10px, 1.4vw, 18px); }
.opt-proposals-kpis .kpi-num { font-size: clamp(26px, 3.6vw, 38px); }
.opt-proposals-kpis .kpi-label { font-size: 12px; }
html[data-optical-panel][data-mode="admin"] .opt-proposals-track {
  padding: 14px clamp(14px, 2vw, 22px);
  margin-top: 14px;
}
.opt-tracking-groups {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 10px;
}
.fa-recover {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 12px 0;
  padding: 6px 12px;
  border: 1px solid var(--faces-cut);
  border-inline-start: 2px solid var(--faces-accent);
  border-radius: 13px;
  background: var(--faces-base);
  color: var(--faces-text);
}
.fa-recover-copy {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 9px;
  min-width: 0;
  padding-block: 6px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.fa-recover-meta { color: var(--faces-muted); font-size: 12px; }
.fa-recover-actions { display: flex; flex-wrap: wrap; gap: 3px; }
.fa-recover-actions .btn { padding-inline: 11px; }

@media (min-width: 760px) {
  .opt-operations-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .opt-proposals-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .opt-proposals-kpis .kpi:nth-child(n) {
    border-bottom: 0 !important;
    border-right: 1px solid var(--faces-cut) !important;
  }
  .opt-proposals-kpis .kpi:last-child { border-right: 0 !important; }
}
@media (min-width: 1000px) {
  .opt-tracking-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (orientation: landscape) and (max-height: 620px) {
  #app:has(> .opt-panel-scroll > .page > .opt-module-head) > .opt-dock {
    --opt-dock-offset: max(8px, env(safe-area-inset-bottom));
    margin-top: 6px;
    padding: 4px;
  }
  #app:has(> .opt-panel-scroll > .page > .opt-module-head) > .opt-dock > a,
  #app:has(> .opt-panel-scroll > .page > .opt-module-head) > .opt-dock summary { min-height: 44px; }
}

.opt-home {
  --opt-page-gap: clamp(12px, 1.05vw, 17px);
  max-width: min(1700px, 100%);
  margin-top: 0;
  padding: 0 clamp(18px, 2.15vw, 32px);
}
.opt-home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 36%);
  align-items: center;
  min-height: clamp(218px, 18.6vw, 280px);
  padding: clamp(24px, 2.3vw, 36px) clamp(30px, 4.2vw, 64px);
}
.opt-home-hero[data-optical-surface="hero"] { border-radius: clamp(20px, 2vw, 30px); }
.opt-home-copy { min-width: 0; z-index: 1; }
.opt-home-hero > .faces-optical-curves[data-optical-curves="hero"] {
  width: 62%;
  -webkit-mask-image: linear-gradient(to right, transparent 18%, #000 66%);
  mask-image: linear-gradient(to right, transparent 18%, #000 66%);
}
.opt-home-date {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--faces-accent);
  text-transform: uppercase;
  letter-spacing: .15em;
  font-size: clamp(10px, 1.05vw, 15px);
  font-weight: 730;
}
.opt-home-date::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.opt-home h1, .opt-home h2 {
  font-family: var(--faces-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.023em;
}
.opt-home h1 {
  margin: .14em 0 .08em;
  line-height: .98;
  font-size: clamp(40px, 5.28vw, 79px);
}
.opt-home-copy > p:not(.opt-home-date) { color: var(--faces-muted); font-size: clamp(15px, 1.45vw, 22px); }
.opt-home-actions { display: flex; align-items: center; gap: clamp(10px, 2vw, 34px); margin-top: clamp(14px, 1.65vw, 27px); }
.opt-home-actions .faces-optical-button { min-height: clamp(46px, 4.25vw, 62px); padding-inline: clamp(14px, 2.65vw, 42px); }
.opt-home-actions .faces-optical-button { font-size: clamp(12px, 1.28vw, 18px); }
.opt-home-actions .faces-optical-button svg { width: 19px; height: 19px; }
.opt-home-resume {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-left: clamp(8px, 2vw, 28px);
  border: 0;
  border-left: 1px solid var(--faces-cut);
  background: none;
  font-size: clamp(12px, 1.19vw, 17px);
  font-weight: 650;
  text-align: left;
}
.opt-home-resume svg { width: 18px; height: 18px; flex: none; }
.opt-home-resume:disabled { opacity: .58; cursor: default; }
.opt-home-resume:not(:disabled):hover { color: var(--faces-accent); }
.opt-home-emblem { display: grid; place-items: center; min-width: 0; }
.opt-home-emblem .faces-optical-monogram { --faces-monogram-size: clamp(144px, 17vw, 242px); }
.opt-home-grid { display: grid; grid-template-columns: 1fr 1.02fr; gap: var(--opt-page-gap); margin-top: var(--opt-page-gap); }
.opt-home-card { min-width: 0; min-height: 210px; padding: clamp(16px, 1.8vw, 27px); }
.opt-home-card header { display: flex; align-items: center; gap: clamp(8px, 1.1vw, 16px); margin-bottom: 7px; }
.opt-home h2 { font-size: clamp(22px, 2.05vw, 33px); line-height: 1.04; }
.opt-home-card header > :is(.opt-home-link, .opt-home-badge) { margin-left: auto; }
.opt-home-glyph {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(30px, 3vw, 42px);
  height: clamp(30px, 3vw, 42px);
  border-radius: 11px;
  background: var(--faces-selected);
  border: 1px solid var(--faces-cut);
  color: var(--faces-accent);
}
.opt-home-glyph.t-bad { background: var(--bad-bg); color: var(--bad); }
.opt-home-glyph svg { width: 58%; height: 58%; }
.opt-home-list { list-style: none; }
.opt-home-row { display: flex; align-items: start; gap: clamp(10px, 1.3vw, 20px); padding: 8px 0; }
.opt-home-row + .opt-home-row { border-top: 1px solid color-mix(in srgb, var(--faces-cut), transparent 33%); }
.opt-home-row strong, .opt-home-row div span { display: block; }
.opt-home-row strong { line-height: 1.24; font-size: clamp(13px, 1.22vw, 17px); }
.opt-home-row div span, .opt-home-card small, .opt-home-empty, .opt-home-lumi p { font-size: clamp(12px, 1.04vw, 15px); color: var(--faces-muted); }
.opt-home-event { align-items: center; min-height: 54px; }
.opt-home-event time { color: var(--faces-accent); font-weight: 720; }
.opt-home-event .opt-home-badge { margin-left: auto; }
.opt-home-badge {
  flex: none;
  border-radius: 99px;
  padding: .3em .85em;
  font-size: clamp(10px, .91vw, 13px);
  font-weight: 650;
  background: var(--faces-selected);
  color: var(--faces-accent);
}
.opt-home-badge.is-confirmed { background: var(--ok-bg); color: var(--ok); }
.opt-home-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  padding: 0;
  background: none;
  color: var(--faces-accent);
  font-size: clamp(11px, 1.08vw, 15px);
  font-weight: 700;
  text-decoration: none;
}
.opt-home-link:hover { text-decoration: underline; }
.opt-home-link svg { width: 1em; height: 1em; flex: none; }
.opt-home-month { text-transform: capitalize; }
.opt-home-more { margin-top: 7px; }
.opt-home-empty { padding: 10px 0; }
.opt-home-agenda:has(> .opt-home-empty) { align-self: start; min-height: 0; }
.opt-home-finances, .opt-home-lumi { min-height: clamp(140px, 13vw, 185px); }
.opt-home-finances dl { display: grid; grid-template-columns: 1fr 1fr; margin: 12px 0 0; }
.opt-home-finances dl > div + div { border-left: 1px solid var(--faces-cut); padding-left: 12%; }
.opt-home-finances dt { font-size: clamp(11px, 1.1vw, 16px); font-weight: 700; }
.opt-home-finances dd { margin: 0; font: italic 400 clamp(24px, 3vw, 43px)/1.1 var(--faces-serif); }
.opt-home-lumi { display: grid; grid-template-columns: minmax(0, 1fr) minmax(70px, 27%); align-items: center; gap: 16px; }
.opt-home-lumi p { margin: 8px 0 11px; }
.opt-home-lumi .faces-optical-lumi { max-width: 134px; width: 100%; justify-self: center; }
.opt-home-lumi img { position: relative; width: 100%; height: auto; }
[data-optical-theme="day"] .opt-home-lumi-night, [data-optical-theme="night"] .opt-home-lumi-day { display: none; }

@media (min-width: 860px) {
  html[data-optical-panel][data-mode="admin"] { --opt-rail-width: clamp(62px, 5.6vw, 82px); }
  .opt-panel-scroll { margin-left: var(--opt-rail-width); }
  .opt-panel-scroll > .container:not(.opt-home) { max-width: none; }
  .opt-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--opt-rail-width);
    z-index: 29;
    background: color-mix(in srgb, var(--faces-ground), var(--faces-base) 35%);
    border-right: 1px solid var(--faces-cut);
    padding: 16px 4px;
    overflow: auto;
  }
  [data-optical-theme="night"] .opt-rail { background: #080e12; }
  .opt-rail a {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--ink);
    text-decoration: none;
  }
  .opt-rail .opt-rail-brand { margin-bottom: 9px; }
  .opt-rail a:is(:hover, [aria-current="page"]) { background: var(--faces-selected); }
  .opt-rail a span { display: none; }
  .opt-rail-more { display: grid; gap: 9px; border-top: 1px solid var(--faces-cut); padding-top: 9px; }
  .opt-dock { transform: translateX(calc(var(--opt-rail-width) / 2)); }
}

@media (max-width: 680px) {
  .opt-header { padding: 10px 13px; min-height: 67px; }
  .opt-header-tools { gap: 6px; }
  .opt-theme button { min-height: 38px; min-width: 36px; padding: 0 7px; }
  .opt-theme button svg, .opt-header-tools .opt-icon-button svg { width: 18px; height: 18px; }
  .opt-theme button span, .opt-header .opt-new span, .opt-search { display: none; }
  .opt-theme button[data-faces-theme="day"]::after, .opt-theme button[data-faces-theme="night"]::after { content: none; }
  .opt-header .opt-new { min-height: 42px; width: 42px; padding: 0; }
  .opt-dock { --opt-dock-offset: max(9px, env(safe-area-inset-bottom)); padding: 4px; gap: 1px; }
  .opt-dock > a, .opt-dock summary { flex-direction: column; gap: 3px; min-height: 45px; min-width: 49px; padding: 2px 7px; font-size: 10px; }
  .opt-dock svg { width: 19px; height: 19px; }
  .opt-home { padding-inline: 12px; }
  .opt-home-hero { grid-template-columns: 1fr; gap: 8px; padding: 21px 18px 17px; }
  .opt-home-emblem .faces-optical-monogram { --faces-monogram-size: clamp(130px, 45vw, 204px); }
  .opt-home-hero > .faces-optical-curves[data-optical-curves="hero"] {
    inset: auto 0 0;
    width: 100%;
    height: 58%;
    -webkit-mask-image: linear-gradient(transparent, #000 42%);
    mask-image: linear-gradient(transparent, #000 42%);
  }
  .opt-home-copy { padding: 1px 3px; }
  .opt-home-actions { flex-wrap: wrap; }
  .opt-home-actions .faces-optical-button { padding-inline: 13px; }
  .opt-home-actions .faces-optical-button svg { width: 16px; height: 16px; }
  .opt-home-resume { border-left: 0; padding-left: 4px; }
  .opt-home-grid { grid-template-columns: minmax(0, 1fr); }
  .opt-home-card { min-height: 0; }
  .opt-home-empty { padding: 8px 0 3px; }
}
@media (max-width: 370px) {
  .opt-brand { gap: 5px; }
  .opt-brand .bp-sig { width: 83px; }
  .opt-header-tools { gap: 4px; }
}
@media print {
  #app:has(> :is(.opt-dock, .wiz-bar)) { display: block; height: auto; }
  .opt-panel-scroll { margin: 0; overflow: visible; }
  .opt-header, .opt-dock, .opt-rail { display: none !important; }
}
.opt-dock.faces-optical-glass[data-optical-surface="dock"] { overflow: visible; }
/* Entrada profissional: o vidro e o texto acompanham o tema escolhido, inclusive no Safari. */
html[data-optical-panel] .opt-login {
  --login-page: radial-gradient(ellipse at 17% 0%, #fffdf9, transparent 62%), linear-gradient(135deg, #fcf9f2, #efe0ce);
  --login-surface: #fcf9f2;
  --login-field: #fbf7ef;
  --login-hero: radial-gradient(ellipse at 51% 55%, #fcf9f2, #f3e9da 46%, #d7c8b5 100%);
  --login-glass: url("/assets/optical/login-glass-day.svg");
  --login-rim: #af9a81;
  --login-placeholder: #62584e;
  padding: 12px max(14px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: var(--login-page);
}
html[data-optical-panel][data-optical-theme="night"] .opt-login {
  --login-page: radial-gradient(ellipse at 18% 0%, #2b424f, transparent 57%), linear-gradient(145deg, #0e1419, #152630);
  --login-surface: #172731;
  --login-field: #101f28;
  --login-hero: radial-gradient(ellipse at 48% 51%, #354954, #253740 45%, #14232c 100%);
  --login-glass: url("/assets/optical/login-glass-night.svg");
  --login-rim: #637780;
  --login-placeholder: #c0c7ca;
}
.opt-login-frame { width: min(100%, 466px); }
.opt-login-theme { width: fit-content; margin: 0 0 9px auto; padding: 2px; }
.opt-login-theme button { min-height: 44px; padding-inline: 13px; font-size: 12px; }
.opt-login .opt-login-theme button span { display: inline; }
.opt-login-theme svg { width: 16px; height: 16px; flex: none; }
.opt-login-card.faces-optical-glass {
  border-color: var(--login-rim);
  border-radius: clamp(19px, 5vw, 27px);
  background: var(--login-surface);
  overflow: hidden;
}
.opt-login-masthead {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  min-height: clamp(136px, 41vw, 196px);
  border-bottom: 1px solid var(--login-rim);
  background: var(--login-glass) center / 100% 100% no-repeat, var(--login-hero);
  color: var(--faces-text);
}
.opt-login-masthead img {
  width: clamp(70px, 19vw, 94px);
  height: auto;
  filter: drop-shadow(1px 4px 3px rgba(32, 24, 18, .26));
}
.opt-login-masthead .bp-sig { width: clamp(148px, 43vw, 198px); aspect-ratio: 2590 / 266; }
.opt-login-content { display: grid; gap: 10px; padding: clamp(16px, 5vw, 26px); }
.opt-login-intro { margin-bottom: 4px; }
.opt-login-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--faces-accent);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.opt-login-kicker::before {
  content: "";
  width: 22px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--faces-accent), transparent);
}
.opt-login .opt-login-intro h1 {
  margin: 5px 0 6px;
  font-size: clamp(34px, 10vw, 50px);
  letter-spacing: -.035em;
  color: var(--faces-text);
}
.opt-login-description { color: var(--faces-muted); font-size: 13px; line-height: 1.45; }
.opt-login .lg-field {
  min-height: 55px;
  border: 1px solid var(--faces-cut);
  border-radius: 11px;
  background: var(--login-field);
  box-shadow: none;
  padding-block: 6px;
  transition: box-shadow .18s, border-color .18s;
}
html[data-optical-panel] .opt-login .lg-field:focus-within {
  border-color: var(--faces-focus);
  box-shadow: 0 0 0 1px var(--faces-focus);
  transform: none;
}
.opt-login .lg-field > svg { color: var(--faces-accent); }
.opt-login .lg-field .fx { padding-inline-start: 10px; border-inline-start: 1px solid var(--faces-cut); }
.opt-login .lg-field label { letter-spacing: .14em; color: var(--faces-muted); }
.opt-login .lg-field input::placeholder { color: var(--login-placeholder); opacity: 1; }
.opt-login .lg-field .eye { width: 44px; height: 44px; margin-block: -2px; margin-inline-end: -8px; }
.opt-login .opt-login-submit {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 16px;
  width: 100%;
  min-height: 49px;
  padding: 6px 11px;
  border-radius: 11px;
  font-size: clamp(10px, 2.65vw, 12px);
  font-weight: 700;
  letter-spacing: .10em;
  line-height: 1.35;
  text-transform: uppercase;
}
.opt-login .opt-login-submit svg { width: 16px; height: 16px; }
.opt-login .lg-row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.opt-login .btn-reg {
  min-height: 44px;
  padding: 6px 7px;
  border-radius: 10px;
  border: 1px solid var(--faces-cut);
  background: var(--login-field);
  box-shadow: none;
  font-size: clamp(11px, 2.9vw, 13px);
  line-height: 1.28;
}
.opt-login .btn-reg svg { flex: none; width: 16px; height: 16px; }
.opt-login .card-f { flex-wrap: wrap; gap: 2px 10px; color: var(--faces-muted); }
#care360-host .care360-toolbar {
  padding: clamp(14px, 2vw, 24px);
  border: 1px solid var(--faces-optic-edge);
  border-radius: var(--r-lg);
  background: var(--faces-glass);
}
#care360-host .care360-status { color: var(--faces-muted); }

.opt-doc-brand { display: flex; align-items: center; gap: 10px; color: var(--faces-text); }
.opt-doc-brand img { object-fit: contain; }
.opt-doc-brand .bp-sig { width: clamp(115px, 22vw, 178px); aspect-ratio: 2590 / 266; }
@media print {
  .opt-doc-brand { color: #121212; }
}

/* O cabeçalho reduz a assinatura antes de comprometer os alvos de toque. */
.opt-brand { min-width: 0; }
.opt-brand .bp-sig { height: auto; min-width: 0; }
.opt-header .opt-new, .opt-home-actions .faces-optical-button { text-decoration: none; font-weight: 650; }
@media (max-width: 680px) {
  .opt-brand .bp-sig { width: clamp(60px, 24vw, 112px); }
}

html[data-optical-panel] .doc-brand {
  background: var(--faces-hero);
  color: var(--faces-text);
}
html[data-optical-panel] .doc-brand-meta {
  color: var(--faces-muted);
  border-color: var(--faces-cut);
}
html[data-optical-panel] .doc-brand .doc-print {
  color: var(--faces-text);
  border-color: var(--faces-cut);
  background: var(--faces-tile);
}
html[data-optical-panel] .doc :is(.opt-box, .opt-input:checked + .opt-box, .cond, .confirm-card),
html[data-optical-panel] .doc-mobilebar {
  background: var(--surface-2);
}
html[data-optical-panel] .doc .opt-input:not(:checked) + .opt-box .opt-mark { background: var(--surface-2); }
@media print {
  html[data-optical-panel] .doc-brand { background: #fff; color: #121212; }
  html[data-optical-panel] .doc-brand-meta { color: #544e46; }
}

/* Os controles ocupam o espaço real de cada ilha, inclusive com campos nativos do Safari. */
html[data-optical-panel] :is(.input, .select, .field textarea) {
  min-inline-size: 0;
  max-inline-size: 100%;
}
html[data-optical-panel] :is(input[type="month"], input[type="date"], input[type="time"]).input {
  inline-size: 100%;
}
html[data-optical-panel] .input::-webkit-date-and-time-value {
  min-width: 0;
  text-align: start;
}
html[data-optical-panel][data-mode="admin"] select:is(.input, .select):not([multiple], [size]) {
  -webkit-appearance: none;
  appearance: none;
  padding-inline-end: 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(45deg, transparent 50%, var(--ink-2) 50%) right 18px center / 5px 5px no-repeat,
    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%) right 13px center / 5px 5px no-repeat,
    var(--input-bg);
}
html[data-optical-panel] :is(.btn, .nt-chip, .chip) {
  max-inline-size: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
html[data-optical-panel] .btn svg { flex-shrink: 0; }
.opt-header { gap: 8px 16px; }
.opt-header-tools { flex: none; }
.opt-brand { min-inline-size: 0; }
.opt-brand .bp-sig { min-inline-size: 0; }
.opt-dock {
  max-width: calc(100% - var(--opt-rail-width, 0px) - 24px);
  box-shadow: 0 11px 24px -10px var(--faces-optic-shadow), inset 0 1px 2px var(--faces-optic-near);
}
/* A luz termina dentro da borda e o menu continua livre para abrir acima. */
.opt-dock.faces-optical-glass[data-optical-surface="dock"]::after { width: 52%; }
.opt-dock > a, .opt-dock summary { min-width: 0; }
.opt-dock .opt-popover { max-height: min(60dvh, 440px); overflow-y: auto; }
.opt-header .opt-popover { max-height: min(65dvh, 440px); overflow-y: auto; }

html[data-optical-panel] :is(.opt-module-card, .cash-card, .fa-crm-card, .attention.faces-optical-glass, .wiz-panel) {
  box-shadow: var(--card-shadow), 0 10px 22px -15px var(--faces-optic-shadow);
}
.opt-module-actions, .opt-coupon-actions { gap: 8px; }
.cash-filters.cash-search {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr));
  align-items: end;
  gap: 12px 16px;
}
.cash-search > .field, .cash-period > .field { min-inline-size: 0; }
.cash-period {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 5.5rem);
  align-items: end;
  gap: 8px;
}
.cash-period .input { box-sizing: border-box; }
.cash-search .cash-search-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
}
.cash-check input { flex: none; }
.cash-row { overflow-wrap: anywhere; }
.cash-row > .badge { justify-self: start; }
.cash-reference summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.cash-reference summary::-webkit-details-marker { display: none; }
.cash-reference summary::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-inline-end: 1px solid var(--faces-accent);
  border-block-end: 1px solid var(--faces-accent);
  transform: rotate(-45deg);
}
.cash-reference[open] summary::before { transform: rotate(45deg); }

.opt-operations-grid.opt-scheduled { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 68rem) {
  .opt-operations-grid.opt-scheduled { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
}
.sp-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr));
  align-items: end;
  gap: 12px;
}
.opt-scheduled :is(.field label, .mini-card) { overflow-wrap: anywhere; }
.opt-scheduled .field :is(.input, .select) { width: 100%; min-height: 44px; }
.sp-procedure-head, .sp-procedure-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-block-start: 8px;
}
.sp-procedure-head { justify-content: space-between; }
.sp-procedure-actions { justify-content: end; }
.sp-procedure-actions > button { min-width: 44px; min-height: 44px; }

.crm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block: 0 16px;
}
.crm-tabs .nt-chip { min-height: 44px; line-height: 1.3; }
.fa-crm-scope { max-inline-size: 17rem; margin-block: 12px; }
.fa-crm-card { min-inline-size: 0; }
.fa-crm-table-scroll { max-inline-size: 100%; overflow-x: auto; margin-block: 12px; }
.fa-crm-table {
  inline-size: 100%;
  min-inline-size: 36rem;
  border-collapse: collapse;
  font-size: 13px;
}
.fa-crm-table :is(th, td) {
  padding: 9px 10px;
  border-block-end: 1px solid var(--faces-cut);
  text-align: start;
  vertical-align: top;
  overflow-wrap: anywhere;
}
.fa-crm-table th { color: var(--faces-text); background: var(--faces-tile); }
.fa-crm-table tr:last-child td { border-block-end: 0; }

.attention-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
.attention-item .dot { margin: 0; align-self: start; margin-block-start: 8px; }
.attention-item .txt { overflow-wrap: anywhere; }
.attention-action { min-height: 44px; justify-self: start; }
.pcard-foot { flex-wrap: wrap; }
.pcard-foot .grow { min-inline-size: 0; overflow-wrap: anywhere; }
.pcard-side .badge { white-space: normal; text-align: end; }
#app > .wiz-bar { position: relative; inset: auto; padding-inline-start: calc(var(--gutter) + var(--opt-rail-width, 0px)); }
.opt-panel-scroll .wizard { padding-bottom: 0; }
.wiz-bar-inner { flex-wrap: wrap; }

.public-page:has(> .doc-mobilebar) {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100dvh;
  min-height: 0;
}
.public-page:has(> .doc-mobilebar) > .doc-wrap {
  overflow: auto;
  padding-bottom: 24px;
}
.public-page > .doc-mobilebar { position: relative; inset: auto; flex-wrap: wrap; }
@media (min-width: 900px) {
  .public-page:has(> .doc-mobilebar) { display: block; height: auto; min-height: 100vh; }
  .public-page:has(> .doc-mobilebar) > .doc-wrap { overflow: visible; }
}
@media print {
  .public-page:has(> .doc-mobilebar) { display: block; height: auto; }
  .public-page:has(> .doc-mobilebar) > .doc-wrap { overflow: visible; }
}

@media (max-width: 420px) {
  .opt-header { gap: 8px; }
  .opt-header .opt-brand .bp-sig { width: clamp(65px, 23vw, 100px); }
  .opt-header .opt-icon-button { width: 44px; height: 44px; }
  .opt-dock { max-width: calc(100% - 16px); }
  .opt-dock > a, .opt-dock summary { padding-inline: clamp(3px, 1.5vw, 7px); }
  .cash-search-actions .btn { width: 100%; }
  .attention-item { grid-template-columns: auto minmax(0, 1fr); }
  .attention-action { grid-column: 2; }
}
