/* Layout, navigation and UI components. */

/* ---------- Layout ---------- */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.container { width: 100%; max-width: var(--content); margin: 0 auto; padding: 0 var(--space-4); }
main { flex: 1; outline: none; }
.page { padding-top: var(--space-5); padding-bottom: calc(var(--tab-h) + var(--space-7) + env(safe-area-inset-bottom)); }
.page-narrow { max-width: 560px; margin: 0 auto; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); flex-wrap: wrap; }
.page-header p { margin-top: var(--space-2); }

@media (min-width: 900px) {
  .container { padding: 0 var(--space-6); }
  .page { padding-top: var(--space-6); padding-bottom: var(--space-8); }
}

/* ---------- Glass surfaces (with solid fallback) ---------- */
.glass {
  background: var(--glass-solid);
  border: 1px solid var(--border);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass {
    background: var(--glass);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
  }
}
@media (prefers-reduced-transparency: reduce) {
  .glass { background: var(--glass-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---------- Top navigation ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-width: 0 0 1px;
  padding-top: env(safe-area-inset-top);
}
.topbar-inner { height: var(--nav-h); display: flex; align-items: center; gap: var(--space-5); }
.wordmark { display: inline-flex; align-items: center; text-decoration: none; flex: none; line-height: 0; }
.brand-logo { height: 28px; width: auto; }
.brand-logo-dark { display: none; }[data-theme='dark'] .brand-logo-light { display: none; }[data-theme='dark'] .brand-logo-dark { display: block; }
.auth-card .brand-logo { height: 34px; }
.nav-links { display: none; gap: 2px; margin-left: var(--space-4); }
.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
  padding: 8px 14px;
  border-radius: 999px;
  color: color-mix(in srgb, var(--text) 78%, transparent);
  font-size: 0.94rem;
  font-weight: 560;
  letter-spacing: -0.005em;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-links a .icon { width: 18px; height: 18px; opacity: 0.85; }
.nav-links a:hover { color: var(--text); background: var(--bg-subtle); }
.nav-links a[aria-current='page'] { color: var(--accent-contrast); background: var(--accent); }
.nav-links a[aria-current='page'] .icon { opacity: 1; }
@media (min-width: 900px) and (max-width: 1080px) { .nav-links a { padding: 8px 10px; } .nav-links a .icon { display: none; } }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.bell-wrap { position: relative; }
.notif-dot { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--down); color: #fff; font-size: 0.66rem; font-weight: 700; display: inline-grid; place-items: center; border: 2px solid var(--surface); pointer-events: none; line-height: 1; }
.notif-dot[hidden] { display: none; }
.account-menu { position: relative; display: none; }
.account-trigger { list-style: none; display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--border); cursor: pointer; font-size: 0.9rem; font-weight: 560; user-select: none; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.account-trigger::-webkit-details-marker { display: none; }
.account-trigger:hover, .account-menu[open] .account-trigger { background: var(--bg-subtle); border-color: var(--border-strong); }
.account-trigger .chev { width: 14px; height: 14px; transform: rotate(-90deg); transition: transform var(--dur) var(--ease); }
.account-menu[open] .account-trigger .chev { transform: rotate(90deg); }
.account-avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-contrast); font-size: 0.75rem; font-weight: 700; }
.account-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-panel { background: var(--surface); position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; padding: 6px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-lg); display: grid; gap: 2px; z-index: 30; }
.menu-head { display: grid; gap: 2px; padding: 10px 12px 8px; }
.menu-head .xsmall { overflow: hidden; text-overflow: ellipsis; }
.menu-panel hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--text); font: inherit; font-size: 0.9rem; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.menu-item .icon { width: 18px; height: 18px; color: var(--text-muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--bg-subtle); }
@media (min-width: 900px) { .nav-links { display: flex; } .account-menu { display: block; } .topbar-actions .mobile-logout, .topbar-actions .mobile-account { display: none; } }
.nav-links.nav-scroll { display: flex; overflow-x: auto; scrollbar-width: none; margin-left: 0; min-width: 0; }
.nav-links.nav-scroll::-webkit-scrollbar { display: none; }

/* Pages of the current section, under the top bar. */
.subnav { border-bottom: 1px solid var(--border); background: var(--surface); }
.subnav[hidden] { display: none; }
.subnav-inner { display: flex; gap: var(--space-5); overflow-x: auto; scrollbar-width: none; }
.subnav-inner::-webkit-scrollbar { display: none; }
.subnav a { position: relative; padding: 12px 0 11px; text-decoration: none; white-space: nowrap; color: var(--text-muted); font-size: 0.9rem; font-weight: 560; }
.subnav a:hover { color: var(--text); }
.subnav a[aria-current='page'] { color: var(--text); }
.subnav a[aria-current='page']::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }

/* ---------- Mobile tab bar ---------- */
.tabbar {
  position: fixed;
  left: var(--space-3);
  right: var(--space-3);
  bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
  z-index: 20;
  height: var(--tab-h);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  font-size: 0.69rem;
  font-weight: 500;
  color: var(--text-muted);
  min-height: 44px;
}
.tabbar a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0; letter-spacing: -0.01em; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a[aria-current='page'] { color: var(--text); }
@media (min-width: 900px) { .tabbar { display: none; } }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), opacity var(--dur);
}
.btn:hover { background: var(--bg-subtle); }
.btn:active { transform: scale(0.98); }
.btn[disabled], .btn[aria-busy='true'] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent); opacity: 0.88; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg-subtle); }
.btn-danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, transparent); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 0.86rem; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 0.86rem; font-weight: 550; }
.field .hint { font-size: 0.8rem; color: var(--text-muted); }
.field .error-text { font-size: 0.8rem; color: var(--down); }
.input, .select, .textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 16px; /* avoids iOS zoom */
  transition: border-color var(--dur), box-shadow var(--dur);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 12%, transparent); }
