:root {
  color-scheme: dark;
  --bg: #0b1018;
  --panel: #141d2b;
  --line: #29364a;
  --muted: #a7b5c9;
  --ink: #edf3fb;
  --accent: #f3c553
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, sans-serif
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 5%;
  border-bottom: 1px solid var(--line)
}

a {
  color: var(--accent);
  text-decoration: none
}

.brand {
  font-size: 19px;
  letter-spacing: 2px;
  font-weight: 800;
  color: white
}

.brand span {
  display: block;
  font-size: 12px;
  color: var(--accent)
}

nav {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  align-items: center
}

main {
  max-width: 1180px;
  margin: 48px auto;
  padding: 0 24px
}

h1 {
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.15;
  margin: 10px 0 16px
}

h2 {
  font-size: 22px;
  margin: 0 0 18px
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 2px
}

#intro,
.muted {
  color: var(--muted)
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
  gap: 24px;
  margin-top: 32px
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 24px
}

.narrow {
  max-width: 480px
}

label {
  display: block;
  margin: 16px 0 6px;
  font-size: 14px;
  color: var(--muted)
}

input,
select,
textarea,
button {
  font: inherit;
  border-radius: 7px
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  background: #0b1320;
  color: white;
  border: 1px solid #42516a
}

textarea {
  min-height: 80px
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px
}

button,
.button {
  padding: 11px 18px;
  background: var(--accent);
  color: #121720;
  border: 0;
  font-weight: 650;
  cursor: pointer;
  display: inline-block
}

button:disabled {
  opacity: .5;
  cursor: wait
}

button.secondary {
  background: #25354b;
  color: white
}

.danger {
  color: #ff9a9a
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink)
}

.check input {
  width: 19px;
  height: 19px
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 20px 0;
  padding: 10px 18px 18px
}

legend {
  color: var(--muted)
}

#notice {
  padding: 16px 20px;
  border: 1px solid #ba9340;
  border-radius: 8px;
  background: #282318;
  white-space: pre-wrap;
  overflow-wrap: anywhere
}

.license-key {
  padding: 16px;
  background: #0b1320;
  overflow-wrap: anywhere;
  user-select: all;
  font-family: monospace
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px
}

td,
th {
  padding: 14px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line)
}

.scroll {
  overflow-x: auto
}

.pill {
  border: 1px solid #53657f;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 13px
}

.stats {
  display: flex;
  gap: 32px;
  margin-top: 24px
}

.stats strong {
  display: block;
  font-size: 26px
}

footer {
  color: var(--muted);
  padding: 32px 5%;
  font-size: 14px;
  border-top: 1px solid var(--line)
}

code {
  overflow-wrap: anywhere
}

.feature {
  display: block;
  border-top: 1px solid var(--line);
  padding: 16px 0
}

.feature span {
  display: block;
  font-size: 14px;
  color: var(--muted)
}

@media(max-width:650px) {
  header {
    align-items: flex-start;
    flex-direction: column
  }

  main {
    margin-top: 30px
  }

  .card {
    padding: 20px
  }

  nav {
    gap: 14px
  }
}

/* Shared Chandra identity: same symbol and wordmark as the four dashboards. */

header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  text-decoration: none
}

header .brand-mark {
  width: 52px;
  height: 52px;
  flex-shrink: 0
}

header .brand .brand-name {
  display: flex;
  flex-direction: column;
  gap: 5px;
  line-height: 1.1;
  white-space: nowrap
}

header .brand .brand-name span:first-child {
  display: block;
  font-size: 21px;
  letter-spacing: 4px;
  color: #fff
}

header .brand .brand-name span:last-child {
  display: block;
  font-size: 10px;
  letter-spacing: 3.5px;
  color: #f7c83d
}

@media(max-width:760px) {
  header .brand {
    gap: 9px
  }

  header .brand-mark {
    width: 40px;
    height: 40px
  }

  header .brand .brand-name span:first-child {
    font-size: 16px;
    letter-spacing: 3px
  }

  header .brand .brand-name span:last-child {
    font-size: 8px;
    letter-spacing: 2px
  }
}

