/* Glow da Clara — componentes compartilhados (P1)
   Classes sem prefixo são exclusivas do P1 (CONTRATOS 9.3). Outros pacotes não as redefinem.
   Todos os componentes usam os tokens --ui-* e funcionam no tema claro e em [data-theme="dark"]. */

/* =========================================================
   Esqueleto de tela
   ========================================================= */
.screen {
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding:
    calc(var(--safe-t) + var(--sp-6))
    max(var(--gutter), var(--safe-r))
    calc(var(--sp-8) + var(--view-safe-b, 0px))
    max(var(--gutter), var(--safe-l));
}

.screen-header {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  min-height: var(--tap);
}
.screen-header > .btn-icon { align-self: center; margin-left: calc(-1 * var(--sp-2)); }
.screen-header-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.screen-header-text .title-lg { overflow-wrap: anywhere; }
.screen-header-sub { color: var(--ui-muted); font-size: var(--fs-md); }
.screen-header-actions { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; justify-content: flex-end; }

.screen-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

/* =========================================================
   Tipografia
   ========================================================= */
.title-display, .title-lg, .title-md {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--ui-title);
  letter-spacing: -0.005em;
}
.title-display { font-size: var(--fs-3xl); }
.title-lg { font-size: var(--fs-2xl); }
.title-md { font-size: var(--fs-xl); }
.title-display em, .title-lg em, .title-md em { font-style: italic; font-weight: 500; }

.label-caps {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--fs-xs);
  line-height: 1.3;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ui-subtle);
}

.text-muted { color: var(--ui-muted); }

/* =========================================================
   Botões
   ========================================================= */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ui-accent);
  --btn-bd: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 22px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease),
              border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease),
              box-shadow var(--dur-2) var(--ease), opacity var(--dur-1) var(--ease);
}
.btn svg { width: 20px; height: 20px; }
.btn:active { transform: scale(.97); }

.btn-primary {
  --btn-bg: var(--ui-accent);
  --btn-fg: var(--ui-on-accent);
  box-shadow: 0 1px 0 color-mix(in srgb, white 14%, transparent) inset,
              0 6px 16px color-mix(in srgb, var(--vinho) 22%, transparent);
}
.btn-primary:active { --btn-bg: var(--ui-accent-hover); box-shadow: 0 2px 6px color-mix(in srgb, var(--vinho) 20%, transparent); }

.btn-secondary {
  --btn-bg: var(--ui-surface);
  --btn-fg: var(--ui-accent);
  --btn-bd: color-mix(in srgb, var(--ui-accent) 28%, transparent);
}
.btn-secondary:active { --btn-bg: var(--ui-highlight); }

.btn-ghost { --btn-fg: var(--ui-accent); }
.btn-ghost:active { --btn-bg: var(--ui-highlight); }

.btn-danger {
  --btn-bg: var(--erro);
  --btn-fg: var(--perola);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--erro) 22%, transparent);
}

@media (hover: hover) {
  .btn-primary:hover { --btn-bg: var(--ui-accent-hover); }
  .btn-secondary:hover, .btn-ghost:hover { --btn-bg: var(--ui-highlight); }
  .btn-danger:hover { filter: brightness(.94); }
}

.btn-lg { min-height: var(--tap-lg); padding: 0 30px; font-size: var(--fs-md); }
.btn-lg svg { width: 22px; height: 22px; }
.btn-icon { padding: 0; width: var(--tap); height: var(--tap); }
.btn-icon.btn-lg { width: var(--tap-lg); height: var(--tap-lg); padding: 0; }
.btn-icon svg { width: 24px; height: 24px; }
.btn-block { display: flex; width: 100%; }

.btn:disabled, .btn.is-disabled { opacity: .42; pointer-events: none; box-shadow: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--btn-fg);
  border-right-color: transparent;
  animation: glow-spin .7s linear infinite;
}

