/* ============================================================
   MeuCondomínio — White Luxury theme
   Centralized core stylesheet. Theme variables drive everything;
   add per-module overrides in /css/modules/*.css without touching core.
   ============================================================ */

:root {
  /* White Luxury palette */
  --bg: #FFFFFF;
  --bg-secondary: #F8F8F8;
  --card: #FFFFFF;
  --text: #111111;
  --text-secondary: #666666;
  --gold: #D4AF37;
  --gold-hover: #B8860B;
  --gold-soft: #FBF6E6;
  --border: #E5E7EB;
  --positive: #16A34A;
  --positive-soft: #E7F6EC;
  --negative: #DC2626;
  --negative-soft: #FCEBEA;
  --pending: #F59E0B;
  --pending-soft: #FEF3DD;
  --info: #6366F1;
  --info-soft: #ECECFB;

  --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.04);
  --shadow: 0 4px 16px rgba(17, 17, 17, 0.06);
  --shadow-lg: 0 12px 32px rgba(17, 17, 17, 0.08);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --sidebar-w: 264px;
  --sidebar-compact-w: 76px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

/* ============================================================
   THEMES — switch via [data-theme] on <html>. White Luxury is
   the default (:root above). Each block only overrides palette
   tokens, so every component adapts automatically.
   ============================================================ */

/* Rose Gold — warm blush + rose-gold accent on white */
[data-theme="rose-gold"] {
  --bg: #FFFFFF;
  --bg-secondary: #FBF7F6;
  --card: #FFFFFF;
  --text: #1A1213;
  --text-secondary: #7A6A6C;
  --gold: #B76E79;
  --gold-hover: #9A5460;
  --gold-soft: #FBEAED;
  --border: #EFE3E4;
  --info: #C08497;
  --info-soft: #F7E9EE;
}

/* Azure — clean blue accent on white */
[data-theme="azure"] {
  --bg: #FFFFFF;
  --bg-secondary: #F4F7FC;
  --card: #FFFFFF;
  --text: #0F172A;
  --text-secondary: #64748B;
  --gold: #2F6FED;
  --gold-hover: #1E4FB8;
  --gold-soft: #E8F0FE;
  --border: #E3E9F2;
  --info: #6366F1;
  --info-soft: #ECECFB;
}

/* Obsidian Gold — dark luxury with gold accent */
[data-theme="obsidian-gold"] {
  --bg: #0E0E10;
  --bg-secondary: #131316;
  --card: #1A1A1E;
  --text: #F5F5F4;
  --text-secondary: #9CA0A8;
  --gold: #D4AF37;
  --gold-hover: #E6C552;
  --gold-soft: #2A2616;
  --border: #2A2A30;
  --positive-soft: #16331F;
  --negative-soft: #3A1D1D;
  --pending-soft: #3A2E12;
  --info: #818CF8;
  --info-soft: #23233A;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.6);
}
[data-theme="obsidian-gold"] .badge-muted { background: #26262C; color: #A0A0A8; }
[data-theme="obsidian-gold"] table.data tbody tr:hover { background: #202026; }
[data-theme="obsidian-gold"] .icon-btn,
[data-theme="obsidian-gold"] .user-chip,
[data-theme="obsidian-gold"] .select-pill,
[data-theme="obsidian-gold"] .form-control { background: #1A1A1E; }
[data-theme="obsidian-gold"] .qa-icon,
[data-theme="obsidian-gold"] .list-ico { background: #202026; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

/* ---------------- Layout shell ---------------- */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 30;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  transition: transform .22s ease;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
  border: 2px solid var(--bg);
}
.sidebar::-webkit-scrollbar-thumb:hover { background: #D1D5DB; }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left .22s ease;
}
.sidebar-collapsed .sidebar {
  width: var(--sidebar-compact-w);
  transform: none;
  overflow-x: hidden;
}
.sidebar-collapsed .main { margin-left: var(--sidebar-compact-w); }
.sidebar-collapsed .brand {
  justify-content: center;
  padding: 20px 8px 16px;
}
.sidebar-collapsed .brand-text { display: none; }
.sidebar-collapsed .nav { padding: 6px 8px; }
.sidebar-collapsed .nav-group-head { display: none; }
.sidebar-collapsed .nav-group.collapsed .nav-group-body { display: flex; }
.sidebar-collapsed .nav-group-body { gap: 4px; }
.sidebar-collapsed .nav-item {
  justify-content: center;
  width: 52px;
  min-height: 46px;
  padding: 11px;
  gap: 0;
  font-size: 0;
}
.sidebar-collapsed .nav-item svg {
  width: 21px;
  height: 21px;
}
.sidebar-collapsed .nav-item.active::before {
  top: 9px;
  bottom: 9px;
}
.sidebar-collapsed .sidebar-condo {
  margin: 8px;
  padding: 8px;
  border: 0;
}
.sidebar-collapsed .sidebar-condo > :not(.sc-icon) { display: none; }
.sidebar-collapsed .sidebar-condo .sc-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto;
}
.sidebar-collapse-toggle {
  position: fixed;
  top: 84px;
  left: calc(var(--sidebar-w) - 20px);
  z-index: 31;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: left .22s ease, color .15s, border-color .15s, box-shadow .15s;
}
.sidebar-collapse-toggle:hover {
  color: var(--gold-hover);
  border-color: var(--gold);
  box-shadow: var(--shadow-md);
}
.sidebar-collapse-toggle:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.sidebar-collapse-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform .22s ease;
}
.sidebar-collapsed .sidebar-collapse-toggle {
  left: calc(var(--sidebar-compact-w) - 20px);
}
.sidebar-collapsed .sidebar-collapse-toggle svg { transform: rotate(180deg); }

.content {
  padding: 28px 36px 40px;
  flex: 1;
}

/* ---------------- Brand ---------------- */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 22px 20px;
}
.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  color: var(--gold);
  flex-shrink: 0;
}
.brand-mark svg { width: 34px; height: 34px; stroke-width: 1.6; }
.brand-text .brand-title {
  font-size: 15px; font-weight: 800; letter-spacing: 0.06em;
  color: var(--text);
}
.brand-text .brand-sub {
  font-size: 9.5px; letter-spacing: 0.18em; color: var(--text-secondary);
  text-transform: uppercase; margin-top: 2px;
}

