:root {
  --bg: #eef2f7;
  --bg-soft: #f8fafc;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-tint: #f7f9fc;
  --ink: #111827;
  --text: #1f2937;
  --muted: #64748b;
  --muted-strong: #475569;
  --border: #dbe3ef;
  --border-strong: #c7d2e1;
  --active: #2563eb;
  --active-deep: #1e40af;
  --active-soft: #edf4ff;
  --active-border: #bad2ff;
  --passive: #059669;
  --passive-deep: #047857;
  --passive-soft: #ecfdf5;
  --passive-border: #a9e7ce;
  --gold: #b7791f;
  --gold-soft: #fff7e8;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --shadow: 0 22px 55px rgba(15, 23, 42, 0.1);
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.07);
  --shadow-card: 0 1px 1px rgba(15, 23, 42, 0.04), 0 16px 38px rgba(15, 23, 42, 0.07);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, #e9eef6 0, #f8fafc 42%, #eef2f7 100%),
    var(--bg);
  font-family: var(--font);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: 34px 24px 58px;
}

.dashboard-header,
.account-panel,
.general-panel,
.chart-panel,
.table-panel,
.kpi-card,
.disclaimer-panel {
  border-radius: var(--radius);
}

.dashboard-header {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 28px;
  margin-bottom: 18px;
  overflow: hidden;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.98), rgba(26, 37, 55, 0.98) 54%, rgba(13, 84, 82, 0.95)),
    var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
}

.dashboard-header::after {
  content: "";
  position: absolute;
  inset: auto 28px 0 auto;
  width: min(520px, 44%);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.7), rgba(52, 211, 153, 0.7));
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: #7dd3fc;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-mark svg,
.btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-copy {
  min-width: 0;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.dashboard-header h1,
.panel-heading h2,
.section-toolbar h2 {
  margin: 0;
  line-height: 1.1;
}

.dashboard-header h1 {
  color: #ffffff;
  font-size: 2.65rem;
  font-weight: 850;
}

.subtitle {
  max-width: 760px;
  margin: 10px 0 0;
  color: #cbd5e1;
  font-size: 1rem;
  line-height: 1.5;
}

.eyebrow,
.section-kicker {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dashboard-header .eyebrow {
  margin: 0;
  color: #93c5fd;
}

.version-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  color: #d1fae5;
  background: rgba(5, 150, 105, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.config-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.account-panel,
.general-panel,
.chart-panel,
.table-panel,
.disclaimer-panel {
  padding: 22px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 227, 239, 0.95);
  box-shadow: var(--shadow-card);
}

.account-panel {
  position: relative;
  overflow: hidden;
}

.account-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--active);
}

.account-panel-passive::before {
  background: var(--passive);
}

.panel-heading,
.section-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.compact-heading {
  align-items: center;
}

.panel-heading h2,
.section-toolbar h2 {
  color: var(--ink);
  font-size: 1.18rem;
  font-weight: 850;
}

.account-badge,
.goal-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 850;
  white-space: nowrap;
}

.active-badge {
  color: var(--active-deep);
  background: var(--active-soft);
  border: 1px solid var(--active-border);
}

.passive-badge {
  color: var(--passive-deep);
  background: var(--passive-soft);
  border: 1px solid var(--passive-border);
}

.goal-pill {
  color: var(--muted-strong);
  background: var(--surface-tint);
  border: 1px solid var(--border);
}

.goal-pill.goal-met {
  color: var(--passive-deep);
  background: var(--passive-soft);
  border-color: var(--passive-border);
}

