/* ==========================================================================
   Casa — Hugo · design system "Nogueira escura"
   Tokens (8.1) → base → layout → componentes (8.2) → sheets/forms/toasts (8.4) → vistas (25–33)
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: dark;

  --bg: #120d09;
  --bg-2: #18110c;
  --card: #1f1711;
  --card-2: #271d15;
  --card-hover: #2e2219;
  --border: rgba(236, 220, 196, 0.08);
  --border-strong: rgba(236, 220, 196, 0.16);

  --text: #ffffff;
  --text-2: #f6efe4;
  --muted: #cbb9a0;
  --faint: #8f7c66;

  --accent: #d4a373;
  --accent-strong: #b9804f;
  --walnut: #6e4a2f;
  --walnut-2: #3a2717;
  --beige: #e9dcc6;
  --accent-soft: rgba(212, 163, 115, 0.16);
  --on-accent: #1a120c;

  --ok: #7fc8a0;
  --warn: #e9b44c;
  --danger: #e57b6e;
  --info: #8fb3d9;
  --ok-soft: rgba(127, 200, 160, 0.16);
  --warn-soft: rgba(233, 180, 76, 0.16);
  --danger-soft: rgba(229, 123, 110, 0.16);
  --info-soft: rgba(143, 179, 217, 0.16);

  --hero-grad: linear-gradient(135deg, #7a5234 0%, #4a3120 55%, #2e1f14 100%);

  --radius: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --tabbar-h: 64px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;

  /* auxiliares (derivados dos tokens acima) */
  --sheet-bg: #1c150f;
  --elev: #2a1f16;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 0 rgba(255, 240, 220, 0.03) inset, 0 12px 28px -18px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 28px 70px -20px rgba(0, 0, 0, 0.85);
  --ring: 0 0 0 3px rgba(212, 163, 115, 0.3);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 180ms;
  --gutter: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --tabbar-space: calc(var(--tabbar-h) + var(--safe-bottom));
}

@media (min-width: 700px) {
  :root { --gutter: 24px; }
}

/* ---------- 2. Base / reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

/* Fundo: gradiente radial subtil de nogueira (fixo, sem background-attachment) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(122, 82, 52, 0.22), transparent 62%),
    radial-gradient(700px 480px at 100% 0%, rgba(110, 74, 47, 0.12), transparent 60%),
    radial-gradient(800px 600px at 50% 110%, rgba(58, 39, 23, 0.35), transparent 70%);
}

h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, video, canvas { display: block; }
svg { flex-shrink: 0; }
img { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
::selection { background: rgba(212, 163, 115, 0.35); color: #fff; }

.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* Foco: anel caramelo só para teclado */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Scrollbars discretas */
* { scrollbar-width: thin; scrollbar-color: rgba(236, 220, 196, 0.18) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(236, 220, 196, 0.16);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

/* Números alinhados em valores */
.card-value, .kpi-value, .li-amount, .bar-value, .vbar-value, .stepper-value,
.detail-value, .badge, .month-label, .tabular { font-variant-numeric: tabular-nums; }

/* ---------- 3. Splash ---------- */
#splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(520px 420px at 50% 42%, rgba(122, 82, 52, 0.28), transparent 70%),
    var(--bg);
  transition: opacity 0.35s ease, visibility 0.35s ease;
  /* Fallback: esconde-se sozinho aos 6 s mesmo que o JS falhe */
  animation: splash-out 0.45s ease 6s forwards;
}
#splash.hide, #splash.is-hidden, #splash.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.splash-logo {
  width: 84px;
  height: 84px;
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.55));
  animation: splash-breathe 2.6s ease-in-out infinite;
}
.splash-name {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--beige);
}
@keyframes splash-out { to { opacity: 0; visibility: hidden; pointer-events: none; } }

/* Aviso sem JavaScript (por cima do splash) */
.noscript {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--safe-bottom) + 24px);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 420px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.45;
  text-align: center;
}
.noscript span { color: var(--text-2); }
@keyframes splash-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* ---------- 4. Estrutura da app ---------- */
#app { min-height: 100vh; min-height: 100dvh; }
#auth-root { display: none; }
body.auth-mode #app { display: none; }
body.auth-mode #auth-root { display: block; }

.tab-page { min-height: 100%; }

.page {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 0;
  padding-left: max(var(--gutter), var(--safe-left));
  padding-right: max(var(--gutter), var(--safe-right));
  /* nunca esconder conteúdo debaixo da barra de tabs */
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
}
.page:not(:has(.page-header)) { padding-top: calc(var(--safe-top) + 16px); }
body.auth-mode .page { padding-bottom: calc(var(--safe-bottom) + 24px); }

/* Cabeçalho da página (sticky, translúcido) */
.page-header {
  position: sticky;
  top: 0;
  z-index: 30;
  /* grelha: o subtítulo usa a largura toda (por baixo das ações), como nos títulos grandes do iOS */
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "back title actions" "back sub sub";
  align-items: center;
  column-gap: 12px;
  min-height: calc(var(--safe-top) + 64px);
  margin: 0 calc(-1 * var(--gutter)) 8px;
  padding: calc(var(--safe-top) + 12px) var(--gutter) 12px;
  background: rgba(18, 13, 9, 0.88);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  /* fundo contínuo até às margens do ecrã, sem criar scroll horizontal */
  box-shadow: 0 0 0 100vmax rgba(18, 13, 9, 0.88), 0 1px 0 100vmax var(--border);
  clip-path: inset(0 -100vmax -1px);
}
.page-header:not(:has(> .back-btn)) {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "title actions" "sub sub";
}
.page-header-main { display: contents; }
.page-header > .back-btn { grid-area: back; }
.page-header > .header-actions { grid-area: actions; }
.page-title {
  grid-area: title;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* bloco (não flex) para as reticências funcionarem com texto solto; o ponto de sync fica inline */
.page-subtitle {
  grid-area: sub;
  display: block;
  margin-top: 2px;
  font-size: 13.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.page-subtitle > .sync-dot { margin: 0 8px 0 2px; vertical-align: 1px; }
.page-subtitle > .badge { vertical-align: 1px; margin-right: 6px; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-left: -4px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  transition: background var(--dur) ease, transform var(--dur) ease;
}
.back-btn:active { transform: scale(0.94); }

@media (min-width: 700px) {
  .page-title { font-size: 28px; }
  .page-header { min-height: calc(var(--safe-top) + 72px); padding-top: calc(var(--safe-top) + 16px); padding-bottom: 14px; }
}

/* Secções */
.section { margin-top: 26px; }
.page-header + .section, .page-header + .banner + .section { margin-top: 12px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 0 2px;
}
.section-title {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  min-width: 0;
}
.section-action {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  padding: 4px 2px;
  border-radius: 8px;
}
.section-action:active { opacity: 0.7; }

/* Utilitários de layout */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
.grid { display: grid; gap: 12px; }
.grid-2, .grid-3 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) {
  .grid-2, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 13px; }
.strong { font-weight: 650; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.visually-hidden, .sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- 5. Cartões ---------- */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card.clickable, .hub-card, .list-item.clickable, .alert-item.clickable {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background-color var(--dur) ease, transform var(--dur) var(--ease), border-color var(--dur) ease;
}
.card.clickable:active, .hub-card:active, .alert-item.clickable:active { transform: scale(0.98); }
@media (hover: hover) {
  .card.clickable:hover, .hub-card:hover { background: var(--card-hover); border-color: var(--border-strong); }
  .alert-item.clickable:hover { border-color: var(--border-strong); }
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.card-title { font-size: 15px; font-weight: 650; color: var(--text); min-width: 0; }
.card-text { font-size: 14.5px; color: var(--text); line-height: 1.5; }
.card-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}
.card-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.card > .progress { margin-top: 12px; }

/* Cartão principal (saldo) */
.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 20px;
  background: var(--hero-grad);
  border: 1px solid rgba(233, 220, 198, 0.14);
  box-shadow: 0 1px 0 rgba(255, 236, 210, 0.12) inset, 0 22px 48px -24px rgba(0, 0, 0, 0.9);
  color: #fff;
  isolation: isolate;
}
.hero-card::before {
  content: "";
  position: absolute;
  inset: auto -30% 40% auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(233, 196, 150, 0.2), transparent 65%);
  z-index: -1;
  pointer-events: none;
  transform: translate(10%, -45%);
}
.hero-card .card-title { color: var(--beige); font-weight: 600; font-size: 14px; }
.hero-card .card-value { font-size: 34px; color: #fff; margin-top: 4px; }
.hero-card .card-sub { color: rgba(246, 239, 228, 0.82); }
.hero-card .kpis { margin-top: 16px; }
.hero-card .kpi { background: rgba(18, 11, 6, 0.26); border-color: rgba(255, 236, 210, 0.08); }
.hero-card .kpi-label, .hero-card .kpi-sub { color: rgba(246, 239, 228, 0.78); }
.hero-card .badge { background: rgba(18, 11, 6, 0.3); color: var(--beige); }
.hero-card.clickable { cursor: pointer; transition: transform var(--dur) var(--ease); }
.hero-card.clickable:active { transform: scale(0.985); }

/* KPIs */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
}
.kpi {
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--border);
}
.kpi-label { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-value {
  margin-top: 2px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kpi-sub { margin-top: 1px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 6. Listas ---------- */
.list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.list-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 11px 14px;
  min-width: 0;
}
/* separadores só dentro de listas/cartões (não interferem com .alert-item::before) */
:is(.list, .card) > .list-item + .list-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 0;
  height: 1px;
  background: var(--border);
}
:is(.list, .card) > .list-item + .list-item:has(> .li-icon)::before { left: 64px; }
.card > .list-item { margin: 0 -16px; }
.card > .list-item:first-child { margin-top: -6px; }
.card > .list-item:last-child { margin-bottom: -6px; }
.list-item.clickable:active { background: var(--card-hover); transform: none; }
@media (hover: hover) {
  .list-item.clickable:hover { background: rgba(46, 34, 25, 0.6); }
}
.li-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  overflow: hidden;
}
.li-icon img { width: 100%; height: 100%; object-fit: cover; }
.li-icon.accent { background: var(--accent-soft); color: var(--accent); }
.li-icon.ok { background: var(--ok-soft); color: var(--ok); }
.li-icon.warn { background: var(--warn-soft); color: var(--warn); }
.li-icon.danger { background: var(--danger-soft); color: var(--danger); }
.li-icon.info { background: var(--info-soft); color: var(--info); }
.li-icon.muted { background: rgba(236, 220, 196, 0.08); color: var(--muted); }
.li-main { flex: 1 1 auto; min-width: 0; }
.li-title {
  font-size: 15px;
  font-weight: 560;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* bloco (não flex): as reticências funcionam com texto solto; badges ficam inline */
.li-sub {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.li-sub > .badge { height: 20px; padding: 0 8px; font-size: 11.5px; margin-right: 6px; vertical-align: 1px; }
.li-sub > .sync-dot { margin-right: 6px; }
.li-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
  text-align: right;
  max-width: 50%;
}
.li-end:has(> .btn), .li-end:has(> .stepper) { flex-direction: row; align-items: center; gap: 8px; }
.li-amount { font-size: 15px; font-weight: 650; color: var(--text); white-space: nowrap; }
.li-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.list-group-title {
  padding: 16px 6px 7px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.list-group-title:first-child { padding-top: 2px; }
.list-empty { padding: 18px 14px; color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- 7. Badges, chips, segmented ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  background: rgba(236, 220, 196, 0.08);
  color: var(--text-2);
}
.badge.muted { background: rgba(236, 220, 196, 0.08); color: var(--muted); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--gutter);
  margin: 0 calc(-1 * var(--gutter));
  padding: 2px var(--gutter) 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 560;
  white-space: nowrap;
  scroll-snap-align: start;
  transition: background var(--dur) ease, color var(--dur) ease, border-color var(--dur) ease, transform var(--dur) ease;
}
.chip:active { transform: scale(0.96); }
.chip-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(236, 220, 196, 0.1);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip.active .chip-count { background: rgba(26, 18, 12, 0.16); color: var(--on-accent); }
@media (hover: hover) {
  .chip:not(.active):hover { border-color: rgba(212, 163, 115, 0.45); }
}

/* grelha de colunas iguais (como no iOS): nunca corta o texto quando há espaço */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 2px;
  max-width: 100%;
  padding: 3px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
}
.segmented > button {
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--dur) ease, color var(--dur) ease;
}
.segmented > button.active {
  background: var(--walnut);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 236, 210, 0.12) inset, 0 2px 6px rgba(0, 0, 0, 0.35);
}
.segmented > button:disabled { opacity: 0.5; }
@media (hover: hover) {
  .segmented > button:not(.active):hover { color: var(--text-2); }
}

/* ---------- 8. Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  height: 44px;
  padding: 0 18px;
  border-radius: 13px;
  border: 1px solid var(--border-strong);
  background: var(--card-2);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
  transition: background var(--dur) ease, border-color var(--dur) ease, transform var(--dur) var(--ease), opacity var(--dur) ease;
}
.btn > span { overflow: hidden; text-overflow: ellipsis; line-height: 1.3; } /* 1.3: não corta descendentes (g, p, ç) */
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: default; }
@media (hover: hover) {
  .btn:hover:not(:disabled) { background: var(--card-hover); }
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:disabled { opacity: 0.6; }
@media (hover: hover) {
  .btn-primary:hover:not(:disabled) { background: #dcb083; }
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
@media (hover: hover) {
  .btn-ghost:hover:not(:disabled) { background: var(--accent-soft); }
}
.btn-danger { background: var(--danger-soft); border-color: rgba(229, 123, 110, 0.28); color: var(--danger); }
@media (hover: hover) {
  .btn-danger:hover:not(:disabled) { background: rgba(229, 123, 110, 0.24); }
}
.btn-danger.btn-strong { background: var(--danger); border-color: var(--danger); color: #1f0d0a; }
@media (hover: hover) {
  .btn-danger.btn-strong:hover:not(:disabled) { background: #ec8d81; border-color: #ec8d81; }
}
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; gap: 6px; }
.btn-block { display: flex; width: 100%; }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
  border-radius: 12px;
  color: var(--text);
}
.btn.btn-icon { width: 44px; }
.btn.btn-icon.btn-sm { width: 34px; height: 34px; }
.btn-icon:not(.btn) { background: transparent; border: 0; transition: background var(--dur) ease; }
.btn-icon:not(.btn):active { background: var(--card-hover); }
@media (hover: hover) {
  .btn-icon:not(.btn):hover { background: rgba(236, 220, 196, 0.06); }
}
.btn.is-busy { cursor: progress; }

/* ---------- 9. Pesquisa ---------- */
.search-box { position: relative; display: flex; align-items: center; min-width: 0; }
.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: flex;
}
input.search-input {
  width: 100%;
  height: 46px;
  padding: 0 44px 0 42px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg-2);
  color: #fff;
  -webkit-text-fill-color: #fff;
  caret-color: var(--accent);
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease;
}
input.search-input::placeholder { color: #cbb9a0; -webkit-text-fill-color: #cbb9a0; opacity: 1; }
input.search-input:focus { border-color: var(--accent); box-shadow: var(--ring); }
input.search-input::-webkit-search-decoration,
input.search-input::-webkit-search-cancel-button,
input.search-input::-webkit-search-results-button { -webkit-appearance: none; display: none; }
button.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  transition: opacity var(--dur) ease, background var(--dur) ease;
}
button.search-clear:active { background: var(--card-hover); }
.search-box:not(.has-value) .search-clear { opacity: 0; visibility: hidden; pointer-events: none; }

/* ---------- 10. Progresso ---------- */
.progress {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(236, 220, 196, 0.1);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  transition: width 0.4s var(--ease);
}
.progress-bar.ok, .progress.ok .progress-bar { background: var(--ok); }
.progress-bar.warn, .progress.warn .progress-bar { background: var(--warn); }
.progress-bar.danger, .progress.danger .progress-bar { background: var(--danger); }
.progress-bar.info, .progress.info .progress-bar { background: var(--info); }
.progress-bar.muted, .progress.muted .progress-bar { background: var(--faint); }
.progress-bar.accent { background: linear-gradient(90deg, var(--accent-strong), var(--accent)); }
.hero-card .progress { background: rgba(18, 11, 6, 0.32); }

/* ---------- 11. Gráficos ---------- */
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "label value" "track track";
  align-items: center;
  column-gap: 12px;
  row-gap: 7px;
}
.bar-label {
  grid-area: label;
  min-width: 0;
  font-size: 14px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-sub { margin-left: 6px; font-size: 12.5px; color: var(--muted); }
.bar-value { grid-area: value; font-size: 14px; font-weight: 650; color: var(--text); white-space: nowrap; }
.bar-track {
  grid-area: track;
  height: 8px;
  border-radius: 999px;
  background: rgba(236, 220, 196, 0.08);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  transition: width 0.45s var(--ease);
}
.bar-fill.ok { background: var(--ok); }
.bar-fill.warn { background: var(--warn); }
.bar-fill.danger { background: var(--danger); }
.bar-fill.info { background: var(--info); }
.bar-fill.muted { background: var(--faint); }
.bar-fill.walnut { background: var(--walnut); }
@media (min-width: 700px) {
  .bar-row {
    grid-template-columns: minmax(120px, 30%) minmax(0, 1fr) auto;
    grid-template-areas: "label track value";
  }
  .bar-value { min-width: 84px; text-align: right; }
}

.vbars {
  --vbars-h: 140px;
  display: flex;
  align-items: stretch;
  gap: 6px;
  height: calc(var(--vbars-h) + 40px);
}
.vbar {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.vbar-value {
  height: 14px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 14px;
  color: var(--muted);
  white-space: nowrap;
}
.vbar-track {
  flex: 1 1 auto;
  position: relative;
  width: 100%;
  max-width: 36px;
  display: flex;
  align-items: flex-end;
  border-radius: 8px;
  background: rgba(236, 220, 196, 0.06);
  overflow: hidden;
}
.vbar-fill {
  width: 100%;
  min-height: 0;
  border-radius: 8px;
  background: rgba(212, 163, 115, 0.45);
  transition: height 0.45s var(--ease);
}
.vbar-fill.ok { background: var(--ok); }
.vbar-fill.warn { background: var(--warn); }
.vbar-fill.danger { background: var(--danger); }
.vbar-fill.info { background: var(--info); }
.vbar-fill.muted { background: var(--faint); }
.vbar-fill.accent { background: var(--accent); }
.vbar.highlight .vbar-fill { background: linear-gradient(180deg, var(--accent), var(--accent-strong)); }
.vbar.highlight .vbar-value { color: var(--text); }
.vbar.highlight .vbar-label { color: var(--accent); font-weight: 650; }
.vbar-label {
  height: 14px;
  font-size: 11.5px;
  line-height: 14px;
  color: var(--muted);
  white-space: nowrap;
}
.vbars.many .vbar:not(.highlight) .vbar-value { visibility: hidden; }
@media (min-width: 700px) {
  .vbars { gap: 10px; }
  .vbars.many .vbar:not(.highlight) .vbar-value { visibility: visible; }
}

/* ---------- 12. Stepper ---------- */
.stepper {
  display: inline-flex;
  align-items: center;
  height: 36px;
  border-radius: 11px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
}
.stepper > button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 100%;
  color: var(--accent);
  border-radius: 10px;
  transition: background var(--dur) ease;
}
.stepper > button:active { background: var(--card-hover); }
.stepper > button:disabled { color: var(--faint); }
.stepper-value {
  min-width: 36px;
  padding: 0 2px;
  text-align: center;
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
}
.stepper-unit { font-size: 12px; font-weight: 500; color: var(--muted); }
/* telemóveis estreitos: stepper mais compacto dentro das listas (deixa mais espaço ao nome) */
@media (max-width: 419px) {
  .list-item .stepper > button { width: 32px; }
  .list-item .stepper-value { min-width: 30px; }
}

/* ---------- 13. Vazio / erro / banner ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px;
}
.card > .empty, .list > .empty { padding: 26px 16px; }
.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
}
.empty-title { margin-top: 14px; font-size: 17px; font-weight: 650; color: var(--text); }
.empty-text { margin-top: 6px; max-width: 340px; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.empty .btn { margin-top: 16px; }

.error-card {
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(229, 123, 110, 0.1), rgba(229, 123, 110, 0.04)), var(--card);
  border: 1px solid rgba(229, 123, 110, 0.3);
  color: var(--text);
}
.error-head { display: flex; gap: 12px; align-items: flex-start; }
.error-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 11px;
  background: var(--danger-soft);
  color: var(--danger);
}
.error-title { font-size: 15px; font-weight: 650; }
.error-text { margin-top: 2px; font-size: 13.5px; color: var(--text-2); line-height: 1.45; }
.error-details { margin-top: 12px; font-size: 13px; color: var(--muted); }
.error-details summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-weight: 600;
}
.error-details summary::-webkit-details-marker { display: none; }
.error-details summary::before { content: "›"; display: inline-block; transition: transform var(--dur) ease; font-size: 16px; line-height: 1; }
.error-details[open] summary::before { transform: rotate(90deg); }
.error-details pre {
  margin: 8px 0 0;
  padding: 10px 12px;
  max-height: 180px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  border: 1px solid var(--border);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}
.error-card .btn { margin-top: 12px; }

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid rgba(212, 163, 115, 0.28);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}
.banner > svg, .banner > .icon { color: var(--accent); }
.banner > .btn { flex-shrink: 0; margin-left: auto; }
.banner.warn { background: var(--warn-soft); border-color: rgba(233, 180, 76, 0.3); }
.banner.warn > svg { color: var(--warn); }
.banner.info { background: var(--info-soft); border-color: rgba(143, 179, 217, 0.3); }
.banner.info > svg { color: var(--info); }
.banner.danger { background: var(--danger-soft); border-color: rgba(229, 123, 110, 0.32); }
.banner.danger > svg { color: var(--danger); }
.banner-text { flex: 1 1 auto; min-width: 0; }
.banner-close { width: 32px; height: 32px; margin: -4px -6px -4px 0; color: var(--muted); }
.banner + .section { margin-top: 18px; }
.page-header + .banner { margin-top: 4px; }
/* banners globais (ui.banner) no topo de #app */
.app-banners {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 10px) max(var(--gutter), var(--safe-right)) 2px max(var(--gutter), var(--safe-left));
}