/* ---------------- Navigation ---------------- */
.nav {
  padding: 6px 14px;
  display: flex; flex-direction: column; gap: 2px;
  flex: 1;
}
.nav-section {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: #9CA3AF; padding: 16px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  position: relative;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 19px; height: 19px; stroke-width: 1.8; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-secondary); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, var(--gold-soft), rgba(251,246,230,0.4));
  color: var(--gold-hover);
  font-weight: 600;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 3px; background: var(--gold);
}
.nav-item.active svg { color: var(--gold-hover); }

/* collapsible nav groups */
.nav-grouped { gap: 0; }
.nav-group { display: flex; flex-direction: column; }
.nav-group-head {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: none; cursor: pointer;
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: #9CA3AF; font-weight: 700; padding: 16px 12px 6px;
}
.nav-group-head:hover { color: var(--text-secondary); }
.nav-group-head .ngh-label { display: flex; align-items: center; gap: 8px; }
.nav-group-head .ngh-label svg { width: 14px; height: 14px; stroke-width: 2; }
.nav-group-head .ngh-caret { width: 15px; height: 15px; transition: transform .15s; opacity: .7; }
.nav-group.collapsed .ngh-caret { transform: rotate(-90deg); }
.nav-group-body { display: flex; flex-direction: column; gap: 2px; }
.nav-group.collapsed .nav-group-body { display: none; }

/* condo card at bottom of sidebar */
.sidebar-condo {
  margin: 14px; padding: 20px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.sidebar-condo .sc-icon {
  width: 48px; height: 48px; margin: 0 auto 10px;
  display: grid; place-items: center;
  border-radius: 14px; background: var(--gold-soft); color: var(--gold-hover);
}
.sidebar-condo .sc-icon svg { width: 26px; height: 26px; stroke-width: 1.6; }
.sidebar-condo .sc-name { font-size: 13px; font-weight: 700; line-height: 1.3; }
.sidebar-condo .sc-nif { font-size: 11px; color: var(--text-secondary); margin: 6px 0 12px; }

/* ---------------- Topbar ---------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 36px 0;
}
.topbar .page-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 26px; font-weight: 800;
}
.topbar .page-title svg { width: 22px; height: 22px; color: var(--gold); }
.topbar .page-sub {
  display: flex; align-items: center; gap: 7px;
  color: var(--text-secondary); font-size: 13px; margin-top: 5px;
}
.topbar .page-sub svg { width: 15px; height: 15px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

/* ---------------- Topbar condominium switcher ---------------- */
.condo-switch { position: relative; }
.condo-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 8px; height: 42px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-pill); cursor: pointer; max-width: 260px;
  transition: border-color .15s, box-shadow .15s;
}
.condo-pill:hover { border-color: var(--gold); box-shadow: var(--shadow-sm); }
.condo-pill .cp-ico {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--gold-soft); color: var(--gold-hover);
}
.condo-pill .cp-ico svg { width: 17px; height: 17px; }
.condo-pill .cp-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.condo-pill .cp-label { font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-secondary); }
.condo-pill .cp-name {
  font-size: 13px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px;
}
.condo-pill .cp-chev { width: 16px; height: 16px; color: var(--text-secondary); flex-shrink: 0; }
.condo-opt {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: none; background: none; cursor: pointer;
  border-radius: var(--radius-sm); text-align: left;
}
.condo-opt:hover { background: var(--bg-secondary); }
.condo-opt.active { background: var(--gold-soft); }
.condo-opt .co-ico {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px;
  display: grid; place-items: center; background: var(--bg-secondary); color: var(--text-secondary);
}
.condo-opt.active .co-ico { background: var(--gold); color: #fff; }
.condo-opt .co-ico svg { width: 17px; height: 17px; }
.condo-opt .co-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.condo-opt .co-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.condo-opt .co-sub { font-size: 11.5px; color: var(--text-secondary); }
.condo-opt .co-check { width: 18px; height: 18px; color: var(--gold-hover); flex-shrink: 0; }

/* ---------------- Tabs ---------------- */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.tab {
  padding: 11px 18px; font-size: 14px; font-weight: 600; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; white-space: nowrap;
}
.tab svg { width: 16px; height: 16px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold-hover); border-bottom-color: var(--gold); }

