/* OPR Edge — black, silver and light. Load after the existing app styles.
   The public landing owns its visual system; component rules here are scoped
   to the workspace, authentication, and the two native image dialogs. */
:root {
  color-scheme: dark;
  --bg: #080809;
  --bg-soft: #0c0c0d;
  --panel: rgba(17, 17, 19, .96);
  --panel-strong: #151517;
  --panel-soft: #101012;
  --panel-lift: #1b1b1e;
  --text: #d9d9de;
  --text-strong: #f6f6f7;
  --muted: #9a9aa4;
  --muted-strong: #bcbcc5;
  --line: rgba(255, 255, 255, .10);
  --line-strong: rgba(255, 255, 255, .16);
  --accent: #eeeeef;
  --accent-strong: #ffffff;
  --accent-soft: rgba(255, 255, 255, .065);
  --text-on-accent: #121214;
  --surface-card: #111113;
  --surface-input: #0c0c0e;
  --surface-raised: #1a1a1d;
  --surface-mid: #151517;
  --surface-hover: #1b1b1e;
  --surface-high: #242428;
  --surface-night: #0d0d0f;
  --sidebar-bg: rgba(14, 14, 16, .94);
  --shadow: 0 20px 65px rgba(0, 0, 0, .32);
  --shadow-soft: 0 5px 22px rgba(0, 0, 0, .13);
  --silver-edge: rgba(255, 255, 255, .055);
  --silver-wash: rgba(235, 235, 245, .025);
  --control-color-scheme: dark;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f5;
  --bg-soft: #eeeeee;
  --panel: rgba(255, 255, 255, .97);
  --panel-strong: #ffffff;
  --panel-soft: #fafafa;
  --panel-lift: #eeeeef;
  --text: #37373c;
  --text-strong: #161619;
  --muted: #68686f;
  --muted-strong: #505057;
  --line: rgba(20, 20, 24, .11);
  --line-strong: rgba(20, 20, 24, .18);
  --accent: #1b1b1e;
  --accent-strong: #080809;
  --accent-soft: rgba(20, 20, 24, .05);
  --text-on-accent: #ffffff;
  --green: #15803d;
  --red: #c93636;
  --amber: #946514;
  --surface-card: #ffffff;
  --surface-input: #fafafa;
  --surface-raised: #f1f1f2;
  --surface-mid: #f7f7f7;
  --surface-hover: #eeeeef;
  --surface-high: #e4e4e6;
  --surface-night: #ffffff;
  --sidebar-bg: rgba(250, 250, 250, .96);
  --shadow: 0 20px 65px rgba(20, 20, 24, .085);
  --shadow-soft: 0 5px 22px rgba(20, 20, 24, .045);
  --silver-edge: rgba(255, 255, 255, .9);
  --silver-wash: rgba(20, 20, 24, .018);
  --control-color-scheme: light;
}

/* These local variables also replace workspace.css's blue-tinted light greys. */
.app {
  --muted: #9a9aa4;
  --muted-strong: #bcbcc5;
  --ui-border: rgba(255, 255, 255, .11);
  --ui-card: #111113;
  --ui-inset: #171719;
  --ui-grid: rgba(255, 255, 255, .16);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg);
}

:root[data-theme="light"] .app {
  --muted: #68686f;
  --muted-strong: #505057;
  --ui-border: rgba(20, 20, 24, .12);
  --ui-card: #ffffff;
  --ui-inset: #f4f4f5;
  --ui-grid: rgba(20, 20, 24, .18);
}

.app .app-main {
  background: radial-gradient(ellipse at 75% 0, var(--silver-wash), transparent 550px);
}

.app :is(button, a, input, select, textarea) { -webkit-tap-highlight-color: transparent; }
.app ::selection, #authScreen ::selection { background: var(--accent); color: var(--text-on-accent); }

/* A quiet, translucent rail; widths, hiding and mobile positioning stay with
   the existing navigation rules. */
.app .app-sidebar {
  border-right-color: var(--ui-border);
  background: linear-gradient(160deg, var(--silver-wash), transparent 34%), var(--sidebar-bg);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .015);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.app .sidebar-brand-name { font-size: 14px; font-weight: 750; letter-spacing: .035em; }