/* ---------- 14. Alertas ---------- */
.alert-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px 12px 16px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--border);
  overflow: hidden;
  min-width: 0;
}
.alert-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.alert-item.danger { background: linear-gradient(90deg, rgba(229, 123, 110, 0.1), transparent 55%), var(--card); border-color: rgba(229, 123, 110, 0.22); }
.alert-item.danger::before { background: var(--danger); }
.alert-item.warn { background: linear-gradient(90deg, rgba(233, 180, 76, 0.09), transparent 55%), var(--card); border-color: rgba(233, 180, 76, 0.2); }
.alert-item.warn::before { background: var(--warn); }
.alert-item.info { background: linear-gradient(90deg, rgba(143, 179, 217, 0.08), transparent 55%), var(--card); border-color: rgba(143, 179, 217, 0.18); }
.alert-item.info::before { background: var(--info); }
.alert-item.danger .li-icon { background: var(--danger-soft); color: var(--danger); }
.alert-item.warn .li-icon { background: var(--warn-soft); color: var(--warn); }
.alert-item.info .li-icon { background: var(--info-soft); color: var(--info); }
.alert-item + .alert-item { margin-top: 8px; }
.stack > .alert-item + .alert-item, .stack-sm > .alert-item + .alert-item { margin-top: 0; }

/* ---------- 15. Hub da Casa ---------- */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 700px) { .hub-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .hub-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hub-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 132px;
  min-width: 0;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: left;
  text-decoration: none;
}
.hub-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 8px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
}
.hub-title { font-size: 15.5px; font-weight: 650; color: var(--text); line-height: 1.25; }
.hub-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* um indicador comprido quebra em 2 linhas em vez de tapar o ícone */
.hub-badge { position: absolute; top: 14px; right: 14px; max-width: calc(100% - 76px); display: flex; justify-content: flex-end; }
.hub-badge .badge { height: auto; min-height: 22px; padding: 4px 9px; white-space: normal; line-height: 1.2; text-align: right; }

/* ---------- 16. Detalhe ---------- */
.detail-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}
.detail-hero .photo-lg { width: 100%; }
@media (min-width: 700px) {
  .detail-hero { flex-direction: row; align-items: center; gap: 20px; }
  .detail-hero .photo-lg { width: 280px; flex-shrink: 0; }
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 700px) { .detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.detail-item {
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--border);
}
.detail-item.full { grid-column: 1 / -1; }
.detail-label { font-size: 12.5px; color: var(--muted); }
.detail-value {
  margin-top: 3px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* ---------- 17. Fotos ---------- */
.photo-thumb {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 12px;
  object-fit: cover;
  background: var(--card-2);
  border: 1px solid var(--border);
}
.photo-lg {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 340px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--card-2);
  border: 1px solid var(--border);
}
.photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
}
/* foto que não carregou (files.hydratePhotos): o ícone de placeholder fica inteiro, sem cortes */
img.photo-error {
  object-fit: contain;
  padding: 10%;
}

/* ---------- 18. Mês ---------- */
.month-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
}
.month-switch > button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--accent);
  transition: background var(--dur) ease;
}
.month-switch > button:active { background: var(--card-hover); }
.month-label {
  display: inline-block;
  min-width: 140px;
  padding: 0 4px;
  text-align: center;
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
}
.month-label::first-letter { text-transform: uppercase; }

/* ---------- 19. Indicador de sincronização ---------- */
.sync-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 3px rgba(143, 124, 102, 0.16);
  vertical-align: middle;
  transition: background var(--dur) ease, box-shadow var(--dur) ease;
}
.sync-dot[data-state="synced"] { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.sync-dot[data-state="syncing"] { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); animation: sync-pulse 1.2s ease-in-out infinite; }
.sync-dot[data-state="offline"] { background: var(--muted); box-shadow: 0 0 0 3px rgba(203, 185, 160, 0.14); }
.sync-dot[data-state="error"] { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.sync-dot[data-state="local"] { background: var(--faint); box-shadow: 0 0 0 3px rgba(143, 124, 102, 0.16); }
@keyframes sync-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }

/* ---------- 20. Barra de tabs ---------- */
nav.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 max(4px, var(--safe-right)) var(--safe-bottom) max(4px, var(--safe-left));
  background: rgba(24, 17, 12, 0.88);
  -webkit-backdrop-filter: saturate(1.5) blur(20px);
  backdrop-filter: saturate(1.5) blur(20px);
  border-top: 1px solid var(--border);
}
nav.tabbar:empty { display: none; }
a.tab, .tabbar .tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  height: var(--tabbar-h);
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  -webkit-user-select: none;
  user-select: none;
  transition: color var(--dur) ease;
}
.tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  transition: background var(--dur) ease, transform var(--dur) var(--ease);
}
.tab-icon svg { width: 23px; height: 23px; }
.tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 0.01em; }
.tab.active { color: var(--accent); }
.tab.active .tab-icon { background: var(--accent-soft); }
.tab:active .tab-icon { transform: scale(0.92); }
.tab:focus-visible { outline-offset: -4px; border-radius: 14px; }
@media (hover: hover) {
  .tab:not(.active):hover { color: var(--text-2); }
}
body.auth-mode nav.tabbar { display: none; }

@media (min-width: 900px) {
  nav.tabbar {
    left: 50%;
    right: auto;
    bottom: 16px;
    width: min(560px, calc(100% - 32px));
    height: var(--tabbar-h);
    padding: 0 8px;
    transform: translateX(-50%);
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: rgba(31, 23, 17, 0.86);
    box-shadow: var(--shadow-lg);
  }
  .page { padding-bottom: calc(var(--tabbar-h) + 56px); }
}

/* ---------- 21. Sheets e diálogos ---------- */
#sheet-root { position: relative; z-index: 200; }
html.sheet-open { overflow: hidden; overscroll-behavior: none; }

.sheet-layer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--kb, 0px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
}
/* a janela a fechar deixa de reagir, mas o fundo continua a apanhar toques até sair do DOM (duplo toque em Guardar) */
.sheet-layer.closing .sheet { pointer-events: none; }
.sheet-backdrop {
  position: absolute;
  inset: 0 0 calc(-1 * var(--kb, 0px));
  background: rgba(8, 5, 3, 0.62);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  touch-action: none;
  animation: fade-in 0.24s ease;
}
.sheet-layer.closing .sheet-backdrop { animation: fade-out 0.22s ease forwards; }

.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 92vh;
  max-height: min(92dvh, calc(100% - 12px));
  margin-top: auto;
  background: var(--sheet-bg);
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: sheet-up 0.32s var(--ease);
}
.sheet:focus, .sheet:focus-visible { outline: none; }
.sheet-layer.closing .sheet { animation: sheet-down 0.22s ease-in forwards; }
.sheet-layer[data-size="full"] .sheet { height: 92vh; height: min(92dvh, calc(100% - 12px)); }

.sheet-handle {
  flex-shrink: 0;
  width: 38px;
  height: 5px;
  margin: 8px auto 0;
  border-radius: 999px;
  background: rgba(236, 220, 196, 0.24);
  touch-action: none;
}
.sheet-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 10px 18px;
  touch-action: none;
}
.sheet-title {
  flex: 1;
  min-width: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-close { color: var(--muted); background: rgba(236, 220, 196, 0.06) !important; width: 34px; height: 34px; border-radius: 50%; }
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 6px 18px 18px;
}
.sheet-body:last-child { padding-bottom: calc(18px + var(--safe-bottom)); }
.sheet-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 18px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: var(--sheet-bg);
}
.sheet-footer > .btn { width: 100%; }
.sheet-actions { display: flex; align-items: center; gap: 10px; }
.sheet-actions > .btn { flex: 1 1 0; }
.sheet-actions > .btn-danger.btn-icon, .sheet-actions > .btn-danger.btn-compact { flex: 0 0 auto; }
.sheet-footer:has(> .btn:not(.btn-block) + .btn) { flex-direction: row; }
.sheet-footer:has(> .btn:not(.btn-block) + .btn) > .btn { flex: 1 1 0; }
html.kb-open .sheet-footer { padding-bottom: 12px; }

/* Diálogo de confirmação (centrado em todos os tamanhos) */
.sheet-layer[data-size="dialog"] { justify-content: center; align-items: center; padding: 24px; }
.sheet-layer[data-size="dialog"] .sheet {
  width: min(360px, 100%);
  margin: auto;
  border-radius: 20px;
  border-bottom: 1px solid var(--border-strong);
  animation: dialog-in 0.22s var(--ease);
}
.sheet-layer[data-size="dialog"].closing .sheet { animation: dialog-out 0.16s ease-in forwards; }
.sheet-layer[data-size="dialog"] .sheet-handle { display: none; }
.sheet-layer[data-size="dialog"] .sheet-header { padding: 22px 20px 4px; justify-content: center; }
.sheet-layer[data-size="dialog"] .sheet-title { text-align: center; white-space: normal; font-size: 17px; }
.sheet-layer[data-size="dialog"] .sheet-body { padding: 4px 20px 18px; text-align: center; }
.sheet-layer[data-size="dialog"] .sheet-footer { flex-direction: row; padding: 12px 16px 16px; border-top: 0; background: transparent; }
.sheet-layer[data-size="dialog"] .sheet-footer > .btn { flex: 1 1 0; }
.dialog-message { font-size: 14.5px; line-height: 1.5; color: var(--text-2); }

@media (min-width: 700px) {
  .sheet-layer { justify-content: center; align-items: center; padding: 24px; }
  .sheet {
    width: min(560px, 100%);
    max-height: min(92dvh, calc(100% - 48px));
    margin: auto;
    border-radius: 20px;
    border-bottom: 1px solid var(--border-strong);
    animation: dialog-in 0.24s var(--ease);
  }
  .sheet-layer.closing .sheet { animation: dialog-out 0.18s ease-in forwards; }
  .sheet-layer[data-size="full"] .sheet { width: min(760px, 100%); height: min(92dvh, 900px, calc(100% - 48px)); }
  .sheet-handle { display: none; }
  .sheet-header { padding: 18px 14px 10px 22px; }
  .sheet-body { padding: 6px 22px 22px; }
  .sheet-body:last-child { padding-bottom: 22px; }
  .sheet-footer { padding: 14px 22px 16px; }
}

@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(105%); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } }
@keyframes dialog-out { to { opacity: 0; transform: translateY(6px) scale(0.98); } }

/* Lista de opções (chooseDialog) */
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--card-2);
  border: 1px solid var(--border);
  text-align: left;
  color: var(--text);
  transition: background var(--dur) ease, border-color var(--dur) ease, transform var(--dur) var(--ease);
}
.choice:active:not(:disabled) { transform: scale(0.98); background: var(--card-hover); }
@media (hover: hover) {
  .choice:hover:not(:disabled) { border-color: rgba(212, 163, 115, 0.4); }
}
.choice:disabled { opacity: 0.55; cursor: default; }
.choice-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.choice-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.choice-label { font-size: 15px; font-weight: 600; }
.choice-desc { font-size: 13px; color: var(--text-2); line-height: 1.4; } /* texto explicativo: branco (8.1) */
.choice-chevron { color: var(--faint); display: flex; }
.choice.danger { color: var(--danger); }
.choice.danger .choice-icon { background: var(--danger-soft); color: var(--danger); }
.dialog-message + .choice-list { margin-top: 12px; }

/* ---------- 22. Formulários ---------- */
.form { display: block; }
.form.is-saving { pointer-events: none; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field:last-child { margin-bottom: 4px; }
.field-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  line-height: 1.3;
}
.field-label .req { color: var(--accent); margin-left: 3px; }
.field-help { font-size: 12.5px; color: var(--text-2); line-height: 1.4; } /* texto explicativo: branco (8.1) */
.field-error { font-size: 12.5px; font-weight: 600; color: var(--danger); line-height: 1.35; }
.field-error:empty { display: none; }

.input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border-radius: 13px;
  border: 1px solid var(--border-strong);
  background: var(--bg-2);
  color: #fff;
  -webkit-text-fill-color: #fff;
  caret-color: var(--accent);
  font-size: 16px;
  line-height: 1.3;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease, background var(--dur) ease;
}
.input::placeholder { color: #cbb9a0; -webkit-text-fill-color: #cbb9a0; opacity: 1; }
.input:focus { border-color: var(--accent); box-shadow: var(--ring); background: #1b130d; }
/* os campos já têm anel próprio (borda + sombra): sem contorno duplo */
.input:focus-visible, input.search-input:focus-visible { outline: none; }
.input[readonly] { color: var(--muted); -webkit-text-fill-color: var(--muted); background: transparent; }
.input:disabled { opacity: 0.6; }
.field.invalid .input, .field.invalid .segmented, .field.invalid .switch-row, .field.invalid .file-field { border-color: var(--danger); }
.field.invalid .input:focus { box-shadow: 0 0 0 3px rgba(229, 123, 110, 0.25); }
textarea.input {
  height: auto;
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.45;
}
select.input {
  padding-right: 40px;
  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='%23d4a373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  text-overflow: ellipsis;
}
select.input option { background: var(--card); color: #fff; }
input.input[type="date"], input.input[type="month"] {
  line-height: 46px;
  text-align: left;
}
input.input::-webkit-date-and-time-value { text-align: left; min-height: 1.3em; }
/* ícone do calendário nativo: brightness(0) põe-no a preto e o resto pinta-o de caramelo */
input.input::-webkit-calendar-picker-indicator { opacity: 0.9; cursor: pointer; filter: brightness(0) invert(78%) sepia(28%) saturate(620%) hue-rotate(335deg) brightness(92%); }
/* datalist: sem o triângulo nativo (as sugestões aparecem ao escrever) */
input.input[list]::-webkit-calendar-picker-indicator { display: none !important; }

/* prefixo/sufixo (€, km, h) */
.input-affix { position: relative; display: flex; align-items: center; }
.input-prefix, .input-suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  pointer-events: none;
}
.input-prefix { left: 14px; }
.input-suffix { right: 14px; color: var(--muted); font-weight: 500; }
.input-affix.has-prefix .input { padding-left: 34px; }
.input-affix.has-suffix .input { padding-right: 46px; }

/* interruptor (checkbox) */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  padding: 10px 12px 10px 14px;
  border-radius: 13px;
  border: 1px solid var(--border-strong);
  background: var(--bg-2);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch-label { font-size: 15px; font-weight: 560; color: var(--text); }
input.switch {
  position: relative;
  flex-shrink: 0;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 999px;
  background: rgba(236, 220, 196, 0.2);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background 0.2s ease;
}
input.switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  transition: transform 0.22s var(--ease);
}
input.switch:checked { background: var(--accent); }
input.switch:checked::before { transform: translateX(20px); }
input.switch:disabled { opacity: 0.5; }
input.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.field .segmented { width: 100%; }

/* linhas com 2 campos (empilha < 380px) */
.form-row { display: flex; gap: 12px; min-width: 0; }
.form-row > .field { flex: 1 1 0; }
.form-row > .field:last-child { margin-bottom: 16px; }
@media (max-width: 379px) {
  .form-row { flex-direction: column; gap: 0; }
}

.form-section {
  margin: 22px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
}
.form > .form-section:first-child, .form-section:first-child { margin-top: 2px; padding-top: 0; border-top: 0; }
.form-info {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 13px;
  background: rgba(236, 220, 196, 0.05);
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
}
/* bloco informativo sem conteúdo (ex.: info.html que devolve '') não mostra caixa vazia */
.form-info:empty { display: none; }
.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--danger-soft);
  border: 1px solid rgba(229, 123, 110, 0.3);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}