/* ---------------- Form modal (overlay popup for Create/Generate forms) ---------------- */
.fm-overlay {
  position: fixed; inset: 0; z-index: 1200; display: none;
  align-items: flex-start; justify-content: center;
  background: rgba(0,0,0,.45); padding: 40px 16px; overflow-y: auto;
}
.fm-overlay.open { display: flex; }
.fm-box {
  background: var(--card); border-radius: 16px; width: min(880px, 100%);
  box-shadow: 0 24px 70px rgba(0,0,0,.32); margin: auto; overflow: hidden;
  display: flex; flex-direction: column; max-height: calc(100vh - 80px);
}
.fm-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.fm-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.fm-close {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text-secondary); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.fm-close:hover { color: var(--text); border-color: var(--gold); }
.fm-close svg { width: 17px; height: 17px; }
.fm-body { padding: 22px; overflow-y: auto; flex: 1 1 auto; }
.fm-body .fm-card { padding: 0; }
.fm-loading, .fm-error { padding: 30px; text-align: center; color: var(--text-secondary); }
@media (max-width: 560px) { .fm-overlay { padding: 16px 8px; } .fm-body { padding: 16px; } }

/* ---------------- Toast notifications (bottom, auto-dismiss) ---------------- */
.toast-stack {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; gap: 10px; z-index: 1400;
  width: min(92vw, 440px); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px; border-radius: var(--radius-sm); background: var(--card);
  border: 1px solid var(--border); border-left: 4px solid var(--border);
  box-shadow: 0 12px 32px rgba(0,0,0,.22); font-size: 13.5px; color: var(--text);
  animation: toast-in .25s ease-out;
}
.toast.toast-success { border-left-color: var(--positive); }
.toast.toast-success .toast-icon { color: var(--positive); }
.toast.toast-error { border-left-color: var(--negative); }
.toast.toast-error .toast-icon { color: var(--negative); }
.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast-icon svg { width: 18px; height: 18px; }
.toast-body { flex: 1 1 auto; line-height: 1.4; }
.toast-close {
  flex-shrink: 0; background: none; border: none; cursor: pointer; color: var(--text-secondary);
  padding: 0; font-size: 16px; line-height: 1; margin-top: -1px;
}
.toast-close:hover { color: var(--text); }
.toast.toast-leaving { animation: toast-out .18s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }
@media (max-width: 560px) { .toast-stack { width: 94vw; bottom: 12px; } }

/* ---------------- Confirm dialog (styled replacement for native confirm()) ---------------- */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 1300; display: none;
  align-items: center; justify-content: center; background: rgba(0,0,0,.45); padding: 16px;
}
.confirm-overlay.open { display: flex; }
.confirm-box {
  background: var(--card); border-radius: 16px; width: min(420px, 100%);
  box-shadow: 0 24px 70px rgba(0,0,0,.32); padding: 22px;
}
.confirm-box .confirm-title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.confirm-box .confirm-title svg { width: 20px; height: 20px; color: var(--negative); flex-shrink: 0; }
.confirm-box .confirm-message { color: var(--text-secondary); font-size: 13.5px; line-height: 1.5; margin-bottom: 20px; }
.confirm-box .confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------------- @mention autocomplete + highlight ---------------- */
.mention-dropdown {
  position: absolute; z-index: 1500; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.18); max-height: 220px; overflow-y: auto;
  min-width: 200px; display: none;
}
.mention-dropdown.open { display: block; }
.mention-option { padding: 8px 12px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.mention-option:hover, .mention-option.active { background: var(--gold-soft); color: var(--gold-hover); }
.mention-option .mo-type { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; margin-left: auto; }
.mention { color: var(--gold-hover); font-weight: 600; background: var(--gold-soft); padding: 1px 5px; border-radius: 5px; }

/* ---------------- Photo lightbox ---------------- */
.lightbox-overlay {
  position: fixed; inset: 0; z-index: 1600; display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.78); padding: 24px; cursor: zoom-out;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img { max-width: min(90vw, 640px); max-height: 85vh; border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.5); cursor: default; }
