/* Ranch surfaces and readable controls. Marketing layouts keep their own theme. */
:root {
  --ranch-base:#0d1713;
  --ranch-panel:#15221c;
  --ranch-raised:#1b2c24;
  --ranch-ink:#f3efe6;
  --ranch-muted:#c1c8bc;
  --ranch-gold:#d8b97a;
  --ranch-line:#4c6256;
  --ranch-control:#72806f;
  --paper:#f3efe6;
}
@media screen {
body:not(.ranch-site),
body:not(.ranch-site) .admin-vip,
body:not(.ranch-site) #vip-admin-editor {
  color-scheme:dark;
  --ranch-base:#080a0b;--ranch-panel:#131619;--ranch-raised:#202429;
  --ranch-ink:#f7f3eb;--ranch-muted:#c9ccd0;--ranch-gold:#dfbe7b;
  --ranch-line:#5d646b;--ranch-control:#7b838a;
  --bg:var(--ranch-base);--paper:var(--ranch-base);--deep:var(--ranch-base);
  --sidebar:var(--ranch-panel);--panel:var(--ranch-panel);--white:var(--ranch-panel);
  --raised:var(--ranch-raised);--sage:var(--ranch-raised);
  --ink:var(--ranch-ink);--muted:var(--ranch-muted);--dim:var(--ranch-muted);
  --line:var(--ranch-line);--accent:var(--ranch-gold);--gold:var(--ranch-gold);
  --green:#b6dabf;--red:#ffb9a6;
  --paper-ink:var(--ranch-ink);--paper-muted:var(--ranch-muted);--paper-accent:var(--ranch-gold);
  background:var(--ranch-base);color:var(--ranch-ink);
}
body:not(.ranch-site) :is(.tr-terminal,.tr-compact) {
  --tr-bg:var(--ranch-base);--tr-panel:var(--ranch-panel);--tr-raised:var(--ranch-raised);
  --tr-ink:var(--ranch-ink);--tr-muted:var(--ranch-muted);--tr-dim:var(--ranch-muted);
  --tr-line:var(--ranch-line);--tr-gold:var(--ranch-gold);--tr-green:#b6dabf;--tr-red:#ffb9a6;
}
body:not(.ranch-site) :is(.sidebar,.topbar,.auth-panel,.main-area,.main-content,.modal,.editor,.video-dialog,#vip-admin-editor) {
  background:var(--ranch-base);color:var(--ranch-ink);
}
body:not(.ranch-site) .sidebar {background:var(--ranch-panel);border-color:var(--ranch-line);}
body:not(.ranch-site) .topbar {background:var(--ranch-panel);border-bottom:2px solid var(--ranch-line);}
body:not(.ranch-site) .main {padding:32px 32px 48px;}
body:not(.ranch-site) :is(.page-heading,.heading,.tr-heading,.tr-section-heading) {gap:16px;}
body:not(.ranch-site) :is(.metrics,.journal-grid,.tr-company-grid,.tr-driver-grid,.form-grid) {gap:16px;}
body:not(.ranch-site) :is(.metrics,.page-heading,.heading,.tr-heading) {margin-bottom:24px;}
body:not(.ranch-site) :is(.coach-grid,.tr-intraday-grid) {gap:24px;}
body:not(.ranch-site) :is(.panel,.tr-panel,.tr-bias,.tr-compact) {
  background:var(--ranch-panel);color:var(--ranch-ink);
  border:2px solid var(--ranch-line);border-radius:12px;box-shadow:none;
}
body:not(.ranch-site) :is(.metric,.journal-card,.journal-prompt,.review-card,.coaching-panel,.coverage-card,.leader-context,.chart-panel,.secure-link,.coach-review,.coach-guide,.coach-coverage,.coach-next,.tr-driver-card,.tr-driver-empty,.tr-import-provenance,.tr-gamma-projection,.tr-market-empty,.tr-manual-metrics>div) {
  background:var(--ranch-panel);border:2px solid var(--ranch-line);border-radius:8px;box-shadow:none;
}
body:not(.ranch-site) :is(.panel-heading,.tr-panel-top,.editor-header,.modal-header) {
  border-color:var(--ranch-line);gap:16px;
}
body:not(.ranch-site) :is(.hint,.page-note,.metric-note,.metric-label,.filter-note,.table-footer,.chart-footer,.auth-footnote,.small.muted,.tr-small,.tr-muted,.tr-panel-foot,.tr-company-status,.tr-import-provenance span,.tr-intraday-opposition) {
  color:var(--ranch-muted);
}
body:not(.ranch-site) :is(.metric-note,.page-note,.hint,.auth-footnote,.table-footer,.tr-small,.tr-panel-foot,.tr-company-status,.tr-import-provenance span) {
  font-size:12px;line-height:1.7;
}
body:not(.ranch-site) :is(.tr-current-intro,.tr-current-limits,.tr-current-private p,.coach-summary,.coach-questions p,.coach-next p) {
  font-size:14px;line-height:1.75;
}
body:not(.ranch-site) :is(input:not([type=checkbox]):not([type=radio]),select,textarea) {
  min-height:44px;max-width:100%;background:var(--ranch-base);color:var(--ranch-ink);
  border:2px solid var(--ranch-control);border-radius:6px;
}
body:not(.ranch-site) textarea {min-height:88px;}
body:not(.ranch-site) :is(input,textarea)::placeholder {color:var(--ranch-muted);opacity:1;}
body:not(.ranch-site) select option {background:var(--ranch-base);color:var(--ranch-ink);}
body:not(.ranch-site) :is(input[type=checkbox],input[type=radio]) {accent-color:var(--ranch-gold);}
body:not(.ranch-site) :is(button,.button,.text-link,summary) {min-height:44px;}
body:not(.ranch-site) :is(.button,.tr-button) {border-radius:6px;}
body:not(.ranch-site) :is(.button:not(.secondary):not(.danger):not(.quiet),.tr-button.primary) {
  background:var(--ranch-gold);color:var(--ranch-base);border:2px solid var(--ranch-gold);
}
body:not(.ranch-site) :is(.button.secondary,.tr-button:not(.primary)) {
  background:var(--ranch-raised);color:var(--ranch-ink);border:2px solid var(--ranch-control);
}
body:not(.ranch-site) :is(.text-button,.tr-text-button,.tr-text-link) {
  display:inline-flex;align-items:center;gap:8px;background:transparent;color:var(--ranch-gold);border:0;
}
body:not(.ranch-site) :is(.icon-button,.tr-save) {
  min-width:44px;min-height:44px;background:var(--ranch-raised);color:var(--ranch-ink);border:2px solid var(--ranch-control);
}
body:not(.ranch-site) .button.danger {
  background:#30211b;color:#ffb9a6;border:1px solid #9b6556;
}
body:not(.ranch-site) :is(button,.button):disabled {
  opacity:.65;cursor:not-allowed;
}
body:not(.ranch-site) .nav {gap:8px;}
body:not(.ranch-site) .nav :is(button,a) {
  min-height:44px;background:transparent;color:var(--ranch-muted);border:2px solid transparent;
}
body:not(.ranch-site) .nav :is(button,a):hover {background:var(--ranch-raised);color:var(--ranch-ink);}
body:not(.ranch-site) .nav :is(button,a).active {
  background:var(--ranch-gold);color:var(--ranch-base);border-color:var(--ranch-gold);font-weight:700;
}
body:not(.ranch-site) :is(.tr-tabs button,.tr-horizon button,.tr-segments button) {
  min-height:44px;background:var(--ranch-base);color:var(--ranch-muted);border:2px solid var(--ranch-line);
}
body:not(.ranch-site) :is(.tr-tabs button[aria-selected=true],.tr-horizon button[aria-pressed=true],.tr-segments button[aria-pressed=true],.tr-button.selected) {
  background:var(--ranch-gold);color:var(--ranch-base);border-color:var(--ranch-gold);
}
body:not(.ranch-site) :is(.tr-horizon>div,.tr-segments) {gap:8px;}
body:not(.ranch-site) :is(.notice,.sample-banner,.tr-callout,.tr-caution,.tr-market-note,.tr-event-warning,.tr-error) {
  padding:16px;margin-bottom:24px;border:2px solid var(--ranch-line);border-radius:8px;
  background:var(--ranch-raised);color:var(--ranch-ink);line-height:1.7;
}
body:not(.ranch-site) :is(.notice.error,.tr-error) {
  background:#30211b;color:#ffb9a6;border-color:#9b6556;
}
body:not(.ranch-site) .form-error {color:#ffb9a6;}
body:not(.ranch-site) :is(.sample-banner,.tr-caution,.tr-event-warning) {
  background:#29291c;color:#f0d59c;border-color:#8c7950;
}
body:not(.ranch-site) :is(.positive,.tr-positive) {color:#b6dabf;}
body:not(.ranch-site) :is(.negative,.tr-negative) {color:#ffb9a6;}
body:not(.ranch-site) :is(.status-pill,.badge,.tag,.tr-label,.tr-priority,.tr-fixed-frame small,.tr-tabs button>span) {
  border-radius:4px;
}
body:not(.ranch-site) :is(.status-pill,.tag) {background:var(--ranch-raised);}
body:not(.ranch-site) .status-pill.off {color:#f0d59c;background:#29291c;}
body:not(.ranch-site) .tr-fixed-frame small {background:#2a3b2b;color:#d1e2c9;}
body:not(.ranch-site) :is(.eyebrow,.tr-eyebrow,.breadcrumb strong,.tr-external-research a,.tr-company-card h3 a) {color:var(--ranch-gold);}
body:not(.ranch-site) :is(th,.execution-table th,.trade-table th,.history-page thead) {background:var(--ranch-raised);color:var(--ranch-ink);}
body:not(.ranch-site) :is(td,th,.tr-news-row,.tr-panel-foot,.history-page tbody th) {border-color:var(--ranch-line);}
body:not(.ranch-site) :is(.trade-table tbody tr:hover,.history-page tbody tr:hover,.history-page tbody tr:hover th) {background:var(--ranch-raised);}
body:not(.ranch-site) .table-scroll {border:0;}
body:not(.ranch-site) .tr-controls {background:var(--ranch-panel);border:2px solid var(--ranch-line);padding:16px 0;}
body:not(.ranch-site) .tr-controls>label,body:not(.ranch-site) .tr-controls>div {padding-inline:24px;}
body:not(.ranch-site) .tr-controls select {min-height:44px;padding:8px 12px;}
body:not(.ranch-site) .tr-anchor-label strong {line-height:1.6;}
body:not(.ranch-site) :is(.tr-healthline,.tr-source-snapshot) {
  background:var(--ranch-raised);border:2px solid var(--ranch-line);border-radius:8px;padding:16px;gap:16px;
}
body:not(.ranch-site) :is(a,button,input,select,textarea,summary,[tabindex]):focus-visible {
  outline:3px solid var(--ranch-gold);outline-offset:4px;
}
}
/* This footer remains common to public pages and private portal shells. */
.ranch-risk-notice {
  display:block;clear:both;width:100%;box-sizing:border-box;margin:0;
  border-top:1px solid #72806f;background:#0d1713;color:#c1c8bc;
  padding:24px max(24px,calc((100% - 1200px)/2)) calc(32px + env(safe-area-inset-bottom));
  font:400 12px/1.8 system-ui,sans-serif;overflow-wrap:anywhere;
}
.ranch-risk-notice strong {display:block;color:#f3efe6;font-size:13px;margin-bottom:8px;}
.ranch-risk-notice p {color:#c1c8bc;margin:0;max-width:1200px;}
.ranch-risk-notice a {color:#e9cd95;text-underline-offset:3px;}
.ranch-risk-notice a:focus-visible {outline:3px solid #d8b97a;outline-offset:4px;}
@media screen and (min-width:721px) {
  body:not(.ranch-site) .sidebar {border-right:2px solid var(--ranch-line);}
}
@media screen and (max-width:1100px) {
  body:not(.ranch-site) .main {padding:24px 24px 40px;}
  body:not(.ranch-site) .tr-controls>label,body:not(.ranch-site) .tr-controls>div {padding-inline:16px;}
}
@media screen and (max-width:720px) {
  .ranch-site .ranch-risk-notice {padding-bottom:calc(112px + env(safe-area-inset-bottom));}
  body:not(.ranch-site) .main {padding:24px 16px 32px;}
  body:not(.ranch-site) .sidebar {border-right:0;border-bottom:2px solid var(--ranch-line);}
  body:not(.ranch-site) :is(.notice,.sample-banner,.tr-panel-top,.panel-heading,.heading-actions) {flex-wrap:wrap;gap:16px;}
  body:not(.ranch-site) :is(.coach-grid,.tr-intraday-grid) {gap:16px;}
  body:not(.ranch-site) .tr-controls {
    display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;padding:16px;
  }
  body:not(.ranch-site) .tr-controls>label,body:not(.ranch-site) .tr-controls>div {
    width:auto;min-width:0;margin:0;padding:0;border-right:0;
  }
  body:not(.ranch-site) .tr-controls>label {grid-column:1/-1;}
  body:not(.ranch-site) .tr-controls select {width:100%;max-width:100%;}
  body:not(.ranch-site) .tr-controls .tr-anchor-label {display:block;grid-column:1/-1;}
  body:not(.ranch-site) .tr-controls .tr-horizon {grid-column:1/-1;}
  body:not(.ranch-site) .tr-fixed-frame strong {display:block;font-size:13px;line-height:1.8;}
  .ranch-risk-notice {padding-inline:16px;}
}
@media print {
  .history-page :is(thead,th,td) {background:#fff!important;}
  .ranch-risk-notice {background:#fff;color:#000;border-color:#777;padding:16px 0;}
  .ranch-risk-notice :is(strong,p,a) {color:#000;}
}

/* Portal-only neutral surfaces; public marketing retains its own Ranch palette. */
@media screen {
  body:not(.ranch-site) :is(.auth-story,.modal,.editor,.video-dialog,#editor,#modal,#vip-admin-editor) {
    background:var(--ranch-panel);color:var(--ranch-ink);border-color:var(--ranch-line);box-shadow:none;
  }
  body:not(.ranch-site) :is(dialog,.video-dialog,#vip-admin-editor) {border-width:2px;border-radius:12px;}
  body:not(.ranch-site) dialog::backdrop {background:#080a0be8;backdrop-filter:none;}
  body:not(.ranch-site) .auth-story::before,
  body:not(.ranch-site) .auth-story::after {display:none;}
  body:not(.ranch-site) :is(.editor-header,.modal-header) {
    background:var(--ranch-raised);border-bottom:2px solid var(--ranch-line);
  }
  body:not(.ranch-site) :is(.avatar,.avatar.copper,.insight-mark,.step-number,.auth-emblem) {
    background:var(--ranch-raised);color:var(--ranch-gold);border:2px solid var(--ranch-line);
  }
  body:not(.ranch-site) :is(.setting-note,.connection-summary,.linked-execution,.journal-intro,.empty-chart,.process-note) {
    background:var(--ranch-raised);color:var(--ranch-muted);border:2px solid var(--ranch-line);box-shadow:none;
  }
  body:not(.ranch-site) :is(.ranch-note p,.sidebar-bottom>a,.auth-copy>p,.auth-method,.auth-bottom,.identity small) {color:var(--ranch-muted);}
  body:not(.ranch-site) :is(.auth-copy h1 em,.auth-copy .eyebrow,.connection-summary strong) {color:var(--ranch-gold);}
  body:not(.ranch-site) :is(.close-button,.button.secondary:hover,.icon-button:hover,.tr-button:not(.primary):hover) {
    background:var(--ranch-raised);color:var(--ranch-ink);border:2px solid var(--ranch-control);
  }
  body:not(.ranch-site) .close-button {min-height:44px;min-width:44px;}
  body:not(.ranch-site) .button:not(.secondary):not(.danger):not(.quiet):hover {background:#efd5a0;border-color:#efd5a0;}
  body:not(.ranch-site) .tag {color:var(--ranch-ink);border:1px solid var(--ranch-line);}
  body:not(.ranch-site) .ranch-risk-notice {
    border-top:2px solid var(--ranch-line);background:var(--ranch-base);color:var(--ranch-muted);
  }
  body:not(.ranch-site) .ranch-risk-notice strong {color:var(--ranch-ink);}
  body:not(.ranch-site) .ranch-risk-notice p {color:var(--ranch-muted);}
  body:not(.ranch-site) .ranch-risk-notice a {color:var(--ranch-gold);}
  body:not(.ranch-site) :is(.main,.auth-panel,.modal-content,.editor-body) {min-width:0;}
}
@media screen and (min-width:721px) {
  body:not(.ranch-site) .sidebar {overflow-y:auto;overscroll-behavior-y:contain;}
}
@media screen and (max-width:720px) {
  body:not(.ranch-site) :is(.auth-story,.auth-panel) {padding:24px 16px;}
  body:not(.ranch-site) :is(.panel-heading,.editor-header,.modal-header,.modal-content,.editor-body) {padding:16px;}
  body:not(.ranch-site) :is(.page-heading,.heading-actions,.form-grid,.filters) {gap:16px;}
  body:not(.ranch-site) :is(.sidebar .nav,.tr-tabs,.tr-segments,.tr-horizon>div) {gap:8px;}
  body:not(.ranch-site) :is(input:not([type=checkbox]):not([type=radio]),select,textarea) {font-size:16px;}
  body:not(.ranch-site) .main {padding-bottom:calc(32px + env(safe-area-inset-bottom));}
}
