/*
 * FlowDesk Site Corporate — one language for every page family
 * ===============================================================
 * Final shared layer for Desk, Markets, News, Earnings, Models, Settings,
 * Auth, Admin, Ops, API docs, and error states. It is deliberately scoped to
 * body.fd-page so fallback/bootstrap pages remain independent and safe.
 */

body.fd-page {
  --fd-site-surface: var(--fd-fin-surface, var(--fd-surface));
  --fd-site-surface-2: var(--fd-fin-surface-2, var(--fd-bg-subtle));
  --fd-site-line: var(--fd-fin-line, var(--fd-border));
  --fd-site-line-strong: var(--fd-fin-line-strong, var(--fd-border-strong));
  --fd-site-muted: var(--fd-fin-muted, var(--fd-text-soft));
  --fd-site-blue: var(--fd-fin-blue, var(--fd-accent));
  --fd-site-mono: var(--fd-font-mono);
  background-color: var(--fd-fin-bg, var(--fd-bg));
}
body.fd-page *, body.fd-page *::before, body.fd-page *::after { box-sizing: border-box; }
body.fd-page h1, body.fd-page h2, body.fd-page h3, body.fd-page h4 { text-wrap: balance; }
body.fd-page p, body.fd-page li, body.fd-page label { text-wrap: pretty; }
body.fd-page a { text-underline-offset: 3px; }
body.fd-page a:not(.fd-btn):not(.fd-tab):not(.fd-sidebar-link):not(.fd-globalnav-link):hover { text-decoration: underline; }

/* Every page header gets the same executive brief treatment. */
body.fd-page .fd-page-header,
body.fd-page .ui-page-header {
  position: relative;
  gap: 18px 28px;
  margin-bottom: 22px !important;
  padding: 22px 24px !important;
  border: 1px solid var(--fd-site-line) !important;
  border-radius: 16px !important;
  background: linear-gradient(120deg, color-mix(in srgb, var(--fd-site-surface) 94%, var(--fd-site-blue) 6%), var(--fd-site-surface));
  box-shadow: 0 18px 42px -32px rgba(2,8,23,.8), 0 1px 0 rgba(255,255,255,.035) inset;
}
body.fd-page .fd-page-header::after,
body.fd-page .ui-page-header::after {
  content: "";
  position: absolute;
  left: 24px;
  bottom: -1px;
  width: 64px;
  height: 2px;
  border-radius: 99px;
  background: var(--fd-site-blue);
}
body.fd-page .fd-page-title,
body.fd-page .ui-page-header h1 { font-size: clamp(1.45rem, 2.5vw, 2rem) !important; letter-spacing: -.045em !important; }
body.fd-page .fd-page-sub,
body.fd-page .ui-page-header p { color: var(--fd-site-muted) !important; max-width: 68ch !important; }
body.fd-page .fd-page-actions { justify-content: flex-end; }

/* One button language, including legacy page aliases. */
body.fd-page .fd-btn,
body.fd-page .button,
body.fd-page button.primary,
body.fd-page button.secondary,
body.fd-page .btn-primary,
body.fd-page .btn-secondary,
body.fd-page input[type="submit"] {
  min-height: 38px;
  border: 1px solid var(--fd-site-line-strong);
  border-radius: 9px;
  padding: 9px 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
}
body.fd-page .fd-btn--primary,
body.fd-page .fd-btn-primary,
body.fd-page button.primary,
body.fd-page .btn-primary,
body.fd-page input[type="submit"] {
  border-color: transparent;
  background: linear-gradient(145deg, color-mix(in srgb, var(--fd-site-blue) 88%, white 12%), var(--fd-site-blue)) !important;
  color: #fff !important;
}
body.fd-page .fd-btn--ghost,
body.fd-page .fd-btn-ghost,
body.fd-page button.secondary,
body.fd-page .fd-btn-secondary,
body.fd-page .btn-secondary {
  background: var(--fd-site-surface-2) !important;
  color: var(--fd-text) !important;
}
body.fd-page .fd-btn:hover,
body.fd-page .button:hover,
body.fd-page button:hover { filter: brightness(1.08); transform: translateY(-1px); }
body.fd-page .fd-btn:active,
body.fd-page button:active { transform: translateY(0); }
body.fd-page button:disabled,
body.fd-page input:disabled,
body.fd-page select:disabled { cursor: not-allowed; opacity: .55; filter: none; transform: none; }

