/**
 * UI Refresh — product-wide visual consistency on top of Ocean Finance.
 * Loaded after density.css. Prefer tokens; avoid one-off hex where possible.
 */

:root {
  --ui-refresh-surface: color-mix(in srgb, var(--ds-surface, #0f2744) 88%, #000 12%);
  --ui-refresh-surface-2: color-mix(in srgb, var(--ds-surface, #0f2744) 72%, #081c34 28%);
  --ui-refresh-line: color-mix(in srgb, var(--ocean-sky, #38bdf8) 18%, rgba(148, 163, 184, 0.22) 82%);
  --ui-refresh-line-strong: color-mix(in srgb, var(--ocean-sky, #38bdf8) 32%, rgba(65, 113, 154, 0.45) 68%);
  --ui-refresh-muted: color-mix(in srgb, var(--ocean-mist, #91b8d1) 86%, #fff 14%);
  --ui-refresh-title: color-mix(in srgb, var(--ocean-glacier, #cfe9f7) 94%, #fff 6%);
  --ui-refresh-radius: 12px;
  --ui-refresh-radius-lg: 16px;
  --ui-refresh-shadow: 0 10px 30px rgba(0, 12, 28, 0.28);
  --ui-refresh-focus: color-mix(in srgb, var(--ocean-sky, #38bdf8) 70%, transparent);
}

/* ── Page headers ─────────────────────────────────────────────────────────── */

.page-header,
.settings-page-card .page-header,
.sidebar-content > .page-card > .page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 1.35rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ui-refresh-line);
}

.page-header .page-header-left,
.page-header .cr-reporting-header-text,
.page-header .cr-mr-header-stack {
  min-width: min(100%, 280px);
  flex: 1 1 auto;
}

.page-title,
.page-header h1 {
  margin: 0 0 0.28rem;
  color: var(--ui-refresh-title) !important;
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.page-subtitle {
  margin: 0;
  color: var(--ui-refresh-muted) !important;
  max-width: 58ch;
  line-height: 1.45;
  font-size: 0.92rem;
}

.page-header-right,
.cr-mr-header-outline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ── Shared filter / toolbar strip ────────────────────────────────────────── */

.ui-filter-bar,
.mt5x-filter,
.cr-mr-filter-toolbar-row,
.conn-filter-bar,
.notif-filter-row,
.filter-toolbar,
.page-filters,
.filter-panel,
.filters-card,
#filterForm,
.reports-filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 14px;
  padding: 14px 16px;
  margin-bottom: 1rem;
  border: 1px solid var(--ui-refresh-line);
  border-radius: var(--ui-refresh-radius-lg);
  background:
    linear-gradient(180deg, rgba(56, 189, 248, 0.05), transparent 42%),
    var(--ui-refresh-surface-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.ui-filter-bar label,
.mt5x-field label,
.cr-reports-filter-label,
.filter-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ui-refresh-muted);
}

.ui-filter-bar input:not([type="checkbox"]):not([type="radio"]),
.ui-filter-bar select,
.mt5x-field input,
.mt5x-field select,
.cr-reports-date-input,
.filter-toolbar input:not([type="checkbox"]):not([type="radio"]),
.filter-toolbar select,
.page-filters input:not([type="checkbox"]):not([type="radio"]),
.page-filters select,
.filter-panel input:not([type="checkbox"]):not([type="radio"]),
.filter-panel select,
.filters-card input:not([type="checkbox"]):not([type="radio"]),
.filters-card select {
  appearance: none;
  min-height: 40px;
  min-width: 140px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--ui-refresh-line);
  background: rgba(8, 22, 40, 0.72) !important;
  color: var(--ui-refresh-title) !important;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ui-filter-bar input:not([type="checkbox"]):not([type="radio"]):focus,
.ui-filter-bar select:focus,
.mt5x-field input:focus,
.mt5x-field select:focus,
.cr-reports-date-input:focus {
  border-color: color-mix(in srgb, var(--ocean-sky) 55%, transparent) !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
  outline: none;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn,
button.btn,
a.btn {
  border-radius: 10px !important;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: filter 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:hover,
button.btn:hover,
a.btn:hover {
  transform: translateY(-1px);
}

.btn-primary,
.mt5x-show,
.cr-reports-toolbar-btn:not(.cr-reports-toolbar-btn--ghost),
button.primary,
.action-btn-primary {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--ocean-sky, #38bdf8) 72%, #0ea5e9),
    color-mix(in srgb, var(--ds-primary, #41719a) 70%, #0c4a6e)
  ) !important;
  border: 1px solid color-mix(in srgb, var(--ocean-sky) 40%, transparent) !important;
  color: #f0f9ff !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 6px 16px rgba(14, 116, 144, 0.22);
}

.btn-secondary,
.cr-mr-btn-outline,
.cr-reports-toolbar-btn--ghost,
.mt5x-dl,
a.mt5x-dl {
  background: rgba(56, 189, 248, 0.08) !important;
  border: 1px solid var(--ui-refresh-line-strong) !important;
  color: var(--ui-refresh-title) !important;
}

.btn-secondary:hover,
.cr-mr-btn-outline:hover,
.mt5x-dl:hover {
  background: rgba(56, 189, 248, 0.16) !important;
}

.btn-sm {
  min-height: 32px;
  padding: 5px 12px;
  font-size: 12.5px;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */

.data-table,
.standard-data-table,
.mt5x-table,
.clients-table,
.settings-users-table,
.if-features-table,
.broker-tbl,
.cm-table,
.md-table,
.md-readonly-table,
.users-table,
.ft-table,
.ob-table,
.login-info-table,
.mgmt-bm-table,
.broker-directory-table,
.clients-list-table,
.pnl-accounts,
.pnl-months {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.table-container,
.mt5x-tablewrap,
.table-wrap,
.ui-table-wrap,
.broker-tbl-wrap,
.if-table-scroll,
.mgmt-bm-table-wrap,
.pnl-accounts-scroll,
.settings-users-table-wrap {
  overflow: auto;
  border: 1px solid var(--ui-refresh-line);
  border-radius: var(--ui-refresh-radius-lg);
  background: color-mix(in srgb, var(--ds-surface, #0f2744) 55%, transparent);
  box-shadow: var(--ui-refresh-shadow);
}

.section-card-table-panel {
  overflow: auto;
}

.data-table thead th,
.standard-data-table thead th,
.mt5x-table thead th,
.broker-tbl thead th,
.cm-table thead th,
.md-table thead th,
.md-readonly-table thead th,
.users-table thead th,
.ft-table thead th,
.ob-table thead th,
.login-info-table thead th,
.mgmt-bm-table thead th,
.broker-directory-table thead th,
.clients-list-table thead th,
.pnl-accounts thead th,
.pnl-months thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--ds-surface, #0f2744) 92%, var(--ocean-steel, #41719a)) !important;
  border-bottom: 1px solid var(--ui-refresh-line-strong) !important;
  color: var(--ui-refresh-muted) !important;
  font-size: 11px !important;
  font-weight: 650 !important;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 12px 14px !important;
  white-space: nowrap;
}

.data-table tbody td,
.standard-data-table tbody td,
.mt5x-table tbody td,
.broker-tbl tbody td,
.cm-table tbody td,
.md-table tbody td,
.md-readonly-table tbody td,
.users-table tbody td,
.ft-table tbody td,
.ob-table tbody td,
.login-info-table tbody td,
.mgmt-bm-table tbody td,
.broker-directory-table tbody td,
.clients-list-table tbody td,
.pnl-accounts tbody td,
.pnl-months tbody td {
  padding: 11px 14px !important;
  border-bottom: 1px solid color-mix(in srgb, var(--ui-refresh-line) 70%, transparent) !important;
  color: color-mix(in srgb, var(--ocean-glacier, #cfe9f7) 88%, var(--ocean-white, #fff) 12%);
  vertical-align: middle;
}

.data-table tbody tr:last-child td,
.mt5x-table tbody tr:last-child td,
.broker-tbl tbody tr:last-child td,
.cm-table tbody tr:last-child td,
.md-table tbody tr:last-child td,
.users-table tbody tr:last-child td,
.ft-table tbody tr:last-child td,
.ob-table tbody tr:last-child td,
.mgmt-bm-table tbody tr:last-child td,
.pnl-accounts tbody tr:last-child td,
.pnl-months tbody tr:last-child td {
  border-bottom: none !important;
}

.data-table tbody tr:hover td,
.standard-data-table tbody tr:hover td,
.mt5x-table tbody tr:hover td,
.broker-tbl tbody tr:hover td,
.cm-table tbody tr:hover td,
.md-table tbody tr:hover td,
.md-readonly-table tbody tr:hover td,
.users-table tbody tr:hover td,
.ft-table tbody tr:hover td,
.ob-table tbody tr:hover td,
.login-info-table tbody tr:hover td,
.mgmt-bm-table tbody tr:hover td,
.broker-directory-table tbody tr:hover td,
.clients-list-table tbody tr:hover td,
.pnl-accounts tbody tr:hover td,
.pnl-months tbody tr:hover td {
  background: var(--ui-row-hover, var(--color-bg-hover)) !important;
}

.data-table td.text-right,
.data-table th.text-right,
.cell-numeric,
.mt5x-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.table-empty,
.mt5x-empty,
.empty-state {
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--ui-refresh-line);
  border-radius: var(--ui-refresh-radius-lg);
  background: rgba(8, 22, 40, 0.28);
  color: var(--ui-refresh-muted);
}

.table-empty p,
.mt5x-empty-s {
  margin: 0.35rem auto 0;
  max-width: 42ch;
  line-height: 1.45;
}

/* ── Status pills ─────────────────────────────────────────────────────────── */

.mt5x-pill,
.status-pill,
.badge,
.conn-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.mt5x-ok,
.status-pill--ok,
.badge-success {
  color: var(--color-success-light, var(--color-success)) !important;
  background: var(--color-success-subtle) !important;
  border-color: color-mix(in srgb, var(--color-success) 28%, transparent) !important;
}

.mt5x-failed,
.status-pill--failed,
.badge-danger {
  color: var(--color-error-light, var(--color-error)) !important;
  background: var(--color-error-subtle) !important;
  border-color: color-mix(in srgb, var(--color-error) 28%, transparent) !important;
}

.mt5x-missing,
.status-pill--missing,
.badge-muted {
  color: var(--color-text-secondary) !important;
  background: color-mix(in srgb, var(--color-text-muted) 12%, transparent) !important;
  border-color: color-mix(in srgb, var(--color-text-muted) 22%, transparent) !important;
}

.mt5x-idle {
  color: var(--color-text-muted) !important;
  background: color-mix(in srgb, var(--color-text-muted) 10%, transparent) !important;
  border-color: color-mix(in srgb, var(--color-text-muted) 18%, transparent) !important;
}

.badge-warning,
.status-pill--warning {
  color: var(--color-warning-light, var(--color-warning)) !important;
  background: var(--color-warning-subtle) !important;
  border-color: color-mix(in srgb, var(--color-warning) 28%, transparent) !important;
}

.badge-info,
.status-pill--info {
  color: var(--color-info) !important;
  background: color-mix(in srgb, var(--color-info) 14%, transparent) !important;
  border-color: color-mix(in srgb, var(--color-info) 28%, transparent) !important;
}

/* ── Cards / notes / alerts ───────────────────────────────────────────────── */

.page-card,
.settings-page-card,
.cr-reporting-body-surface,
.notif-card,
.equity-card {
  border-radius: var(--ui-refresh-radius-lg);
}

.mt5x-note,
.info-banner,
.page-note,
.alert-info {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  margin-bottom: 1.1rem;
  border: 1px solid color-mix(in srgb, var(--ocean-sky) 22%, var(--ui-refresh-line));
  border-radius: var(--ui-refresh-radius);
  background: color-mix(in srgb, var(--ocean-sky) 7%, transparent);
  color: var(--ui-refresh-muted);
  font-size: 13px;
  line-height: 1.5;
}

.alert {
  border-radius: var(--ui-refresh-radius) !important;
  border-width: 1px !important;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(52, 211, 153, 0.28) !important;
  color: #bbf7d0 !important;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(248, 113, 113, 0.28) !important;
  color: #fecaca !important;
}

/* ── Sidebar polish ───────────────────────────────────────────────────────── */

.sidebar .sidebar-l1-link,
.sidebar .sidebar-l2 {
  border-radius: 10px;
}

.sidebar .sidebar-l1-split-row.active:not(:has(.sidebar-l2-group .sidebar-l2.active)) > .sidebar-l1-link,
.sidebar .sidebar-l1.active,
.sidebar .sidebar-l2.active {
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--ocean-sky) 75%, transparent);
}

.sidebar-user,
.sidebar-footer {
  border-top-color: var(--ui-refresh-line) !important;
}

/* ── Client reporting hub cards ───────────────────────────────────────────── */

.cr-mr-hub-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 1.25rem;
}

.cr-mr-hub-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 16px 14px;
  text-decoration: none;
  border: 1px solid var(--ui-refresh-line);
  border-radius: var(--ui-refresh-radius);
  background: var(--ui-refresh-surface-2);
  transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease;
}

.cr-mr-hub-card:hover {
  transform: translateY(-2px);
  border-color: var(--ui-refresh-line-strong);
  background: color-mix(in srgb, var(--ocean-sky) 8%, var(--ui-refresh-surface-2));
}

.cr-mr-hub-card--active {
  border-color: color-mix(in srgb, var(--ocean-sky) 45%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ocean-sky) 25%, transparent);
}

.cr-mr-hub-card-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ui-refresh-muted);
}

.cr-mr-hub-card-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ui-refresh-title);
  font-variant-numeric: tabular-nums;
}

.cr-mr-hub-card-meta,
.cr-mr-hub-card-action {
  font-size: 12px;
  color: var(--ui-refresh-muted);
}

/* ── MT5 HTML export page ─────────────────────────────────────────────────── */

.mt5x {
  --mt5x-line: var(--ui-refresh-line);
  --mt5x-fg: var(--ui-refresh-title);
  --mt5x-muted: var(--ui-refresh-muted);
}

.mt5x-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.mt5x-stat {
  font-size: 13px;
  color: var(--ui-refresh-muted);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--ui-refresh-line);
}

.mt5x-stat b {
  color: var(--ui-refresh-title);
  font-size: 14px;
}

.mt5x-stat-year {
  margin-left: auto;
  font-size: 12px;
  color: var(--ui-refresh-muted);
}

.mt5x-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.mt5x-period {
  font-weight: 650;
  color: var(--ui-refresh-title);
}

.mt5x-range,
.mt5x-cap {
  font-family: var(--font-mono, "IBM Plex Mono", ui-monospace, monospace);
  font-size: 12.5px;
  color: var(--ui-refresh-muted);
  white-space: nowrap;
}

.mt5x-empty-t {
  font-size: 16px;
  font-weight: 650;
  color: var(--ui-refresh-title);
  margin-bottom: 4px;
}

.mt5x-empty-ic {
  display: none;
}

.mt5x-filter-slim {
  padding: 12px 14px;
  margin-bottom: 12px;
}

.mt5x-filter-slim .mt5x-field select {
  min-width: 220px;
}

.mt5x-years {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.mt5x-year-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
  margin-bottom: 10px;
}

.mt5x-year-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ui-refresh-title);
}

.mt5x-year-meta {
  font-size: 12px;
  color: var(--ui-refresh-muted);
}

.mt5x-year-head .mt5x-dl-all {
  margin-left: auto;
}

.mt5x-login {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mt5x-login-id {
  font-weight: 650;
  color: var(--ui-refresh-title);
  font-variant-numeric: tabular-nums;
}

.mt5x-broker {
  font-size: 11px;
  color: var(--ui-refresh-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mt5x-client {
  font-weight: 600;
  white-space: nowrap;
}

.mt5x-archive-toggle {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--ocean-sky, #38bdf8);
  text-decoration: none;
}

.mt5x-archive-toggle:hover {
  text-decoration: underline;
}

.mt5x-archive {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px dashed var(--ui-refresh-line);
}

.mt5x-archive-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
  margin-bottom: 14px;
}

.mt5x-archive-head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ui-refresh-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mt5x-year-archive .mt5x-year-title {
  color: var(--ui-refresh-muted);
  font-size: 1.15rem;
}

/* ── Connectivity ─────────────────────────────────────────────────────────── */

.connectivity-page .group-header,
.conn-group-header,
.main-container .summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 1.25rem;
}

.main-container .summary-card,
.critical-section,
.group-card {
  border: 1px solid var(--ui-refresh-line) !important;
  border-radius: var(--ui-refresh-radius-lg) !important;
  background: var(--ui-refresh-surface-2) !important;
  padding: 14px 16px;
}

.main-container .summary-card h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ui-refresh-title);
  font-variant-numeric: tabular-nums;
}

.main-container .summary-card p {
  margin: 2px 0 0;
  color: var(--ui-refresh-muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.main-container .page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.connectivity-page .status-dot.connected,
.conn-dot--ok {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

/* ── Clients list ─────────────────────────────────────────────────────────── */

#clients-list-table {
  border-radius: var(--ui-refresh-radius-lg);
  overflow: hidden;
}

.client-avatar {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ocean-sky) 25%, transparent);
}

/* ── Notifications hub ────────────────────────────────────────────────────── */

.notifications-page .notif-hub-grid,
.notif-center-layout {
  gap: 14px;
}

/* ── Notifications / products / brokers / management ──────────────────────── */

.notifications-hub-grid,
.products-grid,
.broker-cards-grid {
  gap: 14px;
}

.notif-hub-card,
.product-card,
.broker-card,
.management-metric-card {
  border: 1px solid var(--ui-refresh-line) !important;
  border-radius: var(--ui-refresh-radius-lg) !important;
  background: var(--ui-refresh-surface-2) !important;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.notif-hub-card:hover,
.product-card:hover,
.broker-card:hover {
  transform: translateY(-2px);
  border-color: var(--ui-refresh-line-strong) !important;
}

.tabs-container .tab-button,
.tabs-header .tab-button,
.global-tabs .tab {
  border-radius: 999px !important;
  padding: 7px 14px !important;
}

.tabs-container .tab-button.active,
.tabs-header .tab-button.active {
  background: color-mix(in srgb, var(--ocean-sky) 18%, var(--ds-surface)) !important;
  border-color: color-mix(in srgb, var(--ocean-sky) 40%, transparent) !important;
}

/* ── Login ────────────────────────────────────────────────────────────────── */

.login-page {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(56, 189, 248, 0.16), transparent 55%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(65, 113, 154, 0.18), transparent 50%),
    var(--ocean-deep, #071526) !important;
}

.login-page .login-card {
  border: 1px solid var(--ui-refresh-line-strong) !important;
  border-radius: 18px !important;
  background: color-mix(in srgb, #0b1f38 88%, transparent) !important;
  box-shadow: 0 24px 60px rgba(0, 8, 20, 0.45) !important;
  backdrop-filter: blur(18px);
}

.login-page .btn-primary {
  width: 100%;
  min-height: 44px;
}

/* ── Settings / onboarding ────────────────────────────────────────────────── */

.settings-page-card,
.onboarding-card,
.workflow-card {
  border: 1px solid var(--ui-refresh-line);
  background: color-mix(in srgb, var(--ds-surface) 80%, transparent);
}

.collapsible-section {
  border-radius: var(--ui-refresh-radius) !important;
}

/* ── Numeric / money density ──────────────────────────────────────────────── */

.val-gain,
.val-loss,
.val-neutral,
.cell-pct,
.text-right.money,
.equity-value {
  font-variant-numeric: tabular-nums;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .page-header {
    align-items: stretch;
  }

  .ui-filter-bar,
  .mt5x-filter,
  .cr-mr-filter-toolbar-row {
    padding: 12px;
  }

  .ui-filter-bar input:not([type="checkbox"]):not([type="radio"]),
  .ui-filter-bar select,
  .mt5x-field input,
  .mt5x-field select {
    min-width: 0;
    width: 100%;
  }

  .mt5x-stat-year {
    margin-left: 0;
    width: 100%;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   PROD UI AUDIT POLISH (2026-08) — fixes and consistency from the live
   spec/ci production review. Grouped here so the whole pass is auditable.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Login page ───────────────────────────────────────────────────────────────
   density.css zooms body to 0.8 on desktop, which made the login page's
   100vw/100vh gradient cover only 80% of the viewport (dark seams right and
   bottom). The login screen is standalone — render it at 1:1. */
body.login-body {
  zoom: 1;
}

/* The brand heading used gradient text whose first stop resolves to a
   near-background navy under the ocean token remap — "SARNEX" was almost
   invisible on desktop. Solid, readable heading instead. */
.login-page .login-logo h1 {
  background: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
  -webkit-text-fill-color: currentColor !important;
  color: var(--ui-refresh-title) !important;
}

.login-remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.login-remember-checkbox {
  width: 16px;
  height: 16px;
  accent-color: #2dd4bf;
}

.login-remember-label {
  margin: 0;
  cursor: pointer;
}

/* ── Quiet row actions ────────────────────────────────────────────────────────
   Solid red Delete / solid amber Edit buttons repeated on every table row
   dominated whole pages (clients, delta management, brokers). Inside tables
   and card action rows they become quiet outline buttons with a semantic
   tint; standalone destructive CTAs keep the solid style. */
td .btn.btn-danger,
td a.btn.btn-danger,
.data-table .btn.btn-danger,
.li-actions .btn.btn-danger,
td .action-btn-danger,
.btn.clients-delete-btn {
  background: rgba(239, 68, 68, 0.07) !important;
  border: 1px solid rgba(239, 68, 68, 0.38) !important;
  color: #f1a0a0 !important;
  font-weight: 500 !important;
  box-shadow: none !important;
  opacity: 1;
}

td .btn.btn-danger:hover,
td a.btn.btn-danger:hover,
.data-table .btn.btn-danger:hover,
.li-actions .btn.btn-danger:hover,
td .action-btn-danger:hover,
.btn.clients-delete-btn:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
  color: #fecaca !important;
}

td .btn.btn-edit,
td a.btn.btn-edit,
.data-table td a.btn.btn-edit,
td .li-actions a.btn.btn-edit,
.data-table .btn.btn-edit,
.li-actions .btn.btn-edit,
td button[data-mt-edit].btn,
td .btn-action.edit,
.action-buttons .btn-action.edit {
  background: rgba(251, 191, 36, 0.07) !important;
  border: 1px solid rgba(251, 191, 36, 0.35) !important;
  color: #e7c26a !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}

td .btn.btn-edit:hover,
td a.btn.btn-edit:hover,
.data-table td a.btn.btn-edit:hover,
td .li-actions a.btn.btn-edit:hover,
.data-table .btn.btn-edit:hover,
.li-actions .btn.btn-edit:hover,
td button[data-mt-edit].btn:hover,
td .btn-action.edit:hover,
.action-buttons .btn-action.edit:hover {
  background: rgba(251, 191, 36, 0.18) !important;
  border-color: rgba(251, 191, 36, 0.55) !important;
  color: #fbd88a !important;
  filter: none;
}

/* ── Toggle "off" state ──────────────────────────────────────────────────────
   The off state rendered muddy red-brown (reads as an error). Off is a
   neutral state — steel slate; on stays green. Tokens override the
   ui-audit-fixes definitions by later source order. */
:root {
  --toggle-off-bg: #35485d;
  --toggle-off-border: #4d6479;
}

body.product-activation-page input:not(:checked) + .settings-perm-switch::after {
  background: #b6c6d6 !important;
}

/* ── Stat cards (Poll Cycles and friends) ───────────────────────────────────── */
.ui-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.ui-stat-card {
  border: 1px solid var(--ui-refresh-line);
  border-radius: var(--ui-refresh-radius-lg);
  background: var(--ui-refresh-surface-2);
  padding: 14px 18px;
}

.ui-stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ui-refresh-muted);
}

.ui-stat-value {
  font-size: 26px;
  font-weight: 700;
  margin: 2px 0;
  font-variant-numeric: tabular-nums;
  color: var(--ui-refresh-title);
}

.ui-stat-sub {
  font-size: 12px;
  color: var(--ui-refresh-muted);
}

.ui-stat-danger .ui-stat-value { color: #f87171; }
.ui-stat-warning .ui-stat-value { color: #fbbf24; }

/* ── Empty states ─────────────────────────────────────────────────────────── */
.ui-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 42px 24px;
  border: 1px dashed var(--ui-refresh-line);
  border-radius: var(--ui-refresh-radius-lg);
  background: color-mix(in srgb, var(--ui-refresh-surface-2) 60%, transparent);
}

.ui-empty-state-icon {
  color: var(--ui-refresh-muted);
  opacity: 0.75;
  margin-bottom: 4px;
}

.ui-empty-state-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ui-refresh-title);
}

.ui-empty-state-text {
  font-size: 12.5px;
  color: var(--ui-refresh-muted);
  max-width: 46ch;
}

/* ── "Being prepared" placeholder pages ─────────────────────────────────────── */
.ui-placeholder-body {
  padding: 24px 32px;
}

.ui-placeholder-hero {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  margin-bottom: 18px;
  border: 1px solid var(--ui-refresh-line);
  border-radius: var(--ui-refresh-radius-lg);
  background: color-mix(in srgb, var(--ocean-sky, #38bdf8) 7%, var(--ui-refresh-surface-2));
}

.ui-placeholder-hero-icon {
  color: var(--ocean-sky, #38bdf8);
  flex-shrink: 0;
  margin-top: 2px;
}

.ui-placeholder-hero-title {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ui-refresh-title);
}

.ui-placeholder-hero-desc {
  font-size: 12.5px;
  color: var(--ui-refresh-muted);
  margin-top: 2px;
}

.ui-placeholder-fields {
  background: var(--ui-refresh-surface-2);
  border: 1px solid var(--ui-refresh-line);
  border-radius: var(--ui-refresh-radius);
  padding: 0 20px;
}

.ui-placeholder-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--ui-refresh-line);
}

.ui-placeholder-field:last-child {
  border-bottom: none;
}

.ui-placeholder-field-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ui-refresh-muted);
  opacity: 0.6;
  margin-top: 5px;
  flex-shrink: 0;
}

.ui-placeholder-field-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ui-refresh-title);
}

.ui-placeholder-field-desc {
  font-size: 12px;
  color: var(--ui-refresh-muted);
  margin-top: 2px;
}

/* ── Misc audit fixes ─────────────────────────────────────────────────────── */

/* Icon chip on the all-accounts summary (was an inline style + emoji). */
.summary-icon-elevated {
  background: var(--bg-elevated, rgba(56, 113, 154, 0.18));
}

/* Broker profile "Edit" header button (was inline-styled with an emoji). */
.btn-website-muted {
  background: var(--ui-refresh-surface-2) !important;
  border-color: var(--ui-refresh-line-strong) !important;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* Equity Tracker: make the chart track its card (Chart.js under body zoom
   under-measured the parent), and turn the bare native multi-select into a
   themed listbox. */
.mgmt-equity-chart-body canvas {
  width: 100% !important;
  height: 100% !important;
}

.mgmt-equity-clients select[multiple] {
  min-height: 9.5rem;
  background: color-mix(in srgb, var(--ds-surface, #0f2744) 55%, #060f1e 45%);
  border: 1px solid var(--ui-refresh-line-strong);
  border-radius: 10px;
  padding: 6px;
  font-size: 13px;
  color: var(--ui-refresh-title);
  scrollbar-width: thin;
}

.mgmt-equity-clients select[multiple]:focus-visible {
  outline: 2px solid var(--ui-refresh-focus);
  outline-offset: 2px;
}

.mgmt-equity-clients select[multiple] option {
  padding: 5px 8px;
  border-radius: 6px;
}

.mgmt-equity-clients select[multiple] option:checked {
  background: linear-gradient(
    color-mix(in srgb, var(--ocean-sky, #38bdf8) 30%, #10263f),
    color-mix(in srgb, var(--ocean-sky, #38bdf8) 30%, #10263f)
  );
  color: #eaf4fc;
}

/* ── Injected-sidebar pages: content must fit beside the fixed sidebar ───────
   Legacy standalone pages (e.g. /brokers/connectivity) get the client-side
   injected sidebar: the wrapper received margin-left but no width limit, so
   fluid full-width content overflowed the viewport by exactly the sidebar
   width. Mirror the width math the injected topbar already uses. */
body:has(.injected-sidebar) .injected-page-content,
body:has(.injected-sidebar) #injectedPageContent {
  width: calc(100% - var(--layout-sidebar-edge, 300px));
  max-width: calc(100vw - var(--layout-sidebar-edge, 300px));
  box-sizing: border-box;
}

body.app-sidebar-collapsed:has(.injected-sidebar) .injected-page-content,
body.app-sidebar-collapsed:has(.injected-sidebar) #injectedPageContent,
html.app-sidebar-collapsed body:has(.injected-sidebar) .injected-page-content,
html.app-sidebar-collapsed body:has(.injected-sidebar) #injectedPageContent {
  width: calc(100% - var(--layout-sidebar-edge-collapsed, 72px));
  max-width: calc(100vw - var(--layout-sidebar-edge-collapsed, 72px));
}

@media (max-width: 1024px) {
  body:has(.injected-sidebar) .injected-page-content,
  body:has(.injected-sidebar) #injectedPageContent {
    width: 100%;
    max-width: 100%;
  }
}

/* ── Fold portrait (~980px, docked tablet sidebar): stack account groups ─────
   The Capital/Equity/Margin panels went two-up inside account cards that are
   only ~500-650px wide next to the docked sidebar, cramping the metric pairs. */
@media (max-width: 1024px) {
  body.sidebar-tablet-persistent .account-overview-roster .ao-groups,
  body.sidebar-touch-expanded .account-overview-roster .ao-groups {
    grid-template-columns: 1fr;
  }
}

/* ── Modal harmonization ──────────────────────────────────────────────────────
   Three modal families grew apart (.modal-overlay/.modal-content|.modal-box,
   .modal-backdrop/.modal, .bm-modal-backdrop/.bm-modal). One backdrop and
   one panel spec; behavior and IDs untouched. */
.modal-overlay,
.modal-backdrop,
.bm-modal-backdrop {
  background: rgba(4, 10, 22, 0.62) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-overlay .modal-content,
.modal-overlay .modal-box,
.modal-backdrop .modal,
.bm-modal-panel {
  background: color-mix(in srgb, var(--ds-surface, #0f2744) 92%, #081527 8%) !important;
  border: 1px solid var(--ui-refresh-line-strong) !important;
  border-radius: var(--ui-refresh-radius-lg) !important;
  box-shadow: 0 28px 70px rgba(0, 8, 20, 0.55) !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   FULL UI PASS (2026-08-14) — layout, forms, tables, chrome.
   ══════════════════════════════════════════════════════════════════════════ */

/* Clients list: fixed columns so Equity/Actions stay readable and Client
   takes the leftover width. auto-layout was splitting 50/50 or collapsing
   the numeric column to 0. */
#clients-list-table {
  table-layout: fixed;
  width: 100%;
}

#clients-list-table th.col-grow,
#clients-list-table td.col-grow {
  width: auto;
}

#clients-list-table th.col-num,
#clients-list-table td.col-num,
#clients-list-table td.clients-equity-cell {
  width: 8.5rem;
  white-space: nowrap;
  text-align: right;
}

#clients-list-table th.col-shrink,
#clients-list-table td.col-shrink,
#clients-list-table td.clients-list-actions {
  width: 6.5rem;
  white-space: nowrap;
}

#clients-list-table .client-name {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

/* Checkbox / radio rows: never shouty uppercase, never look like text fields. */
.ui-filter-bar label:has([type="checkbox"]),
.ui-filter-bar label:has([type="radio"]),
.mt5x-filter label:has([type="checkbox"]),
.filter-toolbar label:has([type="checkbox"]),
.page-filters label:has([type="checkbox"]),
.conn-filter-bar label:has([type="checkbox"]),
.notif-filter-row label:has([type="checkbox"]) {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 13px;
  font-weight: 600;
  min-height: 40px;
  cursor: pointer;
}

.ui-filter-bar input[type="checkbox"],
.ui-filter-bar input[type="radio"],
.mt5x-filter input[type="checkbox"],
.filter-toolbar input[type="checkbox"],
.page-filters input[type="checkbox"],
.conn-filter-bar input[type="checkbox"],
.notif-filter-row input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: checkbox;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  padding: 0;
  accent-color: var(--ocean-sky, #38bdf8);
  cursor: pointer;
}

/* Sentence-case labels sitting beside a control (Remember me, etc.). */
.login-remember-label,
label.form-label:has(+ input[type="checkbox"]),
.form-group:has(> input[type="checkbox"]) > .form-label {
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 0;
}

.login-remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-page .login-btn {
  border: 1px solid color-mix(in srgb, var(--ocean-sky, #38bdf8) 40%, transparent) !important;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--ocean-sky, #38bdf8) 72%, #0ea5e9),
    color-mix(in srgb, var(--ds-primary, #41719a) 70%, #0c4a6e)
  ) !important;
  color: #f0f9ff !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 6px 16px rgba(14, 116, 144, 0.22);
  text-transform: none;
  letter-spacing: 0.02em;
}

.login-page .login-btn:hover {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--ocean-sky, #38bdf8) 82%, #38bdf8),
    color-mix(in srgb, var(--ds-primary, #41719a) 60%, #0ea5e9)
  ) !important;
  color: #fff !important;
}

.login-page .login-input {
  color: var(--ui-refresh-title) !important;
}

.login-page .login-logo p {
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
}

/* Native selects: chevron + consistent field chrome outside filter bars. */
select.form-input,
select.form-select,
.form-group select,
.page-card select:not([multiple]) {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2391b8d1' d='M1.2 1.4L6 6.2l4.8-4.8 1.2 1.2L6 8.6 0 2.6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

/* Page head: match the rest of the refresh tokens. */
.ds-page-head {
  border-bottom-color: var(--ui-refresh-line);
}

.ds-page-head__title {
  color: var(--ui-refresh-title);
  letter-spacing: -0.035em;
}

.ds-page-head__subtitle {
  color: var(--ui-refresh-muted);
  max-width: 58ch;
}

.ds-page-head__actions .btn-brand-cta,
.page-actions .btn-brand-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 650;
}

/* Thin, themed scrollbars on overflow panes (not the whole page). */
.table-container,
.mt5x-tablewrap,
.table-wrap,
.ui-table-wrap,
.section-card-table-panel,
.sidebar-scroll {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ocean-sky, #38bdf8) 40%, transparent) transparent;
}

/* Strong in running copy must not look like a status chip. */
.page-subtitle strong,
.ds-page-head__subtitle strong,
.mt5x-note strong,
.info-banner strong,
.page-note strong,
.alert-info strong,
.pnl-toolbar-hint strong,
.cr-reporting-header-text strong {
  font-weight: 650;
  color: var(--ui-refresh-title);
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
}

/* Quieter hover on dense table actions — lift is for standalone CTAs only. */
td .btn:hover,
.data-table .btn:hover,
.standard-data-table .btn:hover {
  transform: none;
}

/* Sidebar user: long e2e+/operator emails must ellipsis, not wrap the rail. */
.sidebar-user {
  min-width: 0;
}

.sidebar-user-name,
.sidebar-user-info {
  min-width: 0;
}

/* Empty tables: a bit more breathing room and readable copy. */
.table-empty,
.mt5x-empty,
.empty-state,
.ui-empty-state {
  color: var(--ui-refresh-muted);
}

/* Code / login / account ids stay tabular. */
.mt5x-login-id,
.client-name,
code, .mono {
  font-variant-numeric: tabular-nums;
}

/* ══════════════════════════════════════════════════════════════════════════
   PIXEL FOLD 2 — cover (~412×924) and near-square inner (~840×860).
   ══════════════════════════════════════════════════════════════════════════ */

.login-page {
  width: 100%;
  max-width: 100%;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top, 0px))
           max(16px, env(safe-area-inset-right, 0px))
           max(16px, env(safe-area-inset-bottom, 0px))
           max(16px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
}

.login-page .login-card {
  width: 100%;
  max-width: min(420px, 100%);
}

/* Phone + Fold 2 inner (js adds ui-vp-phone on near-square ~840×860). */
html.ui-vp-phone {
  --ds-btn-height: 44px;
  --ds-btn-height-sm: 44px;
}

html.ui-vp-phone,
html.ui-vp-phone body {
  overflow-x: clip;
  max-width: 100%;
}

html.ui-vp-phone .mobile-sidebar-open-btn {
  display: inline-flex !important;
}

html.ui-vp-phone body.sidebar-tablet-persistent .mobile-sidebar-open-btn {
  display: none !important;
}

/* Standalone pages: keep titles/tables out from under the hamburger. */
@media screen and (max-width: 1024px) {
  body:not(.sidebar-tablet-persistent):not(.sidebar-touch-expanded) > .main-container,
  body:not(.sidebar-tablet-persistent):not(.sidebar-touch-expanded) > .page-wrapper,
  body:not(.sidebar-tablet-persistent):not(.sidebar-touch-expanded) > .sidebar-content {
    padding-top: max(64px, calc(44px + env(safe-area-inset-top, 0px) + 16px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    max-width: 100%;
    margin-left: 0;
  }
}

html.ui-vp-phone .ds-page-head {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

html.ui-vp-phone .ds-page-head__actions {
  width: 100%;
  margin-left: 0;
  justify-content: flex-start;
}

html.ui-vp-phone .ds-page-head__actions .btn,
html.ui-vp-phone .ds-page-head__actions .btn-brand-cta,
html.ui-vp-phone .ds-page-head__actions a.btn {
  min-height: 44px;
}

/* Clients list: give names more than 118px on the 412px cover. */
@media screen and (max-width: 768px) {
  #clients-list-table th.col-num,
  #clients-list-table td.col-num,
  #clients-list-table td.clients-equity-cell {
    width: 5.75rem;
  }
  #clients-list-table th.col-shrink,
  #clients-list-table td.col-shrink,
  #clients-list-table td.clients-list-actions {
    width: 5.25rem;
  }
  .clients-delete-btn,
  td .btn.btn-sm,
  .data-table .btn.btn-sm {
    min-height: 44px;
    height: 44px;
    padding-inline: 10px;
  }
}

/* Cover: wrap long client ids instead of clipping into Equity. */
@media screen and (max-width: 480px) {
  #clients-list-table .client-name {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
  }
}

html.ui-vp-phone .ui-filter-bar,
html.ui-vp-phone .filter-panel,
html.ui-vp-phone .filters-card,
html.ui-vp-phone .mt5x-filter {
  padding: 12px;
}

html.ui-vp-phone .ui-filter-bar input:not([type="checkbox"]):not([type="radio"]),
html.ui-vp-phone .ui-filter-bar select,
html.ui-vp-phone .filter-panel input:not([type="checkbox"]):not([type="radio"]),
html.ui-vp-phone .filter-panel select {
  min-width: 0;
  width: 100%;
}

html.ui-vp-phone .summary-strip,
html.ui-vp-phone .summary-grid,
html.ui-vp-phone .cr-mr-hub-cards {
  grid-template-columns: 1fr;
}

/* Fold 2 inner is an 8" near-square — two tiles fit; one column wastes space. */
html.ui-vp-phone.ui-vp-fold2 .summary-strip,
html.ui-vp-phone.ui-vp-fold2 .summary-grid,
html.ui-vp-phone.ui-vp-fold2 .ui-stat-grid,
html.ui-vp-phone.ui-vp-fold2 .cr-mr-hub-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Undo the desktop table !important padding so Fold 2 / cover stay dense. */
html.ui-vp-phone .data-table thead th,
html.ui-vp-phone .standard-data-table thead th,
html.ui-vp-phone .mt5x-table thead th,
html.ui-vp-phone .broker-tbl thead th,
html.ui-vp-phone .cm-table thead th,
html.ui-vp-phone .md-table thead th,
html.ui-vp-phone .users-table thead th,
html.ui-vp-phone .ft-table thead th,
html.ui-vp-phone .ob-table thead th,
html.ui-vp-phone .mgmt-bm-table thead th,
html.ui-vp-phone .broker-directory-table thead th,
html.ui-vp-phone .clients-list-table thead th,
html.ui-vp-phone .pnl-accounts thead th,
html.ui-vp-phone .pnl-months thead th,
html.ui-vp-phone .data-table tbody td,
html.ui-vp-phone .standard-data-table tbody td,
html.ui-vp-phone .mt5x-table tbody td,
html.ui-vp-phone .broker-tbl tbody td,
html.ui-vp-phone .cm-table tbody td,
html.ui-vp-phone .md-table tbody td,
html.ui-vp-phone .users-table tbody td,
html.ui-vp-phone .ft-table tbody td,
html.ui-vp-phone .ob-table tbody td,
html.ui-vp-phone .mgmt-bm-table tbody td,
html.ui-vp-phone .broker-directory-table tbody td,
html.ui-vp-phone .clients-list-table tbody td,
html.ui-vp-phone .pnl-accounts tbody td,
html.ui-vp-phone .pnl-months tbody td {
  padding: 8px 10px !important;
}

html.ui-vp-phone .ui-filter-bar,
html.ui-vp-phone .mt5x-filter,
html.ui-vp-phone .filter-toolbar,
html.ui-vp-phone .page-filters {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

html.ui-vp-fold2 body {
  zoom: 1;
}

html.ui-vp-cover-land .page-header,
html.ui-vp-cover-land .ds-page-head {
  margin-bottom: 8px;
  padding-bottom: 8px;
}

html.ui-vp-cover-land .ui-filter-bar,
html.ui-vp-cover-land .mt5x-filter {
  padding: 8px 10px;
  margin-bottom: 8px;
}

html.ui-vp-cover-land .ui-loading,
html.ui-vp-cover-land .pnl-empty.ui-loading {
  padding: 20px 12px;
}

/* Cover landscape (~924×412): keep chrome short so content can scroll. */
@media screen and (max-height: 500px) and (max-width: 1000px) {
  .login-page {
    align-items: flex-start;
    padding-top: max(12px, env(safe-area-inset-top, 0px));
  }
  .ds-page-head {
    margin-bottom: 8px;
    padding-bottom: 8px;
  }
  .mobile-sidebar-open-btn {
    top: max(8px, env(safe-area-inset-top, 0px));
  }
}

/* ── Shared semantic sides, dots, loading, flash ─────────────────────────── */

.side-buy,
.side-sell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 12px;
  border-radius: var(--radius-sm, 4px);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--ocean-white, #fff);
}

.side-buy {
  background: var(--color-success);
}

.side-sell {
  background: var(--color-error);
}

.status-dot-ok,
.status-dot-bad {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  vertical-align: middle;
}

.status-dot-ok {
  background: var(--color-success);
  color: var(--color-success);
}

.status-dot-bad {
  background: var(--color-error);
  color: var(--color-error);
}

.toast.warning {
  border-color: var(--color-warning);
}

.ui-flash {
  position: fixed;
  top: var(--spacing-4, 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-tooltip);
  max-width: 640px;
  padding: 10px 40px 10px 16px;
  border-radius: var(--ui-refresh-radius);
  font-size: var(--font-size-sm, 13px);
  background: var(--color-bg-card);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  box-shadow: var(--ui-refresh-shadow);
}

.ui-flash-dismiss {
  position: absolute;
  top: 4px;
  right: 8px;
  background: none;
  border: none;
  color: inherit;
  font-size: 16px;
  cursor: pointer;
}

.modal.is-open,
.modal-backdrop.is-open {
  display: flex;
}

.ui-loading,
.ui-loading-block,
.pnl-empty.ui-loading,
#pnlLoading.ui-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-3, 12px);
  padding: 48px 24px;
  text-align: center;
  color: var(--color-text-muted);
  border: 1px dashed var(--ui-refresh-line);
  border-radius: var(--ui-refresh-radius-lg);
  background: color-mix(in srgb, var(--ui-refresh-surface-2) 60%, transparent);
}

.ui-loading[hidden],
.ui-loading-block[hidden],
#pnlLoading[hidden],
.pnl-empty[hidden] {
  display: none !important;
}

.ui-loading-label {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm, 13px);
}

.ui-skeleton {
  display: block;
  min-height: 14px;
  border-radius: var(--radius-sm, 4px);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--ds-surface) 70%, transparent) 0%,
    color-mix(in srgb, var(--ocean-sky) 18%, transparent) 50%,
    color-mix(in srgb, var(--ds-surface) 70%, transparent) 100%
  );
  background-size: 200% 100%;
  animation: ui-skeleton-shimmer 1.2s ease-in-out infinite;
}

@keyframes ui-skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.ui-card[aria-busy="true"] .dash-chart-body,
.dash-chart-card[aria-busy="true"] .dash-chart-body {
  min-height: 180px;
  position: relative;
}

.ui-card[aria-busy="true"] .dash-chart-body::after,
.dash-chart-card[aria-busy="true"] .dash-chart-body::after {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: var(--ui-refresh-radius);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--ds-surface) 70%, transparent) 0%,
    color-mix(in srgb, var(--ocean-sky) 14%, transparent) 50%,
    color-mix(in srgb, var(--ds-surface) 70%, transparent) 100%
  );
  background-size: 200% 100%;
  animation: ui-skeleton-shimmer 1.2s ease-in-out infinite;
}