.input[aria-invalid='true'] { border-color: var(--down); }
.input.mono, .mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; letter-spacing: 0.02em; }
.check { display: flex; gap: var(--space-3); align-items: flex-start; font-size: 0.92rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.form-grid { display: grid; gap: var(--space-4); }
@media (min-width: 640px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.strength { height: 4px; border-radius: 4px; background: var(--gray-100); overflow: hidden; }
.strength > span { display: block; height: 100%; background: var(--text); transition: width var(--dur) var(--ease); }

/* ---------- Cards & lists ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.card-flat { background: var(--bg-subtle); border-color: transparent; }
.card h2 { margin-bottom: var(--space-4); }
.grid { display: grid; gap: var(--space-4); }
@media (min-width: 900px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: var(--space-3); padding: 14px 0; border-bottom: 1px solid var(--border); min-height: 56px; }
.list > li:last-child { border-bottom: 0; }
.list a.list-link { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; width: 100%; }
.list .end { margin-left: auto; text-align: right; }
.list-compact > li { padding: 10px 0; min-height: 0; }
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-subtle);
  display: grid;
  place-items: center;
  font-weight: 650;
  font-size: 0.85rem;
  flex: none;
}

/* ---------- Tables (stack on mobile) ---------- */
.table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--space-5)); padding: 0 var(--space-5); }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; font-weight: 550; color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table td.r, .table th.r { text-align: right; }
.table tr:last-child td { border-bottom: 0; }
@media (max-width: 639px) {
  .table.stack-mobile thead { display: none; }
  .table.stack-mobile tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .table.stack-mobile td { display: flex; justify-content: space-between; gap: var(--space-3); padding: 4px 0; border: 0; text-align: right; }
  .table.stack-mobile td::before { content: attr(data-label); color: var(--text-muted); font-size: 0.8rem; text-align: left; }
}

/* ---------- Badges, chips, segmented controls ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 550;
  background: var(--bg-subtle);
  color: var(--text-muted);
  white-space: nowrap;
}
.badge-strong { background: var(--accent); color: var(--accent-contrast); }
.badge-warn { background: color-mix(in srgb, var(--down) 12%, transparent); color: var(--down); }
.badge-ok { background: color-mix(in srgb, var(--up) 12%, transparent); color: var(--up); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--bg-subtle); }
.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--text-muted);
  cursor: pointer;
}
.segmented button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Hero figures ---------- */
.figure-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.figure-xl { font-size: clamp(2.3rem, 8vw, 3.6rem); font-weight: 650; letter-spacing: -0.035em; line-height: 1.05; }
.figure-md { font-size: 1.35rem; font-weight: 620; letter-spacing: -0.02em; }
.delta { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi .figure-md { margin-top: 2px; }

/* ---------- Notices ---------- */
.notice {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  font-size: 0.9rem;
}
.notice-strong { background: var(--accent); color: var(--accent-contrast); }
.notice-warn { background: color-mix(in srgb, var(--down) 9%, var(--surface)); }
.notice .icon { margin-top: 2px; }
details.disclosure summary { cursor: pointer; font-weight: 550; list-style: none; display: flex; align-items: center; gap: var(--space-2); min-height: 44px; }
details.disclosure summary::-webkit-details-marker { display: none; }
details.disclosure[open] summary .chev { transform: rotate(90deg); }
.chev { transition: transform var(--dur) var(--ease); }

/* ---------- Skeleton loaders ---------- */
.skeleton {
  display: block;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--bg-subtle) 0%, var(--gray-100) 50%, var(--bg-subtle) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
:root[data-theme='dark'] .skeleton { background: linear-gradient(90deg, #161616 0%, #222 50%, #161616 100%); background-size: 200% 100%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  z-index: 60;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tab-h) + var(--space-5) + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(92vw, 420px);
  pointer-events: none;
}
@media (min-width: 900px) { .toasts { bottom: var(--space-5); } }
.toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  font-size: 0.92rem;
  animation: toast-in var(--dur) var(--ease);
}
.toast-error { border-left: 3px solid var(--down); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Dialogs ---------- */
dialog.modal {
  width: min(94vw, 520px);
  max-height: 88dvh;
  padding: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  overflow: auto;
}
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.32); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  dialog.modal::backdrop { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
}
.modal-body { padding: var(--space-5); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-5); }
dialog.modal[open] { animation: modal-in 200ms var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: var(--space-7) var(--space-4); }
.empty p { max-width: 440px; margin: var(--space-2) auto var(--space-5); color: var(--text-muted); }

/* ---------- Recovery key ---------- */
.recovery-key {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 1.02rem;
  letter-spacing: 0.06em;
  line-height: 1.9;
  padding: var(--space-4);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  word-spacing: 0.25em;
  user-select: all;
  text-align: center;
}

/* ---------- Charts ---------- */
ci-line-chart, ci-donut, ci-bar-chart { display: block; position: relative; }
.chart-svg { width: 100%; height: 100%; overflow: visible; touch-action: pan-y; }
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  transform: translate(-50%, -110%);
  transition: opacity 120ms;
}
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.legend li { display: flex; align-items: center; gap: var(--space-2); font-size: 0.88rem; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .end { margin-left: auto; }
.bar { height: 8px; border-radius: 8px; background: var(--bg-subtle); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--text); border-radius: 8px; }

