/* Shared visual system for CRM workspaces. Keep the public landing page isolated. */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-alt: #f5f8fc;
  --field-surface: #ffffff;
  --text: #172b45;
  --muted: #64758b;
  --muted-soft: #8290a2;
  --primary: #15365e;
  --primary-soft: #31577f;
  --beige: #c8a56b;
  --line: #dfe7f0;
  --success: #258365;
  --danger: #bd4d56;
  --warning: #a9782d;
  --shadow: 0 8px 24px rgba(24, 48, 76, .055);
  --panel-radius: 18px;
  --card-radius: 14px;
  --section-gap: 16px;
}

body[data-page-mode="standalone"] {
  background: #f4f7fb;
  color: var(--text);
}

body[data-page-mode="standalone"] .main-content {
  width: min(100%, 1600px);
  margin-inline: auto;
  padding: clamp(12px, 1.55vw, 24px) clamp(12px, 1.8vw, 28px) 42px;
  gap: var(--section-gap);
}

body[data-page-mode="standalone"] .topbar {
  min-height: 76px;
  padding: 16px 20px;
  border-radius: 18px;
  background: #fff;
  border-color: var(--line);
  box-shadow: var(--shadow);
}

body[data-page-mode="standalone"] .topbar h2,
body[data-page-mode="standalone"] .panel h3,
body[data-page-mode="standalone"] .hero-card h3 {
  color: var(--primary);
  line-height: 1.45;
}

body[data-page-mode="standalone"] .panel,
body[data-page-mode="standalone"] .stat-card,
body[data-page-mode="standalone"] .category-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  background: #fff;
  box-shadow: var(--shadow);
}

body[data-page-mode="standalone"] .panel { padding: clamp(14px, 1.6vw, 22px); }
body[data-page-mode="standalone"] .panel-head { min-width: 0; gap: 14px; margin-bottom: 14px; }
body[data-page-mode="standalone"] .panel-head > * { min-width: 0; }
body[data-page-mode="standalone"] .subtle,
body[data-page-mode="standalone"] .eyebrow { color: var(--muted); }

body[data-page-mode="standalone"] .form-grid { gap: 12px; }
body[data-page-mode="standalone"] .form-grid > label,
body[data-page-mode="standalone"] .form-grid > fieldset {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}
body[data-page-mode="standalone"] .form-grid label > span {
  display: block;
  margin-bottom: 6px;
  color: #50647d;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.45;
}
body[data-page-mode="standalone"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
body[data-page-mode="standalone"] select,
body[data-page-mode="standalone"] textarea {
  min-width: 0;
  max-width: 100%;
  border-color: #d6e0eb;
  border-radius: 10px;
  background-color: #fff;
  color: var(--text);
}
body[data-page-mode="standalone"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
body[data-page-mode="standalone"] select { min-height: 40px; }
body[data-page-mode="standalone"] textarea { line-height: 1.65; }
body[data-page-mode="standalone"] :is(input, select, textarea):focus-visible {
  border-color: #789ac0;
  outline: 3px solid rgba(70, 119, 171, .13);
  outline-offset: 1px;
}

body[data-page-mode="standalone"] :is(.primary-btn, .ghost-btn, button, .button) {
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
body[data-page-mode="standalone"] .primary-btn {
  border-color: var(--primary);
  border-radius: 11px;
  background: var(--primary);
  box-shadow: 0 5px 13px rgba(21, 54, 94, .12);
}
body[data-page-mode="standalone"] .ghost-btn {
  border-color: #d6e0eb;
  border-radius: 11px;
  background: #fff;
}

body[data-page-mode="standalone"] .table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
body[data-page-mode="standalone"] .data-table { min-width: 680px; }
body[data-page-mode="standalone"] .data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9f1e6;
  color: #17324f;
}
body[data-page-mode="standalone"] .data-table td,
body[data-page-mode="standalone"] .data-table th { padding: 11px 12px; }

/* Give dashboard KPIs room to breathe instead of squeezing every item into one row. */
body[data-page-section="overview"] #overviewStats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 172px), 1fr));
  gap: 12px;
  align-items: stretch;
}
body[data-page-section="overview"] #overviewStats > * { min-width: 0; min-height: 112px; }
body[data-page-section="overview"] .dashboard-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
}
body[data-page-section="overview"] .dashboard-grid > * { min-width: 0; }
body[data-page-section="overview"] .dashboard-grid > .wide { grid-column: 1 / -1; }

