/* Dark theme for the entire internal OS. Loaded LAST, after all existing modules.
   No filters/inversion: PDF/brand media and chart colors retain their meaning. */
:root { color-scheme: light; }
.fiscal-address-block {margin:16px 0;padding:16px;border:1px solid var(--line);border-radius:12px;min-width:0;color:var(--ink);text-align:left}
.fiscal-address-block h3 {margin:0 0 10px;font-size:13px;color:var(--muted)}
.fiscal-address-block address {display:grid;gap:6px;margin:0;font-style:normal;font-size:13px;line-height:1.6}
.fiscal-address-block address span {min-width:0;white-space:pre-wrap;overflow-wrap:anywhere}
.theme-toggle {
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-width:42px;min-height:38px;padding:8px 11px;
  border:1px solid var(--line);border-radius:10px;
  background:var(--card);color:var(--ink);
  font-size:12px;font-weight:700;white-space:nowrap;
}
.theme-toggle:hover {border-color:var(--accent2);background:var(--bg)}
.theme-toggle [data-theme-symbol] {font-size:19px;line-height:1}
.theme-toggle:focus-visible {outline:3px solid var(--accent2);outline-offset:2px}
@media(max-width:650px){.theme-toggle {min-width:38px;padding:6px 8px}
  .theme-toggle [data-theme-caption]{display:none}}
