:root {
  color-scheme: dark;
  --bg: #0c0f12;
  --surface: #14191d;
  --surface-raised: #191f24;
  --surface-soft: #20272c;
  --border: #2b343a;
  --border-strong: #3a454c;
  --text: #f2f5f6;
  --text-soft: #c5ced2;
  --muted: #8e9ba2;
  --green: #35c58a;
  --green-soft: #17392d;
  --red: #e06470;
  --red-soft: #402128;
  --amber: #e1ae58;
  --amber-soft: #3f331d;
  --cyan: #55b6ce;
  --blue: #748fe2;
  --sidebar-width: 224px;
  --radius: 6px;
  --shadow: 0 16px 40px rgb(0 0 0 / 22%);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

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

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
a,
select,
input {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

a {
  color: var(--text-soft);
  text-decoration: none;
}

a:hover {
  color: var(--text);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
}

h2 {
  font-size: 17px;
  line-height: 1.3;
  font-weight: 650;
}

small {
  color: var(--muted);
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: #101418;
  padding: 20px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 50px;
  padding: 5px 8px 20px;
  color: var(--text);
}

.brand-mark {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid #2d5f50;
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--green);
}

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

.brand-mark.large svg {
  width: 25px;
  height: 25px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand small {
  margin-top: 1px;
  font-size: 11px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 14px;
}

.nav-item {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 11px;
  border-radius: var(--radius);
  padding: 0 11px;
  color: var(--muted);
  font-weight: 550;
}

.nav-item:hover {
  background: var(--surface);
}

.nav-item.is-active {
  background: var(--surface-soft);
  color: var(--text);
}

.nav-item.is-active svg {
  color: var(--green);
}

.sidebar-foot {
  display: grid;
  gap: 14px;
  margin-top: auto;
  padding: 14px 5px 0;
  border-top: 1px solid var(--border);
}

.paper-lock {
  display: grid;
  grid-template-columns: 10px 1fr;
  align-items: center;
  gap: 2px 8px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.paper-lock small {
  grid-column: 2;
  font-size: 10px;
  font-weight: 500;
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgb(12 15 18 / 94%);
  padding: 13px clamp(18px, 3vw, 36px);
  backdrop-filter: blur(14px);
}

.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.5;
  text-transform: uppercase;
}

.topbar .eyebrow {
  margin-bottom: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.freshness,
.panel-meta {
  color: var(--muted);
  font-size: 12px;
}

.icon-button,
.icon-text-button,
.primary-button,
.secondary-button,
.segmented button {
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

.icon-button {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
}

.icon-button:hover,
.secondary-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
}

.icon-button.is-spinning svg {
  animation: spin 0.8s linear infinite;
}

.icon-text-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
}

.subtle-button {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  color: var(--muted);
}

.subtle-button:hover {
  background: var(--surface);
  color: var(--text);
}

.secondary-button {
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.primary-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--green);
  color: #07130f;
  padding: 0 16px;
  font-weight: 750;
}

.primary-button:hover {
  background: #4bd29a;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.content {
  width: min(1500px, 100%);
  min-height: calc(100vh - 116px);
  margin: 0 auto;
  padding: 24px clamp(18px, 3vw, 36px) 36px;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding: 12px clamp(18px, 3vw, 36px);
  color: var(--muted);
  font-size: 11px;
}

.app-footer a {
  color: var(--muted);
}

.page-error,
.form-error {
  border: 1px solid #70404a;
  border-radius: var(--radius);
  background: var(--red-soft);
  color: #ffbbc2;
  padding: 11px 13px;
}

.page-error {
  margin-bottom: 16px;
}

.status-banner,
.safety-banner,
.readiness-panel {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.status-banner {
  min-height: 48px;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 14px;
}

.status-banner > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.status-banner > span {
  color: var(--muted);
  font-size: 12px;
}

.status-banner.is-ok {
  border-color: #285845;
  background: #10241d;
}

.status-banner.is-warning {
  border-color: #66522d;
  background: #292316;
}

.status-banner.is-error {
  border-color: #70404a;
  background: var(--red-soft);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted);
}

.status-ok {
  background: var(--green);
  box-shadow: 0 0 0 3px rgb(53 197 138 / 12%);
}

.status-warning {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgb(225 174 88 / 12%);
}

.status-error {
  background: var(--red);
  box-shadow: 0 0 0 3px rgb(224 100 112 / 12%);
}

.metric-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.metric-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  display: flex;
  min-width: 0;
  min-height: 112px;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 15px 17px;
}