/* botão flutuante */
.fab {
  position: fixed;
  z-index: 20;
  right: calc(max(var(--safe-r), 0px) + var(--sp-6));
  bottom: calc(var(--nav-offset-b, 0px) + var(--view-safe-b, 0px) + var(--sp-5));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 64px;
  height: 64px;
  padding: 0 26px;
  border-radius: var(--r-pill);
  background: var(--ui-accent);
  color: var(--ui-on-accent);
  font-weight: 700;
  font-size: var(--fs-md);
  box-shadow: 0 1px 0 color-mix(in srgb, white 16%, transparent) inset,
              0 14px 34px color-mix(in srgb, var(--vinho-profundo) 32%, transparent);
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.fab svg { width: 26px; height: 26px; }
.fab:active { transform: scale(.95); }
.fab:empty, .fab:has(> svg:only-child) { padding: 0; width: 64px; }

/* =========================================================
   Cartões
   ========================================================= */
.card {
  position: relative;
  display: block;
  background: var(--ui-surface);
  color: var(--ui-text);
  border-radius: var(--r-lg);
  border: 1px solid color-mix(in srgb, var(--ui-line) 70%, transparent);
  box-shadow: var(--ui-shadow-1);
  padding: var(--sp-5);
}
.card-tap {
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease), background-color var(--dur-1) var(--ease);
}
.card-tap:active { transform: scale(.985); box-shadow: none; background-color: var(--ui-highlight); }
@media (hover: hover) { .card-tap:hover { box-shadow: var(--ui-shadow-2); } }

.card-dark {
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--rose) 18%, transparent), transparent 60%),
    linear-gradient(160deg, var(--vinho) 0%, var(--vinho-profundo) 100%);
  color: var(--sobre-escuro);
  border-color: color-mix(in srgb, var(--champanhe) 30%, transparent);
  box-shadow: 0 14px 36px color-mix(in srgb, var(--vinho-profundo) 30%, transparent);
}
[data-theme="dark"] .card:not(.card-dark) { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* =========================================================
   Chips
   ========================================================= */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--ui-line);
  background: var(--ui-surface);
  color: var(--ui-text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease),
              color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.chip svg { width: 18px; height: 18px; }
.chip:active { transform: scale(.96); }
.chip.is-selected {
  background: var(--ui-highlight);
  border-color: var(--ui-accent);
  color: var(--ui-accent);
}
.chip.is-selected::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  margin-left: -2px;
}
.chip-add { border-style: dashed; color: var(--ui-muted); background: transparent; }
.chip-input {
  min-height: var(--tap);
  width: 180px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--ui-accent);
  background: var(--ui-field);
  color: var(--ui-text);
  font-size: var(--fs-md);
  outline: none;
  box-shadow: 0 0 0 4px var(--ui-highlight);
}

/* =========================================================
   Controle segmentado
   ========================================================= */
.segmented {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  padding: 4px;
  gap: 2px;
  border-radius: var(--r-pill);
  background: var(--ui-surface-2);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented-thumb {
  position: absolute;
  top: 4px; bottom: 4px; left: 0;
  border-radius: var(--r-pill);
  background: var(--ui-surface);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--vinho-profundo) 12%, transparent),
              0 3px 10px color-mix(in srgb, var(--vinho-profundo) 10%, transparent);
  pointer-events: none;
}
.segmented.is-ready .segmented-thumb { transition: transform var(--dur-2) var(--ease), width var(--dur-2) var(--ease); }
[data-theme="dark"] .segmented-thumb, .card-dark .segmented-thumb, .overlay-dark .segmented-thumb { background: color-mix(in srgb, var(--perola) 20%, transparent); }
.segmented-item {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 20px;
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ui-muted);
  transition: color var(--dur-2) var(--ease);
}
.segmented-item svg { width: 18px; height: 18px; }
.segmented-item.is-selected { color: var(--ui-accent); }
.segmented:not(.is-ready) .segmented-item.is-selected { background: var(--ui-surface); }

/* =========================================================
   Campos de formulário
   ========================================================= */
.field { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.field-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ui-subtle);
}
.input, .select, .textarea {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--ui-line);
  background: var(--ui-field);
  color: var(--ui-text-strong);
  font-family: var(--font-ui);
  font-size: var(--fs-md);           /* 17px: o iOS não dá zoom no foco */
  line-height: 1.3;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--ui-subtle); opacity: .75; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--ui-accent);
  box-shadow: 0 0 0 4px var(--ui-highlight);
}
.textarea { min-height: 120px; padding: 14px 16px; resize: vertical; line-height: var(--lh-body); }
.select {
  padding-right: 48px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238A5A62' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
input[type="date"].input, input[type="time"].input, input[type="datetime-local"].input { display: flex; align-items: center; }
input[type="date"].input::-webkit-date-and-time-value,
input[type="time"].input::-webkit-date-and-time-value { text-align: left; }
.field-hint { font-size: var(--fs-sm); color: var(--ui-muted); }
.field-error { font-size: var(--fs-sm); font-weight: 600; color: var(--erro); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea,
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--erro); }
[data-theme="dark"] .field-error, .card-dark .field-error { color: var(--rose); }