@media(max-width:400px) {
  header .brand {
    gap: 6px
  }

  header .brand-mark {
    width: 32px;
    height: 32px
  }

  header .brand .brand-name span:first-child {
    font-size: 13px;
    letter-spacing: 2px
  }

  header .brand .brand-name span:last-child {
    font-size: 7px;
    letter-spacing: 1.5px
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #fff;
  --line: #d5dce5;
  --muted: #526277;
  --ink: #172435;
  --accent: #926900
}

:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea {
  background: #fff;
  color: var(--ink);
  border-color: #b9c5d3
}

:root[data-theme="light"] button,
:root[data-theme="light"] .button {
  background: #f3c553;
  color: #172435
}

:root[data-theme="light"] button.secondary {
  background: #e8edf3;
  color: #172435
}

:root[data-theme="light"] .license-key {
  background: #edf1f6
}

:root[data-theme="light"] #notice {
  background: #fff7db;
  color: #654900
}

:root[data-theme="light"] .danger {
  color: #ac2434
}

:root[data-theme="light"] header .brand .brand-name span:first-child {
  color: #172435
}

:root[data-theme="light"] header .brand .brand-name span:last-child {
  color: #936900
}

:root[data-theme="light"] .brand-mark path[stroke="white"] {
  stroke: #172435
}

:root[data-theme="light"] .brand-mark path[stroke="#f7c83d"] {
  stroke: #b58500
}

:root[data-theme="light"] .brand-mark path[fill="#f7c83d"] {
  fill: #b58500
}

header nav {
  margin-left: auto
}

#portal-theme {
  white-space: nowrap;
  font-size: 12px;
  padding: 9px 12px
}

@media(max-width:760px) {
  header {
    flex-wrap: wrap;
    gap: 14px
  }

  header nav {
    margin-left: 0
  }
}

/* Portal uses the same compact visual language as Money and Open Interest. */

:root {
  --bg: #0b1017;
  --panel: #111b24;
  --line: #293847;
  --muted: #9cb2c9;
  --ink: #dce7f3;
  --accent: #f7c83d;
  --field: #0d151e;
  --control: #1c2d3d;
  --head: #182633
}

body {
  font: 14px/1.5 Arial, Helvetica, sans-serif
}

header {
  height: 72px;
  padding: 0 28px;
  gap: 32px;
  background: #080a0d;
  border-bottom: 1px solid #292c31;
  justify-content: flex-start;
  flex-wrap: nowrap
}

header .brand {
  padding-right: 26px;
  border-right: 1px solid #41454c
}

header nav {
  gap: 26px;
  margin-left: 0;
  flex: 1;
  flex-wrap: wrap
}

header nav a {
  font-size: 15px;
  font-weight: 600;
  color: #cbd0d8;
  padding: 23px 0;
  border-bottom: 3px solid transparent
}

header nav a.active {
  color: #f7c83d;
  border-bottom-color: #f7c83d
}

header nav a.button {
  padding: 7px 12px;
  border: 1px solid var(--line)
}

header #portal-theme {
  margin-left: auto;
  background: #151a21;
  color: #f3f4f6;
  border: 1px solid #454c58;
  padding: 7px 10px
}

main {
  max-width: 1360px;
  margin: 28px auto;
  padding: 0 24px
}

h1 {
  font-size: 28px;
  letter-spacing: 0;
  line-height: 1.25;
  margin: 0 0 8px
}

h2 {
  font-size: 18px;
  margin: 0 0 14px
}

h3 {
  font-size: 16px
}

.eyebrow {
  display: none
}

#intro {
  margin: 0 0 20px;
  font-size: 13px
}

.grid {
  gap: 16px;
  margin-top: 18px;
  align-items: start
}

.card {
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px
}

.narrow {
  max-width: 460px
}

label {
  margin: 12px 0 5px;
  font-size: 13px
}

input,
select,
textarea {
  padding: 8px 11px;
  border: 1px solid #3a5065;
  background: var(--field);
  color: var(--ink);
  border-radius: 6px
}

button,
.button {
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid #3a5065;
  border-radius: 6px;
  background: #8edfc2;
  color: #09251c;
  font-weight: 600
}

button.secondary {
  background: var(--control);
  color: var(--ink)
}

button:hover,
.button:hover {
  filter: brightness(1.08)
}

.actions {
  gap: 10px;
  margin-top: 16px
}

fieldset {
  margin: 14px 0;
  padding: 8px 12px 12px
}

.check {
  margin: 8px 0
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: #36a382
}

.stats {
  gap: 12px;
  margin-top: 18px
}

.stats>div {
  min-width: 140px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 18px
}

.stats strong {
  font-size: 24px
}

table {
  font-size: 13px
}

th {
  background: var(--head);
  font-size: 12px;
  color: var(--muted)
}