.metric-card > span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  min-height: 36px;
  margin: 4px 0 1px;
  overflow-wrap: anywhere;
  font-size: 25px;
  line-height: 1.35;
}

.metric-card small {
  min-height: 17px;
  overflow-wrap: anywhere;
  font-size: 11px;
}

.positive {
  color: var(--green) !important;
}

.negative {
  color: var(--red) !important;
}

.warning {
  color: var(--amber) !important;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
  gap: 14px;
  margin-bottom: 22px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-heading,
.section-heading {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-heading {
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
}

.panel-heading .eyebrow,
.section-heading .eyebrow {
  margin-bottom: 3px;
}

.section-block {
  margin-bottom: 22px;
}

.section-heading {
  min-height: 54px;
}

.section-heading > a {
  color: var(--green);
  font-size: 12px;
  font-weight: 650;
}

.chart-container {
  width: 100%;
  height: 320px;
  min-height: 240px;
}

.chart-container.compact {
  height: 270px;
}

.chart-container.large {
  height: 500px;
}

.chart-container > div,
.chart-container table {
  border-radius: 0 0 var(--radius) var(--radius);
}

.position-panel {
  min-height: 388px;
}

.badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 4px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 750;
}

.badge.neutral {
  background: var(--surface-soft);
  color: var(--text-soft);
}

.badge.long,
.badge.ok {
  background: var(--green-soft);
  color: var(--green);
}

.badge.short,
.badge.error {
  background: var(--red-soft);
  color: var(--red);
}

.badge.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.positive {
  background: var(--green-soft);
  color: var(--green);
}

.badge.negative {
  background: var(--red-soft);
  color: var(--red);
}

.badge.neutral {
  background: var(--surface-soft);
  color: var(--text-soft);
}

.empty-state {
  display: flex;
  min-height: 300px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
}

.empty-state svg {
  width: 26px;
  height: 26px;
}

.position-content {
  padding: 16px;
}

.position-price {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 2px 14px;
  margin-bottom: 15px;
}

.position-price > span {
  font-weight: 700;
}

.position-price strong {
  font-size: 21px;
}

.position-price small {
  grid-column: 2;
  text-align: right;
}

.r-scale {
  position: relative;
  height: 25px;
  margin: 12px 0 19px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--red-soft) 0 25%, var(--surface-soft) 25% 50%, var(--green-soft) 50% 100%);
  color: var(--muted);
  font-size: 9px;
}

.r-zero,
.r-target {
  position: absolute;
  top: 6px;
}

.r-zero {
  left: 25%;
}

.r-target {
  right: 5px;
}

.r-marker {
  position: absolute;
  top: -4px;
  left: 25%;
  width: 3px;
  height: 33px;
  border-radius: 2px;
  background: var(--text);
  box-shadow: 0 0 0 2px rgb(0 0 0 / 35%);
  transition: left 300ms ease;
}

.definition-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.definition-grid div {
  min-width: 0;
}

.definition-grid dt {
  color: var(--muted);
  font-size: 10px;
}

.definition-grid dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 650;
}

.management-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 16px;
}

.management-step {
  min-width: 0;
  border-top: 2px solid var(--border-strong);
  padding-top: 7px;
  color: var(--muted);
  font-size: 9px;
  overflow-wrap: anywhere;
}

.management-step.is-active {
  border-color: var(--green);
  color: var(--text-soft);
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.market-card {
  display: block;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.market-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-raised);
}

.market-card-head,
.market-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.market-card-head strong {
  font-size: 15px;
}

.market-card-price {
  margin: 12px 0;
  font-size: 24px;
  font-weight: 700;
}

.market-card-foot {
  color: var(--muted);
  font-size: 11px;
}

.market-card-foot span:last-child {
  text-align: right;
}

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

.timeline,
.news-list,
.rank-list,
.backup-list,
.error-list {
  padding: 3px 16px 8px;
}