.app .sidebar-brand-name span { color: var(--muted-strong); letter-spacing: .11em; }
.app .app-sidebar .sidebar-brand-mark {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  box-shadow: inset 0 1px 0 var(--silver-edge);
}
.app .app-sidebar :is(.nav-tab, .sidebar-action) {
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 550;
  border-radius: 10px;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.app .app-sidebar :is(.nav-tab, .sidebar-action):hover {
  color: var(--text-strong);
  background: var(--accent-soft);
  border-color: var(--line);
}
.app .app-sidebar :is(.nav-tab, .sidebar-action).active {
  color: var(--text-on-accent);
  border-color: var(--accent);
  background: linear-gradient(145deg, #ffffff, #d3d3d8);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .16), inset 0 1px 0 rgba(255, 255, 255, .65);
}
.app .app-sidebar :is(.nav-tab, .sidebar-action).active .nav-icon { color: inherit; }
:root[data-theme="light"] .app .app-sidebar :is(.nav-tab, .sidebar-action).active {
  color: #ffffff;
  border-color: #1b1b1e;
  background: linear-gradient(145deg, #303034, #171719);
  box-shadow: 0 3px 12px rgba(20, 20, 24, .12), inset 0 1px 0 rgba(255, 255, 255, .10);
}
.app .sidebar-footer { border-top-color: var(--ui-border); }
.app .sidebar-profile-caption { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.app .sidebar-profile .user-greeting { font-size: 13px; font-weight: 550; }
.app .sidebar-avatar { border-color: var(--line-strong); box-shadow: inset 0 1px 0 var(--silver-edge); }

/* The header carries the same restrained editorial hierarchy as the landing. */
.app .app-main > .topbar { border-bottom-color: var(--ui-border); }
.app .topbar .eyebrow { color: var(--muted); font-size: 11px; font-weight: 550; letter-spacing: .16em; }
.app .topbar h1 { font-weight: 650; letter-spacing: -.045em; line-height: 1.18; }
.app .topbar .subtitle { color: var(--muted-strong); font-size: 14px; line-height: 1.65; }
.app :is(.sidebar-menu-button, .sidebar-collapse-button, .theme-toggle-button) {
  color: var(--muted-strong);
  border-color: var(--ui-border);
  background: var(--ui-card);
  box-shadow: inset 0 1px 0 var(--silver-edge);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.app :is(.sidebar-menu-button, .sidebar-collapse-button, .theme-toggle-button):hover {
  color: var(--text-strong);
  border-color: var(--line-strong);
  background: var(--surface-hover);
}
.app .storage-status {
  color: var(--muted-strong);
  font-size: 12px;
  border-color: var(--ui-border);
  background: var(--ui-card);
  box-shadow: inset 0 1px 0 var(--silver-edge);
}
.app .sync-info-toggle { color: var(--muted-strong); border-color: var(--line-strong); }
.app .workspace-popover {
  background: var(--surface-card);
  border-color: var(--line-strong);
  box-shadow: inset 0 1px 0 var(--silver-edge), var(--shadow);
}
.app .workspace-popover :is(p, .sync-last-time) { font-size: 13px; }
.app .announcement-meta time { font-size: 12px; }
.app .announcement-kind { font-size: 11px; }

/* Surface depth comes from fine edges, never a filter on live chart content. */
.app .card {
  background-color: var(--ui-card);
  border-color: var(--ui-border);
  border-radius: 15px;
  box-shadow: inset 0 1px 0 var(--silver-edge), 0 8px 30px rgba(0, 0, 0, .065);
}
.app #roiPage .roi-dashboard-shell { background: transparent; border: 0; box-shadow: none; }
.app #roiPage :is(.roi-summary-strip article, .roi-entry-panel, .roi-table-card) {
  border-color: var(--ui-border);
  box-shadow: inset 0 1px 0 var(--silver-edge), 0 8px 30px rgba(0, 0, 0, .045);
}
.app #adminPage :is(.admin-intro, .admin-stat, .admin-section),
.app #settingsPage :is(.settings-intro, .settings-card) {
  border-color: var(--ui-border);
  box-shadow: inset 0 1px 0 var(--silver-edge), 0 8px 30px rgba(0, 0, 0, .045);
}
.app :is(.panel-title, .settings-card h3) { font-weight: 650; letter-spacing: -.025em; }
.app .panel-kicker { color: var(--muted-strong); font-size: 13px; line-height: 1.7; }
.app .eyebrow { font-size: 11px; font-weight: 550; letter-spacing: .12em; }
.app .empty-state { color: var(--muted-strong); font-size: 14px; border-color: var(--line-strong); }
.app :is(.trade-card, .monthly-report-card, .onboarding-steps article, .admin-announcement-item) { border-color: var(--ui-border); }
.app .metric-icon { color: var(--muted-strong); background: var(--ui-inset); border-color: var(--ui-border); }

/* Increase supporting copy without changing metric sizing or SVG geometry. */
.app #tradingPage :is(.metric-label, .visual-card-title) { font-size: 12px; letter-spacing: .05em; }
.app #tradingPage :is(.metric-note, .expectancy-averages, .outcome-counts span, .distribution-legend-item, .edge-score-note) { font-size: 12px; line-height: 1.65; }
.app #tradingPage :is(.edge-score-caption, .result-label, .meta-label) { font-size: 12px; letter-spacing: .035em; }
.app #tradingPage .meta-value { font-size: 13px; }
.app #tradingPage .notes { font-size: 13px; line-height: 1.75; }
.app #tradingPage :is(.journal-period-summary, .calendar-detail, .journal-period-heading) { font-size: 13px; }
.app #tradingPage .journal-period-panel {
  background: var(--ui-card);
  border-color: var(--line-strong);
  box-shadow: inset 0 1px 0 var(--silver-edge), var(--shadow);
}
.app #roiPage :is(.roi-summary-label, .roi-row-label, .roi-payout-certificate-label) { font-size: 12px; }
.app #settingsPage :is(.settings-description, .settings-group-heading p, .settings-warning, .settings-account-email, .ios-install-step p) { font-size: 13px; }
.app #settingsPage .settings-navigation a { font-size: 13px; }
.app #settingsPage .settings-navigation a span { font-size: 12px; }
.app :is(.profile-avatar-controls p, .profile-avatar-controls small, .onboarding-steps p, .onboarding-card header p:not(.eyebrow), .announcement-banner p, .admin-announcement-item p) { font-size: 13px; }
.app .text-action { font-size: 12px; }

/* Inputs and actions use a crisp silver focus ring and a consistent surface. */
.app label { color: var(--muted-strong); font-size: 13px; font-weight: 500; }
.app :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), select, textarea) {
  color: var(--text-strong);
  background: var(--surface-input);
  border-color: var(--ui-border);
  font-size: 14px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .035);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.app :is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