.form-alert > svg { color: var(--danger); margin-top: 1px; }
.form-alert:empty { display: none; }

/* fotografias / ficheiros */
.file-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 13px;
  border: 1px dashed var(--border-strong);
  background: var(--bg-2);
  min-width: 0;
}
.file-preview { flex-shrink: 0; }
.file-preview .photo-thumb { width: 64px; height: 64px; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 12.5px; color: var(--muted); }
.file-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.file-actions label.btn { position: relative; cursor: pointer; }
.file-actions label.btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 23. Toasts ---------- */
#toast-root {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 max(16px, var(--safe-left)) 0 max(16px, var(--safe-right));
  pointer-events: none;
}
body.auth-mode #toast-root { bottom: calc(var(--safe-bottom) + 16px); }
@media (min-width: 900px) {
  #toast-root { bottom: calc(var(--tabbar-h) + 32px); }
}
@media (min-width: 700px) {
  html.sheet-open #toast-root { bottom: 20px; }
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  min-height: 50px;
  padding: 10px 10px 10px 14px;
  border-radius: 16px;
  background: rgba(46, 34, 25, 0.97);
  border: 1px solid var(--border-strong);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.4;
  animation: toast-in 0.26s var(--ease);
}
.toast.leaving { animation: toast-out 0.2s ease-in forwards; }
.toast-icon { display: flex; flex-shrink: 0; color: var(--info); }
.toast.ok .toast-icon { color: var(--ok); }
.toast.warn .toast-icon { color: var(--warn); }
.toast.danger .toast-icon { color: var(--danger); }
.toast.accent .toast-icon { color: var(--accent); }
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: 4px 0; }
.toast-action {
  flex-shrink: 0;
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  transition: background var(--dur) ease;
}
.toast-action:active { background: var(--accent-soft); }
.toast-close { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; color: var(--muted); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
/* telemóvel com bottom sheet aberta: os avisos passam para o topo (a sheet ocupa o fundo) */
@media (max-width: 699px) {
  html.sheet-open #toast-root { top: calc(var(--safe-top) + 12px); bottom: auto; flex-direction: column-reverse; }
  html.sheet-open .toast { animation-name: toast-in-top; }
  html.sheet-open .toast.leaving { animation-name: toast-out-top; }
}
@keyframes toast-in-top { from { opacity: 0; transform: translateY(-12px) scale(0.98); } }
@keyframes toast-out-top { to { opacity: 0; transform: translateY(-8px) scale(0.98); } }

/* ---------- 24. Ecrãs de entrada / configuração (views/auth.js) ---------- */
.auth-screen {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 28px) max(20px, var(--safe-right)) calc(var(--safe-bottom) + 28px) max(20px, var(--safe-left));
  background:
    radial-gradient(600px 420px at 50% 0%, rgba(122, 82, 52, 0.3), transparent 70%),
    transparent;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 28px 22px 24px;
  border-radius: 24px;
  background: rgba(31, 23, 17, 0.94);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}
@media (min-width: 480px) { .auth-card { padding: 34px 30px 28px; } }
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  color: var(--beige);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-align: center;
}
.auth-brand svg, .auth-brand img { width: 60px; height: 60px; }
.auth-brand .auth-logo { color: var(--accent); }
.auth-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-align: center;
  color: var(--text);
}
.auth-sub {
  margin: 8px auto 22px;
  max-width: 340px;
  font-size: 14.5px;
  line-height: 1.5;
  text-align: center;
  color: var(--text-2);
}
.auth-card .field:last-of-type { margin-bottom: 18px; }
.auth-card .btn-primary { width: 100%; height: 48px; }
.auth-card .form-alert { margin-bottom: 14px; }
.auth-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 18px;
  margin-top: 18px;
  font-size: 14px;
}
.auth-links a, .auth-links button { color: var(--accent); font-weight: 600; padding: 6px 2px; border-radius: 8px; }
.auth-links .muted { color: var(--muted); font-weight: 500; }
.setup-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}
.setup-steps > * {
  height: 8px;
  width: 8px;
  border-radius: 999px;
  background: rgba(236, 220, 196, 0.2);
  transition: width 0.25s var(--ease), background 0.25s ease;
}
.setup-steps > .done { background: rgba(212, 163, 115, 0.55); }
.setup-steps > .active { width: 24px; background: var(--accent); }
/* passos com texto (ex.: "1 Dinheiro") viram pequenas pílulas */
.setup-steps > :not(:empty) {
  width: auto;
  height: 26px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(236, 220, 196, 0.08);
}
.setup-steps > .active:not(:empty) { background: var(--accent-soft); color: var(--accent); }
.setup-steps > .done:not(:empty) { color: var(--text-2); }

/* ==========================================================================
   Vistas (fase das vistas) — uma secção por vista, cada uma com o seu prefixo de classes.
   Só o que é específico de cada vista; tudo o resto vem das secções 1–24 acima.
   ========================================================================== */

/* ---------- 25. Vista: Início (home-) — js/views/home.js ---------- */

/* ---- Grelha dos widgets (ordem 9.1: alertas primeiro) ---- */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 26px;
  margin-top: 4px;
}
.home-grid > .section { margin-top: 0; min-width: 0; }
.home-page [data-region] { scroll-margin-top: calc(var(--safe-top) + 84px); }

@media (min-width: 1024px) {
  .home-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 30px 20px;
    align-items: start;
  }
  .home-w { grid-column: span 6; }
  .home-w-alerts { grid-column: span 7; }
  .home-w-money { grid-column: span 5; }
  .home-w-move, .home-w-vehicles { grid-column: 1 / -1; }
}

.home-page .section-title .badge { margin-left: 6px; height: 22px; padding: 0 8px; font-size: 12px; vertical-align: 3px; }

/* linha de resumo por baixo do título (valores secundários) */
.home-summary {
  margin: -4px 2px 10px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.home-summary strong { color: var(--text); font-weight: 650; }
.home-neg { color: var(--danger); }
.home-warn { color: var(--warn); }

/* ---- Alertas ---- */
.home-alerts .alert-item { padding-right: 12px; }
.home-chev { display: flex; color: var(--faint); }
.home-more { margin-top: 8px; padding-left: 8px; }
.home-pay { padding: 0 11px; gap: 4px; }
.home-pay .icon { color: var(--ok); }

.home-calm {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(90deg, rgba(127, 200, 160, 0.1), transparent 62%), var(--card);
  border-color: rgba(127, 200, 160, 0.2);
}
.home-calm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 14px;
  background: var(--ok-soft);
  color: var(--ok);
}
.home-calm-main { min-width: 0; }
.home-calm .card-text { margin-top: 2px; font-size: 13.5px; }