/* Forms are quiet, aligned, and predictable across auth/settings/admin. */
body.fd-page input:not([type="checkbox"]):not([type="radio"]),
body.fd-page select,
body.fd-page textarea,
body.fd-page .fd-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--fd-site-line-strong) !important;
  border-radius: 9px !important;
  background: var(--fd-site-surface-2) !important;
  color: var(--fd-text) !important;
  padding: 9px 11px;
}
body.fd-page textarea { min-height: 96px; resize: vertical; }
body.fd-page input::placeholder,
body.fd-page textarea::placeholder { color: var(--fd-text-dim); opacity: .8; }
body.fd-page input:focus,
body.fd-page select:focus,
body.fd-page textarea:focus { border-color: var(--fd-site-blue) !important; box-shadow: 0 0 0 3px var(--fd-accent-soft) !important; outline: 0; }
body.fd-page .fd-label,
body.fd-page .form-row-label,
body.fd-page label { display: block; margin: 0 0 6px; color: var(--fd-site-muted); font: 700 .68rem/1.2 var(--fd-site-mono); letter-spacing: .08em; text-transform: uppercase; }
body.fd-page .fd-form-row,
body.fd-page .form-row { display: grid; gap: 7px; margin: 0 0 14px; }
body.fd-page .fd-settings-form,
body.fd-page .auth-form { display: grid; gap: 12px; }

/* Surfaces: no page should invent a second card grammar. */
body.fd-page .fd-card,
body.fd-page .fd-panel,
body.fd-page .ui-panel,
body.fd-page .panel,
body.fd-page .card,
body.fd-page .box,
body.fd-page .news-card,
body.fd-page .auth-card,
body.fd-page .modal-card,
body.fd-page .fd-data-panel {
  border: 1px solid var(--fd-site-line) !important;
  border-radius: 13px !important;
  background: var(--fd-site-surface) !important;
  box-shadow: 0 14px 34px -28px rgba(2,8,23,.8), 0 1px 0 rgba(255,255,255,.028) inset !important;
}
body.fd-page .fd-card-head,
body.fd-page .fd-card-header,
body.fd-page .fd-panel-head,
body.fd-page .ui-panel-head,
body.fd-page .panel-head,
body.fd-page .modal-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--fd-site-line) !important;
  background: linear-gradient(90deg, var(--fd-site-surface-2), color-mix(in srgb, var(--fd-site-surface) 80%, transparent)) !important;
}
body.fd-page .fd-card-title,
body.fd-page .fd-panel-title,
body.fd-page .ui-panel-title,
body.fd-page .panel-title { margin: 0; font-size: .77rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
body.fd-page .fd-card-body,
body.fd-page .fd-panel-body,
body.fd-page .ui-panel-body,
body.fd-page .modal-body { padding: 16px; }
body.fd-page .fd-card-foot,
body.fd-page .fd-panel-foot,
body.fd-page .panel-foot { padding: 11px 16px; border-top: 1px solid var(--fd-site-line); color: var(--fd-site-muted); }
body.fd-page .fd-card--link,
body.fd-page .fd-card-link { display: block; color: inherit; text-decoration: none !important; transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
body.fd-page .fd-card--link:hover,
body.fd-page .fd-card-link:hover { border-color: var(--fd-site-line-strong) !important; transform: translateY(-2px); box-shadow: 0 20px 42px -28px rgba(2,8,23,.95) !important; }

/* Tables and responsive data blocks share one research-desk rhythm. */
body.fd-page .table-wrap,
body.fd-page .fd-table-wrap,
body.fd-page .fd-scroll,
body.fd-page .table {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--fd-site-line);
  border-radius: 11px;
  background: var(--fd-site-surface);
  scrollbar-color: var(--fd-site-line-strong) transparent;
}
body.fd-page table,
body.fd-page .fd-table,
body.fd-page .table { width: 100%; border-collapse: separate; border-spacing: 0; }
body.fd-page table th,
body.fd-page .theader,
body.fd-page .fd-table-head {
  background: var(--fd-site-surface-2);
  color: var(--fd-site-muted);
  font: 750 .64rem/1.2 var(--fd-site-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
body.fd-page table th,
body.fd-page table td,
body.fd-page .theader > *,
body.fd-page .tr > * { padding: 11px 13px; border-bottom: 1px solid var(--fd-site-line); vertical-align: middle; }
body.fd-page table tbody tr:last-child td,
body.fd-page .tr:last-child > * { border-bottom: 0; }
body.fd-page table tbody tr:hover,
body.fd-page .tr:hover { background: var(--fd-accent-soft); }
body.fd-page table td,
body.fd-page .tr > * { font-size: .82rem; font-variant-numeric: tabular-nums; }
body.fd-page .fd-table-wrap table,
body.fd-page .table-wrap table { min-width: 640px; }

/* Tabs, filters, and segmented workflows. */
body.fd-page .fd-tabs,
body.fd-page .auth-tabs,
body.fd-page .fd-ai-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--fd-site-line);
  border-radius: 11px;
  background: var(--fd-site-surface-2);
}
body.fd-page .fd-tab,
body.fd-page .auth-tab,
body.fd-page .fd-ai-tab {
  min-height: 36px;
  flex: 0 1 auto;
  border: 0;
  border-radius: 8px;
  padding: 8px 13px;
  background: transparent;
  color: var(--fd-site-muted);
  font-weight: 750;
  cursor: pointer;
}
body.fd-page .fd-tab:hover,
body.fd-page .auth-tab:hover,
body.fd-page .fd-ai-tab:hover,
body.fd-page .fd-tab[aria-selected="true"],
body.fd-page .fd-tab.on,
body.fd-page .auth-tab.on,
body.fd-page .fd-ai-tab.on { background: var(--fd-accent-soft); color: var(--fd-accent-bright); }
body.fd-page .fd-tab-panel:not(.on),
body.fd-page [data-pane][data-on="false"] { display: none; }
body.fd-page .fd-filters,
body.fd-page .filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--fd-site-line); border-radius: 11px; background: var(--fd-site-surface-2); }
body.fd-page .fd-filters > *, body.fd-page .filters > * { min-width: 150px; flex: 1 1 150px; }