td,
th {
  padding: 10px 12px
}

td button {
  margin: 2px
}

tbody tr:hover {
  background: var(--head)
}

.license-key {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--field)
}

.feature {
  padding: 12px 0;
  font-weight: 600
}

.feature span {
  font-size: 12px;
  font-weight: 400
}

#notice {
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px
}

footer {
  padding: 18px 28px;
  font-size: 12px
}

:root[data-theme="light"] {
  --bg: #f3f6f9;
  --panel: #fff;
  --line: #ccd5df;
  --muted: #516174;
  --ink: #172435;
  --accent: #886000;
  --field: #fff;
  --control: #edf2f7;
  --head: #eaf0f5
}

:root[data-theme="light"] header {
  background: #fff;
  border-bottom-color: #ccd5df
}

:root[data-theme="light"] header .brand {
  border-right-color: #d4dce5
}

:root[data-theme="light"] header nav a {
  color: #516174
}

:root[data-theme="light"] header nav a.active {
  color: #886000;
  border-bottom-color: #c39413
}

:root[data-theme="light"] header #portal-theme {
  background: #f4f6f8;
  color: #172435;
  border-color: #bbc8d5
}

:root[data-theme="light"] button,
:root[data-theme="light"] .button {
  background: #08714d;
  color: #fff;
  border-color: #08714d
}

:root[data-theme="light"] button.secondary {
  background: #edf2f7;
  color: #172435;
  border-color: #bbc8d5
}

@media(max-width:1200px) {
  header {
    height: auto;
    min-height: 72px;
    flex-wrap: wrap;
    gap: 12px 18px;
    padding: 10px 18px
  }

  header nav {
    gap: 18px
  }

  header nav a {
    padding: 10px 0
  }
}

@media(max-width:760px) {
  header {
    flex-direction: row;
    align-items: center;
    padding: 10px 14px
  }

  header .brand {
    padding-right: 14px
  }

  header nav {
    order: 3;
    flex-basis: 100%;
    gap: 20px
  }

  header nav a {
    font-size: 13px;
    padding: 8px 0
  }

  main {
    padding: 0 14px;
    margin: 22px auto
  }

  h1 {
    font-size: 24px
  }

  .grid {
    grid-template-columns: 1fr
  }

  .card {
    padding: 16px
  }

  .stats>div {
    min-width: 110px
  }

  #portal-theme {
    margin-left: auto
  }
}

.broker-settings {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 14px
}

.broker-settings summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600
}

.broker-settings[open] summary {
  margin-bottom: 12px
}

.broker-settings code {
  font-size: 12px
}

.broker-settings+.actions {
  margin-top: 16px
}

/* Primary broker connection action. */

#connect {
  min-width: 132px;
  padding: 10px 20px;
  background: #f7c83d;
  color: #172435;
  border: 1px solid #d8a915;
  font-weight: 700;
  box-shadow: 0 2px 8px #0002
}

:root[data-theme="light"] #connect {
  background: #f7c83d;
  color: #172435;
  border-color: #d8a915
}

#connect:hover:not(:disabled) {
  background: #ffda66;
  filter: none
}

#connect:disabled {
  box-shadow: none;
  opacity: .5
}

.profile-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0
}

.admin-fold {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  margin: 12px 0;
  padding: 0 16px
}

.admin-fold>summary {
  padding: 13px 0;
  font-weight: 600;
  cursor: pointer
}

.admin-fold>.card {
  border: 0;
  padding: 8px 0;
  margin: 0 0 12px
}

.admin-fold>.grid {
  margin: 4px 0 0
}

.admin-fold>.grid>.card {
  border: 0;
  padding: 10px 0;
  background: transparent
}

.admin-actions {
  margin: 14px 0
}

.admin-fold form {
  max-width: 640px
}

.admin-fold #license fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px
}

/* Account: two aligned columns with no empty grid-row space. */
.grid.account-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto
}

.account-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0
}

.account-grid .card {
  margin: 0;
  padding: 20px
}

.account-grid .card h2 {
  margin-top: 0
}

.account-grid .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px
}

.account-grid input,
.account-grid select {
  width: 100%;
  box-sizing: border-box
}

.account-features .feature {
  padding: 10px 0
}

.account-grid .muted {
  font-size: 12px;
  line-height: 1.5
}

@media(max-width:760px) {
  .grid.account-grid {
    grid-template-columns: 1fr
  }

  .account-grid .card {
    padding: 16px
  }
}