/* ---------- Auth & marketing ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-6) var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom)); }
.auth-card { width: min(100%, 440px); }
.auth-card .wordmark { display: inline-flex; margin-bottom: var(--space-6); }
.divider { display: flex; align-items: center; gap: var(--space-3); color: var(--text-muted); font-size: 0.8rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.steps { display: flex; gap: 6px; margin-bottom: var(--space-5); }
.steps span { height: 3px; flex: 1; border-radius: 3px; background: var(--gray-100); }
.steps span.done { background: var(--text); }

.hero { padding-top: var(--space-8); padding-bottom: var(--space-7); }
.hero h1 { font-size: clamp(2.3rem, 7vw, 4.2rem); letter-spacing: -0.045em; max-width: 14ch; }
.hero p { font-size: clamp(1.05rem, 2.2vw, 1.25rem); color: var(--text-muted); max-width: 560px; margin-top: var(--space-4); }
.hero-curve { position: absolute; inset: 0; z-index: -1; opacity: 0.6; pointer-events: none; }
.features { display: grid; gap: var(--space-4); padding-bottom: var(--space-8); }
@media (min-width: 900px) { .features { grid-template-columns: repeat(3, 1fr); } }
.footer { border-top: 1px solid var(--border); padding: var(--space-6) 0 calc(var(--space-6) + env(safe-area-inset-bottom)); font-size: 0.85rem; color: var(--text-muted); }
.footer a { color: var(--text-muted); }
.prose { max-width: 720px; }
.prose h2 { margin: var(--space-6) 0 var(--space-3); }
.prose p, .prose li { color: var(--text); line-height: 1.65; }
.prose p + p { margin-top: var(--space-3); }
.prose ul { padding-left: 1.2em; }

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-7) var(--space-4);
  text-align: center;
  transition: background var(--dur), border-color var(--dur);
}
.dropzone.drag { background: var(--bg-subtle); border-color: var(--text); }
.banner { padding: 10px var(--space-4); text-align: center; font-size: 0.86rem; background: var(--accent); color: var(--accent-contrast); }
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-screen { min-height: 60dvh; display: grid; place-items: center; }

/* ---------- Analyses ---------- */
.tabs { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--bg-subtle); overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; min-height: 34px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 999px; color: var(--text-muted); font-size: 0.88rem; font-weight: 550; text-decoration: none; white-space: nowrap; }
.tabs a[aria-current='page'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.heatmap { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 0.78rem; }
.heatmap th { color: var(--text-muted); font-weight: 550; text-align: center; padding: 2px; }
.heatmap td { text-align: center; padding: 8px 2px; border-radius: 6px; font-variant-numeric: tabular-nums; position: relative; }
.heatmap td.up { background: color-mix(in srgb, var(--up) calc(var(--heat, 0) * 100%), transparent); }
.heatmap td.down { background: color-mix(in srgb, var(--down) calc(var(--heat, 0) * 100%), transparent); }
.heatmap td.strong { color: var(--white); }
.heatmap td.empty { color: var(--text-muted); }
.heatmap td.year { font-weight: 650; background: var(--bg-subtle); }
.insights { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 760px) { .insights { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1080px) { .insights { grid-template-columns: repeat(3, 1fr); } }
.insight { display: flex; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: inherit; text-decoration: none; transition: border-color 0.15s var(--ease); }
.insight:hover { border-color: var(--border-strong); }
.insight .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--text-muted); }
.insight.good .dot { background: var(--up); }
.insight.warn .dot { background: var(--down); }
.insight strong { display: block; font-size: 0.95rem; }
.insight p { margin: 4px 0 0; font-size: 0.85rem; color: var(--text-muted); }
.bridge { display: grid; gap: 10px; }
.bridge .row-between { font-size: 0.9rem; }
.hbar { height: 10px; border-radius: 10px; background: var(--bg-subtle); overflow: hidden; position: relative; }
.hbar > span { position: absolute; top: 0; bottom: 0; border-radius: 10px; background: var(--text); }
.hbar > span.neg { background: var(--down); }
.hbar > span.target { background: transparent; border-right: 2px solid var(--text); border-radius: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
@media (min-width: 900px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
.input-inline { width: 7rem; }
.disclaimer { font-size: 0.78rem; color: var(--text-muted); }

/* ---------- Community ---------- */
.community { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
@media (min-width: 980px) { .community { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); border-radius: 999px; padding: 5px 12px; font-size: 0.82rem; font-weight: 550; cursor: pointer; text-decoration: none; }
.chip[aria-pressed='true'], .chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.post-card { display: grid; gap: 8px; padding: var(--space-4) var(--space-5); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: inherit; text-decoration: none; }
.post-card:hover { border-color: var(--border-strong); }
.post-card.pinned { border-color: var(--text); }
.post-card h3 { margin: 0; font-size: 1.05rem; letter-spacing: -0.01em; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-muted); }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.post-excerpt { color: var(--text-muted); font-size: 0.9rem; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.handle { font-weight: 600; color: var(--text); text-decoration: none; }
.icon-xs { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; margin-right: 2px; }
.avatar-seed { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 650; font-size: 0.8rem; color: var(--white); flex: none; }
.snapshot { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); background: var(--bg-subtle); display: grid; gap: var(--space-3); }
.snapshot h4 { margin: 0; font-size: 0.85rem; color: var(--text-muted); font-weight: 550; text-transform: uppercase; letter-spacing: 0.04em; }
.poll-option { display: grid; gap: 4px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%; }
.poll-option[disabled] { cursor: default; }
.poll-option.mine { border-color: var(--text); }
.comment { display: flex; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.react { appearance: none; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 0.82rem; cursor: pointer; color: var(--text-muted); display: inline-flex; gap: 6px; align-items: center; }
.react[aria-pressed='true'] { color: var(--text); border-color: var(--text); font-weight: 600; }
.textarea { width: 100%; min-height: 140px; resize: vertical; font: inherit; }

/* ---------- Discussion (thread page) ---------- */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; color: var(--text-muted); margin-bottom: var(--space-4); }
.crumbs a { color: inherit; text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.discussion { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .discussion { grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-6, 32px); } }
.discussion-main { display: grid; gap: var(--space-4); min-width: 0; }
.discussion-side { display: grid; gap: var(--space-4); }
.discussion-post { display: grid; gap: var(--space-4); }
.discussion-title { margin: 0; font-size: clamp(1.4rem, 2.6vw, 1.9rem); line-height: 1.2; letter-spacing: -0.02em; }
.discussion-body { font-size: 1.02rem; }
.post-meta .dot, .cmt-head .dot { color: var(--text-muted); }
.post-actions, .cmt-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.post-actions { padding-top: var(--space-3); border-top: 1px solid var(--border); }
.pill { appearance: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 0.82rem; font-weight: 550; cursor: pointer; line-height: 1.2; transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.pill .icon { width: 15px; height: 15px; }
.pill:hover { color: var(--text); background: var(--bg-subtle); }
.pill[aria-pressed='true'] { color: var(--text); border-color: var(--text); }
.pill-ghost { border-color: transparent; background: transparent; }
.pill-danger:hover { color: var(--down); }
.mod-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--bg-subtle); }
.op-badge { font-size: 0.68rem; font-weight: 650; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--text); color: var(--text); text-transform: uppercase; letter-spacing: 0.03em; }