/* Status, errors, empty states, and notices tell the truth without shouting. */
body.fd-page .fd-alert,
body.fd-page .fd-callout,
body.fd-page .auth-banner,
body.fd-page .auth-err,
body.fd-page .fd-form-msg {
  padding: 11px 13px;
  border: 1px solid var(--fd-site-line);
  border-radius: 9px;
  background: var(--fd-site-surface-2);
  color: var(--fd-site-muted);
  font-size: .82rem;
}
body.fd-page .fd-alert--ok,
body.fd-page .auth-banner--ok { border-color: rgba(55,211,155,.35); background: var(--fd-bull-soft); color: var(--fd-bull-bright); }
body.fd-page .fd-alert--error,
body.fd-page .auth-banner--err,
body.fd-page .auth-err { border-color: rgba(240,120,137,.36); background: var(--fd-bear-soft); color: var(--fd-bear-bright); }
body.fd-page .fd-alert--warn { border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.1); color: var(--fd-warn); }
body.fd-page .fd-empty,
body.fd-page .fd-empty-state,
body.fd-page .empty { min-height: 150px; display: grid; place-items: center; align-content: center; gap: 8px; padding: 28px 20px; border: 1px dashed var(--fd-site-line-strong); border-radius: 12px; background: radial-gradient(circle at 50% 0, var(--fd-accent-soft), transparent 60%), var(--fd-site-surface-2); color: var(--fd-site-muted); text-align: center; }
body.fd-page .fd-error-page { min-height: 55vh; display: grid; place-items: center; padding: 40px 16px; }
body.fd-page .fd-error-page .fd-error-code { color: var(--fd-site-blue); font: 800 clamp(4rem, 12vw, 8rem)/.9 var(--fd-site-mono); letter-spacing: -.1em; }

