/* Diligence product UI refresh
   A calm, information-first SaaS system using the existing Diligence palette. */
:root {
  --product-canvas: #f4f5f1;
  --product-surface: #fffefa;
  --product-surface-soft: #f8faf7;
  --product-ink: #17372f;
  --product-muted: #66756f;
  --product-line: rgba(23, 55, 47, .12);
  --product-line-strong: rgba(23, 55, 47, .2);
  --product-green: #17372f;
  --product-teal: #179d8b;
  --product-teal-soft: #e5f3ee;
  --product-rust: #b36549;
}

[data-theme="dark"] {
  --product-canvas: #0c1714;
  --product-surface: #14231e;
  --product-surface-soft: #192c25;
  --product-ink: #f2ede5;
  --product-muted: #a3b3ab;
  --product-line: rgba(235, 244, 238, .1);
  --product-line-strong: rgba(235, 244, 238, .18);
  --product-green: #17372f;
  --product-teal: #54cbb8;
  --product-teal-soft: #1b3a32;
  --product-rust: #cf8061;
}

body,
.app {
  background: var(--product-canvas) !important;
  color: var(--product-ink);
}

/* Remove the repeating decorative layer so real content has the focus. */
.app::before,
.app::after {
  display: none !important;
  content: none !important;
}

.app {
  gap: 12px;
  padding: 12px;
  grid-template-columns: 224px minmax(0, 1fr);
}

.side {
  height: calc(100vh - 24px);
  padding: 16px 10px 10px;
  border: 1px solid var(--product-line);
  border-radius: 14px;
  background: var(--product-surface);
  box-shadow: none;
  backdrop-filter: none;
}

.side::after { display: none !important; }
.brand { min-height: 54px; padding: 3px 10px 16px; }
.brand .mark { width: 34px; height: 34px; border-radius: 9px; }
.brand b { font-size: 15px; letter-spacing: .015em; }
.brand span { display: none; }
.nav { gap: 2px; margin-top: 4px; padding-inline: 2px; }
.nav .lbl { padding: 12px 10px 5px; color: var(--product-muted); font-size: 9px; }
.nav-dept { padding-top: 5px; border-top-color: var(--product-line); }
.nav-dept-toggle {
  min-height: 42px;
  grid-template-columns: minmax(0, 1fr) 16px;
  gap: 8px;
  padding: 8px 10px;
  color: var(--product-ink);
  border-radius: 8px;
}
.nav-dept-index,
.nav-dept-copy small { display: none; }
.nav-dept-copy b { font-size: 12px; font-weight: 650; }
.nav-dept.open .nav-dept-toggle { background: var(--product-surface-soft); }
.nav-dept-panel { padding-left: 5px; }
.nav-dept-panel a,
.nav a { min-height: 40px; border-radius: 8px; font-size: 13px; }
.nav a { color: var(--product-muted); }
.nav a:hover { background: var(--product-surface-soft); color: var(--product-ink); }
.nav a.on {
  color: var(--product-ink);
  background: var(--product-teal-soft);
  box-shadow: inset 3px 0 0 var(--product-teal);
}
.nav a.on::before { display: none; }
.nav a .count { background: var(--product-surface-soft); color: var(--product-muted); }
.side-foot { border-top: 1px solid var(--product-line); padding: 10px 2px 0; }
.side-foot .agent { border-radius: 9px; }
.side-foot .agent:hover { background: var(--product-surface-soft); }
.agent .av { width: 32px; height: 32px; background: var(--product-teal-soft); color: var(--product-green); }

.main { min-width: 0; }
.top {
  height: 62px;
  margin: 0;
  padding: 0 18px;
  gap: 12px;
  border: 1px solid var(--product-line);
  border-radius: 12px;
  background: var(--product-surface);
  box-shadow: none;
  backdrop-filter: none;
}
.search { max-width: 560px; }
.search input {
  height: 40px;
  border-color: var(--product-line);
  border-radius: 8px;
  background: var(--product-surface-soft);
  box-shadow: none;
  font-size: 13px;
}
.search input:focus { box-shadow: 0 0 0 3px rgba(23, 157, 139, .12); }
.top-actions { gap: 5px; }
.icon-btn { width: 38px; height: 38px; border-radius: 8px; }
.top-actions .btn-primary,
.btn-primary {
  border-radius: 8px;
  background: var(--product-green);
  box-shadow: none;
}
.btn-primary:hover { filter: brightness(1.08); transform: none; }
.btn,
.btn-ghost { border-radius: 8px; box-shadow: none; }
.btn-ghost { background: var(--product-surface); border: 1px solid var(--product-line-strong); }
.btn-ghost:hover { background: var(--product-surface-soft); }
.scroll { padding: 24px clamp(18px, 2.6vw, 38px) 48px; }

/* Normalize headings and surfaces across the product: clear, useful, not editorial. */
.page .phead { gap: 16px; margin-bottom: 18px; }
.page h1,
.page h2,
.page h3,
.page h4,
.premium-welcome h1,
.premium-card-head h2,
.premium-deal-head h2,
.premium-visit-head h2,
.premium-visit-details h3,
.premium-task-copy b,
.premium-market h2 {
  font-family: var(--sans) !important;
  letter-spacing: -.035em;
}
.page .phead h1 { font-size: clamp(25px, 2.2vw, 32px); font-weight: 680; line-height: 1.12; }
.page .phead p { color: var(--product-muted); font-size: 13px; line-height: 1.45; }
.page .eyebrow { color: var(--product-muted); font-size: 9px; letter-spacing: .1em; }
.page label { color: var(--product-muted); font-family: var(--sans); font-size: 11px; letter-spacing: 0; }
.card,
.premium-card {
  border: 1px solid var(--product-line);
  border-radius: 12px;
  background: var(--product-surface);
  box-shadow: none;
  backdrop-filter: none;
}
.card-h,
.premium-card-head,
.premium-deal-head,
.premium-visit-head { border-color: var(--product-line); }
.card-h h3,
.premium-card-head h2,
.premium-deal-head h2,
.premium-visit-head h2 { color: var(--product-ink); font-size: 17px; font-weight: 650; }
input, select, textarea {
  border-radius: 8px;
  border-color: var(--product-line-strong);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--product-teal);
  box-shadow: 0 0 0 3px rgba(23, 157, 139, .1);
}
table { border-color: var(--product-line); }
th { color: var(--product-muted); font-size: 10px; letter-spacing: .04em; }
td { font-size: 12px; }