.lightbox-close {
  position: absolute; top: 20px; right: 24px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff; border: none; display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,.28); }
.lightbox-close svg { width: 20px; height: 20px; }

/* Condomínio section tabs: 9 items — wrap to a second line instead of showing a scrollbar,
   with slightly tighter spacing so they fit on one line on normal desktop widths. */
.tabs.condo-tabs { flex-wrap: wrap; row-gap: 0; overflow: visible; }
.tabs.condo-tabs .tab { white-space: nowrap; padding: 10px 12px; font-size: 13px; gap: 6px; }
.tabs.condo-tabs .tab svg { width: 15px; height: 15px; }

/* International phone input: custom country dropdown (real flag) + number field */
.phone-field { display: flex; gap: 8px; align-items: stretch; }
.phone-field .phone-number { flex: 1 1 auto; min-width: 0; }
.phone-cc { position: relative; flex: 0 0 auto; }
.phone-cc-btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  width: auto; min-width: 104px; padding-right: 10px; white-space: nowrap;
}
.phone-cc-flag { width: 22px; height: 16px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); flex: 0 0 auto; }
.phone-cc-code { font-weight: 600; }
.phone-cc-caret { width: 15px; height: 15px; opacity: .55; margin-left: auto; }
.phone-cc-menu {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0;
  list-style: none; margin: 0; padding: 5px; width: 250px; max-height: 280px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 11px;
  box-shadow: 0 14px 40px rgba(0,0,0,.16);
}
.phone-cc-opt {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px;
}
.phone-cc-opt:hover { background: var(--bg-secondary); }
.phone-cc-opt img { width: 22px; height: 16px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); flex: 0 0 auto; }
.phone-cc-opt .cc-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.phone-cc-opt .cc-dc { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
  .phone-field { flex-wrap: wrap; }
  .phone-cc, .phone-cc-btn { width: 100%; }
  .phone-cc-menu { width: 100%; }
}

/* hamburger (mobile) + sidebar overlay */
.hamburger {
  display: none;
  width: 40px; height: 40px; flex-shrink: 0;
  align-items: center; justify-content: center;
  border-radius: 11px; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); cursor: pointer;
}
.hamburger svg { width: 20px; height: 20px; }
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(17,17,17,0.42);
  z-index: 29; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

.icon-btn {
  position: relative; width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px; background: var(--bg); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--gold); color: #fff;
  font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--radius-pill);
  background: var(--bg); border: 1px solid var(--border);
  cursor: pointer;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-hover));
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-chip .uc-name { font-size: 13px; font-weight: 600; }
.user-chip svg { width: 16px; height: 16px; color: var(--text-secondary); }

/* ---------------- Cards ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.card-title { font-size: 16px; font-weight: 700; }
.card-link { color: var(--gold-hover); font-size: 12px; font-weight: 600; }

/* KPI cards */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px;
  margin-bottom: 22px;
}
.kpi {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 24px;
  display: flex; flex-direction: column; gap: 4px;
}
.kpi-top { display: flex; align-items: flex-start; gap: 16px; }
.kpi-icon {
  width: 50px; height: 50px; border-radius: 14px;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--gold-soft); color: var(--gold-hover);
}
.kpi-icon svg { width: 24px; height: 24px; stroke-width: 1.7; }
.kpi-icon.green { background: var(--positive-soft); color: var(--positive); }
.kpi-icon.red { background: var(--negative-soft); color: var(--negative); }
.kpi-icon.amber { background: var(--pending-soft); color: var(--pending); }
.kpi-icon.lg { width: 110px; height: 110px; border-radius: 18px; flex-shrink: 0; }
.kpi-icon.lg svg { width: 44px; height: 44px; }
.kpi-label { font-size: 13px; color: var(--text-secondary); }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin-top: 2px; }
.kpi-value.red { color: var(--negative); }
.kpi-sub { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.kpi-progress { height: 6px; border-radius: 6px; background: var(--border); margin-top: 12px; overflow: hidden; }
.kpi-progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-hover)); border-radius: 6px; }

/* dashboard grids */
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 0.85fr); }
.grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
/* Grid items default to min-width:auto, sized to their content's min-content width — a wide
   table inside a card would then force the card (and the whole grid track) to overflow instead
   of respecting the fr-based column width, breaking the two/three-up layout. Without this, only
   a .table-wrap's overflow-x:auto inside the card has no effect, since the card itself never
   shrinks in the first place. */
