:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --border: #2d3a4d;
  --text: #e7edf4;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --accent-dim: #2563c4;
  --ok: #34d399;
  --warn: #f59e0b;
  --err: #f87171;
  --font: "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Noto Sans Mono TC", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

body.account-live-footer-on {
  padding-bottom: calc(var(--account-footer-offset, 46px) + env(safe-area-inset-bottom, 0px));
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #15202b 0%, #101821 100%);
  padding: 0.7rem 1rem 0.75rem;
}

.top-line {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.deploy-stamp {
  margin: -0.2rem 0 0.35rem;
  color: rgba(139, 156, 179, 0.72);
  font-family: var(--mono);
  font-size: 0.64rem;
  line-height: 1;
}

.deploy-stamp time {
  white-space: nowrap;
}

.top-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.top-menu a {
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.22rem 0.72rem;
  font-size: 0.78rem;
}

.top-menu a:hover {
  border-color: var(--accent);
}

.top-menu a.active {
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.15);
}

.target-pill {
  margin-left: auto;
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 0.22rem 0.72rem;
  border: 1px solid var(--border);
  color: var(--muted);
}

.target-pill.ok {
  color: var(--ok);
  border-color: var(--ok);
}

.target-pill.bad {
  color: var(--warn);
  border-color: var(--warn);
}

.layout {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  max-width: 1220px;
  margin: 0 auto;
}

@media (min-width: 980px) {
  .layout {
    grid-template-columns: 340px 1fr;
    align-items: start;
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}

.panel h2 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
  font-weight: 600;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.field span {
  font-size: 0.8rem;
  color: var(--muted);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.grow {
  flex: 1;
  min-width: 140px;
}

select,
input[type="text"],
input[type="number"] {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.checkbox-line {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  color: var(--text);
  font-size: 0.85rem;
}

.checkbox-line input {
  margin-top: 0.18rem;
}

.method-meta {
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.65rem;
  margin-bottom: 0.85rem;
}

.method-meta code {
  font-family: var(--mono);
  font-size: 0.72rem;
  word-break: break-all;
}

.method-meta.unavailable {
  border-color: var(--err);
  color: var(--err);
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
}

button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-dim);
}

button.primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

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

button.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

button.ghost:hover {
  color: var(--text);
  border-color: var(--muted);
}

.status {
  min-height: 1.25rem;
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.status.running {
  color: var(--accent);
}

.status.done-ok {
  color: var(--ok);
}

.status.done-err {
  color: var(--err);
}

.arb-help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
}

.arb-help-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  padding: 0.65rem 0.7rem;
}

.arb-help-item strong {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
  color: #d8e7ff;
}

.arb-help-item span {
  font-size: 0.78rem;
  color: var(--muted);
}

.arb-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
}

.arb-fleet-scroll {
  overflow-x: auto;
  margin-top: 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.arb-fleet-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  font-size: 0.72rem;
  font-family: var(--mono);
  background: var(--bg);
}

.arb-fleet-table th,
.arb-fleet-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.38rem 0.45rem;
  text-align: left;
  vertical-align: top;
}

.arb-fleet-table thead th {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  background: rgba(26, 35, 50, 0.85);
  position: sticky;
  top: 0;
  z-index: 1;
}

.arb-fleet-table tbody tr:nth-child(even) td {
  background: rgba(10, 14, 18, 0.35);
}

.arb-fleet-table td.bad {
  color: var(--err);
}

.arb-fleet-table td.ok {
  color: var(--ok);
}

.arb-fleet-table td.warn {
  color: var(--warn);
}

.arb-fleet-row--run td:first-child {
  box-shadow: inset 3px 0 0 var(--ok);
}

.metric {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  padding: 0.58rem 0.65rem;
}

.metric span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.metric strong {
  font-family: var(--mono);
  font-size: 0.86rem;
  color: var(--text);
}

.log-panel {
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.arb-layout {
  display: block;
  max-width: 1400px;
}

.arb-top-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 980px) {
  .arb-top-grid {
    grid-template-columns: 340px 1fr;
  }
}