/* ---- Dinheiro (cartão principal) ---- */
.home-hero .card-head { margin-bottom: 0; }
.home-hero-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  color: rgba(246, 239, 228, 0.8);
  white-space: nowrap;
}
.home-hero .card-value { font-size: 36px; }
.home-split {
  height: 8px;
  margin-top: 16px;
  border-radius: 999px;
  background: rgba(233, 220, 198, 0.2);
  overflow: hidden;
}
.home-split-bar {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #c8925f, #e7bf8f);
  transition: width 300ms var(--ease);
}
.home-split-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.home-split-item { display: flex; flex-direction: column; min-width: 0; }
.home-split-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: rgba(246, 239, 228, 0.8);
}
.home-split-item strong {
  margin-top: 2px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.home-split-sub {
  font-size: 12px;
  color: rgba(246, 239, 228, 0.72);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.home-dot.reserved { background: #e0b484; }
.home-dot.free { background: rgba(233, 220, 198, 0.42); }
.home-hero .kpis.home-hero-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 16px; }
.home-hero .kpi-value { font-size: 17px; }
.home-hero .home-neg { color: #ffc4ba; }
.home-income {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 236, 210, 0.1);
  font-size: 13px;
  color: rgba(246, 239, 228, 0.88);
  min-width: 0;
}
.home-income .icon { color: #e7bf8f; }
.home-income span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Mudança ---- */
.home-move { padding: 16px; }
.home-move-top { display: flex; align-items: center; gap: 14px; }
.home-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  border-radius: 18px;
  background: var(--hero-grad);
  border: 1px solid rgba(233, 220, 198, 0.14);
  box-shadow: 0 1px 0 rgba(255, 236, 210, 0.12) inset;
  color: var(--beige);
}
.home-count-num {
  font-size: 27px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.home-count-num.small { font-size: 18px; }
.home-count-unit { margin-top: 3px; font-size: 12px; color: var(--beige); }
.home-move-main { flex: 1 1 auto; min-width: 0; }
.home-move .card-title { font-size: 16px; }
.home-move-line { margin-top: 2px; font-size: 13.5px; line-height: 1.4; }
.home-move-deed { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.home-move-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
@media (min-width: 560px) {
  .home-move-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
}
.home-stat { min-width: 0; }
.home-stat-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.home-stat-label { font-size: 13px; color: var(--muted); }
.home-stat-value {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.home-stat-value .muted { font-weight: 500; }
.home-stat .progress { margin-top: 8px; }
.home-stat-sub { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.home-move-next {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--accent);
  min-width: 0;
}
.home-move-next span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Listas do Início (pagamentos, stock, garantias) ---- */
.home-date { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.home-date b { font-size: 15px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.home-date small { margin-top: 2px; font-size: 10px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }
.home-list .li-end { max-width: 60%; }
.home-list .li-end:not(:has(> .btn)) { flex-direction: row; align-items: center; gap: 6px; }
.home-list-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.home-list-more:active { background: var(--card-hover); }
.home-foot { display: flex; align-items: center; margin-top: 10px; }
.home-foot-note { display: inline-flex; align-items: center; gap: 6px; padding: 0 2px; font-size: 13px; color: var(--text-2); }
.home-foot-note .icon { color: var(--ok); }
.home-link-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 4px 2px;
  font-size: 14px;
  font-weight: 600;
}

/* ---- Compras por fazer ---- */
.home-shop-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.home-shop-head .card-value { font-size: 30px; }
.home-shop-est { text-align: right; flex-shrink: 0; }
.home-shop-total {
  font-size: 19px;
  font-weight: 650;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.home-shop-list { margin-top: 12px; border-top: 1px solid var(--border); }
.home-shop-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  font-size: 14.5px;
}
.home-shop-item + .home-shop-item { border-top: 1px solid var(--border); }
.home-prio { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.home-prio.alta { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.home-prio.baixa { background: var(--faint); }
.home-shop-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.home-shop-qty { font-size: 13px; color: var(--muted); white-space: nowrap; }
.home-shop-price {
  min-width: 62px;
  text-align: right;
  font-size: 13.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.home-more-line { margin-top: 8px; font-size: 13.5px; font-weight: 600; color: var(--accent); }

/* ---- Veículos ---- */
.home-vehicles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 700px) {
  .home-vehicles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
}
.home-veh { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.home-veh-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.home-veh-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
}
.home-veh-main { flex: 1 1 auto; min-width: 0; }
.home-veh-sub { margin-top: 1px; font-size: 13px; color: var(--muted); }
.home-veh-sub strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.home-veh-head > .badge { flex-shrink: 0; }
.home-veh-next {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--card-2);
  font-size: 13.5px;
  color: var(--text-2);
}
.home-veh-next .icon { color: var(--accent); }
.home-veh-next.warn { background: var(--warn-soft); color: var(--warn); }
.home-veh-next.danger { background: var(--danger-soft); color: var(--danger); }
.home-veh-next.warn .icon, .home-veh-next.danger .icon { color: currentColor; }
.home-veh-hint { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; line-height: 1.4; color: var(--text-2); }
.home-veh-hint .icon { margin-top: 1px; color: var(--info); }
@media (min-width: 700px) {
  .home-veh-hint span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}

/* ---- Objetivos de poupança ---- */
.home-goals { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.home-goal-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.home-goal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.home-goal-main { flex: 1 1 auto; min-width: 0; }
.home-goal-sub { margin-top: 2px; font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.home-goal-pct { flex-shrink: 0; font-size: 16px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.home-goal-pct.ok { color: var(--ok); }
.home-goal .progress { margin-top: 12px; }
.home-goal-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--text-2); }

/* ---- Vazio compacto dos widgets ---- */
.home-empty { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 14px; }
.home-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}
.home-empty-main { min-width: 0; }
.home-empty-text { margin-top: 3px; font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.home-empty-btn { margin-top: 12px; }

/* ---- Ações rápidas ---- */
.home-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) and (max-width: 1023px) {
  .home-quick { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.home-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  min-height: 116px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: left;
  transition: background-color var(--dur) ease, border-color var(--dur) ease, transform var(--dur) var(--ease);
}
.home-quick-btn:active { transform: scale(0.97); }
.home-quick-btn:focus-visible { outline: none; box-shadow: var(--ring); }
@media (hover: hover) {
  .home-quick-btn:hover { background: var(--card-hover); border-color: var(--border-strong); }
}
.home-quick-btn:first-child {
  background: linear-gradient(135deg, rgba(212, 163, 115, 0.2), rgba(212, 163, 115, 0.06)), var(--card);
  border-color: rgba(212, 163, 115, 0.3);
}
.home-quick-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 7px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.home-quick-btn:first-child .home-quick-icon { background: var(--accent); color: var(--on-accent); }
.home-quick-label { font-size: 15px; font-weight: 650; line-height: 1.25; }
.home-quick-text { font-size: 12.5px; line-height: 1.35; color: var(--text-2); }

/* ---- Pormenores ---- */
.home-move-label {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.home-listed { color: var(--accent); }
@media (max-width: 519px) {
  .home-wide { display: none; }
}

/* ---------- 26. Vista: Orçamento (bud-) — js/views/budget.js ---------- */

/* ---- Cabeçalho: seletor de mês fixo por baixo do título ---- */
.bud-page .page-header .page-subtitle {
  overflow: visible;
  white-space: normal;
  margin-top: 8px;
}
.bud-month { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.bud-month .month-switch { padding: 2px; }
.bud-month .month-switch > button { width: 34px; height: 34px; }
.bud-month .month-label { min-width: 150px; font-size: 15px; }
.bud-today {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform var(--dur) ease, background var(--dur) ease;
}
.bud-today:active { transform: scale(0.96); }

/* ---- Grelha: 1 coluna no telemóvel (ordem própria), 2 colunas no computador ---- */
.bud-grid { display: flex; flex-direction: column; gap: 26px; margin-top: 4px; }
.bud-col { display: contents; }
.bud-grid .section { margin-top: 0; min-width: 0; }
.bud-page .bud-w { scroll-margin-top: calc(var(--safe-top) + 118px); }
.bud-w-summary { order: 1; }
.bud-w-accounts { order: 2; }
.bud-w-categories { order: 3; }
.bud-w-payments { order: 4; }
.bud-w-movements { order: 5; }
.bud-w-savings { order: 6; }
.bud-w-income { order: 7; }
.bud-w-forecast { order: 8; }
.bud-w-history { order: 9; }

@media (min-width: 1024px) {
  .bud-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }
  .bud-col { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
  .bud-page .bud-w { scroll-margin-top: calc(var(--safe-top) + 126px); }
}

/* valores negativos / positivos */
.bud-neg { color: var(--danger) !important; }
.bud-pos { color: var(--ok); }
.hero-card .bud-neg { color: #ffb4a8 !important; }

/* ---- Resumo do mês (cartão de saldo) ---- */
.bud-hero .card-head { margin-bottom: 0; }
.bud-hero .card-value { font-size: 36px; }
.bud-hero-month { text-transform: none; }
.bud-income-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(18, 11, 6, 0.26);
  border: 1px solid rgba(255, 236, 210, 0.08);
  font-size: 14px;
  color: var(--text-2);
}
.bud-income-icon { display: flex; color: var(--beige); }
.bud-income-text { min-width: 0; }
.bud-income-text strong { color: #fff; font-weight: 650; font-variant-numeric: tabular-nums; }
.bud-hero .badge.ok { background: rgba(127, 200, 160, 0.2); color: #a6e0c0; }
.bud-hero .badge.info { background: rgba(143, 179, 217, 0.2); color: #bcd4ee; }
.bud-hero .badge.warn { background: rgba(233, 180, 76, 0.2); color: #f3cf85; }
.bud-hero-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bud-hero-kpis .kpi { padding: 10px 11px; }
.bud-hero-kpis .kpi-value { font-size: 16px; }
.bud-hero-actions { display: flex; margin-top: 14px; }
.bud-hero-btn {
  background: rgba(255, 244, 228, 0.12);
  border-color: rgba(255, 236, 210, 0.18);
  color: #fff;
}
@media (hover: hover) {
  .bud-hero-btn:hover:not(:disabled) { background: rgba(255, 244, 228, 0.2); }
}
/* telemóvel: a previsão está no cartão logo abaixo (com a decomposição) — o cartão de saldo fica mais curto */
@media (max-width: 520px) {
  .bud-hero-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bud-hero-kpis .kpi:last-child { display: none; }
}

/* previsão do fim do mês (decomposição) */
.bud-fc { margin-top: 12px; }
.bud-fc .card-head { margin-bottom: 6px; }
.bud-fc-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 14.5px;
}
.bud-fc-row + .bud-fc-row { border-top: 1px solid var(--border); }
.bud-fc-label { color: var(--text-2); min-width: 0; }
.bud-fc-label small { margin-left: 6px; font-size: 12.5px; color: var(--muted); }
.bud-fc-value { color: var(--text); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bud-fc-row.strong .bud-fc-label { color: var(--text); font-weight: 650; }
.bud-fc-row.strong .bud-fc-value { font-size: 16.5px; font-weight: 700; }
.bud-fc-sep { height: 6px; }
.bud-fc-sep + .bud-fc-row { border-top: 1px dashed var(--border-strong); }

/* ---- Contas ---- */
.bud-total { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.bud-total-main { min-width: 0; }
.bud-total .card-title { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.bud-total .card-value { margin-top: 2px; }
.bud-split {
  height: 8px;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(127, 200, 160, 0.35);
  overflow: hidden;
}
.bud-split > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-strong), var(--accent)); }
.bud-split-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13.5px; }
.bud-split-legend > div { display: flex; align-items: center; gap: 6px; }
.bud-split-legend strong { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.bud-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.bud-dot.reserved { background: var(--accent); }
.bud-dot.free { background: var(--ok); }
.bud-acc-eom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-2);
}
.bud-acc-eom strong { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bud-acc-list { margin: 12px -16px -6px; border-top: 1px solid var(--border); }
.bud-acc-list > .list-item + .list-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 64px;
  right: 0;
  height: 1px;
  background: var(--border);
}
.bud-archived .li-title, .bud-archived .li-amount { color: var(--muted); }

/* ---- Despesas por categoria ---- */
.bud-cats .bars { gap: 6px; }
.bud-cat {
  margin: 0 -8px;
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--dur) ease;
}
.bud-cat:active { background: var(--card-hover); }
.bud-cat.active { background: var(--accent-soft); }
@media (hover: hover) {
  .bud-cat:hover { background: rgba(46, 34, 25, 0.6); }
  .bud-cat.active:hover { background: var(--accent-soft); }
}
/* rótulo e valor em cima, barra por baixo (em todas as larguras: o rótulo tem o limite e a percentagem) */
.bud-cats .bud-cat {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "label value" "track track";
}
.bud-cats .bud-cat .bar-value { min-width: 0; }
.bud-cat .bar-label { display: flex; align-items: center; gap: 8px; }
.bud-cat .bar-sub { margin-left: 0; overflow: hidden; text-overflow: ellipsis; }
.bud-cat-icon { display: flex; color: var(--accent); flex-shrink: 0; }
.bud-cat .bar-track { position: relative; overflow: visible; }
.bud-cat .bar-fill { position: relative; z-index: 1; }
.bud-limit-mark {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--beige);
  opacity: 0.75;
  z-index: 2;
}
.bud-cat[data-tone="danger"] .bar-value { color: var(--danger); }
.bud-cat[data-tone="warn"] .bar-value { color: var(--warn); }
.bud-limit-alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.bud-limit-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
}
.bud-limit-alert > svg { flex-shrink: 0; margin-top: 1px; }
.bud-limit-alert.warn { background: var(--warn-soft); border: 1px solid rgba(233, 180, 76, 0.28); }
.bud-limit-alert.warn > svg { color: var(--warn); }
.bud-limit-alert.danger { background: var(--danger-soft); border: 1px solid rgba(229, 123, 110, 0.3); }
.bud-limit-alert.danger > svg { color: var(--danger); }
.bud-cats-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }

/* ---- Pagamentos do mês ---- */
.bud-pay-summary { margin: -4px 2px 10px; font-size: 13.5px; }
.bud-pay-summary strong { color: var(--text); font-weight: 650; }
.bud-pay .li-end { max-width: 60%; }
.bud-pay-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bud-pay-end .badge { height: 20px; padding: 0 8px; font-size: 11.5px; }
.bud-pay-btn { padding: 0 11px; gap: 4px; }
.bud-pay-btn .icon, .bud-pay-btn svg { color: var(--ok); }
.bud-cancelled .li-title { color: var(--muted); }
@media (max-width: 519px) {
  .bud-hide-sm { display: none; }
}

/* ---- Filtros e pesquisa dos movimentos ---- */
.bud-filters { display: flex; flex-direction: column; gap: 8px; }
.bud-chips-type .chip, .bud-chips-person .chip { height: 32px; padding: 0 12px; font-size: 13.5px; }
.bud-chip-sep {
  flex: 0 0 1px;
  align-self: center;
  width: 1px;
  height: 20px;
  margin: 0 2px;
  background: var(--border-strong);
}
.bud-clear {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  height: 28px;
  padding: 0 4px;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
}
.bud-search { margin: 10px 0 12px; }
/* computador: os filtros quebram linha em vez de deslizar (rato) */
@media (min-width: 1024px) {
  .bud-filters .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; row-gap: 8px; }
}

/* ---- Movimentos ---- */
.bud-mov-summary { margin: 0 2px 2px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.bud-day { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.bud-day-total { font-size: 12px; letter-spacing: 0; text-transform: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.bud-tx .li-end { max-width: 42%; }
.bud-amt.expense { color: var(--text); }
.bud-amt.income { color: var(--ok); }
.bud-amt.transfer { color: var(--info); }
.bud-strike { text-decoration: line-through; color: var(--muted) !important; }
.bud-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 6px;
  color: var(--beige);
  font-size: 12px;
  vertical-align: 0;
}
.bud-tag svg { opacity: 0.85; }
.bud-origin {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  height: 20px;
  margin-right: 6px;
  padding: 0 7px 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 650;
  vertical-align: 1px;
  transition: background var(--dur) ease;
}
.bud-origin:active { background: rgba(212, 163, 115, 0.28); }
@media (hover: hover) {
  .bud-origin:hover { background: rgba(212, 163, 115, 0.26); }
}
.bud-more { margin-top: 8px; padding-left: 8px; }

/* ---- Poupanças ---- */
.bud-sav-intro { margin: -4px 2px 10px; font-size: 13.5px; }
.bud-sav-intro strong { color: var(--text); font-weight: 650; }
.bud-goals { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 700px) and (max-width: 1023px) {
  .bud-goals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.bud-goal-head { display: flex; align-items: center; gap: 12px; }
.bud-goal-title { flex: 1 1 auto; min-width: 0; }
.bud-goal-title .card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bud-goal-title .card-sub { margin-top: 1px; }
.bud-goal-pct { font-size: 15px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.bud-goal-pct.ok { color: var(--ok); }
.bud-goal-amounts { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-top: 14px; }
.bud-goal-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.bud-goal-amounts .muted { font-size: 14px; }
.bud-goal .progress { margin-top: 10px; }
.bud-goal-metas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.bud-goal-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 10px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--text-2);
}
.bud-goal-line > svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.bud-goal-line.warn > svg { color: var(--warn); }
.bud-goal-notes { margin-top: 10px; font-size: 13.5px; line-height: 1.45; }
.bud-goal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---- Rendimento mensal ---- */
.bud-income-now .card-title { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.bud-income-now .card-title::first-letter { text-transform: uppercase; }
.bud-income-now .card-value { margin-top: 2px; }
.bud-timeline { margin: 12px -16px -6px; border-top: 1px solid var(--border); }
.bud-timeline > .list-item + .list-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 64px;
  right: 0;
  height: 1px;
  background: var(--border);
}
.bud-inc .li-sub > .badge { margin-right: 6px; }

/* ---- Previsões ---- */
.bud-forecast .card-text { font-size: 13.5px; line-height: 1.45; }
.bud-chart { margin-top: 14px; }
.bud-chart .vbars { justify-content: center; }
.bud-chart .vbar { max-width: 96px; }
.bud-chart .vbar-value { font-size: 11.5px; color: var(--text-2); }
.bud-fc-months { margin-top: 6px; }
.bud-fc-month { padding: 10px 0; }
.bud-fc-month + .bud-fc-month { border-top: 1px solid var(--border); }
.bud-fc-month-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; color: var(--text); }
.bud-fc-month-head .strong { font-variant-numeric: tabular-nums; }
.bud-fc-month-head > span:first-child::first-letter { text-transform: uppercase; }
.bud-fc-month-sub { margin-top: 3px; font-size: 12.5px; line-height: 1.4; font-variant-numeric: tabular-nums; }

/* ---- Histórico mensal (receitas vs despesas) ---- */
.bud-hist-chart {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 150px;
}
.bud-hist-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 0 0;
  border-radius: 10px;
  transition: background var(--dur) ease;
}
.bud-hist-col:active { background: var(--card-hover); }
.bud-hist-col.active { background: var(--accent-soft); }
.bud-hist-bars {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 100%;
  padding: 0 2px;
}
.bud-hist-bar {
  width: 42%;
  max-width: 12px;
  min-height: 0;
  border-radius: 4px 4px 2px 2px;
  transition: height 0.45s var(--ease);
}
.bud-hist-bar.in { background: rgba(127, 200, 160, 0.75); }
.bud-hist-bar.out { background: var(--accent); }
.bud-hist-label { height: 16px; font-size: 11px; line-height: 16px; color: var(--muted); white-space: nowrap; }
.bud-hist-col.active .bud-hist-label { color: var(--accent); font-weight: 650; }
.bud-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.bud-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.bud-legend i { width: 10px; height: 10px; border-radius: 3px; }
.bud-legend i.in { background: rgba(127, 200, 160, 0.75); }
.bud-legend i.out { background: var(--accent); }
.bud-hist-list { margin: 12px -16px 0; border-top: 1px solid var(--border); }
.bud-hist-list > .list-item + .list-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 64px;
  right: 0;
  height: 1px;
  background: var(--border);
}
.bud-hist-active { background: rgba(212, 163, 115, 0.07); }
.bud-history > .bud-more { margin-top: 4px; }

/* ---- Formulários (dentro das sheets) ---- */
.bud-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-2);
}
.bud-note > svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.bud-note strong { color: var(--text); }
.bud-split-info { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.bud-split-info > svg { flex-shrink: 0; margin-top: 2px; }
.bud-split-info.ok > svg { color: var(--ok); }
.bud-split-info.warn > svg { color: var(--warn); }
.bud-split-info.danger > svg { color: var(--danger); }
.bud-split-info strong { color: var(--text); font-variant-numeric: tabular-nums; }
.bud-origin-info { display: flex; align-items: center; gap: 10px; }
.bud-origin-icon { display: flex; color: var(--accent); flex-shrink: 0; }
.bud-origin-text { flex: 1 1 auto; min-width: 0; font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.bud-receipt-items { margin-top: 14px; }
.bud-receipt-empty { margin-top: 14px; font-size: 14px; line-height: 1.5; }

/* ---------- 27. Vista: Stock (stock-) — js/views/stock.js ---------- */

/* ---------- Lista: pesquisa, filtros, barra ---------- */
.stock-side { min-width: 0; }
.stock-search { margin-bottom: 12px; }
.stock-chips:empty { display: none; }
.stock-chip-row + .stock-chip-row { margin-top: 8px; }
.stock-main { min-width: 0; }
.stock-main > [data-region="restock"]:not([hidden]) { margin-top: 14px; }

.stock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 2px 10px;
}
.stock-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stock-group-btn {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-2);
}
.stock-group-btn > svg { color: var(--muted); }
.stock-group-btn.active { background: var(--accent-soft); border-color: rgba(212, 163, 115, 0.45); color: var(--accent); }
.stock-group-btn.active > svg { color: var(--accent); }

/* Cartão "N produtos a repor": ícone | texto | botão (no telemóvel o botão fica ao lado do título) */
.stock-restock {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "icon main btn";
  align-items: center;
  gap: 4px 14px;
  padding: 14px 16px;
  border-color: rgba(233, 180, 76, 0.22);
  background:
    linear-gradient(135deg, rgba(233, 180, 76, 0.08), rgba(233, 180, 76, 0) 60%),
    var(--card);
}
.stock-restock > .li-icon { grid-area: icon; }
.stock-restock-main { grid-area: main; min-width: 0; }
.stock-restock-text { margin-top: 2px; font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.stock-restock-btn { grid-area: btn; }
@media (max-width: 599px) {
  .stock-restock {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "icon title btn" "text text text";
    align-items: center;
    row-gap: 10px;
  }
  .stock-restock-main { display: contents; }
  .stock-restock-main > .card-title { grid-area: title; }
  .stock-restock-text { grid-area: text; margin-top: 0; }
  .stock-wide-only { display: none; }
}

/* ---------- Linhas (link para o detalhe + stepper fora do link) ---------- */
.stock-row { padding: 0 14px 0 0; gap: 8px; }
.stock-row-link {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 62px;
  padding: 10px 4px 10px 14px;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.stock-row-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; border-radius: 12px; }
.stock-row:has(.stock-row-link:active) { background: var(--card-hover); }
@media (hover: hover) {
  .stock-row:hover { background: rgba(46, 34, 25, 0.6); }
}
.stock-row .li-end { max-width: none; }
/* steppers com a mesma largura em todas as linhas (colunas alinhadas, seja "1 kg" ou "12 rolo") */
.list-item.stock-row .stepper-value { min-width: 62px; }
@media (max-width: 419px) {
  .list-item.stock-row .stepper-value { min-width: 54px; }
}
/* telemóveis muito estreitos: sem ícone na linha (o nome precisa do espaço) */
@media (max-width: 359px) {
  .stock-row-link .li-icon { display: none; }
  .list.stock-list > .stock-row + .stock-row::before { left: 14px; }
  .list-item.stock-row .stepper-value { min-width: 46px; }
}
.stock-row .li-sub > .badge { margin-right: 6px; }
.stock-row .stepper > button,
.stock-hero .stepper > button { touch-action: manipulation; }
/* separador alinhado com o texto (o ícone está dentro do link) */
.list.stock-list > .stock-row + .stock-row::before { left: 64px; }

/* Grupos por local */
.stock-group + .stock-group { margin-top: 4px; }
.stock-group-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stock-group-count {
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(236, 220, 196, 0.08);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 20px;
  text-align: center;
  letter-spacing: 0;
}

.stock-empty { padding: 4px 0; }

/* Desktop: filtros numa coluna à esquerda (fixa ao fazer scroll), lista à direita */
@media (min-width: 1024px) {
  .stock-list-body {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    margin-top: 8px;
  }
  .stock-side {
    position: sticky;
    top: calc(var(--safe-top) + 96px);
    padding: 16px;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .stock-side .chips {
    flex-wrap: wrap;
    overflow: visible;
    margin: 0;
    padding: 0;
  }
  .stock-chip-row + .stock-chip-row {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
  }
  .stock-main > [data-region="restock"]:not([hidden]) { margin-top: 0; margin-bottom: 4px; }
  .stock-bar { margin-top: 2px; }
  .stock-main > [data-region="restock"]:not([hidden]) + [data-region="bar"] .stock-bar { margin-top: 16px; }
}

/* ---------- Detalhe ---------- */
.stock-detail-view > .page-header + .stock-detail-layout { margin-top: 12px; }
.stock-detail-col { min-width: 0; }

.stock-hero { padding: 18px; }
.stock-hero-top { display: flex; align-items: center; gap: 12px; }
.stock-hero-badges { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.stock-hero-qty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 20px 0 6px;
}
.stock-hero-label {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.stock-hero .stepper { height: 60px; border-radius: 18px; background: var(--bg-2); }
.stock-hero .stepper > button { width: 60px; border-radius: 17px; }
.stock-hero .stepper > button svg { width: 24px; height: 24px; }
.stock-hero .stepper-value { min-width: 116px; font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.stock-hero .stepper-unit { font-size: 15px; font-weight: 550; }
.stock-set-qty {
  padding: 6px 10px;
  border-radius: 10px;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
}
.stock-set-qty:active { background: var(--accent-soft); }
.stock-hero-note {
  margin: 8px 0 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
}
.stock-hero-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 359px) {
  .stock-hero-actions { grid-template-columns: minmax(0, 1fr); }
}

.stock-detail-sub { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.stock-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stock-kpis .kpi { padding: 12px; }
.stock-kpis .kpi-value { font-size: 18px; }

.stock-note-card .card-title + .stock-card-text { margin-top: 4px; }
.stock-card-text { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.stock-price-chart { margin-bottom: 10px; }
.stock-price-chart .vbars { margin-top: 12px; }
.stock-price-row { min-height: 56px; }

.stock-aliases { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.stock-alias {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  height: 34px;
  padding: 0 3px 0 12px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  font-size: 13.5px;
}
.stock-alias-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-alias-x {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--muted);
  transition: background var(--dur) ease, color var(--dur) ease;
}
.stock-alias-x:active { background: var(--danger-soft); color: var(--danger); }
@media (hover: hover) {
  .stock-alias-x:hover { background: var(--danger-soft); color: var(--danger); }
}

.stock-notes { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }

.stock-detail-actions { margin-top: 26px; display: flex; justify-content: center; }
.stock-detail-actions .btn { width: 100%; }
@media (min-width: 700px) {
  .stock-detail-actions { justify-content: flex-start; }
  .stock-detail-actions .btn { width: auto; }
}

@media (min-width: 1024px) {
  .stock-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
  .stock-first-side { margin-top: 0; }
  .stock-first-side > .section-head:first-child { margin-top: -2px; }
}

/* ---------- Formulário ---------- */
.stock-form-warn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  border: 1px solid rgba(233, 180, 76, 0.28);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.45;
}
.stock-form-warn > svg { flex-shrink: 0; margin-top: 1px; color: var(--warn); }
.stock-form-warn strong { color: var(--text); font-weight: 650; }
.stock-form-warn a { color: var(--accent); font-weight: 600; white-space: nowrap; }
.stock-form-help { margin: -6px 0 0; font-size: 13px; line-height: 1.45; color: var(--text-2); }
/* avisos e ajudas do formulário sem a caixa do .form-info (já têm o seu próprio estilo) */
.form-info:has(> .stock-form-warn),
.form-info:has(> .stock-form-help) { padding: 0; background: none; border: 0; }

.stock-barcode-input { display: flex; align-items: center; gap: 8px; }
.stock-barcode-input > .input { flex: 1 1 auto; }
.stock-barcode-scan { flex: 0 0 auto; height: 48px; padding: 0 14px; }

/* ---------- Leitor de códigos de barras ---------- */
.stock-scan-view {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 56vh;
  border-radius: 18px;
  overflow: hidden;
  background: #070504;
  border: 1px solid var(--border);
}
.stock-scan-video { display: block; width: 100%; height: 100%; object-fit: cover; }
.stock-scan-frame {
  position: absolute;
  inset: 26% 10%;
  border-radius: 14px;
  border: 2px solid rgba(212, 163, 115, 0.9);
  box-shadow: 0 0 0 999px rgba(7, 5, 4, 0.38);
  pointer-events: none;
}
.stock-scan-line {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 50%;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px 2px rgba(212, 163, 115, 0.55);
  opacity: 0;
}
.stock-scan.is-live .stock-scan-line,
.is-live .stock-scan-line { opacity: 1; animation: stock-scan-sweep 2.2s ease-in-out infinite; }
.is-error .stock-scan-frame { border-color: rgba(229, 123, 110, 0.7); }
@keyframes stock-scan-sweep {
  0%, 100% { top: 14%; }
  50% { top: 84%; }
}
.stock-scan-status {
  margin: 14px 4px 2px;
  text-align: center;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-2);
}
.stock-scan-status[data-tone="danger"] { color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  .is-live .stock-scan-line { animation: none; top: 50%; }
}

/* ---------- 28. Vista: Compras (shop-) — js/views/shopping.js ---------- */

/* ---------- Estrutura ---------- */
.shop-page.has-cartbar {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 104px);
}

.shop-tabs { margin: 2px 0 14px; }
.shop-tabs .segmented { width: 100%; }

/* Telemóvel: uma coluna, pela ordem Ler talão → pesquisa → sugestões → em falta → lista */
.shop-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.shop-aside { display: contents; }
.shop-scan { order: 1; }
.shop-search { order: 2; }
.shop-quick-wrap { order: 3; }
.shop-restock-wrap { order: 4; }
.shop-histsum-wrap { order: 4; }
.shop-list-wrap { order: 5; }
.shop-history-wrap { order: 6; }
.shop-layout [data-region][hidden],
.shop-scan[hidden] { display: none; }

/* ---------- Ler talão (botão de destaque) ---------- */
.shop-scan {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 74px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(212, 163, 115, 0.22), transparent 55%),
    linear-gradient(135deg, #5d3e27 0%, #3f2a1a 60%, #2c1e13 100%);
  border: 1px solid rgba(233, 220, 198, 0.16);
  box-shadow: 0 1px 0 rgba(255, 236, 210, 0.1) inset, 0 16px 34px -22px rgba(0, 0, 0, 0.9);
  color: #fff;
  text-align: left;
  overflow: hidden;
  transition: transform var(--dur) var(--ease), filter var(--dur) ease;
}
.shop-scan:active { transform: scale(0.985); }
@media (hover: hover) {
  .shop-scan:hover { filter: brightness(1.06); }
}
.shop-scan-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 6px 16px -8px rgba(212, 163, 115, 0.8);
}
.shop-scan-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.shop-scan-title { font-size: 17px; font-weight: 680; letter-spacing: -0.01em; color: #fff; }
.shop-scan-sub { font-size: 13.5px; color: var(--text-2); line-height: 1.35; }
.shop-scan-go { display: flex; color: var(--beige); opacity: 0.8; flex-shrink: 0; }

/* ---------- Pesquisa e adicionar rápido ---------- */
.shop-quick { box-shadow: var(--shadow); }
.shop-quick-row {
  width: 100%;
  text-align: left;
  color: inherit;
  background: transparent;
}
.shop-quick-row .li-title,
.shop-quick-row .li-sub,
.shop-item .li-title,
.shop-item .li-sub { display: block; }
.shop-quick-add .li-title { color: var(--accent); font-weight: 650; }
.shop-kbd {
  flex-shrink: 0;
  padding: 3px 7px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}
@media (hover: none) {
  .shop-kbd { display: none; }
}
.shop-plus {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.shop-quick-label {
  padding: 10px 14px 4px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.shop-quick > .shop-quick-label:first-child { border-top: 0; }

/* ---------- Em falta no stock ---------- */
.shop-restock {
  padding: 14px 16px 16px;
  background:
    linear-gradient(180deg, rgba(233, 180, 76, 0.07), rgba(233, 180, 76, 0) 70%),
    var(--card);
  border-color: rgba(233, 180, 76, 0.18);
}
.shop-restock-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.shop-restock-titles { min-width: 0; }
.shop-restock-head .card-title { display: flex; align-items: center; gap: 8px; }
.shop-restock-head .card-text { margin-top: 2px; font-size: 13.5px; color: var(--text-2); }
.shop-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12.5px;
  font-weight: 700;
}
.card > .shop-restock-row { margin: 0 -16px; min-height: 54px; padding: 8px 12px 8px 16px; }
.card > .shop-restock-row:first-child { margin-top: 0; }
.shop-restock-row .li-sub { display: flex; align-items: center; gap: 6px; }
.shop-restock-row .li-sub > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.shop-restock-row .btn-icon { color: var(--accent); }
.shop-restock-more { padding: 4px 0 2px; font-size: 13px; color: var(--muted); }
.shop-restock-all { margin-top: 12px; }

/* ---------- Lista ---------- */
.shop-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 2px 2px;
}
.shop-group-toggle { flex-shrink: 0; }
.shop-group-toggle .segmented > button { height: 30px; padding: 0 12px; font-size: 13px; }
.shop-group-title { display: flex; align-items: center; gap: 8px; }
.shop-group-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-group-count {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 560;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  white-space: nowrap;
}
.shop-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--accent); }
.shop-dot.alta { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.shop-dot.normal { background: var(--accent); }
.shop-dot.baixa { background: var(--faint); }
.shop-dot.store { background: var(--beige); }
.shop-dot.none { background: transparent; border: 1.5px solid var(--faint); }

.shop-item { padding: 0; gap: 0; align-items: stretch; }
.shop-list > .shop-item + .shop-item::before { left: 54px; }
.shop-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  flex-shrink: 0;
  padding: 0 2px 0 8px;
  background: transparent;
  border: 0;
  color: inherit;
}
.shop-check-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(236, 220, 196, 0.34);
  color: transparent;
  transition: background var(--dur) ease, border-color var(--dur) ease, color var(--dur) ease, transform var(--dur) var(--ease);
}
.shop-check:active .shop-check-box { transform: scale(0.88); }
.shop-check:focus-visible { outline: none; }
.shop-check:focus-visible .shop-check-box { box-shadow: var(--ring); }
.shop-item.in-cart .shop-check-box {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.shop-item-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  min-height: 62px;
  padding: 10px 14px 10px 4px;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
  border-radius: 0;
  transition: background var(--dur) ease;
}
.shop-item-main:active { background: var(--card-hover); }
@media (hover: hover) {
  .shop-item-main:hover { background: rgba(46, 34, 25, 0.5); }
}
.shop-item .li-title { transition: color var(--dur) ease; }
.shop-item.in-cart .li-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgba(203, 185, 160, 0.6);
}
.shop-item.in-cart .li-amount { color: var(--muted); }
.shop-note { color: var(--text-2); opacity: 0.85; }
.shop-item .li-end { gap: 4px; }
.shop-item.is-new { animation: shop-flash 1.4s var(--ease) both; }
@keyframes shop-flash {
  0% { background: rgba(212, 163, 115, 0.28); }
  100% { background: transparent; }
}

/* ---------- Histórico ---------- */
.shop-histsum { padding: 14px 16px; }
.shop-histsum .card-head { margin-bottom: 8px; }
.shop-stats { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; }
.shop-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(236, 220, 196, 0.04);
  border: 1px solid var(--border);
}
.shop-stat-value {
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shop-stat-label { font-size: 12.5px; color: var(--muted); }
.shop-day + .shop-day { margin-top: 6px; }
.shop-day-trips { display: grid; gap: 12px; }
.shop-trip-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(110, 74, 47, 0.28), rgba(110, 74, 47, 0.1));
  border-bottom: 1px solid var(--border);
}
.shop-trip-head .li-title { font-weight: 650; }
.shop-trip-head .li-amount { font-size: 16px; }
.shop-link {
  padding: 0;
  background: none;
  border: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.shop-link:active { opacity: 0.7; }
@media (hover: hover) {
  .shop-link:hover { text-decoration: underline; text-underline-offset: 3px; }
}
.shop-hist-item { min-height: 54px; padding: 8px 10px 8px 14px; gap: 10px; }
.shop-trip > .shop-trip-head + .shop-hist-item::before { display: none; }
.shop-readd { flex-shrink: 0; color: var(--accent); }
.shop-readd.is-listed {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--ok);
  opacity: 0.85;
}
.shop-more { margin-top: 14px; }