/* =========================================================
   Stepper
   ========================================================= */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 4px;
  border-radius: var(--r-pill);
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
}
.stepper-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-lg);
  height: var(--tap-lg);
  border-radius: 50%;
  background: var(--ui-surface-2);
  color: var(--ui-accent);
  touch-action: manipulation;
  transition: transform var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease), opacity var(--dur-1) var(--ease);
}
.stepper-btn svg { width: 24px; height: 24px; }
.stepper-btn:active, .stepper-btn.is-pressed { transform: scale(.9); background: var(--ui-highlight); }
.stepper-btn:disabled { opacity: .32; }
.stepper-value {
  min-width: 96px;
  padding: 0 var(--sp-2);
  text-align: center;
  font-size: var(--fs-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ui-text-strong);
  white-space: nowrap;
}

/* =========================================================
   Lista
   ========================================================= */
.list {
  display: flex;
  flex-direction: column;
  background: var(--ui-surface);
  border: 1px solid color-mix(in srgb, var(--ui-line) 70%, transparent);
  border-radius: var(--r-lg);
  box-shadow: var(--ui-shadow-1);
  overflow: hidden;
}
.list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  width: 100%;
  min-height: 64px;
  padding: var(--sp-3) var(--sp-5);
  text-align: left;
  color: var(--ui-text);
  text-decoration: none;
  background: transparent;
  transition: background-color var(--dur-1) var(--ease);
}
.list-item + .list-item { box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ui-line) 75%, transparent); }
button.list-item, a.list-item, .list-item[role="button"] { cursor: pointer; }
button.list-item:active, a.list-item:active, .list-item[role="button"]:active { background: var(--ui-highlight); }
.list-item > :not(.list-item-end):not(.avatar):not(svg) { min-width: 0; }
.list-item-title {
  display: block;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--ui-text-strong);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-item-sub {
  display: block;
  font-size: var(--fs-sm);
  color: var(--ui-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-item-end {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--ui-subtle);
  font-size: var(--fs-sm);
}

/* =========================================================
   Arco da marca e avatar
   ========================================================= */
.arc {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 50% 50% 10px 10px / 37.5% 37.5% 10px 10px;
  overflow: hidden;
  background: var(--ui-surface-2);
}
.arc > img, .arc > video, .arc > canvas { width: 100%; height: 100%; object-fit: cover; }

.avatar {
  --av-size: 56px;
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--av-size);
  height: calc(var(--av-size) * 1.2);
  border-radius: 50% 50% 18% 18% / 42% 42% 15% 15%;
  overflow: hidden;
  background:
    radial-gradient(90% 70% at 50% 0%, color-mix(in srgb, var(--perola) 80%, transparent), transparent 70%),
    linear-gradient(165deg, var(--rose-suave) 0%, var(--areia) 100%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rose) 45%, transparent);
  color: var(--vinho);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: calc(var(--av-size) * 0.42);
  line-height: 1;
  letter-spacing: .01em;
}
.avatar > img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initials { transform: translateY(6%); }
[data-theme="dark"] .avatar, .card-dark .avatar {
  background: linear-gradient(165deg, color-mix(in srgb, var(--rose) 40%, transparent), color-mix(in srgb, var(--rose) 14%, transparent));
  color: var(--perola);
}

/* =========================================================
   Legenda de cores
   ========================================================= */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-5); }
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ui-text);
  white-space: nowrap;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--dot, var(--rose));
  box-shadow: 0 0 0 2px var(--ui-surface), 0 0 0 3px color-mix(in srgb, var(--dot, var(--rose)) 50%, transparent);
}

/* =========================================================
   Cartões de seleção visual (Fitzpatrick, acne, cicatriz)
   ========================================================= */
.option-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--sp-3);
}
.option-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--sp-2);
  min-height: 120px;
  padding: var(--sp-3);
  border-radius: var(--r-md);
  border: 1.5px solid var(--ui-line);
  background: var(--ui-surface);
  color: var(--ui-text);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease),
              transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.option-card:active { transform: scale(.97); }
