:root {
  color-scheme: light;
  --bg: #f5f2eb;
  --ink: #1d2522;
  --muted: #65706b;
  --line: #cfc7b8;
  --surface: #fffaf1;
  --surface-strong: #fcf0dc;
  --accent: #0f766e;
  --accent-strong: #0a4f49;
  --warn: #9f4f13;
  --bad: #a73434;
  --ready: #206c45;
  --shadow: 0 18px 48px rgba(29, 37, 34, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Avenir Next, Trebuchet MS, Verdana, sans-serif;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.1), transparent 34%),
    linear-gradient(0deg, rgba(29, 37, 34, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 100% 28px, auto;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 40px 0;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(420px, 1.05fr);
  gap: 24px;
}

.workspace,
.jobs-panel {
  border: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.88);
  box-shadow: var(--shadow);
}

.workspace {
  padding: 28px;
}

.mast {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, Times New Roman, serif;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 0.95;
  max-width: 8ch;
}

h2 {
  font-size: 1.35rem;
}

.summary {
  max-width: 36rem;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.upload-panel {
  display: grid;
  gap: 16px;
}

.form-stack {
  display: grid;
  gap: 24px;
}

.upload-panel h2 {
  font-size: 1.1rem;
}

.task-name-field {
  display: grid;
  gap: 7px;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
}

.task-name-field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 13px;
  outline: none;
}

.task-name-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.project-upload {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.drop-zone {
  min-height: 240px;
  border: 1.5px dashed var(--accent);
  background: var(--surface-strong);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 28px;
  cursor: pointer;
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.drop-zone.compact {
  min-height: 176px;
  background: #f4fbf7;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--accent-strong);
  background: #edf7f3;
  transform: translateY(-2px);
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent-strong);
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 18px;
}

.drop-title {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
}

.drop-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.actions,
.panel-head,
.job-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

button,
.job-actions a {
  border: 1px solid var(--accent);
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-strong);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

button:hover,
.job-actions a:hover {
  background: #e3f3ef;
}

button:disabled {
  border-color: var(--line);
  color: #9f9789;
  cursor: not-allowed;
  background: transparent;
}

.primary {
  background: var(--accent);
  color: #fffaf1;
}

.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  background: #1d2522;
  border-color: #1d2522;
  color: #fffaf1;
}

.secondary:hover {
  background: #35403c;
}

.ghost {
  min-height: 34px;
}

.status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
}