.shop-empty { padding: 4px 16px; }

/* ---------- Barra do carrinho (fixa, por cima da barra de tabs) ---------- */
.shop-cartbar {
  position: fixed;
  left: max(12px, var(--safe-left));
  right: max(12px, var(--safe-right));
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px);
  z-index: 45;
  animation: shop-bar-in 0.24s var(--ease) both;
}
.shop-cartbar[hidden] { display: none; }
@keyframes shop-bar-in {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.shop-cartbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 12px;
  border-radius: 18px;
  background: rgba(46, 33, 23, 0.94);
  -webkit-backdrop-filter: saturate(1.4) blur(18px);
  backdrop-filter: saturate(1.4) blur(18px);
  border: 1px solid rgba(212, 163, 115, 0.3);
  box-shadow: var(--shadow-lg);
}
.shop-cartbar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.shop-cartbar-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.shop-cartbar-count { font-size: 15px; font-weight: 650; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-cartbar-sum { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-checkout { flex-shrink: 0; height: 44px; padding: 0 16px; }

/* os avisos (toasts) sobem para não tapar a barra do carrinho (com uma sheet aberta vale a regra geral da secção 23) */
html:not(.sheet-open) body:has(.tab-page[data-tab="compras"]:not([hidden]) .shop-page.has-cartbar) #toast-root {
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 90px);
}

/* ---------- Finalizar compra (formulário) ---------- */
.field[data-field^="pp_"] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  grid-template-areas: "label input" "help input" "err err";
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.field[data-field^="pp_"] > .field-label {
  grid-area: label;
  align-self: end;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.field[data-field^="pp_"] > .input-affix { grid-area: input; }
.field[data-field^="pp_"] > .field-help { grid-area: help; align-self: start; }
.field[data-field^="pp_"] > .field-error { grid-area: err; }
.field[data-field^="pp_"] .input { height: 44px; text-align: right; }

.shop-total { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shop-total-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shop-total-label { font-size: 15px; font-weight: 650; color: var(--text); }
.shop-total-sub { font-size: 12.5px; color: var(--muted); }
.shop-total-value { font-size: 22px; font-weight: 720; letter-spacing: -0.02em; color: var(--text); white-space: nowrap; }

/* ---------- Computador ---------- */
@media (min-width: 700px) {
  .shop-tabs .segmented { width: auto; max-width: 420px; }
}

@media (min-width: 900px) {
  .shop-cartbar {
    left: 50%;
    right: auto;
    width: min(560px, calc(100% - 32px));
    bottom: calc(16px + var(--tabbar-h) + 12px);
    transform: translateX(-50%);
    animation: none;
  }
  .shop-page.has-cartbar { padding-bottom: calc(var(--tabbar-h) + 56px + 84px); }
  html:not(.sheet-open) body:has(.tab-page[data-tab="compras"]:not([hidden]) .shop-page.has-cartbar) #toast-root {
    bottom: calc(16px + var(--tabbar-h) + 88px);
  }
}

@media (min-width: 1024px) {
  .shop-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "search side"
      "quick side"
      "main side";
    column-gap: 24px;
    row-gap: 0;
    align-items: start;
  }
  .shop-aside {
    grid-area: side;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: calc(var(--safe-top) + 84px);
  }
  .shop-search { grid-area: search; margin-bottom: 12px; }
  .shop-quick-wrap { grid-area: quick; margin-bottom: 12px; }
  .shop-list-wrap, .shop-history-wrap { grid-area: main; }
  .shop-list-head { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .shop-item.is-new, .shop-cartbar { animation: none; }
}

/* ---------- 29. Vista: Leitor de talões (rc-) — js/views/receipt.js ---------- */

/* ---------- Comuns ---------- */
.rc-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  -webkit-user-select: none;
  user-select: none;
}
.rc-link:active { opacity: 0.7; }
@media (hover: hover) {
  .rc-link:hover { text-decoration: underline; text-underline-offset: 3px; }
}
.rc-foot { display: flex; flex-direction: column; gap: 10px; }
.rc-foot > .btn { width: 100%; }
.rc-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
  vertical-align: 2px;
  font-variant-numeric: tabular-nums;
}
.rc-count:empty { display: none; }

/* ---------- Captura ---------- */
.rc-capture { padding-top: 2px; }
.rc-intro { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 6px 8px 18px; }
.rc-intro-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 24px;
  background: radial-gradient(120% 120% at 30% 20%, rgba(212, 163, 115, 0.28), rgba(110, 74, 47, 0.18) 70%);
  border: 1px solid rgba(212, 163, 115, 0.22);
  color: var(--accent);
}
.rc-intro-qr {
  position: absolute;
  right: -6px;
  bottom: -6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.7);
}
.rc-intro-title { margin-top: 16px; font-size: 18px; font-weight: 650; color: var(--text); letter-spacing: -0.01em; }
.rc-intro-text { margin-top: 6px; max-width: 320px; font-size: 14px; line-height: 1.5; color: var(--text-2); }

.rc-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rc-pick-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 112px;
  padding: 16px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--card-2);
  color: var(--text);
  text-align: center;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background var(--dur) ease, border-color var(--dur) ease, transform var(--dur) var(--ease);
}
.rc-pick-btn:active { transform: scale(0.97); }
@media (hover: hover) {
  .rc-pick-btn:hover { border-color: rgba(212, 163, 115, 0.45); background: var(--card-hover); }
}
.rc-pick-btn:focus-within { box-shadow: var(--ring); border-color: var(--accent); }
.rc-pick-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: var(--accent-soft);
  color: var(--accent);
}
.rc-pick-label { font-size: 15px; font-weight: 620; line-height: 1.25; }
.rc-pick-btn.primary { background: linear-gradient(160deg, rgba(212, 163, 115, 0.2), rgba(110, 74, 47, 0.16)), var(--card-2); border-color: rgba(212, 163, 115, 0.4); }
.rc-pick-btn.primary .rc-pick-icon { background: var(--accent); color: var(--on-accent); }

.rc-pick.compact { margin-top: 12px; }
.rc-pick.compact .rc-pick-btn { flex-direction: row; min-height: 48px; padding: 8px 12px; gap: 8px; }
.rc-pick.compact .rc-pick-icon { width: 30px; height: 30px; border-radius: 10px; }
.rc-pick.compact .rc-pick-label { font-size: 14px; }

.rc-thumbs { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; }
.rc-thumbs::-webkit-scrollbar { display: none; }
.rc-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 92px;
  height: 124px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--card-2);
  border: 1px solid var(--border-strong);
}
.rc-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.rc-thumb-n {
  position: absolute;
  left: 6px;
  bottom: 6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(18, 13, 9, 0.78);
  color: var(--beige);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
.rc-thumb-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(18, 13, 9, 0.8);
  color: #fff;
  cursor: pointer;
}
.rc-thumb-remove:active { transform: scale(0.92); }
.rc-thumb-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-style: dashed;
  border-color: rgba(212, 163, 115, 0.4);
  background: rgba(212, 163, 115, 0.06);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.rc-thumb-add:focus-within { box-shadow: var(--ring); }
.rc-thumbs-note { margin: 4px 2px 0; font-size: 13px; color: var(--text-2); }

.rc-modes-title { margin: 20px 2px 10px; font-size: 13px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.rc-modes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.rc-mode {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 76px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--card-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background var(--dur) ease, border-color var(--dur) ease, transform var(--dur) var(--ease);
}
.rc-mode:active:not(:disabled) { transform: scale(0.98); }
@media (hover: hover) {
  .rc-mode:hover:not(:disabled) { border-color: rgba(212, 163, 115, 0.5); background: var(--card-hover); }
}
.rc-mode:disabled { opacity: 0.5; cursor: default; }
.rc-mode-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 15px;
  background: var(--accent-soft);
  color: var(--accent);
}
.rc-mode[data-mode="ai"]:not(:disabled) { background: linear-gradient(135deg, rgba(122, 82, 52, 0.55), rgba(46, 31, 20, 0.6)), var(--card-2); border-color: rgba(212, 163, 115, 0.35); }
.rc-mode[data-mode="ai"]:not(:disabled) .rc-mode-icon { background: var(--accent); color: var(--on-accent); }
.rc-mode-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rc-mode-title { font-size: 16px; font-weight: 650; }
.rc-mode-sub { font-size: 13.5px; color: var(--text-2); }
.rc-mode-note {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 2px 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-2);
}
.rc-mode-note > svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.rc-mode-note > span { flex: 1 1 200px; min-width: 0; }
.rc-mode-note > .rc-link { padding: 0 2px; font-size: 13.5px; }
.rc-manual { display: flex; margin: 16px auto 2px; }

@media (min-width: 560px) {
  .rc-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rc-mode { flex-direction: column; align-items: flex-start; min-height: 136px; }
}

/* ---------- Processamento ---------- */
.rc-process { display: flex; flex-direction: column; align-items: center; padding: 6px 4px 8px; }
.rc-scan {
  position: relative;
  width: 148px;
  height: 196px;
  border-radius: 18px;
  overflow: hidden;
  background: var(--card-2);
  border: 1px solid rgba(212, 163, 115, 0.35);
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.9);
}
.rc-scan img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; filter: saturate(0.85) brightness(0.9); }
.rc-scan-icon { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--accent); }
.rc-scan-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 36%;
  background: linear-gradient(180deg, rgba(212, 163, 115, 0), rgba(212, 163, 115, 0.28) 85%, rgba(233, 196, 150, 0.95) 100%);
  border-bottom: 2px solid var(--accent);
  animation: rc-scan 1.8s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}
@keyframes rc-scan { from { transform: translateY(-100%); } to { transform: translateY(180%); } }
@media (prefers-reduced-motion: reduce) {
  .rc-scan-line { animation: none; transform: translateY(80%); }
}
.rc-steps { list-style: none; margin: 22px 0 0; padding: 0; width: min(100%, 320px); display: flex; flex-direction: column; gap: 12px; }
.rc-step { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--muted); }
.rc-step-dot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
}
.rc-step[data-state="active"] { color: var(--text); font-weight: 600; }
.rc-step[data-state="active"] .rc-step-dot { border-color: rgba(212, 163, 115, 0.25); border-top-color: var(--accent); animation: rc-spin 0.8s linear infinite; }
.rc-step[data-state="done"] { color: var(--text-2); }
.rc-step[data-state="done"] .rc-step-dot { border-color: var(--ok); background: var(--ok); color: #10231a; }
.rc-step[data-state="miss"] .rc-step-dot { border-color: var(--faint); color: var(--muted); }
@keyframes rc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .rc-step[data-state="active"] .rc-step-dot { animation-duration: 2.4s; }
}
.rc-process-hint { min-height: 20px; margin: 16px 0 0; font-size: 13.5px; color: var(--text-2); text-align: center; }