/* Dashboard: a useful working surface, with operational details over brand theatre. */
.premium-dashboard { max-width: 1380px; }
.premium-welcome { align-items: center; margin: 2px 2px 20px; }
.premium-welcome .eyebrow { color: var(--product-muted); font-size: 9px; }
.premium-welcome h1 {
  margin: 7px 0 4px;
  color: var(--product-ink);
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 680;
  letter-spacing: -.045em;
  line-height: 1.08;
}
.premium-welcome p {
  max-width: 600px;
  color: var(--product-muted);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
}
.premium-date { gap: 12px; padding: 4px 0; }
.premium-date time { font-size: 11px; }
.premium-weather { padding-left: 12px; font-size: 11px; }
.premium-weather b { font-size: 14px; }
.premium-main-grid { gap: 14px; }
.premium-left-stack { gap: 14px; }
.premium-left-stack > .premium-visit { margin-top: 0; }
.premium-left-stack .premium-visit .premium-visit-body { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.premium-left-stack .premium-visit:not(.no-photo) .premium-visit-photo { height: clamp(132px, 22vw, 224px); }
.cmp-selecting .cmp-control-check,
.cmp-selecting .cmp-controls > button,
.cmp-selecting #comparisonShareButton,
.cmp-selecting #comparisonReportButton { display: none; }
.premium-card:hover { border-color: var(--product-line-strong); }
.premium-card-head,
.premium-deal-head,
.premium-visit-head { padding: 16px 18px 12px; }
.premium-card-head h2,
.premium-deal-head h2,
.premium-visit-head h2 { font-size: 17px; letter-spacing: -.025em; }
.premium-card-head p,
.premium-deal-head p,
.premium-visit-head p { color: var(--product-muted); font-size: 11px; }
.premium-today-list { min-height: 0; padding: 0 12px 12px; }
.premium-task { min-height: 54px; padding: 11px 9px; border-color: var(--product-line); }
.premium-task.is-primary { min-height: 62px; padding: 12px; border: 1px solid var(--product-line); border-radius: 9px; background: var(--product-teal-soft); }
.premium-task-copy b { color: var(--product-ink); font-size: 13px; font-weight: 650; }
.premium-task-copy small,
.premium-task-meta { color: var(--product-muted); font-family: var(--sans); font-size: 11px; }
.premium-check { width: 21px; height: 21px; }
.premium-market,
.premium-market-inner { min-height: 100%; background: var(--product-surface-soft); }
.premium-market-inner { padding: 18px; }
.premium-market-top { color: var(--product-muted); font-size: 9px; }
.premium-market h2 { max-width: 340px; margin-top: 14px; color: var(--product-ink); font-size: 21px; font-weight: 650; line-height: 1.16; }
.premium-market p { max-width: 420px; margin-top: 8px; color: var(--product-muted); font-family: var(--sans); font-size: 12px; line-height: 1.45; }
.premium-market-data { padding-top: 15px; }
.premium-market-data b { color: var(--product-green); font-size: 28px; }
.premium-market-data span { color: var(--product-muted); font-family: var(--mono); font-size: 8px; }
.premium-market .btn { min-height: 36px; margin-top: 12px; }
.premium-visit { margin-top: 14px; }
.premium-visit-body { gap: 16px; padding: 0 12px 12px; }
.premium-visit-photo { height: 190px; border-radius: 9px; }
.premium-visit-photo.is-empty { height: 112px; }
.premium-visit-details { padding: 8px 3px; }
.premium-visit-details h3 { margin-top: 5px; color: var(--product-ink); font-size: 21px; font-weight: 650; }
.premium-visit-time { color: var(--product-teal); font-size: 9px; }
.premium-visit-address,
.premium-visit-summary { color: var(--product-muted); font-size: 12px; }
.premium-specs { border-color: var(--product-line); color: var(--product-ink); }
.premium-visit-actions { gap: 6px; margin-top: 12px; }
.premium-visit-actions .btn { min-height: 38px; font-size: 11px; }
.first-value-guide,
.activation-loop,
.persona-strip { border: 1px solid var(--product-line); border-radius: 11px; background: var(--product-surface); box-shadow: none; }
.first-value-guide { padding: 12px 14px; }
.first-value-guide h2 { font-size: 14px; }
.first-value-step { border-radius: 8px; }

[data-theme="dark"] body,
[data-theme="dark"] .app { background: var(--product-canvas) !important; }
[data-theme="dark"] .side,
[data-theme="dark"] .top,
[data-theme="dark"] .card,
[data-theme="dark"] .premium-card { background: var(--product-surface); border-color: var(--product-line); }
[data-theme="dark"] .nav-dept.open .nav-dept-toggle,
[data-theme="dark"] .search input,
[data-theme="dark"] .premium-market,
[data-theme="dark"] .premium-market-inner { background: var(--product-surface-soft); }
[data-theme="dark"] .nav a.on,
[data-theme="dark"] .premium-task.is-primary,
[data-theme="dark"] .first-value-guide { background: var(--product-teal-soft); }
[data-theme="dark"] .premium-market h2,
[data-theme="dark"] .premium-market p,
[data-theme="dark"] .premium-market-data b { color: var(--product-ink); }
[data-theme="dark"] .premium-market-data b { color: var(--product-teal); }

@media (max-width: 900px) {
  .app { display: block; padding: 0; background: var(--product-canvas) !important; }
  .side { height: 100dvh; width: min(286px, 88vw); border-radius: 0; }
  .top { height: 60px; margin: 8px 8px 0; padding-inline: 10px; }
  .scroll { padding: 20px 16px 92px; }
  .premium-main-grid { grid-template-columns: 1fr; }
  .premium-welcome { align-items: flex-start; }
  .premium-date { display: none; }
  .premium-market,
  .premium-market-inner { min-height: 0; }
}

@media (max-width: 620px) {
  .top { height: 56px; border-radius: 10px; }
  .search input { height: 38px; font-size: 12px; }
  .scroll { padding: 16px 12px 100px; }
  .page .phead h1 { font-size: 25px; }
  .premium-welcome { margin: 0 2px 14px; }
  .premium-welcome h1 { font-size: 28px; }
  .premium-welcome p { font-size: 12px; }
  .premium-card-head,
  .premium-deal-head,
  .premium-visit-head { padding: 14px 14px 10px; }
  .premium-today-list { padding: 0 8px 8px; }
  .premium-task { min-height: 50px; }
  .premium-task.is-primary { min-height: 56px; }
  .premium-market-inner { padding: 15px; }
  .premium-market h2 { margin-top: 10px; font-size: 19px; }
  .premium-market p { margin-top: 6px; font-size: 11px; }
  .premium-market-data b { font-size: 25px; }
  .premium-visit-body,
  .premium-visit.no-photo .premium-visit-body { grid-template-columns: 1fr; gap: 0; padding: 0 9px 9px; }
  .premium-visit-photo { height: 170px; }
  .premium-visit.no-photo .premium-visit-photo.is-empty { height: 88px; }
  .premium-visit-details h3 { font-size: 19px; }
  .premium-visit-actions { grid-template-columns: 1fr 1fr; }
  .premium-visit-actions .btn { min-height: 42px; }
  .nav-dept-toggle { min-height: 44px; }
  .nav-dept-panel a,
  .nav a { min-height: 42px; }
}

/* CASAFARI tools: expandable, cost-transparent actions with dashboard-like density. */
#oppCasafariTrial {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-color: var(--product-line);
  border-radius: 14px;
  background: var(--product-surface);
  color: var(--product-ink);
  box-shadow: 0 10px 28px rgba(22, 47, 39, .035);
}
#oppCasafariTrial[hidden] { display: none !important; }
.casafari-trial-head { align-items: center; gap: 20px; }
.casafari-trial-head h2 { margin: 6px 0; font-size: clamp(19px, 1.7vw, 24px); font-weight: 680; }
.casafari-trial-head p { max-width: 680px; font-size: 12px; line-height: 1.55; }
.casafari-trial-head a { display: inline-flex; align-items: center; min-height: 36px; margin-top: 8px; color: var(--product-ink); font-size: 12px; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.casafari-trial-balance { min-width: 190px; padding: 12px 14px; border-color: var(--product-line); border-radius: 11px; background: var(--product-surface-soft); text-align: left; }
.casafari-trial-balance b { color: var(--product-ink); font-size: 26px; letter-spacing: -.04em; }
.casafari-trial-notice { margin: 0; border: 1px solid var(--product-line); border-left: 3px solid var(--product-teal); border-radius: 8px; background: var(--product-surface-soft); color: var(--product-muted); font-size: 12px; line-height: 1.5; }
.casafari-trial-notice.success { border-left-color: var(--product-teal); }
.casafari-trial-notice.warning { border-left-color: var(--product-rust); }
.casafari-trial-form { display: grid; grid-template-columns: minmax(210px, 1.4fr) repeat(4, minmax(110px, .65fr)) auto; align-items: end; gap: 9px; padding: 12px; border: 1px solid var(--product-line); border-radius: 11px; background: var(--product-surface-soft); }
.casafari-trial-form label,
.casafari-resolve-form label,
.casafari-inline-filter,
.casafari-coordinate-fields label { display: grid; min-width: 0; gap: 5px; color: var(--product-muted); font-size: 11px; }
.casafari-trial-form input,
.casafari-trial-form select,
.casafari-resolve-form input,
.casafari-inline-filter input,
.casafari-coordinate-fields input,
.casafari-coordinate-fields select { box-sizing: border-box; width: 100%; min-width: 0; min-height: 42px; padding: 8px 10px; border: 1px solid var(--product-line-strong); border-radius: 8px; background: var(--product-surface); color: var(--product-ink); font: 13px var(--sans); }
.casafari-trial-form .btn { min-height: 42px; white-space: nowrap; }
.casafari-location-options { position: relative; z-index: 4; display: grid; gap: 4px; margin-top: -8px; }
.casafari-location-options:empty { display: none; }
.casafari-location-options button { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid var(--product-line); border-radius: 9px; background: var(--product-surface); color: var(--product-ink); text-align: left; }
.casafari-location-options button[aria-selected="true"] { border-color: var(--product-teal); background: var(--product-teal-soft); }
.casafari-location-options button small { color: var(--product-muted); text-align: right; }
.casafari-tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: start; }
.casafari-extra-tool { min-width: 0; border: 1px solid var(--product-line); border-radius: 10px; background: var(--product-surface); }
.casafari-extra-tool[open] { border-color: var(--product-line-strong); box-shadow: 0 4px 16px rgba(22, 47, 39, .04); }
.casafari-extra-tool > summary { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; color: var(--product-ink); font-size: 12px; font-weight: 650; cursor: pointer; list-style: none; }
.casafari-extra-tool > summary::-webkit-details-marker { display: none; }
.casafari-extra-tool > summary::after { content: '＋'; color: var(--product-muted); font-weight: 500; }
.casafari-extra-tool[open] > summary::after { content: '−'; }
.casafari-extra-tool > summary small { flex: 0 0 auto; padding: 4px 7px; border-radius: 999px; background: var(--product-teal-soft); color: var(--product-ink); font: 650 10px var(--mono); }
.casafari-extra-tool > p { margin: 0; padding: 0 12px 10px; color: var(--product-muted); font-size: 11px; line-height: 1.45; }
.casafari-resolve-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; padding: 0 12px 12px; }
.casafari-resolve-form .btn,
.casafari-extra-tool > .btn { min-height: 42px; }
.casafari-inline-filter { margin: 0 12px 9px; }
.casafari-coordinate-fields { display: grid; grid-template-columns: .8fr 1fr 1fr; gap: 7px; padding: 0 12px 10px; }
.casafari-extra-tool > [data-casafari-private-search],
.casafari-extra-tool > [data-casafari-seller-search] { margin: 0 12px 12px; }
.casafari-tool-results { display: grid; gap: 7px; padding: 0 12px 12px; }
.casafari-tool-results:empty { display: none; }
.casafari-tool-result { display: grid; gap: 7px; min-width: 0; padding: 10px; border: 1px solid var(--product-line); border-radius: 9px; background: var(--product-surface-soft); }
.casafari-tool-result > div:first-child { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.casafari-tool-result > div:first-child b { color: var(--product-ink); font-size: 12px; }
.casafari-tool-result strong { color: var(--product-ink); font-size: 14px; white-space: nowrap; }
.casafari-tool-result p,
.casafari-tool-result small { margin: 0; color: var(--product-muted); font-size: 11px; line-height: 1.4; }
.casafari-tool-result dl,
.casafari-result-card dl { display: flex; flex-wrap: wrap; gap: 8px 13px; margin: 0; }
.casafari-tool-result dl div,
.casafari-result-card dl div { display: flex; gap: 4px; font-size: 11px; }
.casafari-tool-result dt,
.casafari-result-card dt { color: var(--product-muted); }
.casafari-tool-result dd,
.casafari-result-card dd { margin: 0; color: var(--product-ink); font-weight: 650; }
.casafari-tool-result .btn,
.casafari-result-actions .btn { min-height: 40px; }
.casafari-tool-detail { padding: 8px 9px; border-radius: 8px; background: var(--product-teal-soft); }
.casafari-tool-detail b { color: var(--product-ink); font-size: 11px; }
.casafari-tool-detail p { margin: 4px 0 0; color: var(--product-ink); }
.casafari-next-page { width: 100%; min-height: 42px; justify-content: center; }
.casafari-trial-footnote { max-width: 1000px; margin: 0; color: var(--product-muted); font-size: 11px; line-height: 1.5; }
.casafari-result-card { border-color: var(--product-line); border-radius: 11px; background: var(--product-surface); box-shadow: none; }
.casafari-result-card h3 { color: var(--product-ink); font-size: 15px; }
.casafari-result-card strong { color: var(--product-ink); }
.casafari-area-result { border: 1px solid var(--product-line); border-radius: 11px; background: var(--product-surface-soft); }
.casafari-area-grid > div { border-color: var(--product-line); background: var(--product-surface); }

[data-theme="dark"] #oppCasafariTrial { background: var(--product-surface); }
[data-theme="dark"] .casafari-trial-form,
[data-theme="dark"] .casafari-tool-result { background: var(--product-surface-soft); }
[data-theme="dark"] .casafari-trial-balance,
[data-theme="dark"] .casafari-extra-tool { background: var(--product-surface); }
[data-theme="dark"] .casafari-tool-detail { background: var(--product-teal-soft); }

@media (max-width: 1100px) {
  .casafari-trial-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .casafari-trial-form > label:first-child { grid-column: span 2; }
  .casafari-trial-form .btn { grid-column: 3; }
  .casafari-tool-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  #oppCasafariTrial { gap: 10px; padding: 12px; border-radius: 12px; }
  .casafari-trial-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .casafari-trial-balance { grid-template-columns: 1fr auto; min-width: 0; align-items: center; text-align: left; }
  .casafari-trial-balance span { grid-column: 1; }
  .casafari-trial-balance b { grid-column: 2; grid-row: 1 / span 2; font-size: 24px; }
  .casafari-trial-balance small:last-child { grid-column: 1 / -1; }
  .casafari-trial-form { grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; }
  .casafari-trial-form > label:first-child { grid-column: 1 / -1; }
  .casafari-trial-form > label:nth-child(2),
  .casafari-trial-form > label:nth-child(3) { grid-column: span 1; }
  .casafari-trial-form .btn { grid-column: 1 / -1; width: 100%; min-height: 46px; }
  .casafari-trial-form input,
  .casafari-trial-form select,
  .casafari-resolve-form input,
  .casafari-inline-filter input,
  .casafari-coordinate-fields input,
  .casafari-coordinate-fields select { min-height: 44px; font-size: 14px; }
  .casafari-tool-grid { gap: 7px; }
  .casafari-extra-tool > summary { min-height: 50px; font-size: 13px; }
  .casafari-resolve-form { grid-template-columns: 1fr; }
  .casafari-resolve-form .btn,
  .casafari-extra-tool > .btn,
  .casafari-tool-result .btn,
  .casafari-result-actions .btn { width: 100%; min-height: 44px; justify-content: center; }
  .casafari-coordinate-fields { grid-template-columns: 1fr 1fr; }
  .casafari-coordinate-fields label:first-child { grid-column: 1 / -1; }
  .casafari-result-actions { display: grid; grid-template-columns: 1fr; }
  .casafari-tool-result { padding: 9px; }
  .casafari-tool-result strong { font-size: 13px; }
  .casafari-trial-footnote { font-size: 12px; }
}

/* ---------- DILIGENCE WORKSPACE · REVOLUT-INSPIRED, PROPERTY-FIRST ----------
   Borrow the reference's strong hierarchy, compact navigation and useful
   information density; retain Diligence's forest, teal, warm white and rust. */
/* Palette. Four colours: deep forest green, warm beige, vibrant orange and
   aqua green. Every pairing below was measured, not eyeballed; the ratio in
   the comment is the WCAG contrast against the surface it is used on.

   The accents stay vibrant because text on them is deep green rather than
   white: white on #13a98f is 2.96:1 and fails, while #07211b on the same fill
   is 5.71:1. Darkening the accent to carry white text would have cost exactly
   the vibrancy these colours are here for. */
:root {
  /* surfaces */
  --product-canvas: #f3efe7;        /* beige, the room the cards sit in */
  --product-surface: #fffdf9;       /* warm white, same as the public site */
  --product-surface-soft: #f7f3ea;
  --product-nav: #07211b;           /* deepest green, the sidebar */
  --product-nav-hover: #123a30;
  --product-green: #0d2e26;

  /* text */
  --product-ink: #13201c;           /* 16.5:1 on surface */
  --product-muted: #5c6b64;         /*  5.5:1 on surface */
  --product-nav-ink: #f6f4ee;       /* 15.4:1 on nav */
  --product-nav-muted: #b9c7c1;     /*  9.7:1 on nav */
  --product-nav-faint: #8fa39c;     /*  6.4:1 on nav — group headings */

  /* accents: fills are vibrant, inks are for text on light surfaces */
  --product-teal: #13a98f;          /* aqua green fill */
  --product-teal-ink: #0b6b5b;      /*  6.3:1 on surface */
  --product-teal-soft: #ddf3ee;
  --product-rust: #ee6c2d;          /* vibrant orange fill */
  --product-rust-ink: #9c3c08;      /*  6.8:1 on surface */
  --product-rust-soft: #fdeadd;
  --product-on-accent: #07211b;     /* 5.5:1 on orange, 5.7:1 on aqua */

  /* lines, radii, elevation */
  --product-line: rgba(19, 32, 28, .08);
  --product-line-strong: rgba(19, 32, 28, .16);
  --product-radius: 18px;
  --product-radius-sm: 12px;
  --product-shadow: 0 1px 2px rgba(19, 32, 28, .04), 0 8px 24px rgba(19, 32, 28, .06);
  --product-shadow-lift: 0 2px 4px rgba(19, 32, 28, .05), 0 16px 40px rgba(19, 32, 28, .1);
}

[data-theme="dark"] {
  --product-canvas: #0a1512;
  --product-surface: #121f1a;
  --product-surface-soft: #18271f;
  --product-nav: #060f0d;
  --product-nav-hover: #14322a;
  --product-green: #123a30;

  --product-ink: #f1efe8;           /* 14.8:1 on surface */
  --product-muted: #9aaaa3;         /*  7.0:1 on surface */
  --product-nav-ink: #e8e4db;       /* 15.3:1 on nav */
  --product-nav-muted: #b9c7c1;
  --product-nav-faint: #8fa39c;

  --product-teal: #3fd0b4;          /*  8.8:1 as text on surface */
  --product-teal-ink: #7fe0ca;
  --product-teal-soft: #15342c;
  --product-rust: #ff8a4c;          /*  7.3:1 as text on surface */
  --product-rust-ink: #ffb088;
  --product-rust-soft: #33211a;
  --product-on-accent: #07211b;     /* 8.8:1 on aqua, 7.2:1 on orange */

  --product-line: rgba(232, 243, 237, .09);
  --product-line-strong: rgba(232, 243, 237, .18);
  --product-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  --product-shadow-lift: 0 2px 4px rgba(0, 0, 0, .34), 0 16px 40px rgba(0, 0, 0, .36);
}

body,
.app { background: var(--product-canvas) !important; color: var(--product-ink); }
.app { min-height: 100dvh; grid-template-columns: 226px minmax(0, 1fr); gap: 12px; padding: 12px; }
.app::before,
.app::after { display: none !important; content: none !important; }
.main { min-width: 0; }

/* The navigation is the product's anchor; reduce noise, keep all destinations. */
.side {
  height: calc(100dvh - 24px);
  padding: 14px 10px 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: var(--product-nav) !important;
  color: #f5f5ef;
  box-shadow: 0 8px 24px rgba(13, 39, 31, .1);
  backdrop-filter: none;
}
.side::after { display: none !important; }
.brand { min-height: 50px; padding: 3px 11px 13px; }
.brand img { width: 137px; height: 38px; object-fit: contain; object-position: left center; content: url('../assets/diligence-wordmark-vector-light.svg'); filter: none; }
.nav { gap: 3px; margin-top: 3px; padding: 0 2px 10px; }
.nav .lbl { padding: 10px 10px 4px; color: rgba(235, 247, 240, .52); font-size: 9px; }
.nav-dept { margin-top: 2px; padding-top: 5px; border-top-color: rgba(255,255,255,.095); }
.nav-dept:first-of-type { border-top: 0; }
.nav-dept-toggle {
  min-height: 44px;
  grid-template-columns: minmax(0, 1fr) 14px;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 8px;
  color: rgba(248, 250, 246, .9);
}
.nav-dept-toggle:hover,
.nav-dept-toggle:focus-visible,
.nav-dept.open .nav-dept-toggle { background: var(--product-nav-hover); }
.nav-dept-index { display: none; }
.nav-dept-copy b { color: #f4f5ef; font-size: 11.5px; font-weight: 650; }
.nav-dept-copy small { display: none; }
.nav-dept-toggle > svg { color: rgba(255,255,255,.64); }
.nav-dept-panel { padding: 2px 0 5px 5px; }
.nav-dept-panel a,
.nav a { min-height: 38px; border-radius: 8px; font-size: 12px; }
.nav a { color: rgba(237, 246, 240, .72); }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.on,
.nav-dept-panel a.on {
  color: #f8fffb;
  background: rgba(43, 174, 145, .19);
  box-shadow: inset 3px 0 0 #4bd0b1;
}
.nav a.on::before { display: none; }
.nav a svg { stroke: currentColor; }
.nav a .count { background: rgba(255,255,255,.1); color: rgba(245,250,246,.78); }
.nav-tools-toggle { color: rgba(237,246,240,.58); border-color: rgba(255,255,255,.1); }
.nav-tools .nav-dept { border-color: rgba(255,255,255,.095); }
.nav-tools .nav-dept-toggle { color: #f4f5ef; }
.nav-tools .nav-dept-copy small { color: rgba(237,246,240,.48); }
.nav-dept-panel a { color: rgba(237,246,240,.7); }
.side-foot { padding: 8px 6px 2px; border-top: 1px solid rgba(255,255,255,.11); background: transparent; box-shadow: none; }
.side-foot .agent { color: #f5f5ef; border-radius: 8px; }
.side-foot .agent:hover { background: rgba(255,255,255,.07); }
.agent .av { background: #b9684c; color: #fff; }
.side-foot .agent span,
.side-foot .agent .nm span { color: rgba(239,246,241,.58); }
.agent-logout { color: rgba(245,250,246,.76); }

/* A compact utility bar, consistent with the rest of the workspace. */
.top {
  position: sticky;
  top: 10px;
  z-index: 18;
  height: 58px;
  margin: 0;
  padding: 0 14px;
  gap: 12px;
  border: 1px solid var(--product-line);
  border-radius: 11px;
  background: var(--product-surface);
  box-shadow: 0 2px 8px rgba(20, 47, 39, .035);
  backdrop-filter: none;
}
.search { max-width: 620px; }
.search input {
  height: 38px;
  border: 1px solid var(--product-line);
  border-radius: 8px;
  background: var(--product-surface-soft);
  color: var(--product-ink);
  font-size: 12px;
}
.search input::placeholder { color: var(--product-muted); }
.top-actions { gap: 5px; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; color: var(--product-muted); }
.icon-btn:hover { background: var(--product-surface-soft); color: var(--product-ink); }
.top-actions .btn-primary,
.btn-primary { border-radius: 8px; background: var(--product-green); box-shadow: none; }
.btn-primary:hover { filter: brightness(1.08); transform: none; }
.btn,
.btn-ghost { border-radius: 8px; box-shadow: none; }
.btn-ghost { border: 1px solid var(--product-line-strong); background: var(--product-surface); color: var(--product-ink); }
.btn-ghost:hover { background: var(--product-surface-soft); }
.scroll { padding: 22px clamp(18px, 2.4vw, 34px) 54px; }

/* Real-estate workspace: crisp titles, predictable cards, legible data tables. */
.page .phead { gap: 14px; margin-bottom: 16px; }
.page .phead h1 { color: var(--product-ink); font: 680 clamp(24px, 2.1vw, 31px)/1.12 var(--sans); letter-spacing: -.045em; }
.page .phead p { color: var(--product-muted); font: 12px/1.5 var(--sans); }
.page .eyebrow { color: var(--product-muted); font: 650 9px/1.3 var(--mono); letter-spacing: .09em; }
.card,
.pcard,
.deal,
.kpi,
.crm-kpi,
.cont-card,
.setting-card,
.account-card,
.tpl,
.portal,
.ai-box,
.mkt-command,
.mkt-kpi,
.mkt-card,
.premium-card {
  border: 1px solid var(--product-line);
  border-radius: 11px;
  background: var(--product-surface);
  box-shadow: 0 2px 7px rgba(15, 45, 35, .025);
  backdrop-filter: none;
}
.card:hover,
.pcard:hover,
.deal:hover,
.premium-card:hover { border-color: var(--product-line-strong); box-shadow: 0 5px 16px rgba(15,45,35,.045); }
.card-h,
.card-header,
.premium-card-head,
.premium-deal-head,
.premium-visit-head { border-color: var(--product-line); }
.card-h { padding: 14px 16px; }
.card-h h3 { color: var(--product-ink); font-size: 14px; font-weight: 650; letter-spacing: -.02em; }
.card-b { color: var(--product-ink); }
.kpi { padding: 14px 16px; }
.kpi .val,
.crm-kpi b { color: var(--product-ink); font-size: 24px; letter-spacing: -.045em; }
.kpi .cap,
.crm-kpi span,
.crm-kpi small { color: var(--product-muted); }
.chip,
.tag,
.badge,
.doc-status { border-radius: 6px; }
table { border-color: var(--product-line); background: var(--product-surface); color: var(--product-ink); }
thead th,
th { background: var(--product-surface-soft); color: var(--product-muted); font: 650 10px/1.35 var(--sans); letter-spacing: .035em; }
td { color: var(--product-ink); font-size: 12px; }
tbody tr { border-color: var(--product-line); }
tbody tr:hover { background: var(--product-surface-soft); }
input,
select,
textarea,
.field input,
.field select,
.field textarea { border-color: var(--product-line-strong) !important; border-radius: 8px !important; background: var(--product-surface) !important; color: var(--product-ink) !important; }
input:focus,
select:focus,
textarea:focus { border-color: var(--product-teal) !important; box-shadow: 0 0 0 3px rgba(32,168,143,.11) !important; }
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible { outline: 2px solid var(--product-teal); outline-offset: 2px; }

/* Home screen: use the high-signal split layout from the reference, not a hero. */
.premium-dashboard { max-width: 1460px; }
.premium-welcome { align-items: center; gap: 20px; margin: 0 2px 17px; }
.premium-welcome .eyebrow { color: var(--product-muted); font: 650 9px/1.3 var(--mono); letter-spacing: .11em; }
.premium-welcome h1 { margin: 5px 0 3px; color: var(--product-ink); font: 680 clamp(28px, 2.6vw, 38px)/1.05 var(--sans); letter-spacing: -.055em; }
.premium-welcome p { max-width: 680px; color: var(--product-muted); font: 13px/1.45 var(--sans); }
.premium-date { gap: 12px; padding: 0; color: var(--product-muted); }
.premium-date time { font-size: 11px; }
.premium-weather { border-color: var(--product-line); padding-left: 12px; font-size: 11px; }
.premium-weather b { color: var(--product-ink); font-size: 13px; }
.premium-main-grid { grid-template-columns: minmax(0, 1.35fr) minmax(300px, .82fr); gap: 14px; align-items: stretch; }
.premium-left-stack { gap: 14px; }
.premium-card-head,
.premium-deal-head,
.premium-visit-head { padding: 15px 17px 11px; }
.premium-card-head h2,
.premium-deal-head h2,
.premium-visit-head h2 { color: var(--product-ink); font: 650 17px/1.2 var(--sans); letter-spacing: -.035em; }
.premium-card-head p,
.premium-deal-head p,
.premium-visit-head p { color: var(--product-muted); font: 11px/1.45 var(--sans); }
.premium-card-head .btn { min-height: 36px; }
.premium-today-list { min-height: 0; padding: 0 10px 10px; }
.premium-task { min-height: 54px; padding: 10px 9px; border-color: var(--product-line); }
.premium-task.is-primary { min-height: 62px; padding: 11px; border: 1px solid rgba(32,168,143,.19); border-radius: 9px; background: var(--product-teal-soft); }
.premium-task-copy b { color: var(--product-ink); font: 650 12.5px/1.35 var(--sans); letter-spacing: -.015em; }
.premium-task-copy small,
.premium-task-meta { color: var(--product-muted); font: 10.5px/1.35 var(--sans); }
.premium-check { border-color: var(--product-line-strong); }
.premium-market,
.premium-market-inner { min-height: 100%; border-radius: 11px; background: var(--product-green); color: #f7faf5; }
.premium-market-inner { min-height: 288px; padding: 19px; }
.premium-market-top { color: rgba(245,250,246,.68); font: 650 9px/1.4 var(--mono); letter-spacing: .07em; text-transform: uppercase; }
.premium-market h2 { max-width: 340px; margin-top: 17px; color: #fff; font: 650 clamp(20px, 2vw, 27px)/1.12 var(--sans); letter-spacing: -.04em; }
.premium-market p { max-width: 360px; margin-top: 8px; color: rgba(245,250,246,.73); font: 11.5px/1.5 var(--sans); }
.premium-market-data { margin-top: auto; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.16); }
.premium-market-data b { color: #fff; font: 700 28px/1 var(--sans); letter-spacing: -.055em; }
.premium-market-data span { color: rgba(245,250,246,.65); font: 8px/1.4 var(--mono); }
.premium-market .btn { min-height: 36px; margin-top: 12px; border-color: rgba(255,255,255,.28); background: transparent; color: #fff; }
.premium-market .btn:hover { background: rgba(255,255,255,.09); }
.premium-visit { margin-top: 14px; }
.premium-visit-body { gap: 14px; padding: 0 12px 12px; }
.premium-visit-photo { height: 188px; border-radius: 8px; }
.premium-visit-photo.is-empty { height: 100px; }
.premium-visit-details h3 { color: var(--product-ink); font: 650 20px/1.15 var(--sans); letter-spacing: -.04em; }
.premium-visit-time { color: var(--product-teal); font: 650 9px/1.4 var(--mono); }
.premium-visit-address,
.premium-visit-summary { color: var(--product-muted); font-size: 11.5px; }
.premium-visit-actions { gap: 6px; margin-top: 10px; }
.premium-visit-actions .btn { min-height: 38px; font-size: 11px; }
.first-value-guide,
.activation-loop,
.persona-strip { border-color: var(--product-line); border-radius: 10px; background: var(--product-surface); box-shadow: none; }
.first-value-guide { padding: 12px 14px; }
.first-value-guide h2 { color: var(--product-ink); font-size: 13px; }
.first-value-step { border-radius: 7px; }

[data-theme="dark"] body,
[data-theme="dark"] .app { background: var(--product-canvas) !important; color: var(--product-ink); }
[data-theme="dark"] .side { background: var(--product-nav) !important; }
[data-theme="dark"] .top,
[data-theme="dark"] .card,
[data-theme="dark"] .pcard,
[data-theme="dark"] .deal,
[data-theme="dark"] .kpi,
[data-theme="dark"] .crm-kpi,
[data-theme="dark"] .premium-card,
[data-theme="dark"] .first-value-guide,
[data-theme="dark"] .activation-loop,
[data-theme="dark"] .persona-strip { border-color: var(--product-line); background: var(--product-surface); color: var(--product-ink); }
[data-theme="dark"] .nav a,
[data-theme="dark"] .nav-dept-panel a { color: rgba(237,246,240,.72); }
[data-theme="dark"] .nav a.on,
[data-theme="dark"] .nav-dept-panel a.on { color: #f8fffb; background: rgba(43,174,145,.19); }
[data-theme="dark"] .premium-task.is-primary { border-color: rgba(85,203,181,.2); background: var(--product-teal-soft); }
[data-theme="dark"] .premium-market,
[data-theme="dark"] .premium-market-inner { background: #173d32; }
[data-theme="dark"] .premium-market h2,
[data-theme="dark"] .premium-market-data b { color: #fff; }
[data-theme="dark"] .premium-market p { color: rgba(245,250,246,.76); }
[data-theme="dark"] table { background: var(--product-surface); color: var(--product-ink); }
[data-theme="dark"] thead th,
[data-theme="dark"] th { background: var(--product-surface-soft); color: var(--product-muted); }
[data-theme="dark"] tbody tr:hover { background: var(--product-surface-soft); }
[data-theme="dark"] .btn-ghost { border-color: var(--product-line-strong); background: var(--product-surface); color: var(--product-ink); }

@media (max-width: 1100px) {
  .premium-main-grid { grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); }
}
@media (max-width: 900px) {
  .app { display: block; padding: 0; background: var(--product-canvas) !important; }
  .side { height: 100dvh; width: min(286px, 88vw); border: 0; border-radius: 0; }
  .top { top: 0; height: 58px; margin: 8px 8px 0; padding-inline: 10px; border-radius: 10px; }
  .scroll { padding: 18px 16px 96px; }
  .premium-welcome { align-items: flex-start; }
  .premium-main-grid { grid-template-columns: 1fr; }
  .premium-market,
  .premium-market-inner { min-height: 0; }
  .premium-market-inner { min-height: 230px; }
}
@media (max-width: 620px) {
  .top { height: 54px; margin: 6px 6px 0; padding-inline: 7px; }
  .search { min-width: 0; }
  .search input { height: 36px; font-size: 12px; }
  .top-actions { gap: 2px; }
  .icon-btn { width: 44px; height: 44px; }
  .top-actions .btn-primary { min-width: 44px; min-height: 44px; padding: 7px 9px; }
  .scroll { padding: 15px 11px calc(100px + env(safe-area-inset-bottom, 0px)); }
  .page .phead { align-items: flex-start; }
  .page .phead h1 { font-size: 24px; }
  .premium-welcome { margin: 0 1px 12px; }
  .premium-welcome h1 { font-size: 27px; }
  .premium-welcome p { font-size: 12px; }
  .premium-date { display: none; }
  .premium-main-grid,
  .premium-left-stack { gap: 10px; }
  .premium-card,
  .premium-market { border-radius: 10px; }
  .premium-card-head,
  .premium-deal-head,
  .premium-visit-head { padding: 13px 13px 9px; }
  .premium-card-head h2,
  .premium-deal-head h2,
  .premium-visit-head h2 { font-size: 16px; }
  .premium-today-list { padding: 0 7px 7px; }
  .premium-task { grid-template-columns: 22px minmax(0, 1fr) 14px; gap: 8px; min-height: 48px; padding: 9px 6px; }
  .premium-task.is-primary { min-height: 54px; padding: 9px; }
  .premium-task-meta { display: none; }
  .premium-task-copy b { font-size: 12px; }
  .premium-task-copy small { font-size: 10px; }
  .premium-market-inner { min-height: 215px; padding: 15px; }
  .premium-market h2 { margin-top: 12px; font-size: 21px; }
  .premium-market p { font-size: 11px; }
  .premium-market-data b { font-size: 25px; }
  .premium-visit { margin-top: 10px; }
  .premium-visit-body,
  .premium-visit.no-photo .premium-visit-body { grid-template-columns: 1fr; gap: 0; padding: 0 9px 9px; }
  .premium-visit-photo { height: 156px; }
  .premium-visit.no-photo .premium-visit-photo.is-empty { height: 76px; }
  .premium-visit-details { padding: 11px 3px 6px; }
  .premium-visit-details h3 { font-size: 19px; }
  .premium-visit-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .premium-visit-actions .btn { min-height: 42px; }
  .premium-visit-actions .btn:first-child { grid-column: 1 / -1; }
  .mobile-action-dock { border-color: rgba(255,255,255,.1); border-radius: 13px; background: var(--product-nav); box-shadow: 0 8px 24px rgba(9,30,23,.24); }
  .mobile-dock-secondary { color: #eaf3ee; background: rgba(255,255,255,.09); }
  .mobile-dock-primary { color: #fff; background: var(--product-teal); box-shadow: none; }
  [data-theme="dark"] .mobile-dock-secondary { color: #eaf3ee; background: rgba(255,255,255,.09); }
}

/* ---------- INTERIOR · REVOLUT POSTURE, DILIGENCE COLOUR ----------------
   What is borrowed from the reference: one plain canvas with cards floating
   on it instead of boxed-in panels, generous radii, separation by elevation
   rather than hairlines, a strong type step between page and card, pill
   actions, and accent used as a saturated fill rather than a tint.
   What stays ours: the four colours, and the restraint.               */

/* Canvas and shell ------------------------------------------------------ */
.app { gap: 14px; padding: 14px; }
.main { display: flex; flex-direction: column; gap: 0; }
.scroll { padding: 4px 4px 48px; }

/* Sidebar --------------------------------------------------------------- */
.side { border: 0; border-radius: 20px; box-shadow: var(--product-shadow-lift); }

/* The group headings were #203a32 on #102e26: 1.19:1, effectively invisible,
   and they are what you must click to reach most of the product. */
.nav-dept-copy b { color: var(--product-nav-ink); font-weight: 600; letter-spacing: -.005em; }
.nav-dept-copy small { color: var(--product-nav-faint); font-size: 10px; letter-spacing: 0; }
.nav-dept-index { color: var(--product-teal); }
.nav-dept-toggle { border-radius: 12px; color: var(--product-nav-ink); }
.nav-dept-toggle:hover,
.nav-dept-toggle:focus-visible { background: var(--product-nav-hover); }
.nav-dept.open > .nav-dept-toggle { background: var(--product-nav-hover); }
.nav-dept { border-top-color: rgba(246, 244, 238, .1); }

.nav a { border-radius: 12px; color: var(--product-nav-muted); font-weight: 500; }
.nav a:hover { background: var(--product-nav-hover); color: var(--product-nav-ink); }
.nav a.on {
  background: var(--product-teal);
  color: var(--product-on-accent);
  font-weight: 650;
  box-shadow: none;
}
.nav a.on svg { stroke-width: 2; }
.nav a .count {
  border-radius: 999px;
  padding: 1px 7px;
  background: rgba(246, 244, 238, .12);
  color: var(--product-nav-ink);
  font-size: 10px;
  font-weight: 650;
}
.nav a.on .count { background: rgba(7, 33, 27, .18); color: var(--product-on-accent); }

/* The account strip was light text at 58% over a near-white card: 1.05:1. */
.side-foot { border-radius: 14px; background: rgba(246, 244, 238, .07); }
.side-foot .nm { color: var(--product-nav-ink); }
.side-foot .nm span,
.side-foot #sideRole { color: var(--product-nav-faint); }
.side-foot .av { background: var(--product-rust); color: var(--product-on-accent); font-weight: 700; }

/* Top bar --------------------------------------------------------------- */
.top { border: 0; border-radius: 16px; background: transparent; box-shadow: none; }
.search input { border-radius: 999px; background: var(--product-surface); border: 1px solid var(--product-line); }
.search input:focus { border-color: var(--product-teal); outline: 2px solid var(--product-teal-soft); outline-offset: 0; }

/* Page head: one clear step above the cards ----------------------------- */
.phead h1 { font-size: clamp(26px, 2.4vw, 34px); letter-spacing: -.028em; line-height: 1.08; }
.phead > div > p { color: var(--product-muted); font-size: 14px; max-width: 62ch; }
.phead { align-items: start; margin-bottom: 18px; }

/* Cards: floating, not boxed -------------------------------------------- */
.card {
  border: 0;
  border-radius: var(--product-radius);
  background: var(--product-surface);
  box-shadow: var(--product-shadow);
}
.card-h { border-bottom: 0; padding: 18px 20px 0; }
.card-h h3 { font-size: 15px; font-weight: 650; letter-spacing: -.012em; }
.card-b { padding: 14px 20px 20px; }
.eyebrow { color: var(--product-rust-ink); font-weight: 700; letter-spacing: .14em; }

/* Numbers read as data, not as prose ------------------------------------ */
.num, .v b, .kpi .val {
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  font-weight: 680;
}

/* Actions: pills, one loud primary -------------------------------------- */
.btn {
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 620;
  letter-spacing: -.005em;
  transition: background .16s, color .16s, box-shadow .16s;
}
.btn-sm { padding: 7px 13px; }
.btn-primary { background: var(--product-nav); color: var(--product-nav-ink); border: 0; }
.btn-primary:hover { background: var(--product-green); filter: none; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--product-line-strong);
  color: var(--product-ink);
}
.btn-ghost:hover { background: var(--product-surface-soft); border-color: var(--product-ink); }
/* The one accent action per screen: vibrant fill, deep green label. */
.btn-accent { background: var(--product-rust); color: var(--product-on-accent); border: 0; font-weight: 680; }
.btn-accent:hover { background: #ff7a33; }

/* Fields: filled, not outlined ------------------------------------------ */
.field input, .field select, .field textarea {
  border-radius: var(--product-radius-sm);
  border: 1px solid var(--product-line);
  background: var(--product-surface-soft);
}
.field input:focus, .field select:focus, .field textarea:focus {
  background: var(--product-surface);
  border-color: var(--product-teal);
  outline: 2px solid var(--product-teal-soft);
  outline-offset: 0;
}
.field > label, .field > span { color: var(--product-muted); font-size: 10.5px; letter-spacing: .09em; }

/* Status chips: tinted, legible ----------------------------------------- */
.chip, .tag, .plan-tag, .fi-badge, .doc-status, .cont-status, .mkt-status, .crm-stage {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 650;
  border: 0;
  background: var(--product-teal-soft);
  color: var(--product-teal-ink);
}
.chip.warn, .tag.warn, .doc-status.warn, .cont-status.warn, .mkt-status.warn {
  background: var(--product-rust-soft);
  color: var(--product-rust-ink);
}

/* Tables: rows, not a grid of boxes ------------------------------------- */
table th {
  border-bottom: 1px solid var(--product-line);
  color: var(--product-muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}
table td { border-bottom: 1px solid var(--product-line); padding-top: 13px; padding-bottom: 13px; }
table tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--product-surface-soft); }

/* Empty states ---------------------------------------------------------- */
.empty, .cont-empty {
  border: 0;
  border-radius: var(--product-radius-sm);
  background: var(--product-surface-soft);
  color: var(--product-muted);
}

@media (max-width: 900px) {
  .app { gap: 0; padding: 0; }
  .side { border-radius: 0; }
  .phead h1 { font-size: 25px; }
  .card { border-radius: 16px; }
}

/* The inline stylesheet sets these with `.side ...` (0,2,0), which outranks a
   bare class selector, so the sidebar text has to be stated at the same
   weight. Measured before: group headings 1.38:1, their descriptions 3.45:1,
   the account role 2.54:1. */
.side .nav-dept-toggle { color: var(--product-nav-ink); }
.side .nav-dept-copy b { color: var(--product-nav-ink); }
.side .nav-dept-copy small { color: var(--product-nav-faint); }
.side .nav-dept-index { color: var(--product-teal); }
.side .nav a { color: var(--product-nav-muted); }
.side .nav a:hover { color: var(--product-nav-ink); }
.side .nav a.on { color: var(--product-on-accent); background: var(--product-teal); }

.side .side-foot,
.side .side-account { background: rgba(246, 244, 238, .08); }
.side .side-foot .nm { color: var(--product-nav-ink); }
.side .side-foot .nm span,
.side .side-foot #sideRole,
.side .agent .nm span { color: var(--product-nav-faint); }
.side .agent-logout { color: var(--product-nav-muted); }
.side .agent-logout:hover { color: var(--product-nav-ink); background: rgba(246, 244, 238, .1); }

/* Leftovers from a light sidebar variant: a near-white wash over the open
   group (rgba(255,255,255,.46)) and over the account block. On the deep green
   they left near-white text at 3.4:1 and the account role at 2.54:1. */
.side .nav-tools .nav-dept.open > .nav-dept-toggle,
.side .nav-dept.open > .nav-dept-toggle { background: var(--product-nav-hover); }
.side .nav-tools .nav-dept-toggle:hover,
.side .nav-tools .nav-dept-toggle:focus-visible { background: var(--product-nav-hover); }
.side .agent,
.side .side-account .agent,
.side-foot .agent { background: transparent; }
.side .agent .nm { color: var(--product-nav-ink); }
.side .agent .av { background: var(--product-rust); color: var(--product-on-accent); }

/* Last three below AA, all small type: the account role over the translucent
   account block (4.08:1), and the two 9px badges in the utility bar. */
.side .agent .nm span,
.side .side-foot #sideRole { color: var(--product-nav-muted); }
#languageCurrent,
.lang-code,
.top .lang-switch span { color: var(--product-ink); font-weight: 700; }
.top .badge,
.top .notif-count,
#notifCount {
  background: var(--product-rust);
  color: var(--product-on-accent);
  font-weight: 800;
  border: 0;
}

/* The two 9px badges in the utility bar, by their real selectors: the language
   code (3.46:1 muted grey) and the notification count (4.24:1 white on the old
   rust). Both now carry deep green on the vibrant orange. */
.lang-menu-trigger em { color: var(--product-ink); font-style: normal; font-weight: 700; }
.notif-badge,
#notifBadge { background: var(--product-rust); color: var(--product-on-accent); font-weight: 800; }

/* ---------- PAINEL ------------------------------------------------------
   The screen a paying customer opens every morning, and the one they see
   empty on day one. Three decisions:

   One loud thing. "Preparar semana" and "Começar o próximo passo" were both
   solid green, so neither read as the next step. The header action steps back
   to ghost and the activation CTA takes the vibrant orange.

   The market tile earns its space. It is the product's differentiator, so it
   gets the deep green and a number big enough to read across a desk.

   The task list behaves like a list, not a table: whole row is the target,
   circular status chip, chevron that moves on hover. */

/* Hero ------------------------------------------------------------------ */
.premium-welcome { align-items: start; gap: 24px; margin-bottom: 20px; }
.premium-welcome .eyebrow { color: var(--product-rust-ink); }
.premium-welcome h1 { font-size: clamp(30px, 3vw, 42px); line-height: 1.04; letter-spacing: -.035em; }
.premium-welcome > div > p { color: var(--product-muted); font-size: 14.5px; max-width: 54ch; }
.premium-date { align-items: end; gap: 10px; }
.premium-date time { color: var(--product-muted); font-size: 12px; text-align: right; }
.premium-date time b { color: var(--product-ink); font-weight: 650; }
.premium-weather { color: var(--product-muted); font-size: 12px; }
.premium-weather b { color: var(--product-ink); font-weight: 650; }
/* The header action is not the next step. */
.premium-date .btn-primary {
  background: transparent;
  color: var(--product-ink);
  border: 1px solid var(--product-line-strong);
}
.premium-date .btn-primary:hover { background: var(--product-surface); border-color: var(--product-ink); }

/* Cards ----------------------------------------------------------------- */
.premium-card {
  border: 0;
  border-radius: var(--product-radius);
  background: var(--product-surface);
  box-shadow: var(--product-shadow);
}
.premium-card-head { padding: 20px 22px 6px; border-bottom: 0; }
.premium-card-head h2 { font-size: 16px; font-weight: 680; letter-spacing: -.015em; }
.premium-card-head p { color: var(--product-muted); font-size: 12.5px; }
.premium-main-grid { gap: 14px; }

/* Today: a list of rows, each one a target -------------------------------- */
.premium-today-list { padding: 6px 10px 12px; }
.premium-task {
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 0;
  border-radius: 14px;
  transition: background .15s;
}
.premium-task:hover { background: var(--product-surface-soft); }
.premium-task + .premium-task { border-top: 1px solid var(--product-line); border-radius: 14px; }
.premium-check {
  width: 30px; height: 30px;
  border: 0;
  border-radius: 999px;
  background: var(--product-teal-soft);
  color: var(--product-teal-ink);
  display: grid; place-items: center;
  flex: none;
}
.premium-task.is-done .premium-check,
.premium-task .premium-check[data-done="true"] { background: var(--product-teal); color: var(--product-on-accent); }
.premium-task-copy b { font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.premium-task-copy span { color: var(--product-muted); font-size: 12.5px; }
.premium-task-meta {
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--product-rust-soft);
  color: var(--product-rust-ink);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  border: 0;
}
.premium-task-action { color: var(--product-muted); transition: transform .15s, color .15s; }
.premium-task:hover .premium-task-action { color: var(--product-ink); transform: translateX(2px); }

/* Market: the differentiator, so it gets the dark tile and the big number - */
.premium-market {
  background: var(--product-nav);
  color: var(--product-nav-ink);
  box-shadow: var(--product-shadow-lift);
}
.premium-market .premium-market-top,
.premium-market .eyebrow { color: var(--product-teal); letter-spacing: .14em; }
.premium-market h2 { color: var(--product-nav-ink); font-size: 19px; letter-spacing: -.02em; }
.premium-market p { color: var(--product-nav-muted); font-size: 12.5px; }
.premium-market-data b,
.premium-market .num {
  color: var(--product-teal);
  font-size: clamp(34px, 3.4vw, 46px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
  line-height: 1;
}
.premium-market .btn,
.premium-market .btn-ghost {
  background: rgba(246, 244, 238, .1);
  border-color: rgba(246, 244, 238, .22);
  color: var(--product-nav-ink);
}
.premium-market .btn:hover { background: rgba(246, 244, 238, .18); }
.premium-market .market-sk { background: rgba(246, 244, 238, .12); border-radius: 8px; }

/* Activation strip: the one loud action on the screen -------------------- */
.first-value-guide {
  border: 0;
  border-radius: var(--product-radius);
  background: var(--product-surface);
  box-shadow: var(--product-shadow);
  padding: 20px 22px;
}
.first-value-guide .eyebrow { color: var(--product-rust-ink); }
.first-value-guide h2,
.first-value-guide b { font-size: 16px; font-weight: 680; letter-spacing: -.015em; }
.first-value-guide p { color: var(--product-muted); font-size: 13px; }
.first-value-guide .btn-primary {
  background: var(--product-rust);
  color: var(--product-on-accent);
  border: 0;
  font-weight: 700;
  padding: 12px 20px;
}
.first-value-guide .btn-primary:hover { background: #ff7a33; }

/* Next visit and the operations strip ------------------------------------ */
.premium-visit {
  border: 0;
  border-radius: var(--product-radius);
  background: var(--product-surface);
  box-shadow: var(--product-shadow);
}
.premium-visit-head h2 { font-size: 16px; font-weight: 680; letter-spacing: -.015em; }
.premium-visit-details h3 { letter-spacing: -.02em; }
.premium-visit-time { color: var(--product-teal-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.premium-photo-placeholder,
.premium-visit-photo.is-empty {
  border-radius: var(--product-radius-sm);
  background: var(--product-surface-soft);
  color: var(--product-muted);
}

@media (max-width: 900px) {
  .premium-welcome { gap: 14px; margin-bottom: 14px; }
  .premium-welcome h1 { font-size: 28px; }
  .premium-market-data b, .premium-market .num { font-size: 32px; }
}

/* The activation strip was three columns on one row: 220px of copy, 279px for
   four steps and 207px for the action. Each step got 65px for a label that
   wants 150, so they overlapped the button. Copy and action share the top
   row; the steps get the full width underneath. */
.first-value-guide {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "copy cta" "steps steps";
  row-gap: 16px;
  column-gap: 18px;
  align-items: start;
}
.first-value-guide > div:first-child { grid-area: copy; }
.first-value-guide > .first-value-steps { grid-area: steps; }
.first-value-guide > .btn,
.first-value-guide > :last-child:not(.first-value-steps):not(div:first-child) { grid-area: cta; }

.first-value-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(146px, 1fr));
  gap: 8px;
  padding-top: 2px;
  border-top: 1px solid var(--product-line);
}
.first-value-step {
  gap: 9px;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--product-surface-soft);
}
.first-value-step i {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 999px;
  background: var(--product-teal-soft);
  color: var(--product-teal-ink);
  font-size: 10px;
  font-weight: 800;
  font-style: normal;
  display: grid; place-items: center;
}
.first-value-step span {
  min-width: 0;
  font-size: 12px;
  line-height: 1.3;
  color: var(--product-ink);
  overflow-wrap: anywhere;
}
.first-value-step span small,
.first-value-step span span { display: block; color: var(--product-muted); font-size: 10.5px; }

@media (max-width: 760px) {
  .first-value-guide { grid-template-columns: 1fr; grid-template-areas: "copy" "steps" "cta"; }
  .first-value-guide > .btn { justify-self: stretch; }
}

/* The step labels were set to ellipsis for a single narrow row. They have
   room to wrap now, and a truncated instruction is not an instruction. */
.first-value-steps .first-value-step span,
.first-value-steps .first-value-step span * {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

/* Eyebrows default to the orange ink, which is meant for light surfaces. On
   any dark tile they have to flip to the aqua, or they land near 2:1. */
.premium-market .eyebrow,
.premium-market .premium-market-top,
.side .eyebrow,
[class*="dark"] .eyebrow { color: var(--product-teal); }

/* Two more below AA on the dashboard: the 8px section eyebrow (4.04:1) and
   the operations summary line (4.37:1). */
.dash-live .eyebrow,
.premium-dashboard .eyebrow { font-size: 10px; letter-spacing: .12em; }
:root { --product-muted: #54635c; }
[data-theme="dark"] { --product-muted: #a3b3ab; }

/* The operations strip carries hardcoded greys on a white wash, so it reads
   the same 4.04:1 and 4.37:1 in both themes. Put it on the token system. */
.execution-summary {
  border: 0;
  border-radius: var(--product-radius);
  background: var(--product-surface);
  box-shadow: var(--product-shadow);
}
.execution-summary b { color: var(--product-ink); }
.execution-summary span > b:first-child { color: var(--product-rust-ink); letter-spacing: .12em; }
.execution-summary small,
.execution-summary span small { color: var(--product-muted); }

/* ---------- FADES E EFEITOS --------------------------------------------
   From the reference: a coloured glow bleeding out of one corner of the
   feature panel and dissolving into the surface, an area fill that fades to
   nothing under a line, segmented pill tabs, circular gradient icon chips,
   and a hairline of light along the top edge of a raised card.

   Everything here is decoration over a background that already passes
   contrast, so the glows are capped low enough not to move the measured
   ratios: the aqua wash peaks at .22 alpha and the orange at .14. */
:root {
  --glow-teal: radial-gradient(120% 90% at 86% -10%, rgba(19, 169, 143, .22), transparent 62%);
  --glow-rust: radial-gradient(110% 80% at 4% 0%, rgba(238, 108, 45, .14), transparent 58%);
  --edge-light: inset 0 1px 0 rgba(255, 255, 255, .06);
}
[data-theme="dark"] {
  --glow-teal: radial-gradient(120% 90% at 86% -10%, rgba(63, 208, 180, .18), transparent 62%);
  --glow-rust: radial-gradient(110% 80% at 4% 0%, rgba(255, 138, 76, .12), transparent 58%);
  --edge-light: inset 0 1px 0 rgba(255, 255, 255, .07);
}

/* The feature tile: deep green with the glow bleeding from the top corner. */
.premium-market {
  position: relative;
  overflow: hidden;
  background-image: var(--glow-teal), var(--glow-rust);
  background-color: var(--product-nav);
  box-shadow: var(--product-shadow-lift), var(--edge-light);
}
.premium-market > * { position: relative; z-index: 1; }

/* Raised surfaces get the same hairline of light along the top edge. */
.card, .premium-card, .first-value-guide, .execution-summary, .premium-visit { box-shadow: var(--product-shadow), var(--edge-light); }
.card:hover, .premium-card:hover { box-shadow: var(--product-shadow-lift), var(--edge-light); }
.card, .premium-card { transition: box-shadow .22s ease; }

/* The market trend: a change against the previous period with the line under
   it. Both the stroke and the gradient take currentColor, so one token on the
   wrapper colours the whole thing and the two can never drift apart. */
.premium-market-trend {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "spark delta" "spark label";
  align-items: center;
  gap: 0 14px;
  margin-top: 14px;
  color: var(--product-teal);
}
.premium-market-trend.is-down { color: var(--product-rust); }
.premium-market-trend .pm-spark { grid-area: spark; width: 140px; height: 40px; overflow: visible; }
.premium-market-trend .pm-spark-line { stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.premium-market-trend b {
  grid-area: delta;
  color: currentColor;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  align-self: end;
}
.premium-market-trend span {
  grid-area: label;
  color: var(--product-nav-muted);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  align-self: start;
}
@media (max-width: 620px) {
  .premium-market-trend { grid-template-columns: auto 1fr; gap: 0 10px; }
  .premium-market-trend .pm-spark { width: 104px; height: 34px; }
  .premium-market-trend b { font-size: 16px; }
}

/* Segmented control, as the 1D/1W/1M group. */
.seg, .opp-map-switch, .tabs, .mkt-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--product-surface-soft);
  border: 1px solid var(--product-line);
}
.seg > *, .opp-map-switch > button, .tabs > button, .mkt-tabs > button {
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  background: transparent;
  color: var(--product-muted);
  font-size: 12.5px;
  font-weight: 620;
  transition: background .16s, color .16s;
}
.seg > .on, .seg > [aria-selected="true"],
.opp-map-switch > button.on, .tabs > button.on, .mkt-tabs > button.on {
  background: var(--product-surface);
  color: var(--product-ink);
  box-shadow: 0 1px 2px rgba(19, 32, 28, .08);
}

/* Circular icon chips, filled with a soft gradient rather than flat tint. */
.premium-check, .first-value-step i, .fi-row > i {
  background-image: linear-gradient(140deg, rgba(19, 169, 143, .26), rgba(19, 169, 143, .08));
  background-color: var(--product-teal-soft);
}
.fi-row.is-accent > i {
  background-image: linear-gradient(140deg, rgba(238, 108, 45, .3), rgba(238, 108, 45, .1));
  background-color: var(--product-rust-soft);
  color: var(--product-rust-ink);
}

/* Rows lift on hover instead of only changing colour. */
.premium-task, tbody tr { transition: background .15s, transform .15s; }
.premium-task:hover { transform: translateX(2px); }

@media (prefers-reduced-motion: reduce) {
  .card, .premium-card, .premium-task, tbody tr, .premium-task-action { transition: none; }
  .premium-task:hover { transform: none; }
}

/* ---------- MOBILE -----------------------------------------------------
   From the phone reference: frosted glass over content rather than opaque
   bars, a floating pill dock that clears the edges, and a saturated fill
   with a dark label for the affirmative action.

   The dock sits over arbitrary content, so it cannot rely on blur alone for
   legibility: the translucent deep green is dark enough on its own, and the
   @supports fallback drops to the opaque colour where backdrop-filter is
   unavailable. */
@media (max-width: 900px) {
  /* Top bar: lets content pass under it instead of boxing it in. */
  .top {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 10px 14px;
    border: 0;
    border-radius: 0;
    background: color-mix(in srgb, var(--product-canvas) 82%, transparent);
    backdrop-filter: blur(14px) saturate(1.3);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
  }
  .top .search input {
    border-radius: 999px;
    background: color-mix(in srgb, var(--product-surface) 88%, transparent);
  }
  /* Circular utility buttons, as the reference's action circles. */
  .top .icon-btn {
    width: 42px; height: 42px;
    border-radius: 999px;
    border: 0;
    background: color-mix(in srgb, var(--product-surface) 86%, transparent);
    color: var(--product-ink);
  }

  /* The dock floats and is frosted, not an opaque slab. */
  .mobile-action-dock {
    left: 14px; right: 14px;
    gap: 10px;
    padding: 9px;
    border: 1px solid rgba(246, 244, 238, .12);
    border-radius: 999px;
    background: rgba(7, 33, 27, .72);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    box-shadow: 0 14px 40px rgba(7, 33, 27, .34), var(--edge-light);
  }
  .mobile-action-dock button { border-radius: 999px; font-weight: 650; }
  .mobile-dock-secondary {
    background: rgba(246, 244, 238, .12);
    color: var(--product-nav-ink);
  }
  /* Affirmative action: saturated fill, deep green label. 5.71:1. */
  .mobile-dock-primary {
    background: var(--product-teal);
    color: var(--product-on-accent);
    font-weight: 700;
    box-shadow: none;
  }

  /* Rows and cards get phone-sized targets and edge gutters. */
  .card, .premium-card, .first-value-guide, .execution-summary, .premium-visit { border-radius: 18px; }
  .premium-task { padding: 14px 12px; min-height: 60px; }
  .premium-check, .first-value-step i { width: 34px; height: 34px; }
  .scroll { padding-left: 14px; padding-right: 14px; }

  /* Carousel dots, as under the promo card. */
  .dots { display: flex; gap: 6px; justify-content: center; padding: 10px 0 2px; }
  .dots > * {
    width: 6px; height: 6px;
    border-radius: 999px;
    background: var(--product-line-strong);
  }
  .dots > .on { background: var(--product-teal); width: 18px; }
}

/* Where the browser cannot blur, the bars stay opaque rather than washed out. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  @media (max-width: 900px) {
    .top { background: var(--product-canvas); }
    .mobile-action-dock { background: var(--product-nav); }
    .top .icon-btn, .top .search input { background: var(--product-surface); }
  }
}

/* The task row's first column is 22px; the phone chip is 34px, so it ate the
   gap and sat flush against the title. Match the column to the chip. */
@media (max-width: 900px) {
  .premium-task { grid-template-columns: 34px minmax(0, 1fr) 14px; }
}

/* The "next" step was highlighted with rgba(255,253,249,.9) — near-white at
   a specificity my base rule could not reach. In the dark theme that put
   light ink on a white chip: 1.08:1. Highlighting it with the aqua tint
   instead works in both themes and says what it means, which a slightly
   whiter white never did. */
.first-value-steps .first-value-step.is-next {
  background: var(--product-teal-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--product-teal) 38%, transparent);
}
.first-value-steps .first-value-step.is-next span { color: var(--product-ink); }
.first-value-steps .first-value-step.is-next span small,
.first-value-steps .first-value-step.is-next span span { color: var(--product-muted); }
.first-value-steps .first-value-step.is-next i {
  background: var(--product-teal);
  background-image: none;
  color: var(--product-on-accent);
}

/* "Abrir centro ›" carried a hardcoded #174f43, a dark teal meant for the
   light surface. 1.71:1 in the dark theme. */
.execution-summary-action,
.execution-summary-action i { color: var(--product-teal-ink); font-style: normal; }
.execution-summary-action:hover { color: var(--product-ink); }

/* The tile is ~370px at desktop width and .premium-market-data is a nowrap
   flex row, so the value and the trend fought over it: the €/m² ended up in a
   52px column, broken over three lines. Stack them, and give the sparkline the
   full width — a wider line is also a more readable one. */
.premium-market .premium-market-data {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  flex-wrap: wrap;
}
.premium-market .premium-market-data > div:first-child { min-width: 0; }
.premium-market .premium-market-data > div:first-child b { white-space: nowrap; }
.premium-market-trend {
  grid-template-columns: minmax(0, 1fr) 148px;
  grid-template-areas: "delta spark" "label spark";
  gap: 2px 14px;
}
.premium-market-trend .pm-spark { width: 148px; align-self: center; }
@media (max-width: 620px) {
  .premium-market-trend { grid-template-columns: minmax(0, 1fr) 108px; }
  .premium-market-trend .pm-spark { width: 108px; }
}

/* The tile is deep green in both themes, so the trend takes the light accents
   regardless of theme. The light-theme aqua measured 3.48:1 there — passing
   only on the large-text threshold, which is too thin a margin for the one
   number on the card. */
.premium-market .premium-market-trend { color: #3fd0b4; }
.premium-market .premium-market-trend.is-down { color: #ff8a4c; }

/* ---------- KPIs E CONTADORES -----------------------------------------
   The reference leads with numbers, so the number is the loudest thing in
   the tile and everything else steps back. */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi {
  border: 0;
  border-radius: var(--product-radius);
  background: var(--product-surface);
  box-shadow: var(--product-shadow), var(--edge-light);
  padding: 16px 18px 18px;
  transition: box-shadow .2s ease, transform .15s ease;
}
.kpi:hover { box-shadow: var(--product-shadow-lift), var(--edge-light); transform: translateY(-1px); }
.kpi:focus-visible { outline: 2px solid var(--product-teal); outline-offset: 2px; }
.kpi .top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.kpi .ic {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 999px;
  background-image: linear-gradient(140deg, rgba(19,169,143,.26), rgba(19,169,143,.08));
  background-color: var(--product-teal-soft);
  color: var(--product-teal-ink);
}
.kpi .ic svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; }
.kpi .delta {
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--product-teal-soft);
  color: var(--product-teal-ink);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0;
  text-align: right;
}
.kpi .delta.down { background: var(--product-rust-soft); color: var(--product-rust-ink); }
.kpi .val {
  font-size: clamp(26px, 2.2vw, 34px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
  line-height: 1.02;
  color: var(--product-ink);
}
.kpi .cap { margin-top: 6px; color: var(--product-muted); font-size: 12.5px; }

/* A counter at zero is noise, not information. */
.nav a .count.is-zero { display: none; }

@media (max-width: 620px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .val { font-size: 24px; }
}

/* ---------- DOCK E CAMADAS ---------------------------------------------
   The page dock sits at z-index 55 and the client sheet at 50, so the dock
   floated over the sheet — "+ New client" offered inside another client's
   record, over content it also covered. Raising the sheet instead would only
   move the argument along a scale that already has .cmp-fixed-dock declared
   twice (54 and 60), .opp-compare-dock at 56 and .side-backdrop at 60.

   A dock belongs to the page behind the sheet, so while a sheet or modal is
   open it has no business being on screen at all. :has() is already used in
   this stylesheet, so this needs no class plumbing in the JS. */
body:has(#sheet.on) .mobile-action-dock,
body:has(.sheet.on) .mobile-action-dock,
body:has(#modalWrap.on) .mobile-action-dock,
body:has(#sheet.on) .cmp-fixed-dock,
body:has(#modalWrap.on) .cmp-fixed-dock {
  display: none;
}

/* ---------- FICHA DO CLIENTE NO TELEMÓVEL ------------------------------
   Call / email / WhatsApp sat at 1320px down the record — two screens of
   scrolling past score, tags and journey for the action a consultant takes
   thirty times a day. They are not moved in the markup, where they belong
   next to "Registar contacto"; on a phone they are pinned to the bottom
   edge instead, which is where the thumb already is, and the same place the
   page dock occupies elsewhere in the product.

   The dock itself is hidden while the sheet is open, so the two never
   compete for that edge. */
@media (max-width: 900px) {
  #sheet.on .crm-actions {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 3;
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    overflow-x: auto;
    scrollbar-width: none;
    background: color-mix(in srgb, var(--product-surface) 92%, transparent);
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    box-shadow: 0 -8px 24px rgba(19, 32, 28, .1);
  }
  #sheet.on .crm-actions::-webkit-scrollbar { display: none; }
  #sheet.on .crm-actions > button {
    flex: 0 0 auto;
    min-height: 44px;
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 620;
    white-space: nowrap;
  }
  /* The first three are the ones that matter; give them the accent weight. */
  #sheet.on .crm-actions > button:nth-child(-n+3) {
    background: var(--product-nav);
    color: var(--product-nav-ink);
    border: 0;
  }
  /* Room for the bar so it never covers the last rows of the record. */
  #sheet.on .sheet-body { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  @media (max-width: 900px) { #sheet.on .crm-actions { background: var(--product-surface); } }
}

/* .crm-actions wraps by default, so the pinned bar grew to two rows and ran
   off the bottom edge. One row that scrolls sideways instead. */
@media (max-width: 900px) {
  #sheet.on .crm-actions { flex-wrap: nowrap; align-items: center; }
}

/* ---------- JORNADA E BOTÃO DE FECHAR ---------------------------------
   The journey is five grid columns of 60px, and its labels carry nowrap +
   overflow:hidden, so at 406px each step gets 38px of text: "Crit…",
   "Sho…", "Dea…". A step nobody can read is not a step. One row that
   scrolls sideways instead, wide enough for the label to wrap.

   Neither the grid nor the buttons carry a class, so this matches on the
   shape: a div inside .linked whose children are buttons with a <b>. */
@media (max-width: 900px) {
  #sheet .linked > div:has(> button > b) {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }
  #sheet .linked > div:has(> button > b)::-webkit-scrollbar { display: none; }
  #sheet .linked > div:has(> button > b) > button {
    flex: 0 0 132px;
    scroll-snap-align: start;
    min-height: 44px;
    text-align: left;
  }
  #sheet .linked > div:has(> button > b) b,
  #sheet .linked > div:has(> button > b) small {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.25;
  }

  /* The close button is absolutely positioned at right:18px and the score
     ring sat under it — 36px of overlap, so the ring was partly untouchable
     and the X partly illegible. Keep the header's content clear of it. */
  #sheet .crm-sheet-top { padding-right: 52px; }
}

/* The journey's grid, buttons and labels are all styled inline at the render
   site — display:grid;grid-template-columns:repeat(5,minmax(0,1fr)) on the
   container and white-space:nowrap;overflow:hidden on the labels. No selector
   beats an inline declaration, so these need !important. The honest fix is to
   take the inline styles out of the template; this is the narrow one, scoped
   to phones and to this shape only. */
@media (max-width: 900px) {
  #sheet .linked > div:has(> button > b) {
    display: flex !important;
    grid-template-columns: none !important;
  }
  #sheet .linked > div:has(> button > b) > button { min-width: 132px !important; }
  #sheet .linked > div:has(> button > b) b,
  #sheet .linked > div:has(> button > b) small {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
}

/* ============================================================
   Ecrã "Hoje" — primeiro o telemóvel, depois o desktop.
   Reutiliza .card, .dash-agenda-item, .dash-priority e .task,
   que já estão definidos no index.html; aqui só a disposição.
   ============================================================ */
.hoje-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  align-items: start;
}
/* O .card desta app não traz padding próprio (overflow:hidden corta o que encosta
   à borda arredondada), por isso o espaçamento tem de vir daqui. */
.hoje-block { padding: 16px; }
.hoje-block h2 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--product-muted);
}
.hoje-block .dash-agenda-item,
.hoje-block .dash-priority { cursor: pointer; }
/* O alvo de toque mínimo: 44px, como na auditoria mobile. */
.hoje-block .task .chk {
  min-width: 28px;
  min-height: 28px;
  cursor: pointer;
}
.hoje-block .task {
  min-height: 44px;
  align-items: center;
}
@media (min-width: 980px) {
  .hoje-grid { grid-template-columns: 1.15fr 1fr; }
  /* A agenda fica à esquerda, a ocupar a altura das duas da direita. */
  .hoje-grid > .hoje-block:first-child { grid-row: span 2; }
}

/* ============================================================
   Contraste em botões sobre o verde-água de destaque.
   Medido a 9/11/2026: branco sobre var(--teal) dá 3,37:1 no
   separador selecionado — abaixo
   dos 4,5:1 exigidos. O verde é demasiado claro para carregar
   texto branco; o tom legível sobre destaque é o --product-on-accent.
   ============================================================ */
.listing-scope-tabs button[aria-pressed="true"] {
  color: var(--product-on-accent);
}

/* "Ver todas" e outras ligações de cabeçalho de cartão.
   .card-h a usa var(--green), que é #17372F fixo e não muda com o tema:
   no escuro ficava verde-escuro sobre fundo escuro, 1,31:1.
   Correção localizada. O --green é usado 17 vezes como texto e 17 como
   fundo; redefini-lo no tema escuro partiria os botões verdes, por isso
   a correção de fundo pertence à migração das cores literais para tokens. */
[data-theme="dark"] .card-h a { color: var(--teal-ink); }

.dash-priority-list > button.dash-priority {
  width: 100%;
  min-height: 44px;
  color: inherit;
  font: inherit;
  text-align: start;
  background: transparent;
  border-inline: 0;
  border-bottom: 0;
  border-radius: 0;
}
.dash-priority-list > button.dash-priority:hover { background: var(--carbon); }
.dash-priority-list > button.dash-priority:focus-visible { outline-offset: -3px; }
#hojeResumo { font-size: 12px; }
@media (max-width: 520px) {
  #page-hoje .phead > .right {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #page-hoje .phead > .right .btn[data-hoje-action] {
    display: inline-flex;
    min-height: 44px;
  }
}

/* Tarefa atrasada no ecrã Hoje: assinalada pelo peso e pelo texto
   ("Atrasada há N dias"), não só pela cor, para não depender do contraste. */
.hoje-block .task .tm.hoje-atrasada { font-weight: 700; color: var(--product-ink); }

/* Hoje — visitas por fechar, por baixo dos compromissos do dia.
   Atenção: nesta app --ink NÃO é a cor do texto (no tema claro vale #F2EDE5,
   um creme para superfícies escuras). O texto principal é --product-ink. */
.hoje-por-fechar { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.hoje-por-fechar h3 { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: var(--product-ink); }
.hoje-por-fechar p { margin: 0 0 8px; font-size: 13px; color: var(--product-muted); }

/* ============================================================
   Piso de leitura no telemóvel: nada abaixo de 11px.
   Medido a 13/11 a 375px: 93 elementos entre 8 e 10,5px, na maioria
   rótulos de KPI de todos os módulos. Seletores exatos de propósito —
   um ".kpi div" apanharia também o número grande e encolhia-o.
   ============================================================ */
@media (max-width: 760px) {
  .crm-kpi span,
  .mkt-kpi span,
  .legal-kpi span,
  .cont-cash-col span,
  .cont-context-label,
  .kpi .l,
  .kpi .delta,
  .top-row .delta,
  .opp-source-row b,
  .legal-source b,
  .legal-source a,
  .legal-tabs button,
  .mkt-card-h .mkt-mini,
  .cont-command-actions button,
  .task .tm,
  .premium-market-top,
  .first-value-step i,
  .dash-status span {
    font-size: 11px;
  }
}

/* ============================================================
   Paleta de comandos (⌘K / Ctrl+K) e o botão que a abre.
   Superfície fosca só no painel (≈640×560); o fundo é só um
   escurecimento, sem blur no ecrã inteiro. Tokens --product-*,
   por isso o tema escuro vem de graça.
   ============================================================ */
.top-palette {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: transparent;
  color: var(--product-muted); font: inherit; cursor: pointer;
  transition: color .14s ease, border-color .14s ease, background-color .14s ease;
}
.top-palette svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.top-palette kbd, .dg-palette kbd {
  font: 600 11px/1 var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  padding: 4px 6px; border-radius: 6px; background: var(--product-teal-soft); color: var(--product-teal-ink);
}
.top-palette:hover { color: var(--product-ink); border-color: var(--product-teal); }
.top-palette:focus-visible { outline: 2px solid var(--product-teal); outline-offset: 2px; }

.dg-palette {
  position: fixed; inset: 0; z-index: 2147482900;
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(48px, 12vh, 140px) 16px 16px;
}
.dg-palette[hidden] { display: none; }
.dg-palette__scrim { position: absolute; inset: 0; background: rgba(7, 17, 14, .46); opacity: 0; transition: opacity .16s ease; }
.dg-palette.is-open .dg-palette__scrim { opacity: 1; }
.dg-palette__panel {
  position: relative; width: min(640px, 100%); max-height: min(560px, calc(100vh - 96px)); max-height: min(560px, calc(100dvh - 96px));
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--product-surface);
  box-shadow: var(--product-shadow-lift);
  opacity: 0; transform: translateY(-8px) scale(.985);
  transition: opacity .16s ease, transform .18s cubic-bezier(.2, .8, .2, 1);
}
@supports (backdrop-filter: blur(1px)) and (background: color-mix(in srgb, red 50%, transparent)) {
  .dg-palette__panel {
    background: color-mix(in srgb, var(--product-surface) 88%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  }
}
.dg-palette.is-open .dg-palette__panel { opacity: 1; transform: none; }

.dg-palette__field { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.dg-palette__field svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--product-muted); stroke-width: 2; }
.dg-palette__field input {
  flex: 1; min-width: 0; border: 0; outline: 0; box-shadow: none; background: transparent;
  color: var(--product-ink); font-size: 16px; line-height: 1.4; /* 16px: o iOS não amplia o ecrã ao focar */
}
.dg-palette__field input::placeholder { color: var(--product-muted); opacity: 1; }
/* A app tem regras globais com !important para o foco e para os inputs
   (outline de 3px, fundo, cantos retos). Numa combobox o foco é o campo todo,
   por isso o indicador passa para o wrapper: continua visível (WCAG 2.4.7), mas
   deixa de desenhar uma caixa dentro de outra. */
.dg-palette .dg-palette__field input,
.dg-palette .dg-palette__field input:focus,
.dg-palette .dg-palette__field input:focus-visible {
  outline: none !important; box-shadow: none !important; border: 0 !important;
  background: transparent !important; border-radius: 0 !important;
}
.dg-palette__field { box-shadow: inset 0 -2px 0 transparent; transition: box-shadow .14s ease; }
.dg-palette__field:focus-within { box-shadow: inset 0 -2px 0 var(--product-teal); }

.dg-palette__list { overflow: auto; padding: 6px 8px 8px; overscroll-behavior: contain; }
.dg-palette__heading {
  padding: 12px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--product-muted);
}
.dg-palette__option {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 10px;
  border-radius: 10px; color: var(--product-ink); cursor: pointer;
}
.dg-palette__option[aria-selected="true"] { background: var(--product-teal-soft); }
.dg-palette__icon {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center;
  border-radius: 9px; background: var(--product-canvas); color: var(--product-muted);
}
.dg-palette__option[aria-selected="true"] .dg-palette__icon { color: var(--product-teal-ink); background: var(--product-surface); }
.dg-palette__icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.dg-palette__text { display: flex; flex-direction: column; min-width: 0; }
.dg-palette__label { font-size: 14px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dg-palette__detail { font-size: 12px; line-height: 1.3; color: var(--product-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dg-palette__empty { display: flex; flex-direction: column; gap: 4px; padding: 32px 16px; text-align: center; color: var(--product-muted); font-size: 13px; }
.dg-palette__empty b { color: var(--product-ink); font-size: 14px; }
.dg-palette__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dg-palette__foot {
  display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--product-muted);
}
.dg-palette__foot span { display: inline-flex; align-items: center; gap: 6px; }
.dg-palette__foot kbd { padding: 3px 5px; }
.dg-palette__foot i { font-style: normal; }

@media (max-width: 760px) {
  .top-palette { display: none; }
  .dg-palette { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
  .dg-palette__panel { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .dg-palette__option { min-height: 48px; }
  .dg-palette__foot, .dg-palette__field kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .dg-palette__scrim, .dg-palette__panel, .top-palette { transition: none; }
  .dg-palette__panel { transform: none; }
}

/* ============================================================
   Tokens "gallery" no tema escuro.
   --gallery-ink (#102d26) e --gallery-muted (#697972) só tinham valores
   do tema claro, e são usados 20 vezes nos componentes premium-*. Onde
   o tema escuro não corrigiu o seletor à mão, o texto ficava escuro
   sobre o cartão escuro: o nome da fase no resumo do negócio media
   1,15:1, e os cinzentos secundários 3,7:1. Redefinir os tokens corrige
   todos os usos de uma vez, e os novos já nascem corretos.
   ============================================================ */
/* Atualização (mesmo dia): --gallery-muted também falhava no claro (#697972
   sobre quase branco, 4,3:1, em Oportunidades). Em vez de dois valores, os
   tokens apontam para os temáticos --product-*, que já mudam com o tema. */
:root {
  --gallery-ink: var(--product-ink);
  --gallery-muted: var(--product-muted);
}
[data-theme="dark"] { --gallery-line: rgba(241, 239, 232, .12); }

/* Tema escuro: duas falhas de contraste encontradas num varrimento
   com duas passagens (13/11).
   1) --mist2 (#8EA69A) dava 3,99:1 nos painéis verdes mais claros do escuro
      (rótulos do lead, "Sem dados verificados…", o › dos botões). É um token
      de segunda linha usado em muitos sítios, por isso sobe-se o token em
      vez de remendar painel a painel.
   2) O aviso .casafari-trial-notice.warning tem fundo creme fixo no
      index.html (especificidade 0,2,0), e no escuro o texto é cinzento claro:
      claro sobre claro, 1,01:1. No escuro passa a uma superfície quente
      escura com texto claro. */
[data-theme="dark"] { --mist2: #a6b8af; }
[data-theme="dark"] .casafari-trial-notice.warning {
  background: rgba(238, 108, 45, .16);
  border-color: var(--product-rust);
  color: var(--product-ink);
}

/* Os dois últimos casos do varrimento em escuro (4,14:1 e 4,29:1).
   - .premium-deal-summary span pinta de cinzento secundário todos os spans,
     incluindo o › dentro dos botões, que devem herdar a cor do botão.
   - .casafari-kicker tem rgb(22,141,120) fixo a 9px; no escuro usa o teal do tema. */
.premium-deal-summary .btn span { color: inherit; }
[data-theme="dark"] .casafari-kicker { color: var(--product-teal); }

/* Tema claro: as 20 falhas do varrimento fiável de 13/11 (uma abaixo de
   3:1, o resto entre 3,5 e 4,3), em quatro famílias.
   - .av-sm leva fundos pastel de avColors (luminância 0,30–0,50) e o texto
     era --ac, que no claro vale #FFFDF9: branco sobre pastel, 2,0:1. Texto
     escuro dá ≥ 5,3:1 na pior combinação. (.av não se toca: tem vários
     aspetos, com gradientes.)
   - Os números dos passos do negócio usavam #7B8B84 fixo sobre branco: 3,6:1.
   - O texto do aviso CASAFARI e o kicker (rgb(22,141,120) a 9px) ficavam a
     4,0–4,3:1.
   - --mist2 (#5D6B64) dava 4,3:1 nos painéis tingidos de teal-soft; é um
     token de segunda linha, por isso sobe o token. */
/* Atenção: ":root" casa sempre, também no escuro. Com a mesma especificidade
   e depois do bloco escuro, ganhava-lhe e punha texto escuro sobre fundo
   escuro (99 falhas, 1,6:1). O claro exclui o escuro de forma explícita. */
:root:not([data-theme="dark"]) { --mist2: #566259; }
.av-sm { color: #10221d; }
.premium-deal-dot { color: var(--product-muted); }
.casafari-trial-notice { color: var(--product-ink); }
.casafari-kicker { color: var(--product-teal-ink); }

/* ============================================================
   Estado de ações: data-action-state="working|success|error".
   O spinner e o visto são ::before, não elementos: o texto do botão
   continua a ser um só nó, porque o openModal e o submitModal leem e
   escrevem textContent. Só transform/opacity.
   ============================================================ */
.btn[data-action-state="working"],
.btn[data-action-state="success"] { position: relative; }
.btn[data-action-state="working"] { cursor: progress; }
/* O botão a gravar está disabled, e o estilo de disabled baixa a opacidade a
   ~0,5: "A guardar…" caía para 3,5:1. É uma mensagem de estado que se tem de
   ler, por isso mantém a opacidade; o spinner e o cursor dizem que está ocupado. */
.btn[data-action-state="working"]:disabled { opacity: 1; }
.btn[data-action-state="working"]::before {
  content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 8px;
  vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: dg-spin .7s linear infinite;
}
.btn[data-action-state="success"]::before {
  content: "✓"; display: inline-block; margin-right: 6px; font-weight: 700;
  animation: dg-pop .28s cubic-bezier(.2, .9, .3, 1.4) both;
}
.btn[data-action-state="error"] { animation: dg-shake .36s cubic-bezier(.36, .07, .19, .97); }
@keyframes dg-spin { to { transform: rotate(360deg); } }
@keyframes dg-pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
@keyframes dg-shake {
  10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); } 40%, 60% { transform: translateX(3px); }
}
/* O botão do documento muda de peso quando há um próximo passo real. */
#docStatusBtn { transition: background-color .18s ease, color .18s ease, border-color .18s ease; }
#docStatusBtn[data-action-state="success"] { background: var(--product-teal-soft); color: var(--product-teal-ink); border-color: transparent; }
.docs-status-hint {
  display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--product-muted);
}
.docs-status-hint[hidden] { display: none; }
.docs-status-hint span + span::before { content: " · "; }
/* O bloco .meta da barra do documento põe os <span> em 9px, maiúsculas, mono e com
   espaçamento (é um rótulo). A nota de travões é informação para ler antes de
   clicar: tem de ser texto normal. Seletor mais específico para ganhar. */
.docs-preview-toolbar .meta .docs-status-hint,
.docs-preview-toolbar .meta .docs-status-hint span {
  font-family: inherit; font-size: 12px; text-transform: none; letter-spacing: 0;
  line-height: 1.4; color: var(--product-muted);
}
.docs-preview-toolbar .meta .docs-status-hint { margin-top: 4px; }
@media (prefers-reduced-motion: reduce) {
  /* Com as animações quase desligadas pelas regras globais, o anel fica
     parado: o texto ("A guardar…") é que diz que está a trabalhar. */
  .btn[data-action-state="working"]::before { animation: none; border-right-color: currentColor; opacity: .6; }
  .btn[data-action-state="error"] { animation: none; }
}

/* Entrada (login/registo) no telemóvel: texto com o piso de 11px e alvos de
   toque de 44px. Medido a 375px: etiquetas e nota a 10px, separadores a 25px de
   altura e a ligação "Voltar" a 19px. */
@media (max-width: 760px) {
  .login-card .field label, .login-card .sec-note, #authModeNote { font-size: 11px; }
  .login-card #tabLogin, .login-card #tabReg { min-height: 44px; min-width: 44px; padding: 12px 6px 0; box-sizing: border-box; }
  .login-card .back a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* Telemóvel, dentro da app: campos e ligações com alvo de toque de 44px.
   Medido a 375px em todas as páginas da navegação: 12 campos entre 39 e 43px,
   os botões de zoom do mapa com 30px de largura e "Ver todas" com 18px. */
@media (max-width: 760px) {
  .page input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]),
  .page select { min-height: 44px; box-sizing: border-box; }
  .leaflet-touch .leaflet-control-zoom a, .leaflet-control-zoom a { width: 44px; height: 44px; line-height: 44px; }
  .page a.mobile-readable { display: inline-flex; align-items: center; min-height: 44px; }
}

/* Arranque em dois passos. */
.quickstart-intro { margin: 0 0 14px; font-size: 13.5px; line-height: 1.6; color: var(--mist); }
.quickstart-choices { display: grid; gap: 8px; }
.quickstart-choice { display: grid; gap: 2px; justify-items: start; text-align: left; min-height: 56px; padding: 12px 14px; height: auto; }
.quickstart-choice b { font-size: 14px; }
.quickstart-choice small { font-size: 12px; opacity: .8; font-weight: 400; }
.quickstart-more { margin-top: 10px; padding: 10px 2px; min-height: 44px; background: none; border: 0; color: var(--teal-ink, var(--teal)); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }

/* Ficha do imóvel: as ações para este imóvel primeiro; o resto, e a ação destrutiva, à parte. */
.prop-actions { display: grid; gap: 14px; margin-top: 18px; }
.prop-actions-main { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--product-line, rgba(127,127,127,.22)); border-radius: 12px; }
.prop-actions-row { display: flex; flex-wrap: wrap; gap: 8px; }
.prop-actions-row .btn { min-height: 44px; }
.prop-actions-more { display: flex; flex-wrap: wrap; gap: 8px; }
.prop-actions-more .btn { min-height: 44px; }
.prop-actions-more .prop-delete { margin-left: auto; color: #b4452f; }
.listing-quality-progress { margin: 0 0 8px; }

/* Leads: estado na fila (sem resposta, a aguardar, seguimento vencido). Clientes: relação e último contacto. */
.lead-state { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: rgba(127,127,127,.14); }
.lead-state.sem_resposta { background: rgba(180,69,47,.14); color: #b4452f; }
.lead-state.seguimento_vencido { background: rgba(232,180,90,.2); color: #8a5a00; }
.lead-state.a_aguardar { background: rgba(23,157,139,.14); color: var(--teal-ink, #0e6e60); }
.lead-origin { opacity: .85; }
.lead-status { display: grid; gap: 2px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--product-line, rgba(127,127,127,.22)); }
.lead-status b { font-size: 14px; }
.lead-status span { font-size: 12.5px; color: var(--product-muted); }
.lead-status.sem_resposta { border-color: #b4452f; }
.lead-status.seguimento_vencido { border-color: #c98a00; }
.lead-conv .acts button.primary { background: var(--teal); color: #fff; border-color: var(--teal); font-weight: 600; min-height: 44px; }
.crm-lastcontact { display: block; margin-top: 3px; color: var(--mist2); font: 9px var(--mono); }
.client-relation { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; padding: 14px; border: 1px solid var(--product-line, rgba(127,127,127,.22)); border-radius: 12px; }
.client-relation.attention { border-color: #c98a00; }
.client-relation-main { display: grid; gap: 3px; min-width: 0; }
.client-relation-main small { color: var(--product-muted); font-size: 12px; }
.client-relation-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.client-relation-actions .btn { min-height: 44px; }

/* ============================================================
   Hoje como fila de trabalho: Agora · Mais tarde hoje · Por fechar.
   As três primeiras linhas de «Agora» são as prioridades do primeiro ecrã.
   ============================================================ */
.hoje-fila { display: grid; gap: 14px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 980px) {
  .hoje-fila { grid-template-columns: 1.3fr 1fr; }
  .hoje-fila > .hoje-agora { grid-row: span 2; }
}
.hoje-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; min-height: 56px; border-top: 1px solid var(--product-line, rgba(127,127,127,.18)); cursor: pointer;
}
.hoje-item:first-of-type { border-top: 0; }
.hoje-item.hoje-destaque { padding: 16px 14px; margin: 0 0 8px; border: 1px solid var(--product-line, rgba(127,127,127,.22)); border-radius: 12px; }
.hoje-item .hoje-item-main { display: grid; gap: 2px; min-width: 0; }
.hoje-item .hoje-item-main b { font-size: 14px; }
.hoje-item.hoje-destaque .hoje-item-main b { font-size: 15px; }
.hoje-item .hoje-item-main small { color: var(--product-muted); font-size: 12px; }
.hoje-item .why { font-size: 12.5px; line-height: 1.45; color: var(--product-muted); }
.hoje-item .btn { flex: none; min-height: 44px; }
.hoje-item:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.hoje-mais { margin: 8px 0 0; font-size: 12px; color: var(--product-muted); }
.hoje-outcomes { display: grid; gap: 6px; }
.hoje-outcome { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--product-line, rgba(127,127,127,.22)); border-radius: 10px; cursor: pointer; font-size: 13px; }
.hoje-outcome:has(input:checked) { border-color: var(--teal); }

/* Estado do negócio no topo da sala do negócio e botão principal «Registar resultado» na agenda. */
.deal-status { border: 1px solid var(--product-line, rgba(127,127,127,.22)); border-radius: 12px; padding: 14px; }
.deal-status.attention { border-color: var(--amber, #e8b45a); }
.deal-status-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.deal-status-grid > div { display: grid; gap: 2px; min-width: 0; }
.deal-status-grid > .wide { grid-column: 1 / -1; }
.deal-status-grid span { font-size: 10.5px; letter-spacing: .08em; color: var(--product-muted); }
.deal-status-grid b { font-size: 14px; }
.deal-status-grid small { font-size: 12px; color: var(--product-muted); }
.deal-status-grid small.late { color: #b4452f; font-weight: 600; }
.deal-status-advance { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--product-line, rgba(127,127,127,.22)); display: grid; gap: 8px; }
.deal-status-advance > b.blocked { color: #b4452f; }
.deal-status-advance > b.clear { color: var(--teal-ink, var(--teal)); }
.deal-status-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.deal-status-item > span { display: grid; gap: 2px; min-width: 0; }
.deal-status-item small { font-size: 12px; color: var(--product-muted); }
.deal-status-item .btn { flex: none; min-height: 44px; }
@media (max-width: 560px) { .deal-status-item { flex-direction: column; align-items: stretch; } }
#agenda .audit-agenda-event-actions .btn-primary { min-height: 44px; }

/* ============================================================
   Vidro, ao jeito do Revolut: painéis fosqueados e translúcidos sobre um fundo de gradiente com cor.
   Superfícies que flutuam (barra do topo, barra lateral, folha lateral, diálogos, paleta) levam desfocagem forte e uma luz
   na borda de cima. Os cartões principais de cada ecrã também desfocam; a regra geral dos cartões não (a Contabilidade tem
   dezenas e o custo não compensa), só translucidez e brilho. Atrás há um gradiente de cor: sem nada para desfocar o vidro não
   se lê. O texto fica sempre sobre uma camada com opacidade suficiente para manter o contraste.
   Recuos: sem backdrop-filter, transparência reduzida e contraste aumentado ficam opacos. Sem movimento novo.
   ============================================================ */
:root {
  --glass-tint: rgba(255, 255, 255, .54);
  --glass-tint-strong: rgba(255, 255, 255, .62);
  --glass-sheen: linear-gradient(150deg, rgba(255, 255, 255, .74), rgba(255, 255, 255, .5));
  --glass-border: rgba(255, 255, 255, .78);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(255, 255, 255, .25);
  --glass-blur: blur(22px) saturate(1.7);
  --glass-blur-card: blur(16px) saturate(1.5);
  --glass-blur-heavy: blur(34px) saturate(1.8);
  --glass-shadow: 0 12px 38px rgba(23, 55, 47, .11);
  --glass-shadow-heavy: 0 34px 100px rgba(15, 35, 29, .26);
  --glow-a: rgba(84, 203, 184, .36);
  --glow-b: rgba(231, 179, 103, .26);
  --glow-c: rgba(98, 156, 224, .22);
}
[data-theme="dark"] {
  --glass-tint: rgba(20, 35, 30, .5);
  --glass-tint-strong: rgba(20, 35, 30, .6);
  --glass-sheen: linear-gradient(150deg, rgba(235, 244, 238, .11), rgba(235, 244, 238, .035));
  --glass-border: rgba(235, 244, 238, .17);
  --glass-edge: inset 0 1px 0 rgba(235, 244, 238, .16), inset 0 -1px 0 rgba(235, 244, 238, .04);
  --glass-shadow: 0 14px 44px rgba(0, 0, 0, .38);
  --glass-shadow-heavy: 0 34px 100px rgba(0, 0, 0, .55);
  --glow-a: rgba(84, 203, 184, .24);
  --glow-b: rgba(207, 128, 97, .17);
  --glow-c: rgba(98, 156, 224, .16);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  /* Gradiente de cor por trás de tudo. */
  .app {
    background-image:
      radial-gradient(980px 680px at 90% -8%, var(--glow-a), transparent 62%),
      radial-gradient(900px 680px at -8% 106%, var(--glow-b), transparent 62%),
      radial-gradient(760px 560px at 36% 46%, var(--glow-c), transparent 66%) !important;
    background-attachment: fixed !important;
  }

  /* Barra do topo (desktop): o conteúdo passa por baixo. No telemóvel já tem o seu vidro. */
  @media (min-width: 901px) {
    .app .top {
      background: var(--glass-tint) !important;
      -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
      border: 1px solid var(--glass-border);
      box-shadow: var(--glass-shadow), var(--glass-edge);
    }
  }

  /* Cartões: translucidez e brilho em todos; desfocagem só nos principais de cada ecrã. Cartões dentro de cartões ficam sólidos. */
  .app .card {
    background: var(--glass-sheen), var(--glass-tint-strong);
    border-color: var(--glass-border);
    box-shadow: var(--glass-shadow), var(--glass-edge);
  }
  .app .card.hoje-block, .app .premium-card, .app .deal-status, .app .client-relation, .app .prop-actions-main, .app .lead-status {
    -webkit-backdrop-filter: var(--glass-blur-card); backdrop-filter: var(--glass-blur-card);
  }
  .app .card .card {
    background: var(--product-surface-soft);
    box-shadow: none;
  }

  /* Barra lateral: verde profundo em vidro, o gradiente de cor passa ligeiramente por baixo. */
  @media (min-width: 901px) {
    .app .side {
      background: linear-gradient(180deg, rgba(7, 33, 27, .91), rgba(7, 33, 27, .95)) !important;
      -webkit-backdrop-filter: blur(28px) saturate(1.6); backdrop-filter: blur(28px) saturate(1.6);
      border: 1px solid rgba(255, 255, 255, .13);
      box-shadow: 0 24px 64px rgba(7, 33, 27, .3), inset 0 1px 0 rgba(255, 255, 255, .18);
    }
  }

  /* Folha lateral e diálogos: as superfícies mais grossas, por isso mais desfocagem e sombra mais funda. */
  body .sheet {
    background: color-mix(in srgb, var(--ink) 78%, transparent);
    -webkit-backdrop-filter: var(--glass-blur-heavy); backdrop-filter: var(--glass-blur-heavy);
    border-left: 1px solid var(--glass-border);
    box-shadow: -26px 0 76px rgba(15, 35, 29, .2), var(--glass-edge);
  }
  body .modal {
    background: color-mix(in srgb, var(--ink) 80%, transparent);
    -webkit-backdrop-filter: var(--glass-blur-heavy); backdrop-filter: var(--glass-blur-heavy);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow-heavy), var(--glass-edge);
  }
  /* Esmaece para focar, sem esconder o contexto: o vidro precisa de ver o que está por baixo. */
  body .overlay { background: rgba(12, 22, 18, .3); -webkit-backdrop-filter: blur(8px) saturate(1.2); backdrop-filter: blur(8px) saturate(1.2); }

  .dg-palette__panel {
    background: color-mix(in srgb, var(--product-surface) 78%, transparent);
    -webkit-backdrop-filter: var(--glass-blur-heavy); backdrop-filter: var(--glass-blur-heavy);
    border-color: var(--glass-border);
    box-shadow: var(--glass-shadow-heavy), var(--glass-edge);
  }
}

/* Transparência reduzida: tudo opaco, sem desfocagem nem gradiente de cor. */
@media (prefers-reduced-transparency: reduce) {
  .app { background-image: none !important; }
  .app .top, .app .card, .app .side, body .sheet, body .modal, .dg-palette__panel {
    background: var(--product-surface) !important;
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  }
  .app .side { background: #07211b !important; }
  body .overlay { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(12, 22, 18, .6); }
}
/* Contraste aumentado: opaco e com borda definida. */
@media (prefers-contrast: more) {
  .app .top, .app .card, body .sheet, body .modal, .dg-palette__panel {
    background: var(--product-surface) !important;
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    border: 1px solid var(--product-line-strong) !important;
  }
}

/* ============================================================
   Revolut, segunda passagem (vidro a sério).
   Comparação com a referência (web e telemóvel):
   - O Revolut quase não tem «caixas»: barra lateral sem contorno pesado, item ativo como pílula suave, botões em pílula de vidro.
   - No telemóvel tudo flutua em vidro sobre um fundo com cor: botões redondos, pesquisa em pílula, barra inferior flutuante.
   - O nosso fundo era quase liso, por isso o vidro não se via. Agora o fundo tem malha de cor mais viva e as superfícies lêem-se por cima dela.
   Recuos como antes: sem backdrop-filter, transparência reduzida e contraste aumentado ficam opacos.
   ============================================================ */
:root {
  --glow-a: rgba(72, 208, 186, .42);
  --glow-b: rgba(232, 168, 92, .30);
  --glow-c: rgba(104, 128, 232, .28);
  --pill-fill: rgba(255, 255, 255, .62);
  --pill-border: rgba(255, 255, 255, .85);
}
[data-theme="dark"] {
  --glow-a: rgba(58, 206, 182, .46);
  --glow-b: rgba(128, 96, 236, .42);
  --glow-c: rgba(236, 130, 92, .22);
  --pill-fill: rgba(255, 255, 255, .075);
  --pill-border: rgba(255, 255, 255, .15);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  /* Malha de cor: mais pontos de luz, mais viva, ainda por trás de tudo. O seletor tem de ganhar a
     «[data-theme=dark] .app { background: … !important }», que antes a apagava no escuro. */
  html .app, html[data-theme] .app {
    background-image:
      radial-gradient(900px 620px at 92% -6%, var(--glow-a), transparent 60%),
      radial-gradient(860px 640px at -6% 104%, var(--glow-b), transparent 60%),
      radial-gradient(680px 520px at 62% 58%, var(--glow-c), transparent 66%),
      radial-gradient(520px 420px at 18% 12%, var(--glow-c), transparent 70%) !important;
  }

  /* Botões secundários em pílula de vidro (o primário mantém a cor da marca). */
  .app .btn-ghost, .app .page .btn:not(.btn-primary):not(.btn-danger) {
    background: var(--pill-fill);
    border: 1px solid var(--pill-border);
    border-radius: 999px;
    -webkit-backdrop-filter: blur(14px) saturate(1.5); backdrop-filter: blur(14px) saturate(1.5);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
  }

  /* Cartões: cantos mais redondos e menos contorno, como os widgets do Revolut. */
  .app .card { border-radius: 22px; }

  @media (min-width: 901px) {
    /* A barra do topo flutua sobre o início do conteúdo e tapava o título da página: damos-lhe o espaço que ocupa. */
    .app .scroll { padding-top: 26px; }
    /* Botão de sair: vidro, não um quadrado branco. */
    .app .side .agent-logout {
      background: rgba(255, 255, 255, .12) !important; color: #fff !important;
      border: 1px solid rgba(255, 255, 255, .2) !important; border-radius: 12px;
    }
    /* Barra lateral: vidro em vez de caixa. No escuro quase some; no claro mantém o verde profundo com contraste medido. */
    [data-theme="dark"] .app .side {
      background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .025)) !important;
      border: 1px solid rgba(255, 255, 255, .09);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
    }
    /* Item ativo: pílula de vidro suave, não bloco de cor cheia. */
    .app .side .nav a.on, .app .side .nav a[aria-current="page"] {
      background: rgba(255, 255, 255, .15) !important;
      color: #fff !important;
      border-radius: 14px;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22);
    }
    .app .side .nav a.on::before { display: none; }
  }

  /* Telemóvel: tudo flutua em vidro sobre o fundo de cor. */
  @media (max-width: 900px) {
    .app .top {
      background: transparent !important; border: 0 !important; box-shadow: none !important;
      -webkit-backdrop-filter: none; backdrop-filter: none;
    }
    .app .top .hamb, .app .top .mobile-search-trigger, .app .top #notifBtn, .app .top #quickAdd {
      width: 44px; height: 44px; min-width: 44px; padding: 0;
      border-radius: 50%;
      background: var(--pill-fill); border: 1px solid var(--pill-border);
      -webkit-backdrop-filter: blur(16px) saturate(1.6); backdrop-filter: blur(16px) saturate(1.6);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 18px rgba(0, 0, 0, .14);
      display: inline-grid; place-items: center;
    }
    /* A ação principal do topo mantém a cor da marca (com o vidro claro o «+» branco desaparecia). */
    .app .top #quickAdd { background: #17372f !important; color: #fff !important; border-color: rgba(255, 255, 255, .22); }
    /* Barra inferior flutuante: vidro, cantos grandes; «Novo» mantém a cor. */
    .mobile-action-dock {
      background: var(--glass-tint-strong) !important;
      border: 1px solid var(--glass-border) !important;
      border-radius: 28px !important;
      -webkit-backdrop-filter: blur(26px) saturate(1.7); backdrop-filter: blur(26px) saturate(1.7);
      box-shadow: var(--glass-shadow-heavy), var(--glass-edge) !important;
    }
    .mobile-action-dock button { border-radius: 20px; }
    .mobile-dock-secondary {
      background: var(--pill-fill) !important; color: var(--bone) !important;
      border: 1px solid var(--pill-border);
    }
    .app .card { border-radius: 24px; }
  }
}
@media (prefers-reduced-transparency: reduce) {
  .app .btn-ghost, .app .page .btn:not(.btn-primary):not(.btn-danger), .app .top .hamb, .app .top .mobile-search-trigger,
  .app .top #notifBtn, .app .top #quickAdd, .mobile-action-dock {
    background: var(--product-surface) !important;
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  }
}

/* ============================================================
   Texto mínimo de 11 px (e KPIs maiores).
   Quem testou pediu texto maior nos indicadores de Clientes. Uma varredura às páginas principais em desktop encontrou texto
   de 8 a 10,7 px em dezenas de sítios, abaixo do mínimo que já tínhamos no telemóvel. Seletores exatos e conhecidos, de propósito:
   um «span» ou «small» genérico apanharia também números grandes e etiquetas que já estão bem.
   ============================================================ */
/* Indicadores (Clientes e Leads): número, legenda e texto de apoio maiores. */
.crm-kpi b { font-size: 28px; }
.crm-kpi span { font-size: 11px; letter-spacing: .05em; }
.crm-kpi small { font-size: 12.5px; }
/* Resto: 11 px no mínimo. */
.crm-info-grid > div > span,
.crm-stage,
.lead-it .meta .src, .ai-badge,
.audit-agenda-day-head small,
.deal .dmeta .adv, .deal .dv small, .deal .dmeta .dcom, .deal .dmeta .dcom small, .kcol-b .deal > div,
.cont-cash-col span, .kpi .l, .cont-balance-split span, .audit-cashflow-legend span, .cont-context-label, #contSaveState,
.docs-trust span, .doc-row td span, .tpl > div > span.mono, .responsive-field > label,
.premium-market-top, .premium-task small, .premium-task-meta, .premium-deal-stage small,
.dash-priority small, .dash-priority .go, .task .tm,
.kpi .delta,
th, td.mono { font-size: 11px; }

/* Segunda passagem: o que a re-medição ainda encontrou abaixo de 11 px. As regras inline usam seletores por id
   (#page-… .x) e ganham por especificidade; o :is() com os ids das páginas iguala o peso e a ordem decide. */
:is(#page-hoje,#page-clientes,#page-agenda,#page-imoveis,#page-precos,#page-documentos,#page-contabilidade,#page-market-statistics)
:is(th, td.mono, span.mono, .eyebrow, .l, .tl, .ey, .kpi > div, .badge, .field > label, .responsive-field > label,
  #clientRows small, .pm-data-status, .pm-proof span, .pm-proof small, .pm-map-legend span, .pm-source, .pm-source button,
  .pm-zoom-level, #pmFxStatus span, .pm-head > span, .meta span, .doc-row span, .docs-trust span,
  .cont-command-actions button, .cont-attention-item span, .cont-attention-item button, .cont-mini-badge,
  .ms-agent-details small, .ms-rank-card small, .ms-rank-source, .ms-rank-source a, .ms-rank-disclaimer, .ms-provenance) { font-size: 11px; }
/* Menu lateral e barra de topo (fora das páginas). */
html body :is(.nav-tools .nav-dept-copy small, .nav-dept-copy small, .data-trust-state, .lang-menu-trigger span, .lang-menu-trigger em, .notif-badge) { font-size: 11px; }
/* Estes têm font-size no atributo style (inline): só um !important o supera. Alvos exatos, de propósito. */
#contKpis .kpi > div:not(.v), #clientRows td small, #docRows td span { font-size: 11px !important; }

/* Tabelas largas em janelas de ~900-1100 px: o cartão tinha overflow:hidden e cortava as últimas colunas (contacto, ações)
   sem qualquer forma de lá chegar. Passa a deslizar na horizontal; o raio dos cantos mantém-se. */
#clientListCard, .card:has(> .responsive-record-table), .card:has(> table) { overflow-x: auto; overflow-y: hidden; }

/* Ficha rápida no Modo visita. */
.vs { display: grid; gap: 10px; margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.vs summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.vs-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0; }
.vs-facts div { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--slate, rgba(0,0,0,.04)); }
.vs-facts div:last-child:nth-child(odd) { grid-column: 1 / -1; }
.vs-facts dt { font-size: 11px; color: var(--mist); text-transform: uppercase; letter-spacing: .04em; }
.vs-facts dd { margin: 0; font-size: 15px; font-weight: 600; }
.vs-owner { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.vs-note { margin: 0; font-size: 11.5px; color: var(--mist); }
@media (max-width: 900px) { .vs .btn { min-height: 44px; } .vs input, .vs textarea { font-size: 16px; } }

/* Colar contacto (formulário «Novo lead»). */
.lp { display: grid; gap: 8px; margin-bottom: 16px; padding: 12px; border: 1.5px dashed var(--line-strong, var(--line)); border-radius: 14px; }
.lp-label { font-size: 12px; font-weight: 700; }
.lp textarea { width: 100%; min-height: 76px; font: 14px/1.45 var(--sans); resize: vertical; }
.lp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lp-result { font-size: 12px; color: var(--mist); min-height: 1em; }
.lp input[data-auto="1"], .field input[data-auto="1"], .field select[data-auto="1"], .field textarea[data-auto="1"] { box-shadow: inset 0 0 0 1.5px var(--teal, currentColor); }
@media (max-width: 900px) { .lp textarea { font-size: 16px; } .lp-actions .btn { min-height: 44px; } }

/* Compositor de mensagens do consultor (lead, cliente, visita, imóvel). */
.msg-composer { display: grid; gap: 10px; }
.msg-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.msg-tabs .chip.on { background: var(--teal-dim, rgba(52, 208, 186, .18)); color: var(--teal-ink, inherit); border-color: var(--teal, currentColor); }
.msg-when { margin: 0; font-size: 12px; color: var(--mist); }
.msg-label { font-size: 12px; font-weight: 600; }
.msg-composer textarea { width: 100%; min-height: 168px; font: 15px/1.5 var(--sans); resize: vertical; }
.msg-warn { font-size: 12px; padding: 8px 10px; border-radius: 10px; background: rgba(224, 164, 88, .16); color: var(--ink, inherit); border: 1px solid rgba(224, 164, 88, .4); }
.msg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.msg-editor { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.msg-editor summary { cursor: pointer; font-size: 12px; font-weight: 600; }
.msg-editor p { font-size: 11.5px; color: var(--mist); line-height: 1.6; }
.msg-editor code { font-size: 11px; }
.msg-tabs .chip { opacity: .72; }
.msg-tabs .chip.on { opacity: 1; font-weight: 700; box-shadow: inset 0 0 0 1.5px currentColor; }
@media (max-width: 900px) { .msg-composer textarea { font-size: 16px; } .msg-actions .btn { min-height: 44px; } }

/* Documentos da angariação (ficha do imóvel). */
.pdocs { display: grid; gap: 8px; margin-top: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.pdocs-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.pdocs-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pdocs-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.pdocs-bar i { display: block; height: 100%; background: var(--teal, #34d0ba); border-radius: inherit; }
.pdocs-row { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.pdocs-row:first-of-type { border-top: 0; }
.pdocs-ic { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 700; border: 1.5px solid var(--line-strong, var(--line)); }
.pdocs-row[data-status="tem"] .pdocs-ic { background: var(--teal, #34d0ba); border-color: var(--teal, #34d0ba); color: #fff; }
.pdocs-row[data-status="pedido"] .pdocs-ic { border-color: #d9a441; color: #b07a16; }
.pdocs-row[data-status="na"] { opacity: .65; }
.pdocs-txt { display: grid; gap: 2px; min-width: 0; }
.pdocs-txt b { font-size: 13px; }
.pdocs-txt small { font-size: 12px; color: var(--mist); line-height: 1.4; }
.pdocs-row select { min-width: 112px; }
.pdocs-note { margin: 4px 0 0; font-size: 11px; color: var(--mist); }
@media (max-width: 900px) { .pdocs-row { grid-template-columns: 24px 1fr; } .pdocs-row select { grid-column: 2; min-height: 44px; } .pdocs-actions .btn { min-height: 44px; } }

/* Resultado rápido da visita («Como correu?»). */
.vq { display: grid; gap: 8px; margin-top: 15px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.vq-row { display: flex; flex-wrap: wrap; gap: 8px; }
.vq-interest { display: grid; grid-template-columns: repeat(3, 1fr); }
.vq-btn { display: grid; gap: 2px; padding: 12px 8px; min-height: 56px; text-align: center; border-radius: 12px; border: 1.5px solid var(--line); background: transparent; color: inherit; cursor: pointer; }
.vq-btn b { font-size: 15px; }
.vq-btn small { font-size: 11px; opacity: .8; }
.vq-btn.on { border-width: 2px; font-weight: 700; }
.vq-btn.vq-quente.on { border-color: #d6603a; background: rgba(214, 96, 58, .14); }
.vq-btn.vq-morno.on { border-color: #d9a441; background: rgba(217, 164, 65, .16); }
.vq-btn.vq-frio.on { border-color: #5f93d6; background: rgba(95, 147, 214, .14); }
.vq-tag { opacity: .75; }
.vq-tag.on { opacity: 1; font-weight: 700; box-shadow: inset 0 0 0 1.5px currentColor; }
.vq-follow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; }
.vq-follow[hidden] { display: none; }
.vq-follow input { width: auto; }
@media (max-width: 900px) { .vq-btn { min-height: 64px; } .vq-tag { min-height: 40px; } }

/* ============================================================
   Oportunidades no telemóvel: filtros recolhíveis.
   Antes, os nove controlos ocupavam o ecrã inteiro e o primeiro resultado ficava ~880 px abaixo do topo.
   Agora só ficam visíveis a pesquisa e o botão «Filtros (n)»; o resto abre ao tocar. No desktop nada muda. */
.opp-filters-toggle { display: none; }
@media (max-width: 760px) {
  html body #page-oportunidades #oppTools { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; gap: 8px; }
  html body #page-oportunidades #oppTools > #oppQuery { grid-column: span 4; }
  html body #page-oportunidades #oppTools > .opp-filters-toggle {
    display: inline-flex; grid-column: span 2; align-items: center; justify-content: center; gap: 6px;
    min-height: 44px; padding: 0 10px; white-space: nowrap;
  }
  html body #page-oportunidades #oppTools > .opp-filters-toggle svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
  html body #page-oportunidades #oppTools > .opp-filters-toggle .opp-filters-count {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
    background: var(--teal, #1a9f8a); color: #fff; font: 700 11px/1 var(--mono, monospace);
  }
  html body #page-oportunidades #oppTools > .opp-filters-toggle .opp-filters-count[hidden] { display: none; }
  html body #page-oportunidades.opp-filters-open #oppTools > .opp-filters-toggle { background: var(--teal-dim, rgba(26, 159, 138, .12)); border-color: var(--teal-line, rgba(26, 159, 138, .4)); }
  /* Controlos secundários: dois por linha quando abertos. */
  html body #page-oportunidades #oppTools > select,
  html body #page-oportunidades #oppTools > input:not(#oppQuery) { grid-column: span 3; min-height: 44px; }
  html body #page-oportunidades #oppTools > button:not(.opp-filters-toggle) { grid-column: 1 / -1; min-height: 44px; }
  /* Recolhido (por omissão): só a pesquisa e o botão. */
  html body #page-oportunidades:not(.opp-filters-open) #oppCountries,
  html body #page-oportunidades:not(.opp-filters-open) #oppTools > :not(#oppQuery):not(.opp-filters-toggle) { display: none !important; }
}

/* Painel Casafari: nota de que tipo, preço e quartos acompanham os filtros principais. */
.casafari-sync-note { margin: 0 0 10px; font-size: 12px; line-height: 1.5; color: var(--mist, #51655c); }
.casafari-sync-note:empty { display: none; }