.form-grid,
.general-grid {
  display: grid;
  gap: 16px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.general-panel {
  margin-top: 18px;
}

.general-grid {
  grid-template-columns: minmax(220px, 1.2fr) repeat(4, minmax(170px, 1fr));
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field span,
.field label,
.toggle-field {
  color: var(--muted-strong);
  font-size: 0.86rem;
  font-weight: 750;
}

.field-hint {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.35;
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field input:hover,
.field select:hover {
  border-color: var(--border-strong);
}

.field input:focus,
.field select:focus {
  background: #ffffff;
  border-color: var(--active);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.readonly-field input {
  color: var(--active-deep);
  background: var(--active-soft);
  border-color: var(--active-border);
  font-weight: 850;
}

.number-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.number-row span {
  min-width: 42px;
  padding: 10px;
  color: var(--muted-strong);
  text-align: center;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

input[type="range"] {
  width: 100%;
  height: 6px;
  padding: 0;
  accent-color: var(--active);
}

.account-panel-passive input[type="range"] {
  accent-color: var(--passive);
}

.toggle-field {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  align-self: end;
  gap: 10px;
  min-height: 46px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.toggle-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 160ms ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.22);
  transition: transform 160ms ease;
}

.toggle-field input:checked + .toggle-track {
  background: var(--active);
}

.toggle-field input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.rule-notice {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  padding: 14px 16px;
  color: #1e3a8a;
  background: linear-gradient(180deg, #f2f7ff, #ffffff);
  border: 1px solid var(--active-border);
  border-left: 4px solid var(--active);
  border-radius: var(--radius);
}

.rule-notice strong {
  font-size: 0.85rem;
}

.rule-notice span,
.daily-note {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.deployed-strip,
.passive-summary {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 15px 16px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.deployed-strip {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.deployed-strip span,
.passive-summary span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 850;
}

.deployed-strip strong,
.passive-summary strong {
  color: var(--ink);
  font-size: 1.12rem;
}

.passive-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.passive-summary > div {
  display: grid;
  gap: 4px;
}

.daily-note {
  margin: 14px 0 0;
}

.market-strip,
.data-status,
.warning-banner {
  margin-top: 16px;
  padding: 13px 15px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.45;
}

.market-strip {
  color: #164e63;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  font-weight: 750;
}

.data-status {
  min-height: 44px;
  color: var(--muted-strong);
  background: var(--surface-tint);
  border: 1px solid var(--border);
}

.data-status:empty {
  display: none;
}

.warning-banner {
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid #f1d59a;
  font-weight: 750;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.compact-select {
  display: inline-grid;
  grid-template-columns: auto minmax(150px, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 10px;
  color: var(--muted-strong);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.84rem;
  font-weight: 800;
}

.compact-select select {
  min-height: 30px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
  font-weight: 800;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.1;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: #aebdd0;
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.1);
}

.btn:focus-visible {
  outline: 4px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--active), #0f766e);
  border-color: rgba(37, 99, 235, 0.1);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.kpi-card {
  position: relative;
  display: grid;
  gap: 10px;
  min-height: 112px;
  padding: 18px;
  overflow: hidden;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--border-strong), transparent);
}

.kpi-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.kpi-card strong {
  color: var(--ink);
  font-size: 1.38rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.kpi-active {
  border-color: var(--active-border);
  background: linear-gradient(180deg, #f3f8ff, #ffffff 70%);
}

.kpi-active::before {
  background: var(--active);
}

.kpi-passive {
  border-color: var(--passive-border);
  background: linear-gradient(180deg, #f1fff8, #ffffff 70%);
}

.kpi-passive::before {
  background: var(--passive);
}

.chart-panel,
.table-panel,
.disclaimer-panel {
  margin-top: 18px;
}

.tracking-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: -4px 0 16px;
}

.tracking-summary article {
  display: grid;
  gap: 6px;
  padding: 14px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tracking-summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.tracking-summary strong {
  color: var(--ink);
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.chart-panel {
  box-shadow: var(--shadow);
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 430px;
}

.table-scroll {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 1580px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted-strong);
  background: #f8fafc;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

td {
  color: var(--text);
  font-size: 0.9rem;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fbfdff;
}

.positive {
  color: var(--passive-deep);
  font-weight: 850;
}

.negative {
  color: var(--danger);
  font-weight: 850;
}

.daily-table-wrap {
  max-height: 560px;
}

.daily-result-input {
  width: 118px;
  min-height: 36px;
  padding: 7px 9px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  text-align: right;
  font-weight: 750;
}

.daily-result-input:focus {
  border-color: var(--active);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.disclaimer-panel {
  display: grid;
  gap: 6px;
  color: #713f12;
  background: #fffbeb;
  border: 1px solid #fde68a;
  box-shadow: var(--shadow-soft);
}

.disclaimer-panel strong {
  font-size: 0.95rem;
}

.disclaimer-panel p {
  margin: 0;
  color: #854d0e;
  font-size: 0.9rem;
  line-height: 1.55;
}

.company-credit {
  padding-top: 10px;
  border-top: 1px solid rgba(180, 83, 9, 0.18);
}

.company-credit a {
  color: #1d4ed8;
  font-weight: 850;
  text-decoration: none;
}

.company-credit a:hover {
  text-decoration: underline;
}

@media (max-width: 1180px) {
  .general-grid,
  .kpi-grid,
  .tracking-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .app-shell {
    padding: 20px 14px 42px;
  }

  .dashboard-header {
    padding: 22px;
  }

  .dashboard-header h1 {
    font-size: 2.1rem;
  }

  .config-layout,
  .general-grid {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .section-toolbar,
  .compact-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .action-group {
    justify-content: flex-start;
  }

  .chart-wrap {
    height: 340px;
  }
}

@media (max-width: 680px) {
  .dashboard-header {
    grid-template-columns: 1fr;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
  }

  .dashboard-header h1 {
    font-size: 1.75rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .form-grid,
  .passive-summary,
  .kpi-grid,
  .tracking-summary {
    grid-template-columns: 1fr;
  }

  .account-panel,
  .general-panel,
  .chart-panel,
  .table-panel,
  .disclaimer-panel {
    padding: 16px;
  }

  .btn,
  .action-group,
  .compact-select {
    width: 100%;
  }

  .compact-select {
    grid-template-columns: 1fr;
  }

  .btn {
    min-height: 44px;
  }

  .deployed-strip {
    grid-template-columns: 1fr;
  }

  .chart-wrap {
    height: 300px;
  }
}

@media (max-width: 420px) {
  .number-row {
    grid-template-columns: 1fr;
  }

  .number-row span {
    width: 100%;
  }
}