/* estados "sem QR" / "erro da IA" */
.rc-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 0 4px; }
.rc-state-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
}
.rc-state-icon.warn { background: var(--warn-soft); color: var(--warn); }
.rc-state-icon.danger { background: var(--danger-soft); color: var(--danger); }
.rc-state-title { margin-top: 14px; font-size: 18px; font-weight: 650; color: var(--text); }
.rc-state-text { margin: 6px 0 18px; max-width: 360px; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.rc-state .choice-list { width: 100%; text-align: left; }

/* ---------- Talão repetido ---------- */
.rc-dup-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  text-align: left;
}
.rc-dup-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.rc-dup-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.rc-dup-title { font-size: 15px; font-weight: 620; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-dup-sub { font-size: 13px; color: var(--muted); }
.rc-dup-total { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Revisão ---------- */
.rc-review { display: flex; flex-direction: column; gap: 14px; padding-bottom: 8px; }
.rc-review-photos { display: flex; align-items: center; gap: 8px; }
.rc-review-photo {
  width: 46px;
  height: 58px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--card-2);
  cursor: zoom-in;
}
.rc-review-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rc-review-photos-text { margin-left: 4px; font-size: 13px; color: var(--text-2); }

.rc-head { padding-bottom: 4px; }
.rc-head .field:last-child, .rc-head .form-row:last-child > .field { margin-bottom: 12px; }
.rc-head .switch-row { margin-bottom: 12px; }
.rc-qr {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}
.rc-qr > svg { flex-shrink: 0; }
.rc-qr > span { flex: 1 1 auto; min-width: 0; }
.rc-qr .rc-link { padding: 0 2px; font-size: 13.5px; }
.rc-qr.ok { background: var(--ok-soft); color: var(--ok); }
.rc-qr.warn { background: var(--warn-soft); color: var(--warn); }
.rc-qr.info { background: var(--info-soft); color: var(--info); }
.rc-qr.muted { background: rgba(236, 220, 196, 0.07); color: var(--muted); }
.rc-warnings { margin: -6px 0 14px; padding: 0 0 0 18px; font-size: 13px; line-height: 1.45; color: var(--text-2); }
.rc-warnings li + li { margin-top: 3px; }

/* soma dos produtos vs total */
.rc-sum {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-2);
}
.rc-sum > svg { flex-shrink: 0; color: var(--muted); }
.rc-sum > span { flex: 1 1 auto; min-width: 0; }
.rc-sum.ok { border-color: rgba(127, 200, 160, 0.3); background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.rc-sum.ok > svg { color: var(--ok); }
.rc-sum.info, .rc-sum.warn { display: block; }
.rc-sum.warn { border-color: rgba(233, 180, 76, 0.35); }
.rc-sum-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rc-sum-grid > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rc-sum-label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.rc-sum-value { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rc-sum.info .rc-diff { color: var(--info); }
.rc-sum.warn .rc-diff { color: var(--warn); }
.rc-sum-note { margin-top: 8px; font-size: 13.5px; color: var(--text-2); }

/* itens */
.rc-items-section { margin-top: 4px; }
.rc-items-section > .section-head { margin-bottom: 8px; }
.rc-items { display: flex; flex-direction: column; gap: 10px; }
.rc-item {
  padding: 10px 12px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
}
.rc-item[data-dest="ignore"] { background: rgba(31, 23, 17, 0.55); }
.rc-item[data-dest="ignore"] .rc-name { color: var(--muted); -webkit-text-fill-color: var(--muted); }
.rc-item-top { display: flex; align-items: center; gap: 8px; }
.rc-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}
.rc-item-icon.info { background: var(--info-soft); color: var(--info); }
.rc-item-icon.muted { background: rgba(236, 220, 196, 0.08); color: var(--muted); }
.rc-item .input { height: 42px; border-radius: 11px; }
.rc-item select.input { padding-left: 10px; padding-right: 26px; background-position: right 6px center; background-size: 15px; }
.rc-name { flex: 1 1 auto; font-weight: 600; background: transparent; border-color: transparent; padding: 0 8px; }
.rc-name:hover { border-color: var(--border-strong); }
.rc-name:focus { background: var(--bg-2); }
.rc-item-remove { color: var(--muted); }
.rc-raw {
  margin: 1px 0 0 50px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rc-item-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px 10px; margin-top: 8px; }
.rc-mini-qty { grid-column: span 5; }
.rc-mini-total { grid-column: span 7; }
.rc-mini-dest { grid-column: span 7; }
.rc-mini-cat { grid-column: span 5; }
.rc-mini { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rc-mini-label { font-size: 12px; font-weight: 600; color: var(--muted); padding-left: 2px; }
.rc-item .input-affix.has-prefix .input { padding-left: 30px; }
.rc-item .input-prefix { left: 12px; font-size: 15px; }
.rc-item .input-affix.has-suffix .input { padding-right: 42px; }
.rc-item .input-suffix { right: 12px; font-size: 14px; }
.input.rc-bad { border-color: var(--danger); }
.rc-item-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 9px; min-height: 24px; }
.rc-note { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); min-width: 0; }
.rc-note > svg { flex-shrink: 0; color: var(--muted); }
.rc-note.ok > svg { color: var(--ok); }
.rc-note.warn { color: var(--warn); }
.rc-note.warn > svg { color: var(--warn); }
.rc-note.info > svg { color: var(--info); }
.rc-item-foot .rc-link { padding: 0 2px; font-size: 13.5px; }
.rc-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  margin-left: auto;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(212, 163, 115, 0.3);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.rc-tag > svg:last-child { opacity: 0.75; }
.rc-tag:active { transform: scale(0.96); }

@media (min-width: 700px) {
  .rc-mini-qty { grid-column: span 2; }
  .rc-mini-total { grid-column: span 3; }
  .rc-mini-dest { grid-column: span 4; }
  .rc-mini-cat { grid-column: span 3; }
}

.rc-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--info-soft);
  color: var(--text-2);
  font-size: 13.5px;
}
.rc-hint > svg { flex-shrink: 0; color: var(--info); }
.rc-hint > span { flex: 1; min-width: 0; }

/* estado vazio com os botões de adicionar */
.rc-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 22px 16px 14px; }
.rc-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 17px;
  background: var(--accent-soft);
  color: var(--accent);
}
.rc-empty-title { margin-top: 12px; font-size: 16px; font-weight: 650; color: var(--text); }
.rc-empty-text { margin: 6px 0 14px; max-width: 360px; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.rc-empty .rc-add { width: 100%; }

.rc-add { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 12px; }
.rc-items:empty + .rc-add { margin-top: 0; }
.rc-add .btn { justify-content: flex-start; height: 48px; padding: 0 14px; }
.rc-add .btn > svg { color: var(--accent); flex-shrink: 0; }
.rc-add .btn > span:not(.rc-add-count) { flex: 1 1 auto; text-align: left; }
.rc-add-count {
  flex-shrink: 0;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
.rc-add-blank { display: flex; margin: 8px auto 0; }
@media (min-width: 560px) {
  .rc-add { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.rc-switch { margin-top: 2px; }

/* visualizador da foto */
.rc-viewer { display: flex; justify-content: center; }
.rc-viewer img { display: block; width: 100%; max-width: 640px; height: auto; border-radius: var(--radius-md); background: #fff; }

/* ---------- Pickers ---------- */
.rc-picker-search {
  position: sticky;
  top: -6px;
  z-index: 2;
  margin: -6px -18px 0;
  padding: 6px 18px 12px;
  background: var(--sheet-bg);
}
@media (min-width: 700px) {
  .rc-picker-search { margin: -6px -22px 0; padding: 6px 22px 12px; }
}
.rc-picker-results .list + .list-group-title { padding-top: 18px; }
.rc-pick-item .li-icon { width: 30px; height: 30px; border-radius: 50%; background: transparent; }
.rc-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  color: var(--on-accent);
  transition: background var(--dur) ease, border-color var(--dur) ease;
}
.rc-check.on { background: var(--accent); border-color: var(--accent); }
.rc-pick-item.selected { background: rgba(212, 163, 115, 0.07); }
.rc-stock-picker .rc-pick-item:not(.selected) .li-icon.accent { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); }
.rc-pick-item.current .li-meta { color: var(--accent); font-weight: 600; }

/* ---------- Detalhe ---------- */
.rc-detail { display: flex; flex-direction: column; gap: 14px; padding-bottom: 6px; }
.rc-detail-photos { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; }
.rc-detail-photos::-webkit-scrollbar { display: none; }
.rc-detail-photo { flex: 0 0 auto; max-width: 100%; padding: 0; border: 0; background: none; border-radius: var(--radius); cursor: zoom-in; }
.rc-detail-photo:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rc-detail-photos .photo-lg {
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
  height: 260px;
  aspect-ratio: auto;
  object-fit: contain;
  background: #f4efe7;
}
.rc-detail-photos .photo-placeholder { width: 200px; }
.rc-detail-head { padding: 14px 16px; background: linear-gradient(135deg, rgba(122, 82, 52, 0.45), rgba(46, 31, 20, 0.35)), var(--card); border-color: rgba(212, 163, 115, 0.2); }
.rc-detail-top { display: flex; align-items: center; gap: 12px; }
.rc-detail-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 14px;
  background: rgba(18, 11, 6, 0.35);
  color: var(--accent);
}
.rc-detail-main { flex: 1; min-width: 0; }
.rc-detail-merchant {
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.rc-detail-date { margin-top: 2px; font-size: 13.5px; color: var(--beige); }
.rc-detail-total { font-size: 22px; font-weight: 750; letter-spacing: -0.02em; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rc-detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.rc-detail-badges .badge { background: rgba(18, 11, 6, 0.3); }
.rc-detail-badges .badge.ok { color: var(--ok); }
.rc-detail-badges .badge.accent { color: var(--accent); }
.rc-detail-badges .badge.info { color: var(--info); }
.rc-detail-grid { margin: 0; }
.rc-detail-items-head { margin: 4px 0 -4px; }
.rc-detail-item .li-sub > .badge + .badge { margin-left: -2px; }
.rc-detail-empty .card-text { margin: 0; }
.rc-detail-note { margin: 0; }

/* ---------- 30. Vista: Casa › Pagamentos, Serviços e Consumos (hm-) — js/views/house/payments.js, services.js, consumption.js ---------- */

/* ---- Layout: 1 coluna no telemóvel, 2 no computador; regiões vazias não ocupam espaço ---- */
.hm-page .hm-cols { display: flex; flex-direction: column; gap: 22px; margin-top: 4px; }
.hm-col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.hm-col > div:empty { display: none; }
.hm-col .section { margin-top: 0; }
@media (min-width: 1024px) {
  .hm-page .hm-cols {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
}

.hm-mt { margin-top: 12px; }
.hm-break { overflow-wrap: anywhere; }
.hm-notes { white-space: pre-wrap; font-weight: 500; line-height: 1.45; }
.hm-quiet { padding: 14px 16px; }
.hm-quiet .row { align-items: flex-start; gap: 12px; }
.hm-quiet .card-title { margin-bottom: 2px; }
.hm-empty-card { padding: 6px 8px; }

/* selos numa linha própria (quebram em vez de cortar) */
.hm-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; min-width: 0; }
.hm-badges:empty { display: none; }
.hm-badges .badge { height: 20px; padding: 0 8px; font-size: 11.5px; }

/* ---- Barra do mês ---- */
.hm-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hm-toolbar .month-switch > button { width: 34px; height: 34px; }
.hm-today {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform var(--dur) ease;
}
.hm-today:active { transform: scale(0.96); }

/* ---- Resumo do mês (cartão nogueira) ---- */
.hm-overview .card-value { font-size: 32px; }
.hm-overview .card-sub { line-height: 1.4; }
.hm-overview .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hm-overview .kpi { padding: 10px 11px; }
.hm-overview .kpi-value { font-size: 16px; }
.hm-page .hero-card .btn:not(.btn-primary) {
  background: rgba(18, 11, 6, 0.32);
  border-color: rgba(255, 236, 210, 0.16);
  color: #fff;
}
@media (hover: hover) {
  .hm-page .hero-card .btn:not(.btn-primary):hover:not(:disabled) { background: rgba(18, 11, 6, 0.46); }
}
.hm-bills-btn { margin-top: 14px; }
.hm-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---- Ocorrências (lista do mês) ---- */
.hm-occ { position: relative; padding: 12px 14px; }
.hm-occ + .hm-occ::before {
  content: "";
  position: absolute;
  top: 0;
  left: 64px;
  right: 0;
  height: 1px;
  background: var(--border);
}
.hm-occ-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  cursor: pointer;
  border-radius: 12px;
  -webkit-user-select: none;
  user-select: none;
}
.hm-occ-top:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hm-occ-top .li-end { align-self: flex-start; padding-top: 1px; }
.hm-occ.atrasado .li-amount { color: var(--danger); }
.hm-occ.anulado .li-amount { color: var(--muted); text-decoration: line-through; }
.hm-occ.pago .li-title { color: var(--text-2); }

/* linha de baixo: selos à esquerda, ações à direita (passam para baixo quando não cabem) */
.hm-occ-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  margin-top: 8px;
}
.hm-occ-foot > .hm-badges { margin-top: 0; flex: 1 1 auto; }
.hm-occ .hm-occ-foot > .hm-badges { padding-left: 50px; }
.hm-occ-foot > .hm-badges:empty { display: block; }
.hm-occ-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-left: auto; flex-wrap: nowrap; }
.hm-occ-actions .btn-sm { height: 32px; }
.hm-occ-actions .btn.btn-icon.btn-sm { width: 32px; height: 32px; }

/* ---- Todos os pagamentos ---- */
.hm-chips { margin-bottom: 10px; }
@media (min-width: 1024px) {
  .hm-chips .chips { margin: 0; padding: 2px 0 4px; }
}
.hm-pay-row { align-items: flex-start; }
.hm-pay-row .li-icon, .hm-svc-row .li-icon, .hm-cons-row .li-icon { margin-top: 1px; }
.hm-pay-row .li-end, .hm-svc-row .li-end, .hm-cons-row .li-end { align-self: flex-start; padding-top: 1px; }
.hm-pay-row.is-inactive .li-title { color: var(--muted); }
.hm-pay-row.is-inactive .li-amount { color: var(--muted); }

/* ---- Detalhe: cartão principal ---- */
.hm-hero .card-value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 6px; }
.hm-per { font-size: 15px; font-weight: 600; letter-spacing: 0; color: rgba(246, 239, 228, 0.8); }
.hm-hero .card-sub { margin-top: 6px; }
.hm-hero .hm-badges { margin-top: 12px; }
.hm-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hm-hero-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  background: rgba(18, 11, 6, 0.3);
  color: var(--beige);
}
.hm-banner { margin: 0; align-items: flex-start; }
.hm-banner > svg { margin-top: 1px; flex-shrink: 0; }
.hm-banner .banner-text { font-size: 14px; line-height: 1.45; color: var(--text-2); }
.hm-banner .banner-text strong { color: var(--text); font-weight: 650; }
.hm-banner > .btn { align-self: center; }
.hm-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---- Detalhe: meses (linha do tempo) ---- */
.hm-tl {
  padding: 2px 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.hm-tl-item { position: relative; display: flex; gap: 14px; min-width: 0; }
.hm-tl-item::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-strong);
}
.hm-tl-item:first-child::before { top: 20px; }
.hm-tl-item:last-child::before { bottom: auto; height: 20px; }
.hm-tl-item:only-child::before { display: none; }
.hm-tl-dot {
  position: relative;
  z-index: 1;
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  margin-top: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--card), 0 0 0 6px var(--accent-soft);
}
.hm-tl-item.pago .hm-tl-dot { background: var(--ok); box-shadow: 0 0 0 4px var(--card), 0 0 0 6px var(--ok-soft); }
.hm-tl-item.atrasado .hm-tl-dot { background: var(--danger); box-shadow: 0 0 0 4px var(--card), 0 0 0 6px var(--danger-soft); }
.hm-tl-item.anulado .hm-tl-dot { background: var(--card); border: 2px solid var(--faint); box-shadow: 0 0 0 4px var(--card); }
.hm-tl-item.is-current .hm-tl-dot { transform: scale(1.15); }
.hm-tl-body { flex: 1 1 auto; min-width: 0; padding: 12px 0; }
.hm-tl-item + .hm-tl-item .hm-tl-body { border-top: 1px solid var(--border); }
.hm-tl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.hm-tl-month { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.hm-tl-month .badge { height: 20px; padding: 0 8px; font-size: 11.5px; }
.hm-tl-amount { flex-shrink: 0; font-size: 15px; font-weight: 650; color: var(--text); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hm-tl-amount-sub { display: block; margin-top: 1px; font-size: 12px; font-weight: 500; color: var(--muted); }
.hm-tl-item.atrasado .hm-tl-amount { color: var(--danger); }
.hm-tl-item.anulado .hm-tl-amount { color: var(--muted); text-decoration: line-through; }
.hm-tl-sub { margin-top: 2px; font-size: 13px; color: var(--muted); }
.hm-tl .hm-occ-foot { padding-left: 0; }

/* ---- Formulários e janelas ---- */
.form-info:has(> .hm-tpl) { padding: 0; background: none; border: 0; margin-bottom: 14px; }
.hm-tpl .field-label { display: block; margin-bottom: 8px; }
.hm-tpl .chips { margin: 0 -18px; padding: 2px 18px 6px; scroll-padding-inline: 18px; }
.hm-tpl .chip { height: 32px; padding: 0 12px; font-size: 13.5px; }
@media (min-width: 700px) {
  .hm-tpl .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
}
.form-info:has(> .hm-sheet-info) { padding: 12px 14px; }
.hm-sheet-info { display: flex; flex-direction: column; gap: 2px; }
.hm-sheet-info-title { font-size: 15px; font-weight: 650; color: var(--text); margin-bottom: 2px; }

/* Atualizar faturas do mês */
.hm-bills-intro { margin: 0 0 12px; line-height: 1.45; }
.hm-bills { display: flex; flex-direction: column; gap: 8px; }
.hm-bill {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 124px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--border);
}
.hm-bill-main { min-width: 0; }
.hm-bill-main .li-sub { white-space: normal; }
.hm-bill-main .field-error { margin-top: 3px; }
.hm-bill-input .input { height: 44px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.hm-bill-input .input[aria-invalid="true"] { border-color: var(--danger); }
.hm-bill-done { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.hm-bill-done .badge { height: 20px; font-size: 11.5px; }

/* ---- Serviços ---- */
.hm-svc-kpis .kpi-value { font-size: 17px; }
.hm-svc-hero-head { gap: 12px; margin-bottom: 10px; }
.hm-svc-hero-head .card-title { font-size: 15px; }
.hm-contacts .hm-contact { flex: 1 1 0; min-width: 88px; }
@media (min-width: 700px) {
  .hm-contacts .hm-contact { flex: 0 0 auto; min-width: 104px; }
}

/* ---- Consumos ---- */
.hm-cons-tabs { margin: 4px 0 16px; }
.hm-cons-tabs .segmented { width: 100%; max-width: 440px; }
.hm-cons-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hm-cons-kpis .kpi { padding: 11px 12px; }
.hm-cons-kpis .kpi-value { font-size: 16.5px; }
.hm-kpi-up .kpi-value { color: var(--warn); }
.hm-kpi-down .kpi-value { color: var(--ok); }
.hm-chart-card { padding: 14px 14px 10px; }
.hm-chart-toggle { margin-bottom: 14px; }
.hm-chart-toggle .segmented { max-width: 320px; }
.hm-chart-toggle .segmented > button { height: 32px; font-size: 13px; }
.hm-note-head { gap: 10px; margin-bottom: 8px; align-items: center; }
.hm-note-head .li-icon { width: 32px; height: 32px; border-radius: 10px; }
.hm-cons-note .card-text { line-height: 1.5; }

/* ---------- 31. Vista: Casa › Veículos e Manutenção (hv-) — js/views/house/vehicles.js, maintenance.js ---------- */

/* ---- Layout do detalhe: 1 coluna no telemóvel, 2 no computador; regiões vazias não ocupam espaço ---- */
.hv-page .hv-cols { display: flex; flex-direction: column; gap: 22px; margin-top: 4px; }
.hv-col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.hv-col > div:empty { display: none; }
.hv-col .section { margin-top: 0; }
@media (min-width: 1024px) {
  .hv-page .hv-cols {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
}
.hv-view > div:empty { display: none; }
.hv-mt { margin-top: 12px; }
.hv-notes { white-space: pre-wrap; font-weight: 500; line-height: 1.45; }
.hv-quiet { padding: 14px 16px; }
.hv-empty-card { padding: 6px 8px; }
.hv-note { margin: 10px 4px 0; font-size: 13px; line-height: 1.45; }
.hv-badges { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.hv-badges:empty { display: none; }
.hv-badges .badge { height: 20px; padding: 0 8px; font-size: 11.5px; }

/* ---- Lista: cartões dos veículos ---- */
.hv-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 700px) { .hv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .hv-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.hv-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  transition: border-color var(--dur) ease;
}
.hv-card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
}
.hv-card.warn { border-color: rgba(233, 180, 76, 0.22); }
.hv-card.warn::after { background: var(--warn); }
.hv-card.danger { border-color: rgba(229, 123, 110, 0.26); }
.hv-card.danger::after { background: var(--danger); }
.hv-card-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  padding: 16px 16px 14px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background-color var(--dur) ease;
}
.hv-card-main:active { background: var(--card-hover); }
@media (hover: hover) {
  .hv-card-main:hover { background: rgba(46, 34, 25, 0.55); }
}
.hv-card-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hv-card-head > .badge { flex-shrink: 0; align-self: flex-start; margin-top: 2px; }
.hv-type-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 14px;
  background: linear-gradient(145deg, #7a5234, #3a2717);
  border: 1px solid rgba(233, 220, 198, 0.14);
  color: var(--beige);
  box-shadow: 0 1px 0 rgba(255, 236, 210, 0.12) inset;
}
.hv-card-titles { flex: 1 1 auto; min-width: 0; }
.hv-card-titles .card-title { font-size: 16px; }
.hv-card-sub { margin-top: 2px; font-size: 13px; color: var(--muted); }
.hv-odo { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.hv-odo-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.hv-odo-label { font-size: 13px; color: var(--muted); }
.hv-odo-empty { font-size: 15px; font-weight: 600; color: var(--muted); }
.hv-next {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 560;
  color: var(--text-2);
}
.hv-next > svg { flex-shrink: 0; color: var(--muted); }
.hv-next.warn, .hv-next.warn > svg { color: var(--warn); }
.hv-next.danger, .hv-next.danger > svg { color: var(--danger); }
.hv-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.4;
}
.hv-hint > svg { flex-shrink: 0; margin-top: 1px; color: var(--info); }
.hv-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
}
.hv-card-actions .btn { width: 100%; }

.hv-add-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--accent);
  font-size: 14.5px;
  font-weight: 600;
  transition: background var(--dur) ease, border-color var(--dur) ease, transform var(--dur) var(--ease);
}
.hv-add-card:active { transform: scale(0.98); }
@media (hover: hover) {
  .hv-add-card:hover { background: var(--accent-soft); border-color: rgba(212, 163, 115, 0.45); }
}
@media (min-width: 700px) { .hv-add-card { min-height: 100%; flex-direction: column; } }