@media (min-width: 1280px) {
  .arb-top-grid {
    grid-template-columns: 340px 1fr 320px;
  }
}

.arb-layout .log-panel {
  width: 100%;
  overflow: hidden;
}

.arb-layout .log {
  height: calc(100vh - 250px);
  max-height: calc(100vh - 250px);
}

.rank-panel {
  grid-column: 1 / -1;
}

.rank-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.rank-head h2 {
  margin: 0;
}

.rank-empty {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.5rem 0;
}

.rank-table-wrap {
  overflow-x: auto;
}

.rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.rank-table th,
.rank-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.45rem;
  text-align: left;
  white-space: nowrap;
}

.rank-table th {
  color: var(--muted);
  font-weight: 600;
}

.rank-table td {
  font-family: var(--mono);
}

.about-list {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.log {
  flex: 1;
  margin: 0;
  padding: 0.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  background: #0a0e12;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.meta-line {
  color: var(--muted);
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

.spot-arb-top {
  padding: 0.55rem 1rem;
}

.spot-arb-menu {
  gap: 0.6rem;
}

.account-strip {
  display: flex;
  flex: 1;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 260px;
  min-width: 0;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  background: rgba(10, 14, 18, 0.55);
  max-width: 100%;
  white-space: nowrap;
}

.holding-chip {
  max-width: min(360px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-chip.ok {
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.65);
}

.status-chip.warn {
  color: var(--warn);
  border-color: rgba(245, 158, 11, 0.7);
}

.status-chip.bad {
  color: var(--err);
  border-color: rgba(248, 113, 113, 0.7);
}

.account-live-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(16, 24, 33, 0.96), rgba(10, 14, 18, 0.98));
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.36);
  padding: 0.42rem clamp(0.65rem, 1.8vw, 1rem) calc(0.42rem + env(safe-area-inset-bottom, 0px));
}

.account-live-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  max-width: 1440px;
  margin: 0 auto;
}

.account-live-title {
  min-width: 170px;
  display: grid;
  gap: 0.05rem;
}

.account-live-title strong {
  font-size: 0.78rem;
  line-height: 1.1;
}

.account-live-title span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.64rem;
  line-height: 1.1;
}

.account-live-title span.ok {
  color: var(--ok);
}

.account-live-title span.warn {
  color: var(--warn);
}

.account-live-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.38rem;
  min-width: 0;
}

.account-live-chips .status-chip {
  min-height: 1.35rem;
  padding: 0.12rem 0.5rem;
  font-size: 0.68rem;
}

.account-live-primary {
  color: #d8e7ff;
  border-color: rgba(61, 139, 253, 0.58);
}

.account-live-toggle {
  padding: 0.28rem 0.65rem;
  white-space: nowrap;
  font-size: 0.76rem;
}

.account-live-drawer {
  max-width: 1440px;
  margin: 0.45rem auto 0;
}

.account-live-note {
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-family: var(--mono);
}

.account-live-tables {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.account-live-tables section {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(10, 14, 18, 0.68);
  overflow: hidden;
}

.account-live-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.38rem 0.55rem;
  border-bottom: 1px solid var(--border);
}

.account-live-section-head h3 {
  margin: 0;
  font-size: 0.78rem;
}

.account-live-section-head small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
}

.account-live-table-wrap {
  max-height: 190px;
  overflow: auto;
}

.account-live-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.68rem;
}

.account-live-future-table {
  min-width: 680px;
}

.account-live-table th,
.account-live-table td {
  padding: 0.3rem 0.42rem;
  border-bottom: 1px solid rgba(45, 58, 77, 0.75);
  text-align: right;
  white-space: nowrap;
}

.account-live-table th:first-child,
.account-live-table td:first-child,
.account-live-table th:nth-child(2),
.account-live-table td:nth-child(2) {
  text-align: left;
}

.account-live-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #101821;
  font-weight: 600;
}

.account-live-table tbody tr:nth-child(even) td {
  background: rgba(26, 35, 50, 0.28);
}