.grid-2 > .card, .grid-3 > .card { min-width: 0; }
.mt-22 { margin-top: 22px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 22px; align-items: start; }
.dash-rail { display: flex; flex-direction: column; gap: 22px; }
.dash-left { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.dash-left .grid-2 { min-width: 0; align-items: start; }
.dash-left .card { min-width: 0; }
/* Stack the inner two-up cards while the rail is still present, so they never cramp. */
@media (max-width: 1480px) { .dash-left .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1200px) { .dash-grid { grid-template-columns: 1fr; } }

/* finance summary mini */
.fin-row { display: flex; gap: 22px; margin-bottom: 14px; flex-wrap: nowrap; }
.fin-item .fin-label { font-size: 12px; color: var(--text-secondary); }
.fin-item .fin-value { font-size: 18px; font-weight: 800; white-space: nowrap; }
.fin-value.green { color: var(--positive); }
.fin-value.red { color: var(--negative); }

/* select pill */
.select-pill {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 12px; font-size: 12px; color: var(--text-secondary);
  background: var(--bg);
}

/* legend (donut) */
.legend { display: flex; flex-direction: column; gap: 11px; }
.legend-item { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 13px; }
.legend-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.legend-name { flex: 1; min-width: 0; color: var(--text); }
.legend-pct { color: var(--text-secondary); width: 38px; flex: 0 0 38px; text-align: right; white-space: nowrap; }
.legend-val { width: 72px; flex: 0 0 72px; text-align: right; font-weight: 600; white-space: nowrap; }
.category-breakdown { display:flex; align-items:center; gap:20px; min-width:0; }
.category-chart { position:relative; width:150px; height:150px; flex:0 0 150px; }
.category-breakdown .legend { flex:1 1 0; width:0; min-width:0; }

/* quick actions */
.qa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.qa {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 8px; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 9px;
  color: var(--text-secondary); transition: all .15s; cursor: pointer; min-height: 104px;
}
.qa:hover { border-color: var(--gold); color: var(--gold-hover); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.qa-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--bg-secondary); display: grid; place-items: center; color: var(--gold-hover); flex-shrink: 0; }
.qa-icon svg { width: 20px; height: 20px; }
.qa-label { font-size: 11.5px; font-weight: 600; color: var(--text); line-height: 1.25; }