/* área de cor ou ilustração: .option-card-swatch (ou img/svg/canvas direto no cartão) */
.option-card-swatch,
.option-card > img,
.option-card > svg,
.option-card > canvas {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  border-radius: var(--r-sm);
  background: var(--swatch, var(--ui-surface-2));
  object-fit: cover;
  overflow: hidden;
}
.option-card-swatch > img, .option-card-swatch > svg { width: 100%; height: 100%; object-fit: cover; }
.option-card-label, .option-card > strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ui-text-strong);
}
.option-card-desc, .option-card > small {
  display: block;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ui-muted);
}
.option-card.is-selected {
  border-color: var(--ui-accent);
  background: var(--ui-highlight);
  box-shadow: 0 0 0 1.5px var(--ui-accent) inset;
}
.option-card.is-selected::after {
  content: '';
  position: absolute;
  top: 10px; right: 10px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--ui-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F6F0E9' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 12.5l4.2 4.2 8.8-9.4'/%3E%3C/svg%3E") center / 16px no-repeat;
  box-shadow: 0 0 0 2px var(--ui-surface);
}

/* =========================================================
   Selos
   ========================================================= */
.badge {
  --badge-c: var(--ui-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1;
  white-space: nowrap;
  color: var(--badge-c);
  background: color-mix(in srgb, var(--badge-c) 13%, transparent);
}
.badge svg { width: 14px; height: 14px; }
.badge-ok { --badge-c: var(--ok); }
.badge-alerta { --badge-c: var(--alerta); }
.badge-erro { --badge-c: var(--erro); }
.badge-neutro { --badge-c: var(--ui-muted); background: var(--ui-surface-2); }
[data-theme="dark"] .badge-erro, .card-dark .badge-erro { --badge-c: var(--rose); }
[data-theme="dark"] .badge-alerta, .card-dark .badge-alerta { --badge-c: var(--champanhe); }

/* =========================================================
   Folhas (bottom sheet em retrato / painel central em paisagem)
   ========================================================= */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-t) + var(--sp-6)) max(var(--sp-6), var(--safe-r)) calc(var(--safe-b) + var(--sp-6)) max(var(--sp-6), var(--safe-l));
  background: var(--veu);
  -webkit-backdrop-filter: blur(6px) saturate(1.1);
  backdrop-filter: blur(6px) saturate(1.1);
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease);
}
.sheet-backdrop.is-open { opacity: 1; }

.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(600px, 100%);
  max-height: 100%;
  background: var(--ui-bg);
  color: var(--ui-text);
  border-radius: var(--r-lg);
  box-shadow: var(--ui-shadow-2), 0 0 0 1px color-mix(in srgb, var(--ui-line) 60%, transparent);
  overflow: hidden;
  transform: translateY(24px);
  transition: transform var(--dur-3) var(--ease);
  outline: none;
}
.sheet-backdrop.is-open .sheet { transform: none; }
.sheet-sm { width: min(440px, 100%); }
.sheet-md { width: min(600px, 100%); }
.sheet-lg { width: min(860px, 100%); }
.sheet-full { width: 100%; height: 100%; }

.sheet::before {          /* fio champanhe no topo: detalhe premium */
  content: '';
  position: absolute;
  top: 0; left: 50%;
  width: 64px; height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--champanhe), transparent);
  opacity: .8;
}

.sheet-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-4) var(--sp-3) var(--sp-6);
  min-height: 72px;
  flex-shrink: 0;
}
.sheet-grabber { display: none; }
.sheet-title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--ui-title);
}
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 var(--sp-6) var(--sp-5);
}
.sheet-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6) var(--sp-5);
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ui-line) 70%, transparent);
}
.sheet-actions .btn { min-width: 120px; }
.sheet-dialog .sheet-header { padding-top: var(--sp-6); }
.sheet-dialog .sheet-body { padding-bottom: var(--sp-4); }
.confirm-message { font-size: var(--fs-md); color: var(--ui-muted); white-space: pre-line; }