.account-live-error {
  margin: 0.42rem 0 0;
  color: var(--warn);
  font-family: var(--mono);
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

@media (max-width: 920px) {
  .account-live-bar {
    grid-template-columns: 1fr auto;
  }

  .account-live-title {
    min-width: 0;
  }

  .account-live-chips {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }

  .account-live-tables {
    grid-template-columns: minmax(0, 1fr);
  }
}

.spot-arb-layout {
  display: grid;
  gap: 1rem;
  padding: 1rem clamp(0.75rem, 2vw, 1.25rem);
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 1120px) {
  .spot-arb-layout {
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.45fr);
    align-items: start;
  }
}

.spot-arb-layout > .panel {
  min-width: 0;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: flex-start;
}

@media (max-width: 760px) {
  .hero-panel {
    display: block;
  }
}

.hero-panel h1 {
  margin: 0 0 0.55rem;
  font-size: 1.45rem;
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.hero-actions {
  min-width: 230px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.hero-actions .status {
  grid-column: 1 / -1;
  text-align: right;
  overflow-wrap: anywhere;
}

.arb-btn-danger {
  color: var(--warn);
  border-color: rgba(245, 158, 11, 0.55);
}

.arb-btn-danger:hover:not(:disabled) {
  color: #fcd34d;
  border-color: rgba(252, 211, 77, 0.65);
}

@media (max-width: 760px) {
  .hero-actions .status {
    text-align: left;
  }
}

.account-metrics {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.metric {
  min-width: 0;
}

.metric strong {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.section-head h2 {
  margin-bottom: 0.2rem;
}

.section-head .hint {
  margin-bottom: 0;
}

.state-badge {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  color: var(--muted);
  background: rgba(10, 14, 18, 0.55);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.holdings-panel {
  grid-column: 1 / -1;
}

.arb-config-panel {
  grid-column: 1 / -1;
}

.arb-config-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.arb-config-path {
  margin: 0 0 0.5rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.arb-config-json {
  display: block;
  width: 100%;
  min-height: 280px;
  box-sizing: border-box;
  margin: 0;
  padding: 0.65rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
}

.holdings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.7rem;
}

.holding-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(61, 139, 253, 0.08), transparent 42%),
    var(--bg);
  padding: 0.85rem 0.9rem;
}

.holding-card__label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.holding-card strong {
  display: block;
  font-family: var(--mono);
  font-size: 0.96rem;
  overflow-wrap: anywhere;
}

.holding-card small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.state-text.ok {
  color: var(--ok);
}

.state-text.warn {
  color: var(--warn);
}

.state-text.bad {
  color: var(--err);
}

.spot-arb-log-panel {
  grid-column: 1 / -1;
}

.spot-arb-log-panel .log {
  min-height: 380px;
  height: calc(100vh - 390px);
  max-height: 620px;
}

.workflow-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

@media (max-width: 760px) {
  .workflow-card {
    display: block;
  }
}

body.modal-open {
  overflow: hidden;
}

.workflow-modal[hidden] {
  display: none;
}

.workflow-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.workflow-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 12, 0.78);
  backdrop-filter: blur(5px);
}

.workflow-modal__dialog {
  position: absolute;
  inset: 1rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #101821;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.workflow-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #1a2332 0%, #121b26 100%);
}

.workflow-modal__header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.workflow-modal__body {
  overflow: auto;
  padding: 1rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.workflow-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  padding: 1rem;
}

.workflow-section h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.workflow-section p,
.workflow-section li {
  color: var(--muted);
  font-size: 0.86rem;
}

.workflow-section ul,
.workflow-section ol {
  margin: 0.55rem 0 0;
  padding-left: 1.2rem;
}

.spot-arb-layout.mm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) !important;
  width: 100%;
  max-width: 1440px;
}

.spot-arb-layout.mm-layout > .panel,
.spot-arb-layout.mm-layout > .mm-hero,
.spot-arb-layout.mm-layout > .mm-summary-panel,
.spot-arb-layout.mm-layout > .mm-top-panel,
.spot-arb-layout.mm-layout > .mm-breakdown-panel,
.spot-arb-layout.mm-layout > .mm-tree-panel,
.spot-arb-layout.mm-layout > .mm-side-panel {
  grid-column: 1 / -1 !important;
  width: 100%;
  min-width: 0;
}