/* Stable, page-specific chart stages prevent canvases from inheriting unrelated sizes. */
body[data-page-section="overview"] #overviewCurveChart,
body[data-page-section="analytics"] #analyticsChart {
  display: block;
  width: 100% !important;
  max-width: 100%;
  height: 280px !important;
  min-height: 220px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #fbfcfe 100%);
}
body[data-page-section="overview"] #overviewCurveChart { margin-top: 8px; }
body[data-page-section="analytics"] .analytics-chart-panel { overflow: hidden; }
body[data-page-section="analytics"] .analytics-main-grid,
body[data-page-section="analytics"] .analytics-money-grid { align-items: start; }
body[data-page-section="analytics"] .analytics-progress-panel { min-width: 0; }
body[data-page-section="analytics"] .analytics-progress-panel > * { max-width: 100%; }
body[data-page-section="analytics"] .analytics-stats-grid { align-items: stretch; }
body[data-page-section="analytics"] .analytics-stats-grid > * { min-width: 0; }

body[data-page-section="targets"] .main-content > * { min-width: 0; }
body[data-page-section="targets"] .table-wrap { max-height: min(56vh, 560px); }
body[data-page-section="targets"] textarea { min-height: 90px; max-height: 220px; resize: vertical; }
body[data-page-section="targets"] .panel + .panel { margin-top: 0; }

/* Reserve room for the floating dock so the last action/table row can scroll clear of it. */
body[data-page-mode="standalone"] .main-content { padding-bottom: max(142px, calc(env(safe-area-inset-bottom) + 132px)); }
body[data-page-mode="standalone"] #crmFloatingDock { z-index: 90 !important; }
body[data-page-mode="standalone"] .worship-widget { z-index: 100; }
body[data-page-mode="standalone"] .sales-assistant-widget { z-index: 101; }
body[data-page-mode="standalone"] :is(.client-drawer, .workspace-page-modal, .modal-backdrop, .market-chart-modal) { z-index: 1800; }