.recent-panel {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.recent-head,
.panel-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.recent-head h2 {
  font-size: 1rem;
}

.recent-tasks {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.recent-task {
  min-height: 0;
  padding: 11px 12px;
  border-color: var(--line);
  background: rgba(255, 250, 241, 0.72);
  display: grid;
  justify-items: start;
  gap: 3px;
  text-align: left;
}

.recent-task span,
.empty-recent {
  color: var(--muted);
  font-size: 0.78rem;
}

.recent-task.is-active {
  border-color: var(--accent);
  background: #e3f3ef;
}

.empty-recent {
  margin: 0;
  padding: 12px 0;
}

.jobs-panel {
  min-height: 580px;
  padding: 0;
}

.panel-head {
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.jobs-list {
  display: grid;
}

.list-label {
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(252, 240, 220, 0.62);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.empty-state {
  padding: 48px 22px;
  color: var(--muted);
  line-height: 1.6;
}

.job {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
}

.job-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.job-name {
  margin: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.task-kind {
  display: inline-flex;
  margin-top: 5px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
}

.badge {
  height: 26px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  border: 1px solid currentColor;
  font-size: 0.82rem;
  white-space: nowrap;
}

.badge.ready {
  color: var(--ready);
}

.badge.failed {
  color: var(--bad);
}

.badge.processing {
  color: var(--warn);
}

.job-meta,
.job-error {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.job-error {
  color: var(--bad);
}

.page-list {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  background: rgba(244, 251, 247, 0.74);
}

.page-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
}

.page-list-head > div:first-child {
  display: grid;
  gap: 2px;
}

.page-list-head small {
  color: var(--muted);
  font-size: 0.76rem;
}

.page-management-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
}

.page-management-actions button,
.page-actions button,
.deleted-page-row button {
  min-height: 30px;
  border: 1px solid rgba(15, 118, 110, 0.42);
  background: #fffdf7;
  color: var(--accent-strong);
  padding: 4px 9px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.page-management-actions button:hover,
.page-actions button:hover,
.deleted-page-row button:hover {
  background: #e3f3ef;
}

.page-management-actions button:disabled,
.page-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-trash {
  position: relative;
}

.page-trash > summary {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(207, 199, 184, 0.9);
  background: #fffaf1;
  color: var(--muted);
  padding: 4px 9px;
  cursor: pointer;
}

.page-trash[open] > summary {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.deleted-page-list,
.page-trash .empty-version {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  width: min(360px, 78vw);
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(15, 118, 110, 0.35);
  background: #fffdf7;
  box-shadow: 0 16px 40px rgba(29, 37, 34, 0.18);
}

.deleted-page-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
  border-bottom: 1px solid rgba(207, 199, 184, 0.65);
}

.deleted-page-row:last-child {
  border-bottom: 0;
}

.deleted-page-row span,
.deleted-page-row small {
  display: block;
  min-width: 0;
}

.deleted-page-row small {
  margin-top: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.task-card.is-expanded .page-grid {
  grid-template-columns: 1fr;
}

.page-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(207, 199, 184, 0.82);
  background: rgba(255, 250, 241, 0.86);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.page-card.is-dragging {
  opacity: 0.55;
  transform: scale(0.99);
}

.page-card.drop-before::before,
.page-card.drop-after::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.14);
}

.page-card.drop-before::before {
  top: -6px;
}

.page-card.drop-after::after {
  bottom: -6px;
}

.page-card-main {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.page-drag-handle {
  width: 32px;
  min-height: 48px;
  border: 1px dashed rgba(15, 118, 110, 0.44);
  background: #eef7f2;
  color: var(--accent-strong);
  cursor: grab;
  font-size: 1rem;
  font-weight: 900;
  touch-action: none;
}

.page-drag-handle:active {
  cursor: grabbing;
}

.page-card strong,
.page-card small {
  display: block;
}

.page-card small {
  margin-top: 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.page-save-meta {
  display: inline-flex;
  margin-top: 8px;
  color: var(--warn);
  font-size: 0.78rem;
  font-weight: 700;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.page-actions .danger.subtle {
  border-color: rgba(180, 83, 9, 0.38);
  color: #9a4d08;
}

.page-actions a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.page-actions a:hover {
  text-decoration: underline;
}

.version-list {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.version-row {
  display: grid;
  grid-template-columns: 58px minmax(128px, 1fr) minmax(72px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(207, 199, 184, 0.78);
  background: rgba(255, 250, 241, 0.68);
  font-size: 0.84rem;
}

.page-versions summary {
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

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

.version-code {
  font-weight: 800;
  color: var(--accent-strong);
}

.version-time,
.version-note {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.version-row a {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.version-row a:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    width: min(100vw - 20px, 720px);
    padding: 16px 0;
  }

  .workspace {
    padding: 22px;
  }

  h1 {
    max-width: 12ch;
  }

  .jobs-panel {
    min-height: 320px;
  }

  .version-row {
    grid-template-columns: 1fr 1fr;
  }

  .page-list-head {
    align-items: stretch;
    flex-direction: column;
  }

  .page-management-actions {
    justify-content: flex-start;
  }
}

/* ============================================================
   认证门禁层与用户信息条样式
   （用于HTML Mender接入博客JWT登录体系后的登录态提示界面）
   ============================================================ */

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.auth-gate-card {
  width: min(420px, calc(100vw - 40px));
  padding: 32px 28px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-gate-message {
  margin: 0 0 18px;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.6;
}

.auth-gate-action {
  display: inline-flex;
  min-height: 42px;
  padding: 0 20px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fffaf1;
  text-decoration: none;
  font-weight: 700;
}

.auth-gate-action:hover {
  background: var(--accent-strong);
}

.user-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 18px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.72);
}

.user-bar-email {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.user-bar-admin-link {
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 800;
  text-decoration: none;
}

.user-bar-admin-link:hover {
  text-decoration: underline;
}

.user-bar-logout {
  min-height: 30px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-size: 0.8rem;
}

.user-bar-logout:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: transparent;
}

@media (max-width: 900px) {
  .user-bar {
    flex-wrap: wrap;
  }

  .user-bar-email {
    width: 100%;
    margin-right: 0;
  }
}

/* ============================================================
   管理员专属项目管理页（admin.html）样式
   与主工作台(index.html)布局完全独立，不复用.shell的双栏grid，
   强调"审查视图"的独立身份，避免与"生产视图"混淆
   ============================================================ */

.admin-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 40px 0;
  display: grid;
  gap: 24px;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.admin-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  max-width: none;
}

.admin-summary {
  max-width: 46rem;
}

.admin-summary a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.admin-summary a:hover {
  text-decoration: underline;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

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

.admin-stat-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.88);
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
}

.admin-stat-card strong {
  font-size: 1.8rem;
  font-family: Georgia, Times New Roman, serif;
  color: var(--accent-strong);
}

.admin-stat-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.admin-panel {
  min-height: 320px;
}

.admin-owner-line {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.86rem;
}

.admin-owner-line strong {
  font-weight: 800;
}

@media (max-width: 900px) {
  .admin-shell {
    width: min(100vw - 20px, 720px);
    padding: 16px 0;
  }

  .admin-header {
    flex-direction: column;
  }

  .admin-header-actions {
    width: 100%;
    justify-content: space-between;
  }
}