.mm-filter {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: min(360px, 100%);
}

.mm-filter span {
  color: var(--muted);
  font-size: 0.72rem;
}

.mm-breakdown-grid,
.mm-list-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.mm-breakdown-grid h3,
.mm-list-grid h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.mm-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mm-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.74rem;
  padding: 0.22rem 0.55rem;
}

.mm-tree-wrap {
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.mm-tree-table {
  min-width: 980px;
}

.mm-tree-table thead th {
  top: 0;
}

.mm-tree-table td {
  white-space: nowrap;
}

.mm-tree-table td:first-child {
  max-width: 760px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mm-dir-cell {
  color: #d8e7ff;
  font-weight: 600;
}

.mm-path-list {
  display: grid;
  gap: 0.45rem;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  padding: 0.55rem;
}

.mm-path-row {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.mm-path-row code {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mm-path-row small,
.mm-empty {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.mm-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.65rem clamp(0.75rem, 2vw, 1.25rem) 0;
}

.mm-subnav a {
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(26, 35, 50, 0.62);
  padding: 0.24rem 0.7rem;
  font-size: 0.78rem;
}

.mm-subnav a:hover,
.mm-subnav a.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.15);
}

.mm-doc {
  max-width: 1440px;
}

.mm-doc-section h2,
.mm-doc-toc h2 {
  margin-bottom: 0.65rem;
}

.mm-doc-section h3 {
  margin: 1rem 0 0.45rem;
  font-size: 0.98rem;
}

.mm-doc-section p,
.mm-doc-list li {
  color: var(--muted);
  font-size: 0.9rem;
}

.mm-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.mm-doc-card {
  display: block;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(61, 139, 253, 0.08), transparent 46%),
    var(--bg);
  padding: 0.85rem 0.9rem;
}

.mm-doc-card strong {
  display: block;
  margin-bottom: 0.28rem;
  color: #d8e7ff;
}

.mm-doc-card span,
.mm-doc-card p,
.mm-doc-card li {
  color: var(--muted);
  font-size: 0.84rem;
}

.mm-doc-card ul {
  margin: 0.45rem 0 0;
  padding-left: 1.1rem;
}

.mm-diagram pre,
.mm-doc-card pre {
  margin: 0.65rem 0 0;
  padding: 0.75rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0a0e12;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
}

.mm-flow {
  display: grid;
  gap: 0.55rem;
}

.mm-flow > div {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  padding: 0.72rem 0.85rem;
}

.mm-flow b {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid rgba(61, 139, 253, 0.65);
  color: var(--accent);
  font-family: var(--mono);
}

.mm-flow span {
  display: grid;
  gap: 0.18rem;
}

.mm-flow small {
  color: var(--muted);
}

.mm-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0.8rem;
}

.mm-doc-paths {
  max-height: none;
}

.ok-text {
  color: var(--ok) !important;
}

.bad-text {
  color: var(--err) !important;
}

.mm-db-layout {
  grid-template-columns: minmax(0, 1fr);
}

.mm-db-kv {
  display: grid;
  gap: 0.45rem;
}

.mm-db-kv-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  padding: 0.55rem 0.7rem;
}

.mm-db-kv-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.mm-db-kv-row code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mm-db-collections {
  display: grid;
  gap: 0.9rem;
}

.mm-db-collection-card {
  display: grid;
  gap: 0.6rem;
}

.mm-db-collection-card h3 {
  margin: 0.25rem 0 0;
}

.mm-db-small-table,
.mm-db-schema-table {
  max-height: 420px;
}

.mm-db-schema-table table {
  min-width: 880px;
}

.mm-db-sample-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.mm-db-sample-controls select {
  min-height: 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 0.25rem 0.55rem;
}

.mm-db-page-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.mm-db-sample-body {
  display: grid;
  gap: 0.55rem;
}

.mm-db-sample-doc {
  max-height: 360px;
  margin: 0;
  padding: 0.75rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0a0e12;
  color: #d8e7ff;
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.45;
}