@media (orientation: portrait) {
  .sheet-backdrop:not(.sheet-backdrop-dialog) {
    align-items: flex-end;
    padding: calc(var(--safe-t) + var(--sp-7)) 0 0;
  }
  .sheet-backdrop:not(.sheet-backdrop-dialog) .sheet {
    width: min(760px, 100%);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding-bottom: var(--safe-b);
    transform: translateY(100%);
  }
  .sheet-backdrop:not(.sheet-backdrop-dialog) .sheet-full { width: 100%; height: 100%; }
  .sheet-backdrop:not(.sheet-backdrop-dialog).is-open .sheet { transform: translateY(var(--drag-y, 0px)); }
  .sheet-backdrop:not(.sheet-backdrop-dialog) .sheet::before { display: none; }
  .sheet-backdrop:not(.sheet-backdrop-dialog) .sheet-grabber {
    display: block;
    position: absolute;
    top: 8px; left: 50%;
    width: 44px; height: 5px;
    margin-left: -22px;
    border-radius: var(--r-pill);
    background: var(--ui-line);
  }
  .sheet-backdrop:not(.sheet-backdrop-dialog) .sheet-header { touch-action: none; }
  .sheet-backdrop:not(.sheet-backdrop-dialog) .sheet-actions .btn { flex: 1; }
  .sheet.is-dragging { transition: none !important; }
}

/* =========================================================
   Camada de tela inteira
   ========================================================= */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--ui-bg);
  color: var(--ui-text);
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease);
  overscroll-behavior: contain;
}
.overlay.is-open { opacity: 1; }
.overlay-dark {
  background:
    radial-gradient(80% 50% at 50% 0%, color-mix(in srgb, var(--vinho) 55%, transparent), transparent 70%),
    var(--vinho-profundo);
  color: var(--sobre-escuro);
}

/* =========================================================
   Toast
   ========================================================= */
.toast-stack {
  position: fixed;
  z-index: 1000;
  top: calc(var(--safe-t) + var(--sp-4));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  width: min(560px, calc(100% - 2 * var(--sp-5)));
  pointer-events: none;
}
.toast {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  max-width: 100%;
  min-height: 52px;
  padding: var(--sp-3) var(--sp-5) var(--sp-3) var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--texto-forte);
  color: var(--perola);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 12px 32px color-mix(in srgb, var(--vinho-profundo) 35%, transparent);
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-14px);
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-3) var(--ease-spring);
}
.toast.is-visible { opacity: 1; transform: none; }
.toast svg { width: 20px; height: 20px; color: var(--rose); }
.toast-success svg { color: var(--perola); }
.toast-success { background: var(--ok); }
.toast-error { background: var(--erro); }
.toast-error svg { color: var(--perola); }

/* =========================================================
   Estado vazio
   ========================================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-3);
  padding: var(--sp-7) var(--sp-5);
}
.empty-state-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 108px;
  margin-bottom: var(--sp-2);
  border-radius: var(--arc-radius);
  border: 1.5px solid var(--rose);
  background: linear-gradient(180deg, var(--ui-highlight), transparent);
  color: var(--ui-accent);
}
.empty-state-mark svg { width: 34px; height: 34px; }
.empty-state-title {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--ui-title);
}
.empty-state-text { max-width: 440px; color: var(--ui-muted); }
.empty-state .btn { margin-top: var(--sp-3); }

/* =========================================================
   Divisor e utilitários
   ========================================================= */
.divider {
  display: block;
  height: 1px;
  border: 0;
  margin: var(--sp-4) 0;
  background: var(--ui-line);
}

.stack { display: flex; flex-direction: column; gap: var(--gap, var(--sp-4)); }
.row { display: flex; align-items: center; gap: var(--gap, var(--sp-3)); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--gap, var(--sp-3)); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap, var(--sp-4)); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap, var(--sp-4)); }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }

.is-disabled { opacity: .42; pointer-events: none; }
.is-loading { cursor: progress; }
.card.is-loading, .list.is-loading { position: relative; pointer-events: none; }
.card.is-loading::after, .list.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--perola) 55%, transparent) 50%, transparent 80%);
  background-size: 200% 100%;
  animation: glow-shimmer 1.2s linear infinite;
}
@keyframes glow-shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* rótulo só para leitores de tela */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================
   Erro de rota (roteador)
   ========================================================= */
.route-error { min-height: 100%; display: flex; align-items: center; justify-content: center; }

/* =========================================================
   Movimento reduzido: só fades
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-backdrop .sheet,
  .sheet-backdrop.is-open .sheet,
  .toast, .toast.is-visible { transform: none !important; }
  .btn:active, .chip:active, .card-tap:active, .option-card:active,
  .stepper-btn:active, .fab:active { transform: none; }
  .segmented.is-ready .segmented-thumb { transition: opacity var(--dur-1) linear; }
  .card.is-loading::after, .list.is-loading::after, .btn.is-loading::after { animation-duration: 2.4s; }
}

/* camada ou folha em saída não intercepta toques */
.is-closing { pointer-events: none !important; }