/* Auth and account pages use the same confidence language as the product. */
body.fd-page .auth-wrap,
body.fd-page .fd-auth-wrap { min-height: min(680px, 78vh); display: grid; place-items: center; padding: 34px 16px; background: radial-gradient(circle at 10% 0, var(--fd-accent-soft), transparent 34rem); }
body.fd-page .auth-card { width: min(100%, 460px); padding: 26px; }
body.fd-page .auth-title { font-size: clamp(1.55rem, 4vw, 2rem); letter-spacing: -.05em; }
body.fd-page .auth-sub,
body.fd-page .auth-help,
body.fd-page .auth-trust { color: var(--fd-site-muted); }
body.fd-page .auth-trust { display: flex; gap: 7px; align-items: center; padding-top: 12px; border-top: 1px solid var(--fd-site-line); font-size: .75rem; }
body.fd-page .auth-trust-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fd-bull); box-shadow: 0 0 0 4px var(--fd-bull-soft); }

/* News, earnings, chart, and research surfaces. */
body.fd-page .news-feed,
body.fd-page .news-list { display: grid; gap: 10px; }
body.fd-page .news-item,
body.fd-page .news-card,
body.fd-page .fd-ern { min-width: 0; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
body.fd-page .news-item:hover,
body.fd-page .news-card:hover,
body.fd-page .fd-ern:hover { border-color: var(--fd-site-line-strong); background: var(--fd-accent-soft); transform: translateY(-1px); }
body.fd-page .news-headline,
body.fd-page .news-card-body { line-height: 1.42; }
body.fd-page .news-meta,
body.fd-page .news-source,
body.fd-page .news-time { color: var(--fd-site-muted); font: .68rem/1.3 var(--fd-site-mono); }
body.fd-page .chart-host,
body.fd-page .fd-chart-wrap,
body.fd-page .history-chart { min-width: 0; max-width: 100%; overflow: hidden; border: 1px solid var(--fd-site-line); border-radius: 11px; background: linear-gradient(180deg, var(--fd-site-surface-2), var(--fd-site-surface)); }
body.fd-page canvas, body.fd-page svg { max-width: 100%; }
body.fd-page .fd-legend, body.fd-page .fd-legend-row { color: var(--fd-site-muted); font: .68rem/1.35 var(--fd-site-mono); }

/* Portfolio, settings, admin, and model pages inherit useful grid behavior. */
body.fd-page .fd-duo,
body.fd-page .fd-set-grid,
body.fd-page .fd-account-visuals,
body.fd-page .fd-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
body.fd-page .fd-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
body.fd-page .fd-kv > div { min-width: 0; padding: 11px 12px; border: 1px solid var(--fd-site-line); border-radius: 9px; background: var(--fd-site-surface-2); }
body.fd-page .fd-kv-k { color: var(--fd-site-muted); font: .62rem/1.2 var(--fd-site-mono); letter-spacing: .08em; text-transform: uppercase; }
body.fd-page .fd-kv-v { margin-top: 5px; color: var(--fd-text); font-weight: 700; overflow-wrap: anywhere; }
body.fd-page details { border: 1px solid var(--fd-site-line); border-radius: 10px; background: var(--fd-site-surface-2); }
body.fd-page summary { cursor: pointer; }
body.fd-page .fd-prose { max-width: 78ch; color: var(--fd-site-muted); line-height: 1.7; }
body.fd-page .fd-prose h2, body.fd-page .fd-prose h3 { color: var(--fd-text); margin-top: 1.8em; }

@media (max-width: 760px) {
  body.fd-page .fd-page-header, body.fd-page .ui-page-header { padding: 18px !important; }
  body.fd-page .fd-page-actions { width: 100%; justify-content: flex-start; }
  body.fd-page .fd-page-actions .fd-btn { flex: 1 1 auto; }
  body.fd-page .fd-duo, body.fd-page .fd-set-grid, body.fd-page .fd-account-visuals, body.fd-page .fd-settings-grid { grid-template-columns: 1fr; }
  body.fd-page .fd-kv { grid-template-columns: 1fr; }
  body.fd-page .fd-filters > *, body.fd-page .filters > * { min-width: 100%; flex-basis: 100%; }
}
@media (max-width: 480px) {
  body.fd-page .auth-card { padding: 20px 16px; }
  body.fd-page .fd-tabs { overflow-x: auto; flex-wrap: nowrap; }
  body.fd-page .fd-tab { white-space: nowrap; }
  body.fd-page .fd-page-actions .fd-btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  body.fd-page .fd-card--link, body.fd-page .fd-btn, body.fd-page .news-item, body.fd-page .news-card, body.fd-page .fd-ern { transition: none; }
}