/* ---- Gráficos e KPIs ---- */
.hv-chart-card { padding: 16px; }
.hv-chart-card + .hv-chart-card, .hv-kpis + .hv-chart-card { margin-top: 10px; }
.hv-chart-title { margin-bottom: 12px; font-size: 13px; font-weight: 650; color: var(--muted); letter-spacing: 0.02em; }
.hv-chart-total { display: flex; flex-direction: column; margin-bottom: 16px; }
.hv-chart-total .card-sub { color: var(--text-2); }
.hv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hv-kpis .kpi-value { font-size: 17px; }

/* ---- Detalhe: hero ---- */
.hv-hero { padding: 18px 18px 16px; }
.hv-hero-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hv-hero-top > .badge { flex-shrink: 0; align-self: flex-start; }
.hv-hero-icon, .hv-hero-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 16px;
  background: rgba(18, 11, 6, 0.3);
  border: 1px solid rgba(255, 236, 210, 0.14);
  color: var(--beige);
  overflow: hidden;
}
.hv-hero-photo .photo-thumb { width: 100%; height: 100%; border: 0; border-radius: 0; }
.hv-hero-titles { flex: 1 1 auto; min-width: 0; }
.hv-hero-titles .card-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hv-hero-odo { margin-top: 18px; }
.hv-hero-odo .card-value { font-size: 38px; margin-top: 0; font-variant-numeric: tabular-nums; }
.hv-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hv-hero-actions .btn { flex: 1 1 140px; }
.hv-hero .badge.warn { color: var(--warn); }
.hv-hero .badge.danger { color: var(--danger); }
.hv-hero .badge.ok { color: var(--ok); }
.hero-card.hv-hero .btn:not(.btn-primary) {
  background: rgba(18, 11, 6, 0.32);
  border-color: rgba(255, 236, 210, 0.16);
  color: #fff;
}
@media (hover: hover) {
  .hero-card.hv-hero .btn:not(.btn-primary):hover:not(:disabled) { background: rgba(18, 11, 6, 0.46); }
}

.hv-hint-card { padding: 14px 16px; background: linear-gradient(90deg, rgba(143, 179, 217, 0.08), transparent 60%), var(--card); border-color: rgba(143, 179, 217, 0.18); }
.hv-hint-card .row { align-items: flex-start; gap: 12px; }
.hv-hint-card .li-icon { width: 34px; height: 34px; border-radius: 10px; }
.hv-hint-card .card-text { color: var(--text-2); font-size: 14px; }