.timeline-item,
.news-item,
.rank-item,
.backup-item,
.error-item {
  display: grid;
  gap: 3px;
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

.timeline-item:last-child,
.news-item:last-child,
.rank-item:last-child,
.backup-item:last-child,
.error-item:last-child {
  border-bottom: 0;
}

.timeline-item {
  grid-template-columns: 9px minmax(70px, auto) 1fr auto;
  align-items: start;
  gap: 8px;
}

.timeline-item p,
.news-item p,
.error-item p {
  min-width: 0;
  color: var(--text-soft);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.timeline-item small,
.news-item small,
.backup-item small,
.error-item small {
  font-size: 10px;
}

.news-item a {
  color: var(--text-soft);
  font-size: 12px;
}

.news-meta,
.backup-item,
.rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.news-original {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.tone-label.positive {
  color: var(--green);
}

.tone-label.negative {
  color: var(--red);
}

.toolbar,
.market-toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.news-toolbar {
  flex-wrap: wrap;
}

.news-toolbar .search-field {
  min-width: 240px;
  flex: 1 1 240px;
}

.news-section {
  margin-top: 18px;
}

.news-feed {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.news-feed-item {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 15px;
}

.news-feed-head,
.news-feed-meta,
.news-coins {
  display: flex;
  align-items: center;
  gap: 8px;
}

.news-feed-head {
  justify-content: space-between;
}

.news-feed-meta {
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
}

.news-feed-title {
  display: block;
  margin-top: 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.news-feed-original {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.news-coins {
  flex-wrap: wrap;
  margin-top: 12px;
}

.panel-link {
  color: var(--cyan);
  font-size: 11px;
}

.stream-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.segmented.compact {
  width: auto;
}

.segmented.compact button {
  min-width: 86px;
}

.toolbar label {
  display: grid;
  gap: 5px;
  min-width: 150px;
}

.toolbar label > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

select,
input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 11px;
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

td {
  color: var(--text-soft);
  font-size: 11px;
}

tbody tr:hover td {
  background: var(--surface-raised);
}

.safety-banner {
  gap: 12px;
  margin-bottom: 16px;
  border-color: #2a5c49;
  background: #10241d;
  padding: 13px 15px;
}

.safety-banner svg {
  color: var(--green);
}

.safety-banner strong,
.safety-banner span {
  display: block;
}

.safety-banner span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.readiness-panel {
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 20px;
  padding: 15px 17px;
}

.readiness-panel .status-dot {
  margin-top: 7px;
}

.readiness-panel ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 7px 0 0;
  padding-left: 17px;
  color: var(--muted);
  font-size: 11px;
}

.comparison-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  margin-bottom: 20px;
}

.score-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-top-width: 3px;
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
}

.baseline-panel {
  border-top-color: var(--cyan);
}

.model-panel {
  border-top-color: var(--green);
}

.score-panel > strong,
.score-panel > span {
  display: block;
}

.score-panel > strong {
  margin-top: 12px;
  font-size: 31px;
}

.score-panel > span {
  color: var(--muted);
  font-size: 11px;
}

.score-panel dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 22px 0 0;
}

.score-panel dt {
  color: var(--muted);
  font-size: 9px;
}

.score-panel dd {
  margin: 3px 0 0;
  font-size: 12px;
  font-weight: 650;
}

.comparison-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

.comparison-arrow svg {
  color: var(--green);
}

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

.confidence-list,
.outcome-bars {
  padding: 14px 16px;
}

.confidence-row {
  display: grid;
  grid-template-columns: 110px 1fr 70px;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
  font-size: 11px;
}

.interval-track,
.outcome-track,
.meter,
.imbalance-track {
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-soft);
}

.interval-track {
  position: relative;
  height: 8px;
}

.interval-track .range {
  position: absolute;
  top: 2px;
  height: 4px;
  border-radius: 2px;
  background: var(--cyan);
}

.interval-track .estimate {
  position: absolute;
  top: 0;
  width: 2px;
  height: 8px;
  background: var(--text);
}

.confidence-row strong {
  text-align: right;
  font-size: 11px;
}

.panel-note {
  border-top: 1px solid var(--border);
  padding: 11px 16px;
  color: var(--muted);
  font-size: 11px;
}

.outcome-row {
  display: grid;
  grid-template-columns: 80px 1fr 70px;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
  font-size: 11px;
}

.outcome-track {
  height: 7px;
}

.outcome-track span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.outcome-row strong {
  text-align: right;
  font-size: 11px;
}

.diversity-grid {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
}

.rank-item > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.rank-item > span:last-child {
  flex: 0 0 auto;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.market-toolbar {
  justify-content: space-between;
}

.market-symbol-picker {
  display: grid;
  min-width: 150px;
  gap: 5px;
}

.market-symbol-picker > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.management-note {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.5;
}

.segmented {
  display: inline-flex;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 3px;
}

.segmented button {
  min-width: 48px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
}

.segmented button.is-active {
  background: var(--surface-soft);
  color: var(--text);
}

.market-heading-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 13px;
}

.live-price {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.live-price strong {
  font-size: 32px;
}

.live-price span {
  color: var(--muted);
  font-size: 11px;
}

.market-regime {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: right;
}

.market-regime small,
.market-regime strong {
  display: block;
}

.market-regime strong {
  margin-top: 2px;
}

.market-chart-panel {
  position: relative;
  margin-bottom: 14px;
}

.chart-legend {
  position: absolute;
  z-index: 4;
  top: 10px;
  left: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  color: var(--muted);
  font-size: 10px;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-line {
  display: inline-block;
  width: 13px;
  height: 2px;
}

.ema-fast {
  background: var(--cyan);
}

.ema-slow {
  background: var(--amber);
}

.position-line {
  background: var(--green);
}

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

#liquidity-grid {
  padding: 16px;
}

.imbalance-track {
  display: flex;
  height: 9px;
  margin: 0 16px 5px;
}

.imbalance-track span:first-child {
  background: var(--green);
}

.imbalance-track span:last-child {
  background: var(--red);
}

.imbalance-labels {
  display: flex;
  justify-content: space-between;
  padding: 0 16px 16px;
  color: var(--muted);
  font-size: 9px;
}

.system-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 19px 0;
}

.resource-meter {
  width: min(340px, 45%);
}

.resource-meter > span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 11px;
}