.composer { display: grid; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 10px 12px; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.composer.active, .composer:focus-within { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.composer-input { width: 100%; border: 0; outline: none; resize: none; background: transparent; color: var(--text); font: inherit; line-height: 1.55; min-height: 44px; padding: 4px 2px; }
.composer:not(.active) .composer-bar { display: none; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.composer-inline { margin-top: 8px; }
@media (max-width: 639px) { .composer-hint { display: none; } }

.thread-section { display: grid; gap: var(--space-4); margin-top: var(--space-2); }
.thread-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.thread-head h2 { margin: 0; font-size: 1.1rem; }
.thread { display: grid; gap: var(--space-4); }
.cmt { --gutter: 28px; display: grid; grid-template-columns: var(--gutter) minmax(0, 1fr); column-gap: 10px; border-radius: var(--radius-sm); scroll-margin-top: calc(var(--nav-h) + 24px); }
.cmt-gutter { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cmt-rail { flex: 1; width: 18px; min-height: 12px; border: 0; padding: 0; background: none; cursor: pointer; position: relative; }
.cmt-rail::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 2px; width: 2px; transform: translateX(-50%); border-radius: 2px; background: var(--border-strong); transition: background var(--dur) var(--ease); }
.cmt-rail:hover::before, .cmt-rail:focus-visible::before { background: var(--text); }
.cmt-content { min-width: 0; display: grid; gap: 6px; padding-top: 3px; }
.cmt-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text-muted); min-height: 22px; }
.cmt-time { color: inherit; text-decoration: none; }
.cmt-time:hover { text-decoration: underline; }
.cmt-body { font-size: 0.95rem; }
.cmt-removed { margin: 0; font-style: italic; color: var(--text-muted); font-size: 0.9rem; }
.cmt-notice { display: flex; gap: 8px; align-items: flex-start; font-size: 0.82rem; padding: 8px 10px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--down) 9%, var(--surface)); }
.cmt-notice .icon { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.cmt-actions { margin-left: -10px; }
.cmt-children { display: grid; gap: var(--space-3); margin-top: 8px; }
.cmt-children.flat { margin-left: calc(-1 * (var(--gutter) + 10px)); }
.cmt.collapsed .cmt-gutter .avatar-seed { opacity: 0.6; }
.cmt-expand { appearance: none; border: 1px solid var(--border); background: var(--bg-subtle); color: var(--text); border-radius: 999px; padding: 1px 9px; font: inherit; font-size: 0.75rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.cmt-expand .icon { width: 12px; height: 12px; }
.cmt.focus > .cmt-content { animation: cmt-flash 2.4s var(--ease); border-radius: var(--radius-sm); }
@keyframes cmt-flash { 0%, 40% { background: color-mix(in srgb, var(--text) 7%, transparent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--text) 7%, transparent); } 100% { background: transparent; box-shadow: none; } }
.avatar-ghost { background: var(--bg-subtle); border: 1px dashed var(--border-strong); }
@media (max-width: 639px) {
  .cmt { --gutter: 22px; column-gap: 6px; }
  .cmt .avatar-seed { width: 22px !important; height: 22px !important; font-size: 0.62rem; }
  .pill-ghost .pill-label { display: none; }
  .pill-ghost { padding: 6px 8px; }
}

.side-card { display: grid; gap: var(--space-3); padding: var(--space-4); }
.side-title { font-size: 0.75rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.side-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.side-stats > div { display: grid; gap: 2px; }
.side-stats strong { font-size: 1.1rem; }
.side-stats span { font-size: 0.72rem; color: var(--text-muted); }
.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.side-list li { display: grid; gap: 2px; }
.side-list a { color: var(--text); text-decoration: none; font-weight: 550; font-size: 0.9rem; line-height: 1.35; }
.side-list a:hover { text-decoration: underline; }
.side-rules { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 0.82rem; color: var(--text-muted); }

/* ---------- Moderation decision (member side) ---------- */
.decision-card { display: grid; gap: var(--space-4); }
.decision-quote { margin: 0; padding: var(--space-3) var(--space-4); border-left: 3px solid var(--border-strong); background: var(--bg-subtle); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.92rem; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.timeline li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; font-size: 0.9rem; }
.timeline li::before { content: ''; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--border-strong); }
.timeline li.done::before { background: var(--text); }
/* ---------- Steps ---------- */
.steps { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.steps li::marker { font-weight: 650; }

/* ---------- Import (full width) ---------- */
.import-head { display: grid; gap: var(--space-4); margin-bottom: var(--space-5); }
.import-head .page-header { margin-bottom: 0; }
.stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-muted); font-weight: 550; }
.stepper li + li::before { content: ''; width: 28px; height: 1.5px; background: var(--border-strong); border-radius: 2px; }
.stepper-dot { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; border: 1.5px solid var(--border-strong); font-size: 0.75rem; font-weight: 700; background: var(--surface); }
.stepper-dot .icon { width: 14px; height: 14px; }
.stepper li.current { color: var(--text); }
.stepper li.current .stepper-dot { border-color: var(--text); background: var(--text); color: var(--bg); }
.stepper li.done { color: var(--text); }
.stepper li.done .stepper-dot { border-color: var(--up); background: var(--up); color: #fff; }
@media (max-width: 639px) { .stepper-label { display: none; } .stepper li.current .stepper-label { display: inline; } .stepper li + li::before { width: 14px; } }
.import-start, .import-review { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) {
  .import-start { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); }
  .import-review { grid-template-columns: minmax(0, 1fr) 340px; }
  .import-review-side { position: sticky; top: calc(var(--nav-h) + var(--space-4)); }
}
.import-review-main, .import-review-side { min-width: 0; }
.dropzone { min-height: 340px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: var(--space-7) var(--space-5); background: var(--surface); }
.dropzone:hover { border-color: var(--text-muted); }
.dropzone-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--bg-subtle); }
.dropzone-icon .icon { width: 28px; height: 28px; }
.dropzone-title { font-size: 1.2rem; letter-spacing: -0.01em; }
.dropzone-formats { display: flex; gap: 6px; }
.import-status { display: flex; align-items: flex-start; gap: var(--space-4); padding: var(--space-6, 32px); }
.spinner.spinner-lg { width: 32px; height: 32px; border-width: 3px; flex: none; }
.status-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--bg-subtle); flex: none; }
.status-icon .icon { width: 22px; height: 22px; }
.status-icon.ok { background: color-mix(in srgb, var(--up) 14%, transparent); color: var(--up); }
.status-icon.warn { background: color-mix(in srgb, var(--down) 12%, transparent); color: var(--down); }
.import-actions .btn-block { width: 100%; }
.import-recap { margin: 0; padding-left: 18px; display: grid; gap: 2px; }
.import-queue { list-style: none; margin: 0; padding: 0; display: grid; }
.import-queue-item { display: flex; gap: var(--space-3); align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.import-queue-item:last-child { border-bottom: 0; }
.import-queue-item > .spinner { flex: none; width: 22px; height: 22px; margin: 3px; }
.status-icon.status-sm { width: 28px; height: 28px; border-radius: 9px; }
.status-icon.status-sm .icon { width: 15px; height: 15px; }
.import-file { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
.import-file > *, .import-detail > * { min-width: 0; }
.import-file.is-skipped { opacity: 0.6; }
.import-file.is-error { border-color: color-mix(in srgb, var(--down) 35%, var(--border)); }
.import-file-head { display: flex; gap: var(--space-3); align-items: flex-start; }
.import-file-name { font-weight: 600; overflow-wrap: anywhere; }
.import-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; }
.import-note .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.import-dest { display: grid; gap: var(--space-4); padding: var(--space-4); border-radius: var(--radius); background: var(--bg-subtle); }
.import-dest-switch { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.import-dest-select { width: auto; max-width: 100%; min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 0.88rem; background-color: var(--surface); }
.import-dest-main { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(150px, 240px); gap: var(--space-3); align-items: start; }
@media (max-width: 640px) { .import-dest-main { grid-template-columns: auto minmax(0, 1fr); } .import-dest-main > .import-dest-select { grid-column: 1 / -1; } }
.import-dest-wide { grid-column: 2 / -1; }
@media (max-width: 640px) { .import-dest-wide { grid-column: 1 / -1; } }
.import-start-simple .dropzone { min-height: 380px; }
.import-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.import-foot > span, .import-actions > .xsmall { display: inline-flex; align-items: center; gap: 6px; }
.import-foot .icon, .import-actions > .xsmall .icon { width: 13px; height: 13px; flex: none; }
.import-split { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding-top: var(--space-3); border-top: 1px solid var(--border); }
.import-split .import-dest-select { max-width: 280px; }
.import-dest-body { display: grid; gap: 2px; }
.import-new-grid { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .import-new-grid { grid-template-columns: minmax(0, 2fr) minmax(140px, 1fr); } }
.import-new-grid .field { margin: 0; }
.import-dest-name { font-weight: 650; font-size: 1.05rem; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.import-dest-name:hover { text-decoration: underline; }
.import-compare { font-size: 0.92rem; padding-top: var(--space-3); border-top: 1px solid var(--border); }
.import-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.import-file-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.import-detail { padding-top: var(--space-4); border-top: 1px solid var(--border); }
.import-results { margin-top: 4px; }
.import-results > li { min-height: 0; padding: 10px 0; }

/* ---------- Info tiles (Mes données) ---------- */
.info-tiles { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .info-tiles { grid-template-columns: 1fr 1fr; } }
.info-tile { display: flex; gap: var(--space-3); align-items: flex-start; }

/* ---------- Notifications page ---------- */
.notif-layout { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .notif-layout { grid-template-columns: 260px minmax(0, 1fr); } .notif-side { position: sticky; top: calc(var(--nav-h) + var(--space-4)); } }
.notif-side { display: grid; gap: var(--space-4); }
.notif-filters { display: grid; gap: 2px; }
@media (max-width: 999px) { .notif-filters { display: flex; overflow-x: auto; scrollbar-width: none; } .notif-filters .notif-filter { flex: none; } }
.notif-filter { appearance: none; border: 0; background: none; font: inherit; color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.9rem; text-align: left; }
.notif-filter:hover { background: var(--bg-subtle); }
.notif-filter[aria-pressed='true'] { background: var(--accent); color: var(--accent-contrast); }
.notif-filter[aria-pressed='true'] .muted { color: inherit; opacity: 0.7; }
.notif-day { margin: 0 0 8px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 650; }
.notif-day::first-letter { text-transform: uppercase; }
@media (max-width: 480px) { .hide-xs { display: none; } }
/* ---------- Broker connections ---------- */
.connection-head { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.connection-head .grow { display: grid; gap: 2px; }
.connection-head .spinner { width: 12px; height: 12px; border-width: 2px; vertical-align: -1px; }
.daily-on { display: inline-flex; align-items: center; gap: 4px; color: var(--up); font-weight: 560; }
.more-menu { position: relative; }
.more-menu > summary { list-style: none; }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-menu .icon-more { width: 20px; height: 20px; stroke-width: 3.2; }
.more-menu .menu-panel { min-width: 230px; }
.menu-item.is-danger, .menu-item.is-danger .icon { color: var(--down); }
/* Account page: how the account is kept up to date. */
.sync-strip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.sync-strip .grow { min-width: 0; display: grid; gap: 2px; }
.sync-strip .sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--up); flex: none; }
.sync-strip.is-error .sync-dot { background: var(--down); }
.sync-strip.is-off .sync-dot { background: var(--text-muted); }
.link-button { appearance: none; background: none; border: 0; padding: 0; font: inherit; color: var(--text); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; justify-self: start; }
.link-button:hover { color: var(--accent); }
.connection-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 0; }
.connection-foot .icon { width: 13px; height: 13px; }
.guest-card { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.guest-text { display: grid; gap: 4px; flex: 1 1 280px; }
.notif-list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.notif + .notif { border-top: 1px solid var(--border); }
.notif-link { display: flex; align-items: flex-start; gap: var(--space-3); padding: 16px 18px; text-decoration: none; color: inherit; }
a.notif-link:hover { background: var(--bg-subtle); }
.notif.unread .notif-link { background: color-mix(in srgb, var(--text) 3.5%, transparent); }
.notif-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--bg-subtle); }
.notif-icon .icon { width: 18px; height: 18px; }
.notif-community { background: color-mix(in srgb, #3b6fd8 13%, transparent); color: #3b6fd8; }
.notif-imports { background: color-mix(in srgb, var(--up) 14%, transparent); color: var(--up); }
.notif-security { background: color-mix(in srgb, #b7791f 15%, transparent); color: #b7791f; }
.notif-team { background: var(--accent); color: var(--accent-contrast); }
.notif-text { flex: 1; min-width: 0; display: grid; gap: 3px; }
.notif-title { font-weight: 600; }
.notif.unread .notif-title { font-weight: 700; }
.notif-detail { font-size: 0.9rem; color: var(--text); opacity: 0.85; overflow-wrap: anywhere; }
.notif-unread { width: 9px; height: 9px; border-radius: 50%; background: #3b6fd8; flex: none; margin-top: 8px; }
.notif-chev { width: 16px; height: 16px; color: var(--text-muted); flex: none; margin-top: 10px; }
.notif-preview { display: flex; gap: var(--space-3); align-items: flex-start; padding: 12px; border-radius: var(--radius-sm); background: var(--bg-subtle); }

/* ---------- Administration shell ---------- */
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); }
.admin-main { min-width: 0; }
.admin-side { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-3); padding: 10px var(--space-4); border-bottom: 1px solid var(--border); background: var(--glass-solid); }
.admin-brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; flex: none; }
.admin-tag { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-contrast); }
.admin-nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; }
.admin-nav::-webkit-scrollbar { display: none; }
.side-group { display: contents; }
.side-group-title { display: none; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); text-decoration: none; color: color-mix(in srgb, var(--text) 80%, transparent); font-size: 0.92rem; font-weight: 550; white-space: nowrap; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.side-link .icon { width: 18px; height: 18px; flex: none; }
.side-link:hover { background: var(--bg-subtle); color: var(--text); }
.side-link[aria-current='page'] { background: var(--accent); color: var(--accent-contrast); }
.side-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--down); color: #fff; font-size: 0.7rem; font-weight: 700; display: inline-grid; place-items: center; }
.side-count[hidden] { display: none; }
.admin-side-foot { display: flex; align-items: center; gap: 4px; flex: none; }
.admin-side-foot > .side-link .grow, .admin-user-text { display: none; }
.admin-user { display: flex; align-items: center; gap: 8px; }
@media (min-width: 1000px) {
  .admin-shell { grid-template-columns: 248px minmax(0, 1fr); }
  .admin-side { height: 100vh; flex-direction: column; align-items: stretch; gap: var(--space-5); padding: var(--space-5) var(--space-3); border-bottom: 0; border-right: 1px solid var(--border); background: var(--bg-subtle); }
  .admin-brand { padding: 0 10px; }
  .admin-nav { flex-direction: column; overflow: visible; gap: var(--space-4); }
  .side-group { display: grid; gap: 2px; }
  .side-group-title { display: block; padding: 0 12px 4px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
  .admin-side-foot { flex-direction: column; align-items: stretch; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border); }
  .admin-side-foot > .side-link .grow, .admin-user-text { display: grid; }
  .admin-user { padding: 6px 4px 0 8px; }
  .admin-user-text strong { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .admin-main .page { padding-bottom: var(--space-7); }
}

.import-review .table td:nth-child(2), .import-review .table td:nth-child(6) { white-space: nowrap; }

@media (max-width: 999px) { .admin-side { flex-wrap: wrap; row-gap: 8px; } .admin-side-foot { margin-left: auto; } .admin-nav { order: 3; flex-basis: 100%; } .side-link { padding: 7px 10px; font-size: 0.88rem; } }

/* ---------- Accounts & net worth ---------- */
.avatar.kind-investment, .avatar.kind-bank, .avatar.kind-savings, .avatar.kind-real_estate, .avatar.kind-other, .avatar.kind-loan { display: inline-grid; place-items: center; }
.avatar[class*='kind-'] .icon { width: 18px; height: 18px; }
.avatar-logo { background: var(--white); border: 1px solid var(--border); overflow: hidden; padding: 0; }
.avatar-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.avatar.kind-bank, .avatar.kind-savings { background: color-mix(in srgb, #3b6fd8 13%, var(--surface)); color: #3b6fd8; }
.avatar.kind-real_estate { background: color-mix(in srgb, #b7791f 15%, var(--surface)); color: #b7791f; }
.avatar.kind-loan { background: color-mix(in srgb, var(--down) 12%, var(--surface)); color: var(--down); }
.avatar.kind-other { background: color-mix(in srgb, #7c3aed 12%, var(--surface)); color: #7c3aed; }
.wealth-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--bg-subtle); gap: 2px; }
.wealth-bar span { display: block; background: var(--text); min-width: 3px; }
:is(.wealth-bar, .legend) .seg-investment { background: var(--text); }
:is(.wealth-bar, .legend) :is(.seg-bank, .seg-savings) { background: #3b6fd8; }
:is(.wealth-bar, .legend) .seg-real_estate { background: #b7791f; }
:is(.wealth-bar, .legend) .seg-other { background: #7c3aed; }
.wealth-total { padding-top: 12px; border-top: 1px solid var(--border); }
.add-asset-hint { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px; border-radius: var(--radius-sm); border: 1.5px dashed var(--border-strong); text-decoration: none; color: inherit; }
.add-asset-hint:hover { background: var(--bg-subtle); }
.account-row .list-link { min-width: 0; }
.account-row strong { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .list > li.account-row { flex-wrap: wrap; row-gap: 4px; }
  .account-row .list-link { flex: 1 1 100%; }
  .account-row .account-actions { margin-left: auto; }
}
.add-asset-hint > span { display: grid; gap: 2px; }
dialog.modal.modal-wide { width: min(94vw, 680px); }
.kind-grid { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .kind-grid { grid-template-columns: 1fr 1fr; } }
.kind-card { appearance: none; display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: inherit; font: inherit; cursor: pointer; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.kind-card:hover, .kind-card:focus-visible { border-color: var(--text); background: var(--bg-subtle); }
.kind-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--bg-subtle); flex: none; }
.kind-icon .icon { width: 18px; height: 18px; }
.kind-text { display: grid; gap: 3px; }
.split-choice { display: grid; gap: 10px; }
.title-with-logo { display: flex; align-items: center; gap: var(--space-3); }
.title-with-logo h1 { margin: 0; }

/* ---- "Ajouter" hub --------------------------------------------------------------------------------- */
.add-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
button.add-choice { font: inherit; text-align: left; cursor: pointer; width: 100%; }
@media (max-width: 960px) { .add-choices { grid-template-columns: 1fr; } .add-choice { min-height: 0; } }
.add-choice { position: relative; display: flex; flex-direction: column; gap: var(--space-4); min-height: 240px; padding: var(--space-6); color: inherit; text-decoration: none; transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease; }
.add-choice:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.add-choice:focus-visible { outline: 0; border-color: var(--text); }
.add-choice-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--bg-subtle); }
.add-choice-icon .icon { width: 24px; height: 24px; }
.add-choice-body { display: flex; flex-direction: column; gap: 6px; }
.add-choice-title { font-size: 1.25rem; font-weight: 650; letter-spacing: -0.01em; }
.add-choice-foot { margin-top: auto; display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.add-choice-foot .icon { width: 14px; height: 14px; }
.add-choice-go { position: absolute; top: var(--space-6); right: var(--space-6); color: var(--text-muted); }
.add-choice:hover .add-choice-go { color: inherit; }
.add-brand { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 0.85rem; font-weight: 550; }
.add-brand .avatar { width: 28px; height: 28px; border-radius: 8px; }
.add-foot { text-align: center; margin-bottom: 0; }
@media (max-width: 720px) {
  .add-choices { grid-template-columns: 1fr; }
  .add-choice { min-height: 0; padding: var(--space-5); }
  .add-choice-go { top: var(--space-5); right: var(--space-5); }
}
.section-title { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 0; }
.connector-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: var(--space-3); }
.connector-tile { display: flex; align-items: center; gap: var(--space-3); width: 100%; padding: var(--space-4); text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.connector-tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.connector-tile:focus-visible { outline: 0; border-color: var(--text); }
.connector-tile .grow { display: grid; gap: 2px; min-width: 0; }
.connector-tile.is-disabled { opacity: 0.6; cursor: default; }
.connector-tile.is-disabled:hover { border-color: var(--border); box-shadow: none; }
.bank-results { display: grid; gap: 6px; max-height: 300px; overflow-y: auto; margin: 12px 0; }
.bank-option { display: flex; align-items: center; gap: var(--space-3); width: 100%; padding: 8px 10px; font: inherit; color: inherit; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.bank-option:hover { border-color: var(--border-strong); }
.bank-option[aria-selected='true'] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.bank-option .avatar { width: 32px; height: 32px; border-radius: 9px; }
.connector-tile, .connector-tile:hover { text-decoration: none; }
.add-logos { display: inline-flex; }
.add-logos .avatar + .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }

/* ---- Community photos, closed discussions ------------------------------------------------------------ */
.photo-grid { display: grid; gap: 6px; margin: var(--space-3) 0; border-radius: var(--radius); overflow: hidden; }
.photo-grid.photos-2, .photo-grid.photos-3, .photo-grid.photos-4 { grid-template-columns: 1fr 1fr; }
.photo-grid.photos-3 .photo-tile:first-child { grid-row: span 2; }
.photo-tile { padding: 0; border: 0; background: var(--bg-subtle); cursor: zoom-in; display: block; width: 100%; }
.photo-tile img { display: block; width: 100%; height: 100%; max-height: 460px; object-fit: cover; }
.photo-grid.photos-1 .photo-tile img { object-fit: contain; max-height: 520px; background: var(--bg-subtle); }
.photo-grid.photos-2 .photo-tile img, .photo-grid.photos-4 .photo-tile img { aspect-ratio: 4 / 3; }
.photo-full { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto; border-radius: var(--radius-sm); }
.photo-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-picker:empty { display: none; }
.photo-thumb { position: relative; width: 84px; height: 84px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-remove { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.6); color: #fff; cursor: pointer; padding: 0; }
.photo-remove .icon { width: 14px; height: 14px; }
.post-card.has-cover { display: grid; grid-template-columns: minmax(0, 1fr) 96px; column-gap: var(--space-4); }
.post-card.has-cover > :not(.post-cover) { grid-column: 1; }
.post-card .post-cover { grid-column: 2; grid-row: 1 / span 4; width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius-sm); align-self: center; }
.locked-note { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 14px; border-radius: var(--radius); background: var(--bg-subtle); color: var(--text-muted); font-size: 0.9rem; }
.locked-note .icon { width: 16px; height: 16px; flex: none; }
@media (max-width: 600px) {
  .post-card.has-cover { grid-template-columns: minmax(0, 1fr) 64px; }
  .post-card .post-cover { width: 64px; height: 64px; }
}

/* ---------- Lists of findings (spending) ---------- */
.decision-points { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 0.93rem; }

/* ---------- Evolution of the patrimony (dashboard) ---------- */
.evo-head { align-items: flex-end; gap: var(--space-4); flex-wrap: wrap; }
.evo-change { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.delta-lg { font-size: 1.15rem; }
.evo-why { margin-left: 4px; vertical-align: -2px; opacity: 0.7; }
.evo-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
@media (min-width: 900px) { .evo-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.evo-tile { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); display: grid; gap: 4px; align-content: start; }
.evo-tile-value { font-size: 1.15rem; font-weight: 620; letter-spacing: -0.015em; }
.evo-tile-value .delta { font-weight: 620; flex-wrap: wrap; gap: 4px; }
.evo-tile { min-width: 0; }
@media (max-width: 599px) { .evo-tile { padding: 12px; } .evo-tile-value { font-size: 1rem; } .delta-lg { font-size: 1.05rem; } }
.evo-card { padding: 14px 16px 10px; display: grid; gap: 10px; }
.evo-toolbar { flex-wrap: wrap; gap: 8px 16px; }
.segmented-sm button { padding: 5px 12px; font-size: 0.82rem; }
.evo-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.78rem; color: var(--text-muted); }
.evo-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-line { width: 16px; height: 0; border-top: 2px solid var(--text); display: inline-block; }
.lg-line.is-dashed { border-top-style: dashed; opacity: 0.6; }
.evo-notes { list-style: none; margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-subtle); display: grid; gap: 6px; font-size: 0.82rem; color: var(--text-muted); }
.evo-notes[hidden] { display: none; }
.evo-notes li { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.evo-table td, .evo-table th { white-space: nowrap; }
.evo-table td:first-child { white-space: normal; min-width: 160px; }
.evo-table tfoot td { border-top: 1px solid var(--border-strong); border-bottom: 0; font-weight: 600; }
.tip-swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; opacity: 0.7; }
.tip-note { margin-top: 4px; color: var(--text-muted); max-width: 220px; white-space: normal; }
/* Cards, tiles, tabs and menus: no focus frame (the keyboard focus shows through their border or background). */
.list-link:focus-visible, .insight:focus-visible, .kind-card:focus-visible, .segmented button:focus-visible, .menu-item:focus-visible,
summary:focus-visible, ci-line-chart:focus-visible, .subnav a:focus-visible, .nav-links a:focus-visible, .tabbar a:focus-visible { outline: 0; }
.list-link:focus-visible, .insight:focus-visible { border-color: var(--text); }
.segmented button:focus-visible, .subnav a:focus-visible, .nav-links a:focus-visible { color: var(--text); }
/* Drop-down menus are opaque: the page below must not show through. */
.menu-panel.glass { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
/* ---------- Info bubbles ("i" next to a label) ---------- */
.with-tip { display: inline-flex; align-items: center; gap: 2px; }
.info-tip { position: relative; display: inline-flex; vertical-align: middle; line-height: 0; }
.info-tip-btn { appearance: none; border: 0; background: none; padding: 2px; margin: -2px 0; border-radius: 50%; color: var(--text-muted); cursor: help; line-height: 0; }
.info-tip-btn .icon { width: 14px; height: 14px; }
.info-tip-btn:hover, .info-tip-btn:focus-visible { color: var(--text); outline: 0; }
.info-tip-bubble { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(calc(-50% + var(--shift, 0px))); width: max-content; max-width: min(280px, 80vw); padding: 8px 11px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 0.78rem; font-weight: 450; line-height: 1.45; letter-spacing: normal; text-transform: none; text-align: left; white-space: normal; box-shadow: var(--shadow-md); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 120ms ease, visibility 120ms; z-index: 50; }
.info-tip-bubble.is-below { bottom: auto; top: calc(100% + 8px); }
.info-tip:hover .info-tip-bubble, .info-tip-btn:focus + .info-tip-bubble { opacity: 1; visibility: visible; }