.app :is(input, select, textarea):hover { border-color: var(--line-strong); }
.app :is(input, select, textarea):focus-visible {
  border-color: var(--muted-strong);
  outline: 2px solid var(--muted-strong);
  outline-offset: 3px;
  box-shadow: none;
}
.app :is(button, a):focus-visible, #authScreen :is(button, a, input):focus-visible {
  outline: 2px solid var(--muted-strong);
  outline-offset: 4px;
}
.app :is(.primary-btn, .secondary-btn, .mini-action, .edit-btn, .delete-btn) { font-size: 13px; font-weight: 550; }
.app .primary-btn {
  background: linear-gradient(145deg, #ffffff, #d3d3d8);
  color: #121214;
  border-color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 3px 12px rgba(0, 0, 0, .08);
}
.app .primary-btn:hover { background: #ffffff; border-color: #ffffff; box-shadow: 0 3px 15px rgba(255, 255, 255, .07); transform: none; }
:root[data-theme="light"] .app .primary-btn {
  background: linear-gradient(145deg, #303034, #171719);
  color: #ffffff;
  border-color: #1b1b1e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10), 0 3px 12px rgba(20, 20, 24, .07);
}
:root[data-theme="light"] .app .primary-btn:hover { background: #080809; border-color: #080809; }
.app :is(.secondary-btn, .mini-action, .edit-btn) { color: var(--text-strong); background: var(--ui-inset); border-color: var(--ui-border); }
.app :is(.secondary-btn, .mini-action, .edit-btn):hover { background: var(--surface-hover); border-color: var(--line-strong); }
.app :is(.primary-btn, .secondary-btn, .mini-action, .edit-btn, .delete-btn) { transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease; }

/* Authentication is deliberately independent from the public landing. */
#authScreen {
  color: var(--text);
  background: radial-gradient(ellipse at 50% 8%, var(--silver-wash), transparent 65%), var(--bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
#authScreen .auth-stack { gap: 30px; }
#authScreen .auth-back { color: var(--muted-strong); font-size: 13px; }
#authScreen .auth-back:hover { color: var(--text-strong); }
#authScreen .auth-logo { gap: 14px; }
#authScreen .auth-logo-mark {
  width: 62px;
  height: 62px;
  border-color: var(--line-strong);
  border-radius: 17px;
  background: linear-gradient(145deg, var(--surface-high), var(--surface-card));
  box-shadow: inset 0 1px 0 var(--silver-edge), 0 12px 36px rgba(0, 0, 0, .12);
}
#authScreen .auth-logo-mark svg { width: 44px; height: 44px; }
#authScreen .auth-logo-text { color: var(--text-strong); font-size: clamp(29px, 6vw, 38px); font-weight: 650; letter-spacing: -.045em; }
#authScreen .auth-logo-text span:last-child { color: var(--muted-strong); font-size: .7em; font-weight: 500; letter-spacing: .13em; }
#authScreen .logo-orbit { stroke: var(--line-strong); }
#authScreen .logo-bar { fill: var(--accent-soft); stroke: var(--muted-strong); filter: none; }
#authScreen :is(.logo-arrow, .logo-arrow-head) { stroke: var(--text-strong); filter: none; }
#authScreen .auth-card {
  background: linear-gradient(155deg, var(--silver-wash), transparent 45%), var(--surface-card);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 var(--silver-edge), var(--shadow);
  padding: clamp(26px, 4vw, 38px);
}
#authScreen .auth-title { font-family: Manrope, Inter, sans-serif; font-size: clamp(25px, 5vw, 30px); font-weight: 650; line-height: 1.22; letter-spacing: -.04em; }
#authScreen .auth-subtitle { color: var(--muted-strong); font-size: 14px; font-weight: 400; line-height: 1.7; }
#authScreen .auth-link { color: var(--text-strong); font-weight: 550; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
#authScreen .auth-link:hover { text-decoration-color: currentColor; }
#authScreen label { color: var(--muted-strong); font-size: 13px; font-weight: 500; }
#authScreen input {
  min-height: 48px;
  color: var(--text-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-input);
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
  box-shadow: none;
  transition: border-color 160ms ease;
}
#authScreen .password-field input { padding-right: 50px; }
#authScreen input::placeholder { color: var(--muted); opacity: 1; }
#authScreen input:hover { border-color: var(--line-strong); }
#authScreen input:focus-visible { border-color: var(--muted-strong); box-shadow: none; }
#authScreen .password-toggle { color: var(--muted-strong); }
#authScreen .password-toggle:hover { background: var(--accent-soft); color: var(--text-strong); border-color: var(--line); }
#authScreen .auth-forgot { color: var(--muted-strong); font-size: 13px; }
#authScreen .auth-submit {
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: linear-gradient(145deg, #ffffff, #d3d3d8);
  color: #121214;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 5px 18px rgba(0, 0, 0, .12);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
#authScreen .auth-submit:hover { background: #ffffff; border-color: #ffffff; transform: none; }
:root[data-theme="light"] #authScreen .auth-submit { background: linear-gradient(145deg, #303034, #171719); color: #ffffff; border-color: #1b1b1e; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 5px 18px rgba(20, 20, 24, .1); }
:root[data-theme="light"] #authScreen .auth-submit:hover { background: #080809; border-color: #080809; }
#authScreen .auth-note { font-size: 13px; font-weight: 450; line-height: 1.7; }

/* These native image dialogs are direct children of body, outside .app. */
:is(#tradeImageDialog, #payoutCertificateDialog) {
  color: var(--text);
  border-color: var(--line-strong);
  border-radius: 17px;
  background: var(--surface-card);
  box-shadow: inset 0 1px 0 var(--silver-edge), var(--shadow);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:is(#tradeImageDialog, #payoutCertificateDialog)::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
:is(#tradeImageDialog, #payoutCertificateDialog) .trade-image-dialog-header { border-bottom: 1px solid var(--line); padding: 3px 3px 13px; }
:is(#tradeImageDialog, #payoutCertificateDialog) h2 { color: var(--text-strong); font-size: 15px; font-weight: 550; letter-spacing: -.02em; }
:is(#tradeImageDialog, #payoutCertificateDialog) .trade-image-dialog-close { color: var(--text-strong); background: var(--surface-raised); border-color: var(--line); }
:is(#tradeImageDialog, #payoutCertificateDialog) .trade-image-dialog-close:hover { background: var(--surface-hover); border-color: var(--line-strong); }
:is(#tradeImageDialog, #payoutCertificateDialog) .trade-image-dialog-close:focus-visible { outline: 2px solid var(--muted-strong); outline-offset: 3px; }

/* Page changes have a short entrance; chart and table redraws stay still. */
html.opr-landing-motion-paused { scroll-behavior: auto; }
.app .app-page.active { animation: opr-page-enter 240ms ease-out both; }
@keyframes opr-page-enter { from { opacity: .4; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  .app .topbar .eyebrow { font-size: 10px; }
  .app .topbar .subtitle { font-size: 13px; }
  .app .app-main > .topbar .storage-status { font-size: 11px; }
  .app #tradingPage :is(.metric-label, .visual-card-title) { letter-spacing: .025em; }
  #authScreen .auth-stack { gap: 25px; }
  #authScreen .auth-logo-mark { width: 54px; height: 54px; border-radius: 14px; }
  #authScreen .auth-logo-mark svg { width: 39px; height: 39px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  .app, .app *, .app *::before, .app *::after,
  #authScreen *, #authScreen *::before, #authScreen *::after,
  :is(#tradeImageDialog, #payoutCertificateDialog) * {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