.meter {
  height: 8px;
  margin-bottom: 4px;
}

.meter span {
  display: block;
  height: 100%;
  background: var(--green);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.check-item {
  display: grid;
  grid-template-columns: 9px 1fr;
  gap: 3px 9px;
  min-height: 82px;
  align-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.check-item strong {
  font-size: 12px;
}

.check-item small {
  grid-column: 2;
  overflow-wrap: anywhere;
  font-size: 10px;
}

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

.backup-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 11px;
}

.log-panel pre {
  height: 320px;
  margin: 0;
  overflow: auto;
  background: #0a0d0f;
  padding: 13px;
  color: #aebbc0;
  font: 10px/1.55 "Cascadia Mono", Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.loading-block,
.skeleton {
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton {
  min-height: 40px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.skeleton.tall {
  min-height: 130px;
}

.skeleton.rows {
  min-height: 130px;
}

.mobile-nav {
  display: none;
}

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-layout {
  display: grid;
  width: min(900px, 100%);
  min-height: 520px;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border);
  background: #101519;
  padding: 50px;
}

.login-brand .brand-mark {
  margin-bottom: 28px;
}

.login-brand h1 {
  margin-top: 7px;
  font-size: 45px;
  line-height: 1.04;
}

.login-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 38px;
  color: var(--text-soft);
  font-size: 11px;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 42px;
}

.login-heading {
  margin-bottom: 24px;
}

.login-heading h2 {
  margin-top: 4px;
  font-size: 25px;
}

.login-panel .form-error {
  margin-bottom: 15px;
  font-size: 11px;
}

.setup-notice {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 11px;
  margin-bottom: 15px;
  border: 1px solid #315b4a;
  border-radius: var(--radius);
  background: var(--green-soft);
  padding: 12px;
}

.setup-notice > svg {
  width: 19px;
  color: var(--green);
}

.setup-notice div {
  display: grid;
  gap: 3px;
}

.setup-notice strong {
  color: var(--text);
  font-size: 12px;
}

.setup-notice span {
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.45;
}

.login-form {
  display: grid;
  gap: 8px;
}

.login-form label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.input-wrap {
  position: relative;
}

.input-wrap svg {
  position: absolute;
  top: 13px;
  left: 12px;
  width: 16px;
  color: var(--muted);
}

.input-wrap input {
  min-height: 43px;
  padding-left: 38px;
}

.input-wrap input.has-action {
  padding-right: 43px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.password-toggle:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.input-wrap .password-toggle svg {
  position: static;
  width: 16px;
}

.login-form .primary-button {
  width: 100%;
  margin-top: 15px;
}

.setup-account {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  padding: 0 0 14px;
  color: var(--muted);
  font-size: 10px;
}

.setup-account svg {
  width: 16px;
  color: var(--green);
}

.setup-account strong {
  color: var(--text);
  font-size: 12px;
}

.password-checks {
  display: grid;
  gap: 6px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.password-checks span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.password-checks span::before {
  width: 7px;
  height: 7px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  content: "";
}

.password-checks span.is-valid {
  color: var(--green);
}

.password-checks span.is-valid::before {
  border-color: var(--green);
  background: var(--green);
}

.setup-activation {
  display: grid;
  min-height: 150px;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
}

.setup-activation strong {
  font-size: 14px;
}

.setup-activation > span:last-child {
  max-width: 260px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.setup-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.security-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 25px;
  color: var(--muted);
  font-size: 10px;
}

.security-line svg {
  width: 15px;
  color: var(--green);
}

@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1100px) {
  .metric-grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-layout,
  .learning-detail,
  .system-tables,
  .system-bottom {
    grid-template-columns: 1fr;
  }

  .comparison-grid {
    grid-template-columns: 1fr;
  }

  .comparison-arrow {
    min-height: 44px;
  }

  .comparison-arrow svg {
    transform: rotate(90deg);
  }

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

@media (max-width: 760px) {
  body {
    padding-bottom: 66px;
  }

  .sidebar {
    display: none;
  }

  .workspace {
    margin-left: 0;
  }

  .topbar {
    min-height: 66px;
    padding: 10px 14px;
  }

  .topbar .eyebrow {
    display: none;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .freshness {
    max-width: 120px;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .content {
    padding: 15px 12px 28px;
  }

  .app-footer {
    display: none;
  }

  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    display: grid;
    height: 66px;
    grid-template-columns: repeat(6, 1fr);
    border-top: 1px solid var(--border);
    background: #101418;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-nav a {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--muted);
    font-size: 9px;
  }

  .mobile-nav a.is-active {
    color: var(--green);
  }

  .mobile-nav svg {
    width: 18px;
    height: 18px;
  }

  .metric-grid.four,
  .market-grid,
  .activity-layout,
  .market-detail,
  .news-feed {
    grid-template-columns: 1fr;
  }

  .news-toolbar + .metric-grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-card {
    min-height: 92px;
  }

  .metric-card strong {
    min-height: 30px;
    font-size: 21px;
  }

  .chart-container {
    height: 280px;
  }

  .chart-container.large {
    height: 390px;
  }

  .panel-heading,
  .section-heading {
    min-height: 57px;
  }

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

  .toolbar label {
    min-width: 0;
  }

  .toolbar .secondary-button {
    min-height: 38px;
    align-self: end;
  }

  .market-toolbar {
    align-items: stretch;
  }

  .segmented {
    flex: 1;
  }

  .segmented button {
    min-width: 0;
    flex: 1;
    padding: 0 8px;
  }

  .market-heading-row {
    align-items: flex-start;
  }

  .live-price {
    display: block;
  }

  .live-price strong,
  .live-price span {
    display: block;
  }

  .live-price strong {
    font-size: 26px;
  }

  .market-regime {
    max-width: 45%;
  }

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

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

  .confidence-row {
    grid-template-columns: 82px 1fr 55px;
  }

  .system-summary {
    display: block;
  }

  .resource-meter {
    width: 100%;
    margin-top: 14px;
  }

  .check-grid {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 9px 58px 1fr;
  }

  .timeline-item time {
    grid-column: 3;
  }

  .readiness-panel ul {
    display: block;
  }

  .login-body {
    display: block;
    padding: 0;
  }

  .login-layout {
    min-height: 100vh;
    grid-template-columns: 1fr;
    border: 0;
  }

  .login-brand {
    min-height: 265px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 28px;
  }

  .login-brand .brand-mark {
    margin-bottom: 18px;
  }

  .login-brand h1 {
    font-size: 36px;
  }

  .login-status {
    margin-top: 20px;
  }

  .login-panel {
    padding: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
