.admin-page {
  min-height: 100vh;
  overflow: auto;
  background: #f4f6f5;
}

.admin-page .icon-button {
  text-decoration: none;
}

.admin-main {
  min-height: calc(100vh - var(--topbar-height));
  padding: 34px 24px 60px;
}

.admin-content {
  width: min(1040px, 100%);
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid var(--line);
}

.admin-heading,
.admin-section {
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
}

.admin-heading,
.section-heading,
.confirm-row,
.admin-actions {
  display: flex;
  align-items: center;
}

.admin-heading,
.section-heading,
.confirm-row {
  justify-content: space-between;
  gap: 18px;
}

.admin-heading h1 {
  margin: 4px 0 0;
  font-size: 24px;
  letter-spacing: 0;
}

.section-heading h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.section-heading p,
#fileMetadata {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid #b8c4bf;
  border-radius: 4px;
  background: #eef2f0;
  color: #34433d;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.phase-badge.running { border-color: #d2a54f; background: #fff7e5; color: #79520b; }
.phase-badge.ready { border-color: #62a89a; background: #e8f5f1; color: #0d6455; }
.phase-badge.failed { border-color: #d58c88; background: #fbedec; color: #8f302c; }
.phase-badge.completed { border-color: #62a89a; background: #e8f5f1; color: #0d6455; }
.phase-badge.cancelled { border-color: #aab4b0; background: #f0f2f1; color: #52605b; }

.upload-zone {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 94px;
  margin-top: 18px;
  padding: 18px;
  gap: 14px;
  border: 1px dashed #91a49d;
  border-radius: 6px;
  background: #f8faf9;
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragging {
  border-color: var(--accent);
  background: #eff8f5;
}

.upload-zone > svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.upload-zone span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.upload-zone strong { font-size: 13px; }
.upload-zone small { color: var(--muted); font-size: 10px; }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.admin-actions {
  margin-top: 16px;
  gap: 8px;
}

.process-section .section-heading > strong {
  font-size: 18px;
}

.progress-track {
  height: 7px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 3px;
  background: #e5eae8;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 220ms ease;
}

.error-message {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-left: 3px solid #bd4944;
  background: #fbedec;
  color: #842e2a;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.admin-metrics > div {
  display: flex;
  min-height: 78px;
  padding: 13px;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.admin-metrics span { color: var(--muted); font-size: 10px; }
.admin-metrics strong { font-size: 20px; }
.admin-metrics .metric-new strong { color: #137a68; }

.confirm-row {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.confirm-row > span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.confirm-row > span svg { width: 15px; height: 15px; color: var(--accent); }
.confirm-actions { display: flex; align-items: center; gap: 8px; }
.danger-action { background: #a73f3b; }
.danger-action:hover { background: #8f3431; }

@media (max-width: 720px) {
  .admin-main { padding: 0 0 42px; }
  .admin-content { border-width: 0; }
  .admin-heading,
  .admin-section { padding: 20px; }
  .admin-heading h1 { font-size: 20px; }
  .admin-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .confirm-row { align-items: stretch; flex-direction: column; }
  .confirm-actions { align-items: stretch; flex-direction: column-reverse; }
  .confirm-actions .text-button,
  .confirm-row .primary-button { width: 100%; }
  .top-summary { display: none; }
}