/* list rows */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 0; border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-ico {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--bg-secondary); color: var(--text-secondary);
}
.list-ico svg { width: 19px; height: 19px; }
.list-ico.gold { background: var(--gold-soft); color: var(--gold-hover); }
.list-ico.green { background: var(--positive-soft); color: var(--positive); }
.list-ico.red { background: var(--negative-soft); color: var(--negative); }
.list-ico.amber { background: var(--pending-soft); color: var(--pending); }
.list-ico.info { background: var(--info-soft); color: var(--info); }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 13.5px; font-weight: 600; }
.list-sub { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.list-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.list-amount { font-size: 13.5px; font-weight: 700; }
.list-chevron { color: #C4C9D2; }
.list-chevron svg { width: 18px; height: 18px; }

.card-footer-link {
  display: block; text-align: center; padding: 13px 0 2px;
  margin-top: 6px; color: var(--gold-hover); font-weight: 600; font-size: 13px;
}

/* ---------------- Badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-success { background: var(--positive-soft); color: var(--positive); }
.badge-danger { background: var(--negative-soft); color: var(--negative); }
.badge-warning { background: var(--pending-soft); color: #B45309; }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #F1F2F4; color: #6B7280; }
.badge-gold { background: var(--gold-soft); color: var(--gold-hover); }

/* document category badges — distinct colour per category */
.badge-doc-ata { background: #E0ECFF; color: #1D4ED8; }
.badge-doc-regulamento { background: #EDE9FE; color: #6D28D9; }
.badge-doc-seguro { background: #CCFBF1; color: #0F766E; }
.badge-doc-contrato { background: #FEF3C7; color: #B45309; }
.badge-doc-fatura { background: #FFE4E6; color: #BE123C; }
.badge-doc-recibo { background: #DCFCE7; color: #15803D; }
.badge-doc-banco { background: #E0F2FE; color: #0369A1; }
.badge-doc-outro { background: #F1F2F4; color: #6B7280; }
[data-theme="obsidian-gold"] .badge-doc-ata { background: #16243D; color: #93B4FF; }
[data-theme="obsidian-gold"] .badge-doc-regulamento { background: #241B3D; color: #C4B0FF; }
[data-theme="obsidian-gold"] .badge-doc-seguro { background: #103330; color: #74E0CF; }
[data-theme="obsidian-gold"] .badge-doc-contrato { background: #33280F; color: #EAC069; }
[data-theme="obsidian-gold"] .badge-doc-fatura { background: #341019; color: #F79DB0; }
[data-theme="obsidian-gold"] .badge-doc-recibo { background: #122B1B; color: #7FD6A0; }
[data-theme="obsidian-gold"] .badge-doc-banco { background: #0C2A3D; color: #7DD3FC; }
[data-theme="obsidian-gold"] .badge-doc-outro { background: #26262C; color: #A0A0A8; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-hover); }
.btn-outline { background: var(--bg); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold-hover); }
.btn-outline-gold { background: var(--bg); border-color: var(--gold); color: var(--gold-hover); }
.btn-outline-gold:hover { background: var(--gold-soft); }
.btn-danger { background: var(--negative); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); }
.btn-sm { padding: 7px 13px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-secondary); font-weight: 600;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
table.data td {
  padding: 14px 14px; border-bottom: 1px solid var(--border);
  font-size: 13.5px; vertical-align: middle;
}
table.data tbody tr:hover { background: var(--bg-secondary); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data th a.th-sort {
  color: inherit; text-decoration: none; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 2px;
}
table.data th a.th-sort:hover { color: var(--gold-hover); }
.t-strong { font-weight: 600; }
.t-muted { color: var(--text-secondary); font-size: 12.5px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.icon-action {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--text-secondary); background: var(--bg);
}
.icon-action:hover { border-color: var(--gold); color: var(--gold-hover); }
.icon-action svg { width: 15px; height: 15px; }
.icon-action.danger:hover { border-color: var(--negative); color: var(--negative); }

/* ---------------- Page header (module pages) ---------------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-head h1 { font-size: 24px; }
.page-head .ph-sub { color: var(--text-secondary); font-size: 13px; margin-top: 5px; }
.page-actions { display: flex; gap: 10px; }

/* filter bar */
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }

/* forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.form-control, select.form-control, textarea.form-control {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13.5px; color: var(--text); background: var(--bg);
}
.form-control:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
textarea.form-control { resize: vertical; min-height: 90px; }
.field-validation-error, .validation-summary-errors { color: var(--negative); font-size: 12px; }
.form-actions { display: flex; gap: 12px; margin-top: 26px; }

/* custom checkbox — theme-aware (works across white/rose-gold/azure/obsidian-gold) */

/* empty state */
.empty {
  text-align: center; padding: 50px 20px; color: var(--text-secondary);
}
.empty svg { width: 46px; height: 46px; color: var(--border); margin-bottom: 12px; }
.empty h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }

/* stat mini cards row */
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.mini-stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.mini-stat .ms-label { font-size: 12px; color: var(--text-secondary); }
.mini-stat .ms-value { font-size: 22px; font-weight: 800; margin-top: 4px; }

/* footer */
.app-footer {
  display: flex; justify-content: space-between;
  padding: 18px 36px; color: var(--text-secondary); font-size: 12px;
  border-top: 1px solid var(--border); background: var(--bg);
}

/* alerts / toast */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 18px; }
.alert-success { background: var(--positive-soft); color: var(--positive); }
.alert-danger { background: var(--negative-soft); color: var(--negative); }

/* progress inline */
.pbar { height: 8px; border-radius: 8px; background: var(--border); overflow: hidden; }
.pbar > span { display: block; height: 100%; border-radius: 8px; background: var(--gold); }

/* responsive */
@media (max-width: 1200px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); z-index: 40; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .sidebar-collapsed .main { margin-left: 0; }
  .sidebar-collapse-toggle { display: none; }
  .sidebar-collapsed .sidebar {
    width: var(--sidebar-w);
    transform: translateX(-100%);
    overflow-y: auto;
  }
  .sidebar-collapsed .sidebar.open { transform: translateX(0); }
  .sidebar-collapsed .brand {
    justify-content: flex-start;
    padding: 24px 22px 20px;
  }
  .sidebar-collapsed .brand-text { display: block; }
  .sidebar-collapsed .nav { padding: 6px 14px; }
  .sidebar-collapsed .nav-group-head { display: flex; }
  .sidebar-collapsed .nav-group.collapsed .nav-group-body { display: none; }
  .sidebar-collapsed .nav-group-body { gap: 2px; }
  .sidebar-collapsed .nav-item {
    justify-content: flex-start;
    width: auto;
    min-height: 0;
    padding: 11px 14px;
    gap: 13px;
    font-size: 13px;
  }
  .sidebar-collapsed .nav-item svg { width: 19px; height: 19px; }
  .sidebar-collapsed .sidebar-condo {
    margin: 14px;
    padding: 20px 16px;
    border: 1px solid var(--border);
  }
  .sidebar-collapsed .sidebar-condo > :not(.sc-icon) { display: revert; }
  .sidebar-collapsed .sidebar-condo .sc-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
  }
  .hamburger { display: inline-flex; }
  .grid-3, .grid-2, .form-grid { grid-template-columns: 1fr; }
  .kpi-grid, .mini-stats { grid-template-columns: 1fr 1fr; }
  .content { padding: 20px; }
  .topbar { padding: 16px 20px 0; }
  .condo-pill .cp-text { display: none; }
  .condo-pill { padding: 6px; }
  .tabs.condo-tabs { flex-wrap: nowrap; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .main,
  .sidebar-collapse-toggle,
  .sidebar-collapse-toggle svg { transition: none; }
}
@media (max-width: 560px) {
  .kpi-grid, .mini-stats { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .topbar-right { width: 100%; min-width: 0; justify-content: flex-start; gap: 6px; }
  .topbar-right .user-chip { padding: 3px; }
  .topbar-right .user-chip > :not(.avatar) { display: none; }
  .category-breakdown { flex-direction: column; align-items: stretch; gap: 16px; }
  .category-chart { align-self: center; }
  .category-breakdown .legend { width: 100%; }
  .category-breakdown .legend-item { gap: 8px; }
  .category-breakdown .legend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .category-breakdown .legend-pct { width: 34px; flex-basis: 34px; }
  .category-breakdown .legend-val { width: 76px; flex-basis: 76px; }
  .dropdown-menu {
    width: min(280px, calc(100vw - 16px));
    min-width: 0;
    max-height: min(70vh, 520px);
    overflow-y: auto;
  }
  .dropdown-menu.narrow { width: min(210px, calc(100vw - 16px)); }
  #dd-condo .dropdown-menu { left: 0; right: auto; width: min(300px, calc(100vw - 16px)); }
  #dd-lang .dropdown-menu,
  #dd-theme .dropdown-menu { left: 0; right: auto; }
  #dd-bell .dropdown-menu { left: 50%; right: auto; transform: translateX(-55%); }
  #dd-user .dropdown-menu { right: 0; left: auto; }
  /* Unlike long content navigation, the Admin section has just six fixed destinations.
     A two-column grid keeps every destination visible immediately (the screenshot showed
     Backup, Email, and Security hidden beyond a horizontal scroll area). */
  .tabs.admin-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
    border: 0;
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
  }
  .tabs.admin-tabs .tab {
    justify-content: center;
    min-width: 0;
    padding: 10px 8px;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 12px;
  }
  .tabs.admin-tabs .tab.active {
    background: var(--card);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
  }
  /* Email has three fixed destinations; keep all of them visible without horizontal scrolling. */
  .tabs.email-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
    border: 0;
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
  }
  .tabs.email-tabs .tab {
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    padding: 10px 6px;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 12px;
  }
  .tabs.email-tabs .tab svg { display: none; }
  .tabs.email-tabs .tab.active {
    background: var(--card);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
  }
  .page-title { font-size: 20px !important; }
}
@media (max-width: 700px) {
  .responsive-table thead { display: none; }
  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td { display: block; width: 100%; }
  .responsive-table tr {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
  }
  .responsive-table tbody tr:last-child { border-bottom: none; }
  .responsive-table td {
    display: grid;
    grid-template-columns: minmax(92px, 38%) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border: 0;
    text-align: left;
    overflow-wrap: anywhere;
  }
  .responsive-table td::before {
    content: attr(data-label);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  .responsive-table td > .row-actions { justify-content: flex-start !important; }
  .responsive-table td .perfis { justify-content: flex-start; }
}

/* ---------------- Dropdowns (topbar) ---------------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 10px); right: 0;
  min-width: 280px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 8px; z-index: 60; display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu.narrow { min-width: 210px; }
.dd-head { padding: 10px 12px 8px; font-size: 13px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.dd-head .t-muted { font-weight: 500; }
.dd-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text); cursor: pointer;
}
.dd-item:hover { background: var(--bg-secondary); }
.dd-item svg { width: 17px; height: 17px; color: var(--text-secondary); }
.dd-item.danger, .dd-item.danger svg { color: var(--negative); }
.dd-divider { height: 1px; background: var(--border); margin: 6px 4px; }
.dd-alert { display: flex; align-items: flex-start; gap: 11px; padding: 10px 12px; border-radius: var(--radius-sm); }
.dd-alert:hover { background: var(--bg-secondary); }
.dd-alert .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.dd-alert .ic svg { width: 16px; height: 16px; }
.dd-alert .at { font-size: 13px; font-weight: 600; }
.dd-alert .as { font-size: 11.5px; color: var(--text-secondary); }
.dd-empty { padding: 22px 12px; text-align: center; color: var(--text-secondary); font-size: 13px; }

/* theme swatches */
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-opt {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; cursor: pointer; transition: all .15s; text-align: left;
}
.theme-opt:hover { border-color: var(--gold); }
.theme-opt.active { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.theme-opt .to-swatches { display: flex; gap: 6px; margin-bottom: 10px; }
.theme-opt .to-swatches span { width: 26px; height: 26px; border-radius: 7px; border: 1px solid rgba(0,0,0,0.06); }
.theme-opt .to-name { font-size: 13px; font-weight: 700; }
.theme-opt .to-check { float: right; color: var(--gold); display: none; }
.theme-opt.active .to-check { display: inline; }

/* theme menu item swatch row */
.theme-menu-opt { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.theme-menu-opt:hover { background: var(--bg-secondary); }
.theme-menu-opt .dots { display: flex; gap: 4px; }
.theme-menu-opt .dots span { width: 13px; height: 13px; border-radius: 50%; }
.theme-menu-opt .nm { flex: 1; font-size: 13px; font-weight: 600; }
.theme-menu-opt .ck { color: var(--gold); display: none; }
.theme-menu-opt.active .ck { display: inline; }

/* ---------------- Payment calendar (per fraction) ---------------- */
.paycal { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.paycal-cell {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 8px; text-align: center; position: relative;
}
.paycal-cell .pc-mes { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.paycal-cell .pc-val { font-size: 12.5px; font-weight: 700; margin-top: 4px; }
.paycal-cell .pc-dot { width: 9px; height: 9px; border-radius: 50%; margin: 8px auto 0; }
.paycal-cell.pago { background: var(--positive-soft); border-color: transparent; }
.paycal-cell.divida { background: var(--negative-soft); border-color: transparent; }
.paycal-cell.pendente { background: var(--pending-soft); border-color: transparent; }
.paycal-cell.vazio { opacity: 0.5; }
.pc-dot.pago { background: var(--positive); }
.pc-dot.divida { background: var(--negative); }
.pc-dot.pendente { background: var(--pending); }
.pc-dot.vazio { background: var(--border); }

/* annual payment matrix (fractions x months) */
.matrix-wrap { overflow-x: auto; }
table.matrix { border-collapse: collapse; width: 100%; }
table.matrix th, table.matrix td { padding: 8px 6px; text-align: center; font-size: 12px; border-bottom: 1px solid var(--border); }
table.matrix th { color: var(--text-secondary); font-weight: 600; font-size: 11px; text-transform: uppercase; }
table.matrix td.frac { text-align: left; font-weight: 600; white-space: nowrap; }
.mx { width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 0; }
.mx.pago { background: var(--positive); }
.mx.divida { background: var(--negative); }
.mx.pendente { background: var(--pending); }
.mx.vazio { background: var(--border); }

.form-hint { display: flex; align-items: flex-start; gap: 10px; background: var(--gold-soft); border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px; margin-bottom: 18px; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
/* .ii is a small circular "i" info badge. Defined standalone (not scoped to .form-hint) so it
   also works inline next to a label, e.g. a field's own tooltip icon outside a hint banner. */
.ii { width: 19px; height: 19px; border-radius: 50%; background: var(--gold); color: #fff; display: inline-grid; place-items: center; font-size: 12px; font-weight: 800; font-style: normal; flex-shrink: 0; margin-top: 1px; cursor: help; }
.form-hint .ii { display: grid; }

/* FAQ / help accordion (app-wide) */
.faq-list { display: grid; gap: 12px; max-width: 780px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); overflow: hidden; }
.faq-item summary { list-style: none; cursor: pointer; padding: 14px 18px; font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .chev { width: 18px; height: 18px; color: var(--text-secondary); transition: transform .2s; flex-shrink: 0; }
.faq-item[open] summary .chev { transform: rotate(180deg); }
.faq-item[open] summary { border-bottom: 1px solid var(--border); }
.faq-body { padding: 4px 18px 18px; font-size: 13.5px; color: var(--text-secondary); line-height: 1.65; }
.faq-body table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.faq-body table th, .faq-body table td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.faq-body table th { color: var(--text); font-weight: 700; }
.faq-body code { background: var(--bg-secondary); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

/* segmented toggle */
.segmented { display: inline-flex; align-self: flex-start; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.segmented label { padding: 9px 16px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-secondary); background: var(--bg); }
.segmented input { display: none; }
.segmented input:checked + label { background: var(--gold); color: #fff; }

/* toggle switch — theme-aware (works across white/rose-gold/azure/obsidian-gold).
   Uses ~ (general sibling) rather than + because asp-for on a bool property
   renders an extra hidden input right after the checkbox (antiforgery-style
   "unchecked posts false" pattern), which would break an adjacent-sibling (+) selector. */
.switch { display: inline-flex; align-self: flex-start; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch-track {
  position: relative; width: 40px; height: 22px; flex-shrink: 0;
  border-radius: 999px; background: var(--border); transition: background .18s;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s;
}
.switch input:checked ~ .switch-track { background: var(--gold); }
.switch input:checked ~ .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible ~ .switch-track { box-shadow: 0 0 0 3px var(--gold-soft); }
.switch-text { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.switch input:checked ~ .switch-text { color: var(--text); }
.switch input:disabled ~ .switch-track { opacity: .5; cursor: not-allowed; }
.switch input:disabled ~ .switch-text { opacity: .5; cursor: not-allowed; }

/* native file input — theme-aware "choose file" button */
input[type="file"] {
  font-family: var(--font); font-size: 13px; color: var(--text-secondary);
}
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  margin-right: 12px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-secondary); color: var(--text);
  font-family: var(--font); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  background: var(--gold-soft); border-color: var(--gold); color: var(--gold-hover);
}