/* ---- Prazos ---- */
.hv-deadline { position: relative; }
.hv-deadline + .hv-deadline::before {
  content: "";
  position: absolute;
  top: 0;
  left: 64px;
  right: 0;
  height: 1px;
  background: var(--border);
}
.hv-deadline .li-end .badge { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.hv-deadline .li-sub { white-space: normal; }
.hv-deadline:has(> .hv-deadline-foot) > .list-item { padding-bottom: 2px; }
.hv-deadline-foot { padding: 0 14px 10px 58px; }
.hv-cal { height: 30px; padding: 0 8px; font-size: 13px; color: var(--accent); }
.hv-cal > svg { flex-shrink: 0; }

/* ---- Manutenção por intervalo ---- */
.hv-items { gap: 10px; }
.hv-item { padding: 12px 14px 12px; }
.hv-item.warn { border-color: rgba(233, 180, 76, 0.24); }
.hv-item.danger { border-color: rgba(229, 123, 110, 0.28); }
.hv-item-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin: -4px -6px 0;
  padding: 4px 6px;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color var(--dur) ease;
}
.hv-item-head:active { background: var(--card-hover); }
@media (hover: hover) {
  .hv-item-head:hover { background: rgba(46, 34, 25, 0.55); }
}
.hv-item-head .li-icon { width: 36px; height: 36px; border-radius: 11px; }
.hv-item-badge { flex-shrink: 0; max-width: 46%; display: flex; justify-content: flex-end; }
.hv-item-badge .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.hv-item-progress { margin: 12px 0 0; }
.hv-item-foot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 12px;
}
.hv-item-stat { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hv-stat-label { font-size: 12px; color: var(--muted); }
.hv-stat-value { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hv-stat-value.muted { font-weight: 500; color: var(--muted); }
.hv-item-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
@media (min-width: 560px) {
  .hv-item-foot { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center; }
  .hv-item-actions { grid-column: auto; }
}
.hv-items-empty { padding: 14px 16px; }
.hv-items-empty .row { align-items: flex-start; gap: 12px; }
.hv-items-empty .card-text { color: var(--text-2); font-size: 14px; }

/* sugestões: chips que quebram de linha (não fazem scroll para fora do cartão) */
.hv-presets { margin-top: 14px; }
.hv-presets-label { margin: 0 2px 8px; font-size: 12.5px; font-weight: 650; color: var(--muted); letter-spacing: 0.02em; }
.hv-presets .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.hv-presets .chip { height: 32px; font-size: 13.5px; }
.hv-presets-open { margin-top: 0; }

/* ---- Registos ---- */
.hv-filter { margin-bottom: 10px; }
@media (min-width: 1024px) {
  .hv-filter .chips { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; }
}
.hv-more { margin-top: 8px; }
.hv-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---- Formulários (blocos informativos) ---- */
.hv-form-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 560;
}
.hv-form-note > svg { flex-shrink: 0; color: var(--accent); }
.hv-form-hint { margin: 0; font-size: 13px; line-height: 1.45; }
/* blocos informativos destas secções sem a caixa do .form-info */
.form-info:has(> .hv-form-note), .form-info:has(> .hv-form-hint) { padding: 0; background: none; border: 0; }

/* ---- Manutenção da casa ---- */
.hv-mnt-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.hv-mnt-kpis .kpi { padding: 10px 11px; }
.hv-mnt-group:first-child { margin-top: 18px; }
.hv-task { align-items: center; }
.hv-task .li-sub + .li-sub { margin-top: 1px; white-space: normal; }
.hv-task-when { color: var(--text-2); font-weight: 560; }
.hv-task-when.warn { color: var(--warn); }
.hv-task-when.info { color: var(--info); }
.hv-task .li-end { max-width: none; }
@media (max-width: 380px) {
  .hv-complete > span { display: none; }
  .hv-complete { width: 34px; padding: 0; }
}

.hv-task-sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.hv-task-sheet-head .li-icon { width: 42px; height: 42px; }
.hv-task-sheet-main { flex: 1 1 auto; min-width: 0; }
.hv-task-sheet-head > .badge { flex-shrink: 0; }
.hv-task-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hv-sheet-section { margin: 18px 2px 8px; font-size: 12px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.hv-sheet-list { box-shadow: none; }
.hv-sheet-note { margin: 0 2px; }
.hv-sheet-links { display: flex; gap: 8px; margin-top: 16px; }
.hv-sheet-links .btn { flex: 1 1 0; }

/* ---------- 32. Vista: Casa › Eletrodomésticos, Móveis, Histórico e Documentos (ha-) — js/views/house/common.js, appliances.js, furniture.js, history.js, documents.js ---------- */

/* ---- Layout: 1 coluna no telemóvel, 2 no computador; regiões vazias não ocupam espaço ---- */
.ha-page [data-ha-region]:empty { display: none; }
.ha-view > [data-ha-region] + [data-ha-region] { margin-top: 14px; }
.ha-cols { display: flex; flex-direction: column; gap: 22px; }
.ha-col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.ha-col > div:empty { display: none; }
.ha-col .section-head, .ha-view .section-head { margin-top: 0; }
@media (min-width: 1024px) {
  .ha-cols {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
}

.ha-badges { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.ha-badges:empty { display: none; }
.ha-badge-room > svg { flex-shrink: 0; opacity: 0.85; }
.li-sub .ha-badges { margin-top: 6px; }
.li-sub .ha-badges .badge { height: 21px; padding: 0 8px; font-size: 11.5px; }
.ha-li-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ha-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.ha-hint { margin-top: 8px; padding: 0 6px; font-size: 13px; }
.ha-empty-card { padding: 4px 8px; }
.ha-danger-zone { padding-top: 4px; }
.ha-danger-zone .btn { height: 46px; }

/* ---- Resumo e filtros ---- */
.ha-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ha-kpis .kpi { padding: 11px 12px; }
.ha-kpis .kpi-value { font-size: 19px; }
.ha-kpi-date { font-size: 16px !important; }
/* .chips já sangra até às margens (margem negativa do design system) */
.ha-filters { margin-top: 2px; }
@media (min-width: 700px) {
  .ha-filters .chips { margin: 0; padding: 2px 0 4px; flex-wrap: wrap; overflow: visible; }
}

/* ---- Lista agrupada (2 colunas equilibradas no computador) ---- */
.ha-group + .ha-group { margin-top: 4px; }
@media (min-width: 1024px) {
  .ha-items [data-ha-region="list"], .ha-docs [data-ha-region="list"] { column-count: 2; column-gap: 24px; }
  .ha-items .ha-group, .ha-docs .ha-group { break-inside: avoid; }
  .ha-items .ha-group + .ha-group, .ha-docs .ha-group + .ha-group { margin-top: 0; padding-top: 4px; }
  .ha-items [data-ha-region="list"] > .ha-empty-card, .ha-docs [data-ha-region="list"] > .ha-empty-card { column-span: all; }
}
.ha-group-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ha-group-meta { font-weight: 600; letter-spacing: 0; text-transform: none; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ha-row .li-icon, .ha-doc-row .li-icon { width: 48px; height: 48px; border-radius: 13px; }
.ha-row .li-icon.muted { background: var(--card-2); color: var(--accent); border: 1px solid var(--border); }
.ha-row .li-icon .photo-thumb { width: 100%; height: 100%; border: 0; border-radius: 0; }
:is(.list, .card) > .ha-row + .ha-row:has(> .li-icon)::before,
:is(.list, .card) > .ha-doc-row + .ha-doc-row::before { left: 74px; }
.ha-row .li-end, .ha-doc-row .li-end { align-self: center; }
.ha-doc-row .li-icon { width: 42px; height: 42px; border-radius: 12px; }
.ha-doc-open.btn-icon { width: 38px; height: 38px; color: var(--accent); }

/* ---- Detalhe: cartão principal ---- */
.ha-hero { display: flex; flex-direction: column; gap: 16px; padding: 12px; }
.ha-hero-media .photo-lg { display: block; max-height: 300px; border-radius: 16px; }
.ha-hero-media .ha-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  height: 112px;
  max-height: none;
  aspect-ratio: auto;
  border-style: dashed;
  border-color: var(--border-strong);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) ease, color var(--dur) ease;
}
.ha-photo-empty svg { color: var(--accent); }
.ha-photo-empty:active { transform: scale(0.99); }
@media (hover: hover) { .ha-photo-empty:hover { background: var(--card-hover); color: var(--text); } }
.ha-hero-body { display: flex; flex-direction: column; gap: 6px; padding: 0 6px 6px; min-width: 0; }
.ha-hero-price { margin-top: 6px; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.ha-hero-w { margin-top: 6px; }
@media (min-width: 700px) {
  .ha-hero { flex-direction: row; align-items: center; }
  .ha-hero-media { flex: 0 0 46%; max-width: 320px; }
  .ha-hero-media .photo-lg { max-height: 240px; aspect-ratio: 4 / 3; }
  .ha-hero-media .ha-photo-empty { height: auto; aspect-ratio: 4 / 3; max-height: 200px; }
}

/* ---- Garantia ---- */
.ha-warranty { display: flex; flex-direction: column; gap: 12px; }
.ha-w-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ha-w-main { flex: 1 1 auto; min-width: 0; }
.ha-w-main .card-text { margin-top: 2px; color: var(--text-2); }
.ha-w-days { flex-shrink: 0; text-align: right; line-height: 1; }
.ha-w-num { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.ha-w-num.ok { color: var(--ok); }
.ha-w-num.warn { color: var(--warn); }
.ha-w-num.danger { color: var(--danger); font-size: 17px; }
.ha-w-unit { margin-top: 4px; font-size: 12px; color: var(--muted); }
.ha-w-track { position: relative; height: 8px; border-radius: 999px; background: rgba(236, 220, 196, 0.08); overflow: hidden; }
.ha-w-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.ha-w-fill.ok { background: linear-gradient(90deg, rgba(127, 200, 160, 0.55), var(--ok)); }
.ha-w-fill.warn { background: linear-gradient(90deg, rgba(233, 180, 76, 0.55), var(--warn)); }
.ha-w-fill.danger { background: linear-gradient(90deg, rgba(229, 123, 110, 0.55), var(--danger)); }
.ha-w-scale { display: flex; justify-content: space-between; gap: 10px; margin-top: -4px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ha-w-coverage { font-size: 14px; color: var(--text); }
.ha-w-coverage .muted { margin-right: 6px; font-size: 12.5px; }
.ha-w-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ha-quiet .ha-w-actions, .ha-warranty .ha-w-actions { margin-top: 2px; }

/* cartões calmos (fora do orçamento, sem ligações) */
.ha-quiet { display: flex; flex-direction: column; gap: 12px; }
.ha-quiet-row { display: flex; align-items: flex-start; gap: 12px; }
.ha-quiet-main { flex: 1 1 auto; min-width: 0; }
.ha-quiet-main .card-text { margin-top: 2px; color: var(--text-2); font-size: 14px; }

/* ---- Formulários: notas, widgets de fotografias e ligações ---- */
.ha-form-note { display: flex; align-items: flex-start; gap: 9px; color: var(--text-2); }
.ha-form-note > svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.ha-form-note strong { color: var(--text); }
.form-info:has(> .ha-widget) { padding: 0; background: none; border: 0; }
.ha-photos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ha-photo { position: relative; aspect-ratio: 1; min-width: 0; }
.ha-photo .photo-thumb { width: 100%; height: 100%; border-radius: 12px; }
.ha-photo-x {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: rgba(18, 13, 9, 0.78);
  color: #fff;
  cursor: pointer;
}
.ha-photo-new {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(18, 13, 9, 0.78);
  color: var(--beige);
  font-size: 10.5px;
  font-weight: 650;
}
.ha-photo-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--bg-2);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) ease;
}
.ha-photo-add:active { transform: scale(0.97); }
.ha-photo-add:focus-within { box-shadow: var(--ring); }
.ha-photos + .field-help { margin-top: 6px; }

.ha-sel { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.ha-sel-empty { font-size: 14px; color: var(--muted); }
.ha-sel-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 34px;
  padding: 0 4px 0 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(212, 163, 115, 0.3);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
}
.ha-sel-chip > svg { flex-shrink: 0; color: var(--accent); }
.ha-sel-chip.is-missing { background: rgba(236, 220, 196, 0.06); border-color: var(--border); color: var(--muted); }
.ha-sel-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ha-sel-x {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.ha-sel-x:active { background: rgba(236, 220, 196, 0.12); }

/* janela de escolha (ligações / documentos) */
.ha-pick-filter { margin-bottom: 10px; }
.ha-pick-filter .chips { margin: 0 -18px; padding: 2px 18px 4px; scroll-padding-inline: 18px; }
.ha-pick-group + .ha-pick-group { margin-top: 4px; }
.ha-pick .list-item { width: 100%; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; }
.ha-pick-check {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  color: transparent;
  transition: background var(--dur) ease, border-color var(--dur) ease, color var(--dur) ease;
}
.ha-pick-item.is-on .ha-pick-check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ha-pick-sheet .sheet-actions { display: flex; gap: 10px; }
.ha-pick-sheet .sheet-actions .btn { flex: 1 1 0; }

/* pré-visualização de imagens (documento local, fotografias do histórico) */
.ha-doc-preview .photo-lg { max-height: 70vh; aspect-ratio: auto; object-fit: contain; background: var(--bg-2); }

/* ---- Histórico: resumo ---- */
.ha-hist-summary .card-value { margin-top: 2px; }
.ha-hist-summary .kpis { margin-top: 14px; }
.ha-years { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.ha-mini-title { margin-bottom: 8px; font-size: 12px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* ---- Histórico: linha do tempo ---- */
.ha-timeline { margin-top: 4px; }
.ha-tl-year {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 2px 4px;
}
.ha-timeline > .ha-tl-year:first-child { margin-top: 4px; }
.ha-tl-year-label { font-size: 22px; font-weight: 750; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.ha-tl-year-total { font-size: 14px; font-weight: 650; color: var(--accent); font-variant-numeric: tabular-nums; }
.ha-tl-month { margin: 10px 0 8px 2px; font-size: 12px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ha-tl { position: relative; display: flex; flex-direction: column; gap: 10px; }
.ha-tl::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 18px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(212, 163, 115, 0.35), rgba(212, 163, 115, 0.08));
}
.ha-tl-item { position: relative; display: flex; align-items: flex-start; gap: 12px; cursor: pointer; -webkit-user-select: none; user-select: none; }
.ha-tl-dot { position: relative; z-index: 1; width: 38px; height: 38px; border-radius: 999px; box-shadow: 0 0 0 4px var(--bg); }
.ha-tl-dot.accent { background: #3a2a1d; }
.ha-tl-dot.warn { background: #3a2e18; }
.ha-tl-dot.info { background: #232a31; }
.ha-tl-dot.ok { background: #1f2d25; }
.ha-tl-dot.muted { background: #2a221b; }
.ha-tl-card {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: background var(--dur) ease, border-color var(--dur) ease, transform var(--dur) var(--ease);
}
.ha-tl-item:active .ha-tl-card { transform: scale(0.99); background: var(--card-hover); }
.ha-tl-item:focus-visible { outline: none; }
.ha-tl-item:focus-visible .ha-tl-card { box-shadow: var(--ring); }
@media (hover: hover) { .ha-tl-item:hover .ha-tl-card { background: var(--card-hover); border-color: var(--border-strong); } }
.ha-tl-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ha-tl-title { min-width: 0; font-size: 15.5px; font-weight: 650; color: var(--text); overflow-wrap: anywhere; }
.ha-tl-cost { flex-shrink: 0; font-size: 15px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ha-tl-sub { margin-top: 2px; font-size: 13px; color: var(--muted); }
.ha-tl-flag { display: inline-flex; vertical-align: -2px; margin-left: 4px; color: var(--accent); }
.ha-tl-desc {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ha-tl-photos { display: flex; gap: 6px; margin-top: 10px; }
.ha-tl-photos .photo-thumb { width: 52px; height: 52px; border-radius: 10px; }

/* ---- Histórico: detalhe ---- */
.ha-hist-hero { padding: 12px; }
.ha-hist-head { display: flex; align-items: center; gap: 10px; }
.ha-gallery { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ha-gallery-item { display: block; padding: 0; border: 0; background: none; border-radius: 12px; cursor: zoom-in; min-width: 0; }
.ha-gallery-item:first-child { grid-column: 1 / -1; }
.ha-gallery-item .photo-lg { display: block; max-height: 300px; border-radius: 16px; }
.ha-gallery-item .photo-thumb { width: 100%; height: auto; aspect-ratio: 1; border-radius: 12px; }
.ha-gallery-1 { grid-template-columns: 1fr; }
@media (min-width: 700px) {
  .ha-hist-hero { flex-direction: column; align-items: stretch; }
  .ha-hist-hero .ha-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- Documentos ---- */
.ha-doc-hero { display: flex; flex-direction: column; gap: 16px; }
.ha-doc-head { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.ha-doc-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(212, 163, 115, 0.28), rgba(110, 74, 47, 0.35));
  color: var(--accent);
  border: 1px solid rgba(212, 163, 115, 0.25);
}
.ha-doc-main { flex: 1 1 auto; min-width: 0; }
.ha-doc-where { display: flex; align-items: center; gap: 7px; margin-top: 10px; min-width: 0; font-size: 17px; font-weight: 650; color: var(--text); }
.ha-doc-where > svg { flex-shrink: 0; color: var(--accent); }
.ha-doc-where > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ha-doc-src { margin-top: 3px; font-size: 13.5px; color: var(--text-2); }
.ha-doc-actions { display: flex; flex-direction: column; gap: 10px; }
.ha-doc-actions > .btn { width: 100%; }
.ha-doc-bad {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--warn-soft);
  border: 1px solid rgba(233, 180, 76, 0.28);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}
.ha-doc-bad > svg { flex-shrink: 0; margin-top: 1px; color: var(--warn); }
.ha-link-chips { display: flex; flex-direction: column; gap: 8px; }
.ha-link-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 0 12px 0 14px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur) ease, transform var(--dur) var(--ease);
}
.ha-link-chip > svg:first-child { flex-shrink: 0; color: var(--accent); }
.ha-link-chip > svg:last-child { flex-shrink: 0; color: var(--faint); }
.ha-link-chip:active { transform: scale(0.99); background: var(--card-hover); }
@media (hover: hover) { .ha-link-chip:hover { background: var(--card-hover); } }
.ha-link-chip.is-missing { cursor: default; color: var(--muted); }
.ha-link-name { flex: 1 1 auto; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ha-link-kind { flex-shrink: 0; font-size: 12.5px; color: var(--muted); }
@media (min-width: 700px) {
  .ha-doc-actions { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .ha-doc-actions > .btn { width: auto; min-width: 180px; }
}

/* ---------- 33. Vista: Casa › Mudança e Gestão da casa (mv- / gm-) — js/views/house/move.js, management.js ---------- */

/* ---------------------------------------------------------------- Mudança */

.mv-layout { display: flex; flex-direction: column; gap: 24px; }
.mv-col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.mv-col > [data-mv]:empty, .mv-page > [data-mv]:empty { display: none; }
.mv-col .section-head { margin-top: 0; }
@media (min-width: 1024px) {
  .mv-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 28px;
    align-items: start;
  }
}

/* Contagem (cartão nogueira) */
.mv-hero { padding: 20px; }
.mv-hero-top { display: flex; align-items: center; gap: 16px; min-width: 0; }
.mv-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 86px;
  height: 86px;
  border-radius: 22px;
  background: rgba(18, 11, 6, 0.32);
  border: 1px solid rgba(255, 236, 210, 0.12);
  box-shadow: 0 1px 0 rgba(255, 236, 210, 0.08) inset;
  color: #fff;
}
.mv-count-num {
  font-size: 36px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.mv-count-num.mv-count-word { font-size: 22px; letter-spacing: -0.01em; }
.mv-count-unit {
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--beige);
}
.mv-count-icon { display: flex; color: var(--beige); }
.mv-hero-main { min-width: 0; flex: 1 1 auto; }
.mv-hero-title { font-size: 21px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; color: #fff; }
.mv-hero-sub { margin-top: 4px; font-size: 14px; line-height: 1.4; color: rgba(246, 239, 228, 0.9); }
.mv-hero-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mv-hero-badges:empty { display: none; }
.hero-card.mv-hero .badge.accent { background: rgba(212, 163, 115, 0.26); color: #f3d7b6; }
.hero-card.mv-hero .badge.ok { background: rgba(127, 200, 160, 0.2); color: #b6e6cb; }
.hero-card.mv-hero .badge.warn { background: rgba(233, 180, 76, 0.22); color: #f5d38e; }
.mv-hero-progress { margin-top: 18px; }
.mv-hero-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 13.5px;
  color: rgba(246, 239, 228, 0.9);
}
.mv-hero-pct { font-weight: 650; color: #fff; font-variant-numeric: tabular-nums; }
.hero-card.mv-hero .progress { background: rgba(18, 11, 6, 0.38); }
.mv-hero-actions { margin-top: 16px; }

/* Datas */
.mv-date-row .li-end { flex-direction: row; align-items: center; }
.mv-cal { color: var(--accent); margin-right: -6px; }
.mv-row-cta { font-size: 13.5px; font-weight: 600; color: var(--accent); }
.mv-date-value { color: var(--text-2); font-weight: 560; }
.mv-date-value.mv-unset { color: var(--muted); font-weight: 500; }
.mv-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 6px 0;
  font-size: 13.5px;
  line-height: 1.45;
}
.mv-hint > svg { flex-shrink: 0; margin-top: 1px; color: var(--accent); }

/* Orçamento */
.mv-budget-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.mv-budget-top .card-sub { margin-top: 0; }
.mv-budget-of { text-align: right; min-width: 0; }
.mv-budget-total { margin-top: 3px; font-size: 17px; font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums; }
.mv-bar {
  display: flex;
  height: 12px;
  margin: 16px 0 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(236, 220, 196, 0.1);
}
.mv-bar > span { display: block; height: 100%; transition: width 0.4s var(--ease); }
.mv-bar-spent { background: linear-gradient(90deg, var(--accent-strong), var(--accent)); }
.mv-bar-planned {
  background: repeating-linear-gradient(-45deg, rgba(212, 163, 115, 0.5) 0 5px, rgba(212, 163, 115, 0.22) 5px 10px);
}
.mv-budget[data-tone="warn"] .mv-bar-planned {
  background: repeating-linear-gradient(-45deg, rgba(233, 180, 76, 0.6) 0 5px, rgba(233, 180, 76, 0.25) 5px 10px);
}
.mv-bar.over .mv-bar-spent { background: var(--danger); }
.mv-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.mv-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.mv-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.mv-dot.spent { background: var(--accent); }
.mv-dot.planned { background: rgba(212, 163, 115, 0.45); }
.mv-dot.free { background: rgba(236, 220, 196, 0.16); }
.mv-kpis { margin-top: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mv-kpis .kpi { background: var(--bg-2); }
.mv-kpi-danger .kpi-value { color: var(--danger); }
.mv-kpi-warn .kpi-value { color: var(--warn); }
.mv-budget-intro { display: flex; align-items: flex-start; gap: 12px; }
.mv-budget-intro .li-icon { width: 36px; height: 36px; }
.mv-budget-intro .card-text { margin: 0; color: var(--text-2); }
.mv-budget-cta { margin-top: 14px; }
.mv-exp { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.mv-exp-title {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.card .mv-exp-list {
  margin: 4px -16px -8px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.mv-exp-list .list-item { min-height: 54px; }
.mv-exp-list .li-icon { width: 34px; height: 34px; border-radius: 10px; }
.mv-exp-more { padding: 10px 0 2px; }

/* Checklist */
.mv-filters { margin-bottom: 14px; }
.mv-groups { display: flex; flex-direction: column; gap: 20px; }
.mv-group-head { display: flex; align-items: center; gap: 9px; padding: 0 4px 8px; }
.mv-group-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}
.mv-group-title {
  flex: 1 1 auto;
  margin: 0;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-2);
}
.mv-group-count { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.mv-group-count.all { color: var(--ok); }
.mv-group > .progress { height: 4px; margin: 0 4px 10px; }

.mv-task { gap: 13px; }
.mv-task .li-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  white-space: normal;
  overflow-wrap: anywhere;
}
.mv-group-hint { margin: -2px 6px 10px; font-size: 13px; line-height: 1.4; }
.mv-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  margin-left: 2px;
  border-radius: 50%;
  border: 2px solid rgba(236, 220, 196, 0.32);
  color: transparent;
  transition: background var(--dur) ease, border-color var(--dur) ease;
}
.mv-task.is-buy .mv-check { border-style: dashed; border-color: rgba(212, 163, 115, 0.6); color: var(--accent); }
.mv-task.is-done .mv-check { background: var(--ok); border: 2px solid var(--ok); color: #0f2519; }
.mv-task.is-done .mv-check svg { stroke-width: 2.6; }
.mv-task.is-done .li-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgba(203, 185, 160, 0.55);
}
@media (hover: hover) {
  .mv-task:not(.is-done):hover .mv-check { border-color: var(--accent); }
}
.mv-task .li-end { flex-direction: row; align-items: center; gap: 2px; }
.mv-est { color: var(--muted); font-weight: 560; }
.mv-more { width: 36px; height: 36px; margin-right: -8px; color: var(--muted); }
.mv-filter-empty .card-text { margin: 0; color: var(--text-2); text-align: center; }

/* Concluir */
.mv-finish-row { display: flex; align-items: flex-start; gap: 12px; }
.mv-finish-row .li-icon { width: 38px; height: 38px; }
.mv-finish .card-text { margin: 4px 0 0; color: var(--text-2); }
.mv-finish > .btn { margin-top: 16px; }
.mv-finish.is-done { border-color: rgba(127, 200, 160, 0.22); }

/* Ficha da tarefa e formulário de conclusão */
.mv-sheet-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.mv-sheet-notes {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--border);
}
.mv-sheet-notes .card-text { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.mv-sheet-links { margin-top: 12px; }
.mv-sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.mv-sheet-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mv-sheet-row > .btn { flex: 1 1 0; min-width: 96px; padding: 0 10px; font-size: 14px; }
.mv-form-task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--border);
}
.mv-form-task-title { font-size: 15.5px; font-weight: 600; color: var(--text); }
.mv-form-task-sub { margin-top: 2px; font-size: 13px; color: var(--muted); }
.mv-form-task-sub:empty { display: none; }

/* -------------------------------------------------------- Gestão da casa */

.gm-layout { display: flex; flex-direction: column; gap: 26px; }
.gm-col { display: flex; flex-direction: column; gap: 26px; min-width: 0; }
.gm-section:empty { display: none; }
.gm-section > .section-head { margin-top: 0; }
@media (min-width: 1024px) {
  .gm-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
    align-items: start;
  }
}

.gm-note { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.gm-note + .gm-note { margin-top: 8px; }
.gm-lead { margin: -2px 6px 10px; font-size: 13.5px; }
.gm-foot { margin: 10px 6px 0; font-size: 13.5px; }
.gm-form-note { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.gm-group { padding-top: 18px; }
.gm-after-card { margin-top: 10px; }
.gm-chev { display: flex; color: var(--faint); margin-right: -4px; }
.gm-wrap { white-space: normal; }
.li-sub.gm-wrap { color: var(--text-2); } /* ajuda dos interruptores: texto explicativo, branco (8.1) */
.gm-error { margin-top: 10px; color: var(--danger); font-size: 13.5px; }
.gm-warn { color: var(--warn); }
.gm-danger { color: var(--danger); }

/* interruptor numa linha de lista */
.gm-switch { cursor: pointer; -webkit-user-select: none; user-select: none; }
.gm-switch .li-main { padding-right: 4px; }
.gm-switch .li-sub { line-height: 1.4; }
.gm-switch .li-title { white-space: normal; }

/* cartões de estado (notificações, sincronização, conta) */
.gm-status-head { display: flex; align-items: flex-start; gap: 12px; }
.gm-status-head > .li-icon { width: 38px; height: 38px; }
.gm-status-head > div { min-width: 0; flex: 1 1 auto; }
.gm-status-head .card-title { margin: 1px 0 4px; }
.gm-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.gm-grid { margin-top: 14px; }
.gm-grid .detail-item { background: var(--bg-2); }
.gm-status[data-sync="error"] { border-color: rgba(229, 123, 110, 0.3); }
.gm-status[data-push-state="on"] { border-color: rgba(127, 200, 160, 0.22); }

/* cópias de segurança */
.gm-backups .list-item { min-height: 58px; }
.gm-more {
  display: block;
  width: 100%;
  padding: 13px 14px;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.gm-more:active { background: var(--card-hover); }
.gm-empty { padding: 26px 18px; border-radius: var(--radius); border: 1px dashed var(--border-strong); background: var(--card); }
.gm-counts { display: flex; flex-direction: column; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--card); overflow: hidden; }
.gm-count-row, .gm-count-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  font-size: 14.5px;
  color: var(--text-2);
}
.gm-count-row + .gm-count-row { border-top: 1px solid var(--border); }
.gm-count-num { font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.gm-count-total { margin-top: 8px; padding: 6px 4px; font-weight: 650; color: var(--text); }
.gm-warn-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  border: 1px solid rgba(229, 123, 110, 0.3);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.gm-warn-box > svg { flex-shrink: 0; margin-top: 1px; color: var(--danger); }

/* lojas habituais */
.gm-store-add { display: flex; gap: 8px; margin-top: 14px; }
.gm-store-add .input { flex: 1 1 auto; min-width: 0; }
.gm-store-add .btn { flex-shrink: 0; }
.gm-store-err:empty { display: none; }
.gm-store-err { margin-top: 6px; }
.gm-stores { margin-top: 12px; }
.gm-store { min-height: 54px; padding-top: 6px; padding-bottom: 6px; }
.gm-store-btns { display: flex; align-items: center; gap: 2px; margin-right: -8px; }
.gm-store-btns .btn-icon { width: 38px; height: 38px; color: var(--text-2); }
.gm-store-btns .btn-icon:disabled { opacity: 0.3; }
.gm-store-btns .gm-store-del { color: var(--danger); }
.gm-reset { margin-top: 6px; border-top: 0; }

/* partilha */
.gm-code {
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  border: 1px dashed var(--border-strong);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--beige);
  font-variant-numeric: tabular-nums;
}

/* sobre */
.gm-about-head { display: flex; align-items: center; gap: 12px; }
.gm-about-logo { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; }
.gm-privacy { display: flex; align-items: flex-start; gap: 8px; margin-top: 16px; font-size: 13.5px; }
.gm-privacy > svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }

/* caixas próprias dentro do bloco informativo do formulário: sem moldura dupla */
.form-info:has(> .mv-form-task), .form-info:has(> .gm-warn-box) { padding: 0; background: none; border: 0; }
/* "Registar também como": o botão do meio (Eletrodoméstico) precisa de mais espaço */
.field[data-field="createAs"] .segmented { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.5fr) minmax(0, 1fr); }
.gm-about .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- 34. Movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
