.mds-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.25rem 0 1.75rem;
}

/* ── Hero ── */
.mds-hero {
  position: relative;
  border-radius: 16px;
  padding: 1.5rem 1.65rem;
  background: linear-gradient(128deg, #312e81 0%, #4f46e5 42%, #6366f1 72%, #818cf8 100%);
  color: #fff;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(79, 70, 229, 0.22);
}

.mds-hero-glow {
  position: absolute;
  inset: -35% auto auto 68%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16) 0%, transparent 70%);
  pointer-events: none;
}

.mds-hero-inner {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.mds-hero-main {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex: 1;
  min-width: 0;
}

.mds-hero-manual-btn {
  flex-shrink: 0;
  margin-top: 0.15rem;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.12);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.mds-hero-manual-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.16);
}

.mds-hero-icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.mds-hero-icon {
  font-size: 1.5rem;
  color: #fff;
}

.mds-hero-title {
  color: #fff !important;
  font-size: 1.5rem !important;
  letter-spacing: -0.02em;
}

.mds-hero-desc {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.5;
}

.mds-hero-stats {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  margin-top: 0.65rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff !important;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.45;
  max-width: 100%;
  backdrop-filter: blur(6px);
}

/* ── Tabs ── */
.mds-tabs {
  margin-top: 0.15rem;
}

.mds-tabs .mantine-Tabs-list {
  flex-wrap: wrap;
  gap: 0.35rem;
  background: #f1f5f9;
  padding: 0.35rem;
  border-radius: 12px;
}

.mds-tabs .mantine-Tabs-tab {
  font-weight: 600;
  font-size: 0.84rem;
  border-radius: 8px !important;
  transition: background 0.15s ease, color 0.15s ease;
}

.mds-tabs .mantine-Tabs-tab[data-active] {
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.mds-tab-panel {
  min-height: 280px;
}

/* ── Cards ── */
.mds-card,
.mds-form-card {
  background: var(--mantine-color-body, #fff);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: box-shadow 0.18s ease;
}

.mds-card:hover,
.mds-form-card:hover {
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.mds-card-icon,
.mds-section-icon {
  color: #6366f1;
  font-size: 0.95rem;
}

.mds-steps {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.65;
}

.mds-setup-status {
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px dashed #cbd5e1;
  font-size: 0.85rem;
}

.mds-status-line {
  font-size: 0.88rem;
  font-weight: 600;
  color: #475569;
  margin: 0.35rem 0;
}

/* ── Distill layout: chart fills column height ── */
.mds-distill-panel {
  display: flex;
  flex-direction: column;
}

.mds-distill-grid {
  align-items: stretch !important;
}

.mds-distill-grid > .mantine-Paper-root {
  height: 100%;
}

.mds-chart-wrap {
  display: flex;
  flex-direction: column;
  min-height: 320px;
  height: 100%;
  padding: 0.65rem 0.75rem 0.85rem !important;
}

.mds-chart-inner {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.mds-loss-graph {
  flex: 1 1 auto;
  min-height: 240px;
  height: 100% !important;
}

.mds-loss-graph .js-plotly-plot,
.mds-loss-graph .plot-container.plotly,
.mds-loss-graph .svg-container {
  height: 100% !important;
  width: 100% !important;
}

.mds-loss-graph .main-svg {
  border-radius: 8px;
}

/* ── Logs & tables ── */
.mds-log-console {
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid #334155;
}

.mds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.mds-table th,
.mds-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 0.5rem 0.65rem;
  text-align: left;
}

.mds-table th {
  color: #64748b;
  font-weight: 600;
  background: #f8fafc;
}

.mds-table tbody tr:hover td {
  background: #f8fafc;
}

.mds-empty-jobs {
  color: #94a3b8;
  font-size: 0.88rem;
  padding: 0.5rem 0;
}

.mds-notification-anchor {
  position: relative;
  z-index: 20;
  min-height: 0;
}

.mds-hw-detail {
  display: none;
}

/* ── Manual modal ── */
.mds-manual-modal-body {
  max-height: min(72vh, 680px);
  overflow-y: auto;
  padding-top: 0.25rem;
}

.mds-setup-guide-body {
  max-height: min(70vh, 620px);
  overflow-y: auto;
}

.mds-manual-steps {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.7;
}

.mds-manual-steps li + li {
  margin-top: 0.35rem;
}

.mds-manual-code {
  font-size: 0.78rem !important;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 640px) {
  .mds-hero-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .mds-hero-manual-btn {
    align-self: flex-end;
    margin-top: 0;
  }
}