/* Country and form validation are available in both themes. */
.country-select-wrap {position:relative;display:flex;align-items:center;min-width:0}
.country-select-wrap select {
  padding-left:52px!important;min-height:48px;font-size:14px!important;
  border-color:var(--line)!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis
}
.country-flag {
  position:absolute;left:14px;top:50%;transform:translateY(-50%);
  font-size:22px;line-height:1;pointer-events:none;z-index:1;
  width:28px;text-align:center;
}
.field-hint {font-size:11px;line-height:1.5;color:var(--muted);margin:1px 0 0}
.field-feedback {font-size:11px;line-height:1.45;color:#b83239;margin:1px 0 0}
.field-feedback:empty {display:none}
.form-field.is-invalid input,.form-field.is-invalid textarea,
.form-field.is-invalid select {border:2px solid #c43f48!important;background:#fff9f9!important}
.form-field.is-invalid input:focus-visible,.form-field.is-invalid textarea:focus-visible,
.form-field.is-invalid select:focus-visible {outline:2px solid #d54856!important}
.form-field.is-invalid label {color:#b83239!important}
.form-field [name="monthly_fee"] {font-size:15px!important;font-variant-numeric:tabular-nums;letter-spacing:.005em}
.form-fields .country-field {margin-bottom:3px}
@media(max-width:560px){.country-select-wrap select {font-size:16px!important}
  .field-feedback{font-size:12px}
  .theme-toggle{position:relative;z-index:2}}
/* Keep preferred contrast and all app regions on the same palette. */
html[data-theme="dark"] {
  --ink:#f1eaf7;
  --muted:#baadc7;
  --accent:#dca9fa;
  --accent2:#c887ed;
  --orange:#ff9851;
  --bg:#15111c;
  --line:#3d324a;
  --success:#70d6a4;
  --danger:#ff9189;
  --card:#251d2f;
  --shadow:0 8px 25px rgba(5,3,8,.24);
  color-scheme:dark;
}
html[data-theme="dark"] body,
html[data-theme="dark"] .main-wrap {background:#15111c;color:var(--ink)}
html[data-theme="dark"] .main-wrap {background:radial-gradient(ellipse at 80% 0%,#38224938,transparent 390px),#15111c}
html[data-theme="dark"] .sidebar {
  background:linear-gradient(165deg,#21172c,#1b1425 75%,#26192c);
  border-color:#40304e;color:var(--ink)
}
html[data-theme="dark"] .brand strong,html[data-theme="dark"] .eyebrow{color:#e2b2ff}
html[data-theme="dark"] .brand strong span{color:#ff994d}
html[data-theme="dark"] .brand small,
html[data-theme="dark"] .workspace-label,
html[data-theme="dark"] .sidebar-sign small {color:#afa0ba}
html[data-theme="dark"] .nav-link {color:#c9b8d4}
html[data-theme="dark"] .nav-icon {color:#c9b8d4}
html[data-theme="dark"] .nav-link.active {
  background:linear-gradient(110deg,#742b92,#9941a5);color:#fff
}
html[data-theme="dark"] .nav-link.active .nav-icon{color:#fff}
html[data-theme="dark"] .nav-link:hover:not(.active){background:#392443;color:#f4e7ff}
html[data-theme="dark"] .sidebar-note {background:#2d213a;border-color:#463451;color:#d7c6e0}
html[data-theme="dark"] .sidebar-note small {color:#aea1bb}
html[data-theme="dark"] .sidebar-sign strong{color:#f3eafa}
html[data-theme="dark"] .sidebar-sign {border-color:#453452}
html[data-theme="dark"] .exit-btn{color:#d2a9eb}
html[data-theme="dark"] .topbar {
  background:#201927;border-color:#44354f;color:var(--ink)
}
html[data-theme="dark"] .breadcrumb,
html[data-theme="dark"] .today-chip {color:#c7b7d3}
html[data-theme="dark"] .breadcrumb strong {color:#f4eafb}
html[data-theme="dark"] .today-chip {background:#33263f;border-color:#4c3a59}
html[data-theme="dark"] .top-avatar {background:#473050;color:#f0cbff}
html[data-theme="dark"] .page-heading h1,
html[data-theme="dark"] .page-heading p {color:var(--ink)}
html[data-theme="dark"] .page-heading p {color:#baadc8}
html[data-theme="dark"] .panel,
html[data-theme="dark"] .card,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .client-card,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .no-data,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .report-card,
html[data-theme="dark"] .report-list-item,
html[data-theme="dark"] .account-security,
html[data-theme="dark"] .account-note {
  background:#251d2f;border-color:#45364e;color:var(--ink)
}
html[data-theme="dark"] .metric-card{background:linear-gradient(145deg,#292035,#251c30)}
html[data-theme="dark"] .metric-value,
html[data-theme="dark"] .metric-top,
html[data-theme="dark"] .panel-title,
html[data-theme="dark"] .detail-row strong,
html[data-theme="dark"] .contract-notes p,
html[data-theme="dark"] .client-title,
html[data-theme="dark"] .client-card strong,
html[data-theme="dark"] .activity-item h3,
html[data-theme="dark"] .activity-item p,
html[data-theme="dark"] .update-block strong,
html[data-theme="dark"] .empty-state h3,
html[data-theme="dark"] .report-heading h2,
html[data-theme="dark"] .report-card h3,
html[data-theme="dark"] .reports-module,
html[data-theme="dark"] .reports-module h2,
html[data-theme="dark"] .reports-module h3 {color:#f0e8f7}
html[data-theme="dark"] .metric-sub,
html[data-theme="dark"] .panel-sub,
html[data-theme="dark"] .client-minor,
html[data-theme="dark"] .small-muted,
html[data-theme="dark"] .mini-meta,
html[data-theme="dark"] .detail-row span,
html[data-theme="dark"] .contract-notes,
html[data-theme="dark"] .source-detail,
html[data-theme="dark"] .source-detail small,
html[data-theme="dark"] .mini-text p,
html[data-theme="dark"] .mini-text small,
html[data-theme="dark"] .activity-item time,
html[data-theme="dark"] .no-data,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .empty-state p,
html[data-theme="dark"] .form-help,
html[data-theme="dark"] .field-hint,
html[data-theme="dark"] .report-note,
html[data-theme="dark"] .report-form label,
html[data-theme="dark"] .report-list-meta dt,
html[data-theme="dark"] .report-save-status,
html[data-theme="dark"] .report-hash,
html[data-theme="dark"] .investment-label,
html[data-theme="dark"] .investment-note,
html[data-theme="dark"] .investment-table small {color:#b9a9c4}
html[data-theme="dark"] .panel,
html[data-theme="dark"] .report-card{box-shadow:none}
html[data-theme="dark"] .report-card,
html[data-theme="dark"] .report-list-item,
html[data-theme="dark"] .report-delivery {border-color:#493851}
html[data-theme="dark"] .report-savebar {
  background:#251d2f;border-color:#5b4669;color:var(--ink)
}
html[data-theme="dark"] .report-state,
html[data-theme="dark"] .report-demo,
html[data-theme="dark"] .report-private,
html[data-theme="dark"] .password-requirements,
html[data-theme="dark"] .split-note,
html[data-theme="dark"] .category-counts>div,
html[data-theme="dark"] .investment-progress,
html[data-theme="dark"] .table-scroll-hint {background:#33263e;border-color:#4f3a5d;color:#dec3ea}
html[data-theme="dark"] .report-state.generated,
html[data-theme="dark"] .pill.good{background:#173f33;color:#94f6c3;border-color:#346657}
html[data-theme="dark"] .report-error,
html[data-theme="dark"] .pill.bad,
html[data-theme="dark"] .field-feedback,
html[data-theme="dark"] .account-feedback.error{color:#ffada7}
html[data-theme="dark"] .report-error,
html[data-theme="dark"] .pill.bad{background:#45252d;border-color:#68434b}
html[data-theme="dark"] .pill.wait,
html[data-theme="dark"] .investment-warning{background:#4b3828;color:#ffcc8b;border-color:#72522f}
html[data-theme="dark"] .pill.neutral{background:#393042;color:#d4c5e0}
html[data-theme="dark"] .client-tabs {border-color:#493858}
html[data-theme="dark"] .client-tabs button{color:#cdb8d8}
html[data-theme="dark"] .client-tabs button.active{background:#4e2b63;color:#f2d3ff;border-color:#bf7de7}
html[data-theme="dark"] .detail-row,
html[data-theme="dark"] .activity-item{border-color:#3d3147}
html[data-theme="dark"] .activity-item {background:#2b2036;color:var(--ink)}
html[data-theme="dark"] .activity-item:first-child {
  background:linear-gradient(115deg,#3d2750,#32233d);border-color:#604676
}
html[data-theme="dark"] .next-step,
html[data-theme="dark"] .chart-data,
html[data-theme="dark"] .document-list a {background:#30243a;color:#ebc9fb;border-color:#453653}
html[data-theme="dark"] .document-list small{color:#b9a2c5}
html[data-theme="dark"] .list-table th {
  background:#332740;color:#d1bddb
}
html[data-theme="dark"] .list-table td {background:#241d2d;color:#eee3f5;border-color:#403248}
html[data-theme="dark"] .list-table tr:hover td{background:#30253b}
html[data-theme="dark"] .search-results {background:#281f33;border-color:#493954}
html[data-theme="dark"] .search-results button{color:#eee2f8}
html[data-theme="dark"] .search-results button:hover{background:#43304d}
html[data-theme="dark"] .search-results small{color:#bba9c8}
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .report-form input,
html[data-theme="dark"] .report-form select,
html[data-theme="dark"] .report-form textarea,
html[data-theme="dark"] .investment-controls input,
html[data-theme="dark"] .investment-controls select,
html[data-theme="dark"] .investment-module select {
  background:#302639;color:#f3e9f9;border-color:#594864;
  caret-color:#e8b5ff
}
html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder{color:#9e8eaa}
html[data-theme="dark"] .form-field label{color:#ddcfe7}
html[data-theme="dark"] .form-field.is-invalid label,
html[data-theme="dark"] .form-field.is-invalid .field-feedback{color:#ffaaa8!important}
html[data-theme="dark"] .form-field.is-invalid input,
html[data-theme="dark"] .form-field.is-invalid textarea,
html[data-theme="dark"] .form-field.is-invalid select{border:2px solid #f3828b!important;background:#452a39!important}
html[data-theme="dark"] .modal-head,
html[data-theme="dark"] .modal-footer{border-color:#44354f}
html[data-theme="dark"] .modal-close{background:#3d2e49;color:#e4d3f0}
html[data-theme="dark"] .btn.secondary,
html[data-theme="dark"] .theme-toggle{background:#30253a;color:#eadcf6;border-color:#554460}
html[data-theme="dark"] .btn.primary{color:white;background:linear-gradient(110deg,#7a3295,#9e4bab)}
html[data-theme="dark"] .btn.secondary:hover,
html[data-theme="dark"] .theme-toggle:hover{background:#41304c}
html[data-theme="dark"] .link-text,
html[data-theme="dark"] .document-list a,
html[data-theme="dark"] .contract-documents a{color:#dbacff}
html[data-theme="dark"] .history-chart text,
html[data-theme="dark"] .investment-chart text{fill:#c8b6d6}
html[data-theme="dark"] .login-body{
  background:radial-gradient(ellipse at 20% 10%,#402052 0,transparent 37%),
             linear-gradient(135deg,#15101e,#0d0b12)
}
html[data-theme="dark"] .login-card input{background:#302639;color:#f4eafd;border-color:#5b4568}
html[data-theme="dark"] .login-card p,
html[data-theme="dark"] .login-footer{color:#b7a8c6}
html[data-theme="dark"] .report-preview-page {
  background:#fff; /* PDF pages are intrinsically white and must not be inverted */
}
html[data-theme="dark"] .demo-banner{background:#4b3828;color:#ffce90;border-color:#8a6542}