/* Keep the service controls in the profile concise and scannable. */
body[data-page-section="profile"] .services-settings-form { display: grid; gap: 9px; }
body[data-page-section="profile"] .service-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(120deg,#fff,#f8fafc); }
body[data-page-section="profile"] .service-setting-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
body[data-page-section="profile"] .service-setting-info > div { display: grid; gap: 3px; }
body[data-page-section="profile"] .service-setting-info small { color: var(--muted); line-height: 1.45; }
body[data-page-section="profile"] .service-setting-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px; color: #234d78; background: #edf3f8; font-size: 1.1rem; }
body[data-page-section="profile"] .service-visibility-toggle { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; padding: 7px 10px; border: 1px solid #dbe3eb; border-radius: 999px; background: #fff; }

/* Small, consistent depth cues; avoid oversized panels and visual noise. */
body[data-page-mode="standalone"] .panel,
body[data-page-mode="standalone"] .stat-card { transition: border-color .2s ease, box-shadow .25s ease, transform .25s ease; }
body[data-page-mode="standalone"] .panel:hover,
body[data-page-mode="standalone"] .stat-card:hover { border-color: #c9d7e4; box-shadow: 0 14px 32px rgba(22,48,75,.09); }
body[data-page-mode="standalone"] :is(.primary-btn,.ghost-btn):active { transform: translateY(1px) scale(.985); }
@media(max-width:640px) {
  body[data-page-mode="standalone"] .main-content { padding-bottom: max(128px, calc(env(safe-area-inset-bottom) + 118px)); }
  body[data-page-section="profile"] .service-setting-row { align-items: flex-start; flex-direction: column; gap: 9px; }
  body[data-page-section="profile"] .service-visibility-toggle { align-self: flex-end; }
}

/* Persistent application-wide dark appearance. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg:#0e1621;
  --surface:#172230;
  --surface-strong:#1a2736;
  --surface-alt:#253446;
  --field-surface:#131e2b;
  --text:#e6edf5;
  --muted:#aab8c8;
  --muted-soft:#8798ab;
  --primary:#8db6ea;
  --primary-soft:#6e9bd3;
  --beige:#d5b06e;
  --line:rgba(188,207,228,.15);
  --shadow:0 14px 38px rgba(0,0,0,.24);
}
html[data-theme="dark"] body { color:var(--text); background:radial-gradient(circle at 85% 0,rgba(50,83,120,.18),transparent 28%),linear-gradient(180deg,#101a27,#0d1520); }
html[data-theme="dark"] :is(.topbar,.panel,.stat-card,.category-card,.hero-card,.profile-account-hero,.profile-backup-box,.service-setting-row,.analytics-command-value,.analytics-insight-card,.target-metric-grid>*,.target-plan-panel,.target-coach-panel,.target-log-panel,.target-history-panel,.sales-performance-kpi,.sales-performance-insight-grid>div,.personal-plan-analytics-row,.personal-plan-analytics-summary article,.personal-orientation-card,.empty-state,.personal-plan-empty-library) { color:var(--text); border-color:var(--line); background:linear-gradient(145deg,#1a2736,#15202d); box-shadow:0 8px 24px rgba(0,0,0,.18); }
html[data-theme="dark"] :is(h1,h2,h3,h4,strong,.panel h3,.topbar h2) { color:var(--text); }
html[data-theme="dark"] :is(p,small,.subtle,.eyebrow,.muted,.profile-account-email,.service-setting-info small,.target-save-hint) { color:var(--muted); }
html[data-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),select,textarea) { color:var(--text); border-color:var(--line); background:#111c29; }
html[data-theme="dark"] :is(input,select,textarea)::placeholder { color:#8292a5; }
html[data-theme="dark"] :is(.ghost-btn,.button,.profile-theme-button) { color:var(--text); border-color:var(--line); background:#1c2a39; }
html[data-theme="dark"] .primary-btn { color:#fff; border-color:#315f91; background:#285485; box-shadow:0 6px 18px rgba(0,0,0,.22); }
html[data-theme="dark"] .data-table { color:var(--text); background:#172230; }
html[data-theme="dark"] .data-table th { color:#e4c88f!important; border-color:var(--line); background:#253547!important; }
html[data-theme="dark"] .data-table td { color:#dbe5ef; border-color:var(--line); background:#172230; }
html[data-theme="dark"] :is(.table-wrap,.client-table-wrap,.target-table-wrap) { border-color:var(--line); background:#141f2c; }
html[data-theme="dark"] :is(.crm-dock-panel,#crmFloatingDock .crm-dock-panel) { border-color:rgba(219,232,246,.18); background:linear-gradient(145deg,rgba(27,41,56,.97),rgba(18,29,42,.96)); box-shadow:0 16px 42px rgba(0,0,0,.38),inset 0 1px rgba(255,255,255,.08); }
html[data-theme="dark"] #crmFloatingDock :is(.crm-dock-link span,.crm-clock-date span) { color:#aebed0; }
html[data-theme="dark"] #crmFloatingDock .crm-dock-link svg { color:#c2d3e5; border-color:var(--line); background:radial-gradient(circle at 32% 24%,#34485d,#1b2a3b 75%); }
html[data-theme="dark"] #crmFloatingDock .crm-dock-link.is-current svg { color:#fff; background:radial-gradient(circle at 32% 20%,#456e96,#16395f 72%); }
html[data-theme="dark"] #crmFloatingDock :is(.crm-dock-collapse,.crm-dock-quiet-trigger,.crm-dock-reopen) { color:#d9e5f1; border-color:var(--line); background:#223347; }
html[data-theme="dark"] :is(.worship-menu,.worship-panel,.sales-assistant-panel,.sales-assistant-chat,.sales-assistant-widget .assistant-panel) { color:var(--text); border-color:var(--line); background:rgba(22,34,48,.98)!important; box-shadow:0 20px 50px rgba(0,0,0,.42)!important; }
html[data-theme="dark"] :is(.worship-menu-action,.worship-close,.service-setting-icon) { color:#d9e5f1!important; border-color:var(--line)!important; background:#223347!important; }
html[data-theme="dark"] :is(.worship-kicker,.worship-menu-label,.sales-assistant-widget small) { color:#9db0c4; }
html[data-theme="dark"] :is(.market-rate-card,.market-chart-header,.market-chart-widget,.market-chart-dialog,.market-chart-tools select) { color:var(--text); border-color:var(--line); background:#172433; }
html[data-theme="dark"] .market-rate-card>strong { color:#e6edf5; }
html[data-theme="dark"] :is(.market-rate-label,.market-rate-meta,.market-chart-hint,.market-chart-header h3) { color:#bfccda; }
html[data-theme="dark"] .market-rates-heading button { color:#e6edf5; border-color:var(--line); background:#1b2938; }
html[data-theme="dark"] :is(.client-drawer,.workspace-page-modal-panel,.modal-content,.sales-card-editor-modal,.personal-plan-modal,.project-directory-modal-panel,.project-inline-form-wrap.project-form-modal-open) { color:var(--text); border-color:var(--line); background:#172230!important; }
html[data-theme="dark"] :is(.overview-meeting-table td,.client-row,.history-item,.target-timeline-item,.personal-orientation-notes) { color:var(--text); border-color:var(--line); background:#1b2938; }
html[data-theme="dark"] .service-setting-row { background:linear-gradient(120deg,#1a2736,#15202d); }
html[data-theme="dark"] .service-visibility-toggle { color:var(--text); border-color:var(--line); background:#111c29; }
html[data-theme="dark"] .market-chart-backdrop { background:rgba(0,0,0,.72); }
html[data-theme="dark"] .profile-theme-panel { display:flex; align-items:center; justify-content:space-between; gap:18px; }
html[data-theme="dark"] .profile-theme-copy { display:grid; gap:5px; }
html[data-theme="dark"] .profile-theme-copy small { color:var(--muted); }
html[data-theme="dark"] .profile-theme-button { min-height:40px; padding:8px 14px; border:1px solid var(--line); border-radius:11px; cursor:pointer; }
html[data-theme="dark"] .target-hero-ring > div { color:#172230; }
html[data-theme="dark"] .target-hero-ring span { color:#65758a; }
html[data-theme="dark"] .analytics-hero { color:#fff; }
@media(max-width:640px) { html[data-theme="dark"] .profile-theme-panel { align-items:flex-start; flex-direction:column; } }

body[data-page-section="clients"] .main-content,
body[data-page-section="timeline"] .main-content,
body[data-page-section="projects"] .main-content,
body[data-page-section="profile"] .main-content { min-width: 0; }
body[data-page-section="clients"] :is(.table-wrap, .client-table-wrap) { max-width: 100%; }
body[data-page-section="clients"] :is(.table-wrap, .client-table-wrap) table { min-width: 920px; }

/* Keep the dedicated visual identity of the public, premium login page. */
body.premium-page { --text: #142943; --primary: #10243f; }
body.premium-page .hero-art .main-card,
body.premium-page .hero-art .floating-card,
body.premium-page .hero-art .stat-card {
  animation: crm-hero-drift 7s ease-in-out infinite;
}
body.premium-page .hero-art .floating-card { animation-delay: -2s; }

/* Unified user appearance system. Keep all shared pages on the same tokens. */
html[data-color-palette="classic"] {
  --bg: #f4f7fb; --surface: #ffffff; --surface-strong: #ffffff; --surface-alt: #f5f8fc; --field-surface: #ffffff;
  --text: #172b45; --muted: #64758b; --muted-soft: #8290a2; --primary: #15365e; --primary-soft: #31577f;
  --beige: #c8a56b; --line: #dfe7f0; --success: #258365; --danger: #bd4d56;
}
html[data-color-palette="ocean"] {
  --bg: #eef7fa; --surface: #ffffff; --surface-strong: #ffffff; --surface-alt: #f1fafc; --field-surface: #fbfeff;
  --text: #163b4b; --muted: #587584; --muted-soft: #7d9aa5; --primary: #0c6475; --primary-soft: #2d9db1;
  --beige: #d7a34d; --line: #d5e8ed; --success: #27856b; --danger: #bd5360;
}
html[data-color-palette="emerald"] {
  --bg: #f1f8f4; --surface: #ffffff; --surface-strong: #ffffff; --surface-alt: #f3faf6; --field-surface: #fcfffd;
  --text: #173c35; --muted: #628077; --muted-soft: #8ba49d; --primary: #176b55; --primary-soft: #36a47c;
  --beige: #c89e55; --line: #d8eae2; --success: #27815d; --danger: #bd5b5b;
}
html[data-color-palette="plum"] {
  --bg: #f7f3fa; --surface: #ffffff; --surface-strong: #ffffff; --surface-alt: #faf7fc; --field-surface: #fffdfd;
  --text: #3f2b50; --muted: #786786; --muted-soft: #a08eac; --primary: #613d7d; --primary-soft: #a875ba;
  --beige: #c99958; --line: #e8dced; --success: #36856c; --danger: #be5d70;
}
html[data-color-palette="graphite"] {
  --bg: #f1f4f6; --surface: #ffffff; --surface-strong: #ffffff; --surface-alt: #f5f7f8; --field-surface: #fcfdfe;
  --text: #263746; --muted: #687987; --muted-soft: #8c9aa3; --primary: #263746; --primary-soft: #65798b;
  --beige: #bd8b45; --line: #dce3e8; --success: #2d806a; --danger: #b6565e;
}

body[data-page-mode="standalone"] { background: var(--bg); color: var(--text); }
body[data-page-mode="standalone"] :is(.topbar,.panel,.stat-card,.category-card,.hero-card,.profile-account-hero,.profile-backup-box,.service-setting-row,.account-security-card,.subscription-card,.appearance-settings-panel) {
  color: var(--text); border-color: var(--line); background: var(--surface); box-shadow: var(--shadow);
}
body[data-page-mode="standalone"] :is(.form-grid > label,.form-grid > fieldset) { color: var(--text); border-color: var(--line); background: var(--surface); }
body[data-page-mode="standalone"] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),select,textarea) { color: var(--text); border-color: var(--line); background: var(--field-surface); }
body[data-page-mode="standalone"] :is(.topbar h2,.panel h3,.hero-card h3) { color: var(--primary); }
body[data-page-mode="standalone"] .primary-btn { border-color: var(--primary); background: var(--primary); color: #fff; }
body[data-page-mode="standalone"] .ghost-btn { border-color: var(--line); background: var(--surface); color: var(--text); }
body[data-page-mode="standalone"] .data-table th { color: var(--primary); background: var(--surface-alt); }
body[data-page-mode="standalone"] .data-table td { color: var(--text); background: var(--surface); border-color: var(--line); }

/* Dark mode: every shared surface gets an explicit readable background and text color. */
html[data-theme="dark"] {
  --bg: #0e1621; --surface: #172230; --surface-strong: #1b2a3a; --surface-alt: #223347; --field-surface: #111c29;
  --text: #e6edf5; --muted: #aab8c8; --muted-soft: #8798ab; --primary: #8db6ea; --primary-soft: #6e9bd3;
  --beige: #d5b06e; --line: rgba(188, 207, 228, .17); --shadow: 0 14px 38px rgba(0,0,0,.24);
}
html[data-theme="dark"][data-color-palette="ocean"] { --primary: #69c7d8; --primary-soft: #35a9bd; --beige: #e0b866; }
html[data-theme="dark"][data-color-palette="emerald"] { --primary: #70d0a8; --primary-soft: #3eaa83; --beige: #dfb66e; }
html[data-theme="dark"][data-color-palette="plum"] { --primary: #d1a5e3; --primary-soft: #a875ba; --beige: #dfb375; }
html[data-theme="dark"][data-color-palette="graphite"] { --primary: #b7c9d7; --primary-soft: #8299aa; --beige: #d6ad70; }
html[data-theme="dark"] body,
html[data-theme="dark"] body[data-page-mode="standalone"] { color: var(--text); background: radial-gradient(circle at 85% 0, rgba(50,83,120,.18), transparent 28%), linear-gradient(180deg, #101a27, #0d1520); }
html[data-theme="dark"] body[data-page-mode="standalone"] :is(.topbar,.panel,.stat-card,.category-card,.hero-card,.profile-account-hero,.profile-backup-box,.service-setting-row,.account-security-card,.subscription-card,.appearance-settings-panel,.form-grid > label,.form-grid > fieldset) {
  color: var(--text); border-color: var(--line); background: var(--surface); box-shadow: var(--shadow);
}
html[data-theme="dark"] body[data-page-mode="standalone"] :is(.eyebrow,.subtle,.muted,.profile-account-email,.appearance-mode-copy small,.color-palette-option small) { color: var(--muted); }
html[data-theme="dark"] body[data-page-mode="standalone"] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),select,textarea) { color: var(--text); border-color: var(--line); background: var(--field-surface); }
html[data-theme="dark"] body[data-page-mode="standalone"] :is(.topbar h2,.panel h3,.hero-card h3,.form-grid label > span,.color-palette-option strong) { color: var(--text); }
html[data-theme="dark"] body[data-page-mode="standalone"] .primary-btn { border-color: var(--primary-soft); background: var(--primary-soft); color: #07131d; }
html[data-theme="dark"] body[data-page-mode="standalone"] :is(.ghost-btn,.profile-theme-button,.color-palette-option) { color: var(--text); border-color: var(--line); background: var(--surface-alt); }
html[data-theme="dark"] body[data-page-mode="standalone"] .data-table,
html[data-theme="dark"] body[data-page-mode="standalone"] .data-table td { color: var(--text); background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] body[data-page-mode="standalone"] .data-table th { color: var(--primary); background: var(--surface-alt) !important; border-color: var(--line); }
html[data-theme="dark"] :is(.crm-card,.crm-post,.crm-resale,.resale-listing-card,.resale-filters,.resale-dialog,.developer-directory,.developer-detail-tabs,.developer-directory-card,.developer-mini-card) { color: var(--text); border-color: var(--line); background: var(--surface) !important; }
html[data-theme="dark"] :is(.crm-head h1,.crm-post-body,.crm-resale h3,.resale-section-head h2,.resale-dialog > header h2,.developer-directory-heading h2,.developer-detail-tabs .active) { color: var(--text); }
html[data-theme="dark"] :is(.crm-head p,.crm-post-head,.crm-empty,.resale-card-copy > small,.developer-directory-heading p,.developer-directory-card small) { color: var(--muted); }
html[data-theme="dark"] :is(.crm-btn-secondary,.resale-dialog-close,.developer-detail-tab) { color: var(--text); border-color: var(--line); background: var(--surface-alt); }
html[data-theme="dark"] :is(.news-ticker,.alert-ticker) { color: var(--text); border-color: var(--line); background: var(--surface) !important; }
html[data-theme="dark"] :is(.modal-content,.workspace-page-modal-panel,.client-drawer,.market-chart-dialog) { color: var(--text); border-color: var(--line); background: var(--surface) !important; }
html[data-theme="dark"] ::placeholder { color: var(--muted-soft); }

/* Preserve the account hero as the visual anchor of the profile page. */
body[data-page-section="profile"] .profile-account-hero {
  color: #fff;
  border-color: color-mix(in srgb, var(--primary-soft) 48%, #fff 18%);
  background: radial-gradient(circle at 8% 0, color-mix(in srgb, var(--primary-soft) 55%, transparent), transparent 34%), linear-gradient(128deg, color-mix(in srgb, var(--primary) 86%, #061a30), var(--primary) 62%, var(--primary-soft));
  box-shadow: 0 22px 48px color-mix(in srgb, var(--primary) 20%, transparent);
}
body[data-page-section="profile"] .profile-account-hero .eyebrow { color: #b9d7f5; }
body[data-page-section="profile"] .profile-account-hero h2 { color: #fff; }
body[data-page-section="profile"] .profile-account-hero .profile-account-email { color: rgba(255,255,255,.76); }
body[data-page-section="profile"] .profile-account-progress { border-color: rgba(255,255,255,.16); background: rgba(5,20,44,.24); }
body[data-page-section="profile"] .profile-account-progress-head { color: #dcecff; }
body[data-page-section="profile"] .profile-account-progress-head strong { color: #f4d18f; }
body[data-page-section="profile"] .profile-account-progress small { color: rgba(255,255,255,.7); }
body[data-page-section="profile"] .profile-account-stats > div { border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.08); }
body[data-page-section="profile"] .profile-account-stats span { color: rgba(255,255,255,.74); }
body[data-page-section="profile"] .profile-account-stats strong { color: #fff; }

@media (max-width: 760px) {
  body[data-page-section="profile"] .color-palette-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
body.premium-page .hero-art .stat-card { animation-delay: -4s; }
body.premium-page .hero-art .bars i { transform-origin: bottom; animation: crm-chart-pulse 3.2s ease-in-out infinite alternate; }
body.premium-page .hero-art .bars i:nth-child(2n) { animation-delay: -1.4s; }
body.premium-page .hero-art .bars i:nth-child(3n) { animation-delay: -2.3s; }
@keyframes crm-hero-drift { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
@keyframes crm-chart-pulse { from { scale: 1 .94; opacity: .75; } to { scale: 1 1.04; opacity: 1; } }

@media (max-width: 900px) {
  body[data-page-section="overview"] .dashboard-grid { grid-template-columns: 1fr; }
  body[data-page-section="overview"] .dashboard-grid > .wide { grid-column: auto; }
  body[data-page-section="analytics"] .analytics-main-grid,
  body[data-page-section="analytics"] .analytics-money-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body[data-page-mode="standalone"] .main-content { padding: 10px 10px 30px; }
  body[data-page-mode="standalone"] .topbar { padding: 13px 14px; }
  body[data-page-mode="standalone"] .panel { padding: 13px; }
  body[data-page-section="overview"] #overviewStats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  body[data-page-section="overview"] #overviewStats > * { min-height: 98px; }
  body[data-page-section="overview"] #overviewCurveChart,
  body[data-page-section="analytics"] #analyticsChart { height: 230px !important; min-height: 210px; }
  body[data-page-section="targets"] .table-wrap { max-height: 48vh; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-page-mode="standalone"] *, body[data-page-mode="standalone"] *::before, body[data-page-mode="standalone"] *::after,
  body.premium-page .hero-art * {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
.personal-orientation-card { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:16px 18px; border:1px solid #e1e8ef; border-radius:17px; background:linear-gradient(115deg,#fff 0%,#f8fafc 100%); box-shadow:0 7px 20px rgba(18,42,68,.045); }
.personal-orientation-card h4 { margin:7px 0 3px; color:#173656; font-size:1.05rem; }
.personal-orientation-card p { margin:0; color:#687b91; font-size:.86rem; }
.personal-orientation-date { color:#9b733c; font-size:.74rem; font-weight:800; }
.personal-orientation-notes { margin-top:10px; padding-top:9px; border-top:1px solid #e9edf1; color:#435a72; font-size:.88rem; line-height:1.7; white-space:pre-wrap; }
.personal-orientation-card > button { display:grid; width:34px; height:34px; flex:none; place-items:center; border:1px solid #f0d9d7; border-radius:11px; color:#ad514d; background:#fff7f6; font-size:1.2rem; cursor:pointer; }
.personal-orientation-empty { padding:25px 18px; border:1px dashed #cad5e1; border-radius:16px; color:#6d7e91; background:#f8fafc; text-align:center; }
@media(max-width:560px){#personalOrientationForm{grid-template-columns:1fr!important}.personal-orientation-card{padding:13px}.personal-orientation-card h4{font-size:.98rem}}
