:root {
  --bg: #05080c;
  --panel: #0d1722;
  --panel-2: #09111a;
  --panel-3: #15283a;
  --line: #33506a;
  --line-soft: #23394d;
  --text: #eef6ff;
  --muted: #9aaec2;
  --hot: #ffd447;
  --blue: #00a8ff;
  --green: #00e08a;
  --red: #ff4d57;
  --cyan: #00e5ff;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", "Aptos", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body:has(._dash-loading-callback),
body:has(._dash-loading-callback) * {
  cursor: progress !important;
}

.terminal-shell {
  min-height: 100vh;
  max-width: none;
  padding: 0 18px 28px;
  background:
    linear-gradient(180deg, rgba(25, 50, 75, 0.95) 0, rgba(5, 8, 12, 0) 230px),
    radial-gradient(circle at 15% 0%, rgba(0, 168, 255, 0.2), transparent 30%),
    radial-gradient(circle at 82% 4%, rgba(255, 212, 71, 0.12), transparent 24%),
    var(--bg);
}

.terminal-shell.light-mode {
  --bg: #f2f5f7;
  --panel: #ffffff;
  --panel-2: #edf2f6;
  --panel-3: #e6edf3;
  --line: #c8d3dc;
  --line-soft: #d9e2e9;
  --text: #172331;
  --muted: #52677d;
  --hot: #9b6500;
  --blue: #0f75bc;
  --green: #0d8a57;
  --red: #c43b3b;
  --cyan: #087d86;
  background:
    linear-gradient(180deg, rgba(219, 230, 239, 0.95) 0, rgba(242, 245, 247, 0) 220px),
    radial-gradient(circle at 15% 0%, rgba(15, 117, 188, 0.14), transparent 28%),
    var(--bg);
}

.light-mode .topbar {
  background: rgba(242, 245, 247, 0.94);
}

.light-mode .brand-mark,
.light-mode .login-input,
.light-mode .setting-input,
.light-mode .setting-switch,
.light-mode .dash-graph,
.light-mode .metric-tile {
  background-color: var(--panel);
}

.light-mode .dash-graph {
  background: #ffffff;
}

.theme-toggle {
  min-width: 88px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 12px;
  background: rgba(7, 11, 16, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  padding: 6px 9px;
  border: 1px solid var(--hot);
  color: var(--hot);
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  background: #081018;
}

.app-title {
  color: #ffffff;
  font-size: 18px;
  font-weight: 750;
  line-height: 1.1;
}

.app-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.login-zone {
  min-width: 280px;
}

.login-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.login-input {
  height: 32px;
  min-width: 180px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: 2px;
}

.login-msg {
  color: var(--muted);
  font-size: 12px;
}

.auth-badge {
  display: inline-block;
  padding: 5px 9px;
  color: var(--green);
  border: 1px solid rgba(71, 209, 140, 0.45);
  background: rgba(71, 209, 140, 0.08);
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
}

.workspace {
  padding-top: 16px;
}

.terminal-tabs-wrap {
  background: transparent;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.terminal-tabs {
  min-width: max-content;
}

.terminal-tabs .tab {
  background: var(--panel-2) !important;
  color: var(--muted) !important;
  border: 1px solid var(--line-soft) !important;
  border-bottom: 1px solid var(--line) !important;
  padding: 11px 16px !important;
  font-weight: 650;
}

.terminal-tabs .tab--selected {
  background: var(--panel-3) !important;
  color: #ffffff !important;
  border-top: 2px solid var(--hot) !important;
  border-bottom: 1px solid var(--panel-3) !important;
}

.metric-strip {
  margin: 0 0 14px;
}

.metric-tile {
  min-height: 92px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(0, 168, 255, 0.08), rgba(255, 212, 71, 0.015)),
    var(--panel);
  border-radius: 4px;
}

.metric-label {
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 8px;
  color: #ffffff;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 800;
  line-height: 1.05;
}

.metric-good .metric-value {
  color: var(--green);
}

.metric-warn .metric-value {
  color: var(--hot);
}

h5,
h6 {
  color: #ffffff;
  font-weight: 750;
  margin: 14px 0 10px;
}

.dash-graph {
  border: 1px solid var(--line);
  background: var(--panel);
  margin-bottom: 14px;
  overflow: hidden;
}

.btn,
.terminal-button {
  border-radius: 2px !important;
  font-weight: 700 !important;
  border: 1px solid var(--line) !important;
}

.btn-primary {
  background: var(--blue) !important;
  border-color: var(--blue) !important;
  color: #06101b !important;
}

.btn-secondary {
  background: #17283a !important;
  border-color: #446580 !important;
  color: var(--text) !important;
}

.btn-warning {
  background: var(--hot) !important;
  border-color: var(--hot) !important;
  color: #111111 !important;
}

.btn-danger {
  background: var(--red) !important;
  border-color: var(--red) !important;
  color: #160808 !important;
}

.terminal-table {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
}

.terminal-table th {
  color: #ffffff;
  background: var(--panel-3);
  border-color: var(--line) !important;
}

.terminal-table td {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line-soft) !important;
}

.settings-grid {
  row-gap: 12px;
  margin-bottom: 10px;
  max-width: 1320px;
}

.dash-table-container {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.setting-label {
  display: block;
  margin: 0 0 5px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.setting-input {
  width: 100%;
  min-height: 34px;
  padding: 5px 8px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 13px;
}

.projection-growth-bar {
  align-items: flex-start;
  margin-bottom: 12px;
}

.compact-setting-input {
  width: 92px;
  max-width: 100%;
}

.projection-growth-msg {
  min-height: 34px;
  display: flex;
  align-items: center;
  color: var(--green);
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
}

.goal-seek-suggestion {
  font-size: 16px;
  font-weight: 800;
  color: var(--hot);
}

.field-help {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  min-height: 38px;
  max-width: 220px;
}

.setting-dropdown .Select-control,
.setting-dropdown .Select-menu-outer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--text);
}

.setting-dropdown .Select-value-label,
.setting-dropdown .Select-placeholder,
.setting-dropdown .VirtualizedSelectOption {
  color: var(--text) !important;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 13px;
}

.setting-dropdown .VirtualizedSelectFocusedOption {
  background: var(--panel-3);
}

.setting-check {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
}

.setting-switch {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
}

.setting-switch .form-check-input:not(:checked) {
  background-color: #243c52 !important;
  border-color: #6e87a0 !important;
}

.setting-switch .form-check-input:checked {
  background-color: var(--green) !important;
  border-color: var(--green) !important;
}

.setting-switch .form-check-input {
  cursor: pointer;
}

.setting-switch .form-check-label {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-weight: 700;
}

.guardrails-disabled > div:not(:first-child) {
  opacity: 0.42;
  filter: grayscale(0.8);
}

.guardrails-disabled > div:not(:first-child) input {
  cursor: not-allowed;
}

.settings-review {
  max-width: 1320px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 14px 18px 14px 28px;
  font-size: 13px;
}

.settings-review li {
  margin-bottom: 7px;
}

.settings-json {
  max-width: 1320px;
  width: 100%;
  height: 420px;
  padding: 10px 12px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
}

textarea,
input {
  background: var(--panel) !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  border-radius: 2px !important;
}

.dash-spinner {
  color: var(--hot);
}

@media (max-width: 1200px) {
  .terminal-tabs .tab {
    padding: 10px 13px !important;
    font-size: 13px;
  }
}

@media (max-width: 900px) {
  .terminal-shell {
    padding: 0 14px 24px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    position: static;
  }

  .brand-block {
    align-items: flex-start;
  }

  .login-zone {
    min-width: 0;
    width: 100%;
  }

  .login-row {
    justify-content: flex-start;
    flex-wrap: wrap;
    width: 100%;
  }

  .login-input {
    min-width: 0;
    flex: 1 1 180px;
  }

  .metric-strip > div {
    margin-bottom: 10px;
  }

  .terminal-tabs-wrap {
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
  }

  .terminal-tabs .tab {
    min-width: 128px;
    text-align: center;
    white-space: nowrap;
  }

  .dash-graph {
    margin-left: -2px;
    margin-right: -2px;
  }

  .dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner th,
  .dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner td {
    min-width: 78px !important;
    max-width: 160px !important;
    font-size: 11px !important;
    padding: 5px 6px !important;
  }

  .settings-json {
    height: 300px;
  }
}

@media (max-width: 560px) {
  .terminal-shell {
    padding: 0 8px 18px;
  }

  .workspace {
    padding-top: 10px;
  }

  .topbar {
    gap: 10px;
    padding-top: 10px;
  }

  .brand-mark {
    font-size: 11px;
    padding: 5px 7px;
  }

  .app-title {
    font-size: 16px;
  }

  .app-subtitle {
    font-size: 11px;
  }

  .login-row .btn,
  .login-row .terminal-button {
    width: 100%;
  }

  .login-input {
    flex-basis: 100%;
    height: 42px;
  }

  .metric-tile {
    min-height: 72px;
    padding: 11px 12px;
  }

  .metric-value {
    font-size: 18px;
  }

  h5,
  h6 {
    font-size: 15px;
  }

  .terminal-tabs-wrap {
    margin-left: -8px;
    margin-right: -8px;
    padding-left: 8px;
  }

  .terminal-tabs .tab {
    min-width: 112px;
    padding: 9px 10px !important;
    font-size: 12px;
  }

  .btn {
    width: 100%;
    margin: 0 0 8px !important;
    min-height: 42px;
  }

  .stale-actions .btn,
  .stale-actions .terminal-button {
    width: 100%;
  }

  .setting-label {
    font-size: 10px;
  }

  .settings-grid > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .setting-input,
  .setting-check,
  .setting-switch,
  .setting-dropdown {
    min-height: 42px;
    font-size: 14px;
  }

  .compact-setting-input {
    max-width: 100%;
  }

  .field-help {
    font-size: 11px;
    line-height: 1.35;
  }

  .projection-growth-msg {
    align-items: flex-start;
    min-height: 22px;
  }

  .dash-graph {
    margin-left: -8px;
    margin-right: -8px;
    border-left: none;
    border-right: none;
    min-height: 360px;
  }

  .dash-graph .modebar {
    display: none !important;
  }

  .planner-graph .gtitle {
    font-size: 14px !important;
  }

  .planner-graph .legend text {
    font-size: 8px !important;
  }

  .dash-table-container {
    margin-left: -8px;
    margin-right: -8px;
    max-width: calc(100% + 16px);
  }

  .dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner th,
  .dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner td {
    min-width: 96px !important;
    max-width: 168px !important;
    font-size: 12px !important;
    padding: 7px 8px !important;
  }

  .dash-table-container input {
    min-height: 34px;
    font-size: 13px !important;
  }

.settings-review {
  max-width: 1320px;
  padding: 12px 12px 12px 24px;
}

.settings-json {
  max-width: 1320px;
  height: 240px;
}
}

.stale-alert {
  border: 1px solid rgba(246, 200, 95, 0.45);
  background: rgba(246, 200, 95, 0.1);
  color: var(--text);
}

.stale-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
