:root {
  color-scheme: light;
  --bg: #f4efe6;
  --bg-deep: #eadfcd;
  --panel: rgba(255, 251, 245, 0.92);
  --panel-strong: #fff8ee;
  --panel-soft: rgba(255, 255, 255, 0.72);
  --line: rgba(110, 83, 44, 0.14);
  --line-strong: rgba(110, 83, 44, 0.24);
  --text: #1f1d19;
  --muted: #6c655b;
  --primary: #b45938;
  --primary-strong: #914226;
  --primary-soft: rgba(180, 89, 56, 0.14);
  --accent: #1a7a75;
  --accent-strong: #125b57;
  --accent-soft: rgba(26, 122, 117, 0.12);
  --success: #286a46;
  --success-soft: rgba(40, 106, 70, 0.14);
  --warning: #8a5a1f;
  --warning-soft: rgba(138, 90, 31, 0.16);
  --danger: #ab4636;
  --danger-soft: rgba(171, 70, 54, 0.14);
  --shadow: 0 20px 50px rgba(79, 54, 21, 0.08);
  --shadow-strong: 0 26px 70px rgba(79, 54, 21, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.82), transparent 30%),
    radial-gradient(circle at bottom right, rgba(180, 89, 56, 0.12), transparent 36%),
    linear-gradient(180deg, #f8f4ed 0%, #ede4d6 100%);
  font-family: "Bahnschrift", "Trebuchet MS", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(110, 83, 44, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 83, 44, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 96%);
}

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

button,
input,
select,
textarea {
  outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  box-shadow: 0 0 0 3px rgba(26, 122, 117, 0.16);
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.subtle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.inline-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
}

.button.primary {
  background: linear-gradient(135deg, var(--primary), #d07c55);
  color: #fff7ef;
  box-shadow: 0 12px 24px rgba(180, 89, 56, 0.18);
}

.button.primary:hover {
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
}

.button.ghost {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--line);
}

.button.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(171, 70, 54, 0.22);
}

.button.small {
  min-height: 36px;
  padding: 0 14px;
}

.button.wide {
  width: 100%;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-stage {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 22px;
}

.auth-showcase,
.auth-panel,
.topbar,
.panel,
.notice-card,
.summary-card,
.meta-badge {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.auth-showcase,
.auth-panel {
  padding: 30px;
}

.auth-showcase {
  display: grid;
  gap: 24px;
  overflow: hidden;
  position: relative;
}

.auth-showcase::after {
  content: "";
  position: absolute;
  inset: auto -90px -100px auto;
  width: 240px;
  height: 240px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(26, 122, 117, 0.18), rgba(180, 89, 56, 0.16));
  transform: rotate(16deg);
}

.auth-copy,
.auth-points {
  position: relative;
  z-index: 1;
}

.auth-copy h1,
.auth-panel h2,
.topbar h1,
.main-header h2 {
  margin: 0;
  font-family: "Bahnschrift SemiBold", "Segoe UI Variable Display", "PingFang SC", sans-serif;
}

.auth-copy h1 {
  margin-top: 8px;
  font-size: clamp(36px, 4vw, 56px);
  line-height: 1.04;
}

.auth-lead {
  max-width: 620px;
  font-size: 15px;
}

.auth-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.auth-point {
  min-height: 154px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 249, 241, 0.68)),
    var(--panel-strong);
  display: grid;
  gap: 10px;
}

.auth-point strong {
  font-size: 20px;
}

.auth-point p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-panel {
  display: grid;
  gap: 18px;
  align-self: center;
}

.auth-panel-head {
  display: grid;
  gap: 14px;
}

.auth-panel-head h2 {
  margin-top: 8px;
  font-size: 34px;
  line-height: 1.06;
}

.auth-tag {
  width: fit-content;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
}

.auth-tabbar {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid var(--line);
}

.auth-tab,
.nav-button,
.tab-button {
  min-height: 42px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.auth-tab.active,
.nav-button.active,
.tab-button.active {
  background: #fffdf8;
  color: var(--text);
  box-shadow: 0 10px 22px rgba(79, 54, 21, 0.08);
}

.auth-form,
.form-grid,
.stack-layout {
  display: grid;
  gap: 14px;
}

.auth-helper {
  padding-top: 2px;
}

.app-shell {
  width: min(1500px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 16px;
}

.topbar {
  padding: 16px 20px;
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
}

.topbar h1 {
  margin-top: 6px;
  font-size: 28px;
  line-height: 1.05;
}

.topbar-brand,
.topbar-side {
  display: grid;
  gap: 10px;
}

.topbar-brand .subtle {
  max-width: 300px;
}

.topbar-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 6px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.44);
  border: 1px solid var(--line);
}

.topbar-user {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(110, 83, 44, 0.1);
  display: grid;
  gap: 6px;
  min-width: 280px;
}

.topbar-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.nav-button {
  min-height: 46px;
  text-align: center;
  padding: 0 18px;
  border-radius: 14px;
}

.workspace-shell {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 0;
}

.main-header h2 {
  margin-top: 8px;
  font-size: 36px;
  line-height: 1.04;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.meta-badge {
  min-width: 150px;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  border-radius: 20px;
}

.meta-label,
.summary-label,
.context-label,
.notice-label {
  color: var(--muted);
  font-size: 12px;
}

.notice-strip,
.summary-grid,
.content-grid,
.detail-stats,
.context-grid {
  display: grid;
  gap: 12px;
}

.notice-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.notice-card {
  min-height: 92px;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.notice-card strong {
  font-size: 15px;
  line-height: 1.5;
}

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

.summary-card {
  min-height: 114px;
  padding: 18px;
  display: grid;
  gap: 12px;
}

.summary-value {
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}

.summary-text {
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
}

.panel {
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(110, 83, 44, 0.09);
}

.panel-head h3 {
  margin: 0;
  font-size: 18px;
}

.panel-body {
  padding: 22px 24px 24px;
}

.dashboard-grid,
.task-stage,
.admin-grid {
  display: grid;
  gap: 12px;
}

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

.task-stage {
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 760px;
}

.task-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.task-form-grid > .field-row,
.task-form-grid > .quote-panel,
.task-form-grid > .form-actions {
  grid-column: 1 / -1;
}

.task-list {
  padding: 14px;
  border-right: 1px solid rgba(110, 83, 44, 0.08);
  overflow: auto;
}

.task-detail {
  min-width: 0;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.detail-headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-headline h3 {
  margin: 6px 0 0;
  font-size: 28px;
  line-height: 1.06;
}

.field,
.field-row {
  display: grid;
  gap: 8px;
}

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

.captcha-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 152px;
  gap: 12px;
  align-items: end;
}

.captcha-side {
  display: grid;
  align-items: stretch;
}

.captcha-image {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  object-fit: cover;
  cursor: pointer;
  user-select: none;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.captcha-image:hover,
.captcha-image:focus-visible {
  border-color: rgba(26, 122, 117, 0.42);
  box-shadow: 0 0 0 3px rgba(26, 122, 117, 0.14);
  transform: translateY(-1px);
}

.proxy-row {
  align-items: end;
}

.proxy-row .checkbox-field {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.field span {
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}

.field textarea,
.plain-textarea {
  min-height: 92px;
  padding: 12px 14px;
  resize: vertical;
}

.plain-textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}

.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-field input {
  min-height: auto;
  width: 18px;
  height: 18px;
}

.quote-panel,
.detail-stat,
.context-block,
.stack-item,
.video-item,
.note-block {
  border-radius: 18px;
  border: 1px solid rgba(110, 83, 44, 0.1);
  background: var(--panel-soft);
}

.quote-panel,
.note-block {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.quote-head,
.list-row-top,
.task-row-top,
.task-row-bottom,
.task-mini-top,
.video-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.detail-stat {
  min-height: 96px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.detail-stat-wide {
  grid-column: span 2;
}

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

.context-block {
  min-height: 96px;
  padding: 14px;
  display: grid;
  gap: 8px;
}

.context-value {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-row,
.stack-item {
  width: 100%;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.task-row {
  border: 1px solid rgba(110, 83, 44, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.task-row + .task-row,
.stack-item + .stack-item {
  margin-top: 10px;
}

.task-row:hover,
.task-row.active {
  transform: translateY(-1px);
  border-color: rgba(26, 122, 117, 0.26);
  box-shadow: 0 14px 28px rgba(26, 122, 117, 0.08);
}

.task-name,
.list-title,
.video-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 800;
}

.task-time,
.task-progress,
.task-meta,
.video-percent,
.video-meta,
.list-meta {
  color: var(--muted);
  font-size: 12px;
}

.list-meta,
.video-meta,
.stack-item-actions,
.form-actions,
.tabbar,
.admin-tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.stack-item-actions {
  margin-top: 4px;
}

.mini-button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  cursor: pointer;
}

.mini-button.danger {
  border-color: rgba(171, 70, 54, 0.22);
  color: var(--danger);
}

.progress-bar {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(110, 83, 44, 0.08);
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
}

.progress-fill.overall {
  background: linear-gradient(90deg, var(--primary), #dd8b62);
}

.progress-fill.course {
  background: linear-gradient(90deg, var(--accent), #4ea7a1);
}

.progress-fill.video,
.task-mini-fill {
  background: linear-gradient(90deg, #be7e21, #e1ac44);
}

.task-mini-bar {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(110, 83, 44, 0.08);
  overflow: hidden;
}

.task-mini-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
}

.badge,
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.tabbar,
.admin-tabbar {
  margin-top: 4px;
}

.tab-count {
  min-width: 26px;
  background: rgba(110, 83, 44, 0.08);
}

.tab-panel,
.admin-panel {
  display: none;
}

.tab-panel.active,
.admin-panel.active {
  display: block;
}

.video-list {
  display: grid;
  gap: 10px;
  max-height: 220px;
  overflow: auto;
}

.log-meta {
  padding-top: 6px;
}

.log-output {
  margin: 0;
  min-height: 0;
  padding: 16px;
  border-radius: 18px;
  background: #1f2928;
  color: #edf4f3;
  font: 12px/1.7 "Cascadia Mono", "Consolas", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}

.record-list {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
}

.record-item {
  padding: 14px 16px;
  border: 1px solid rgba(110, 83, 44, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.record-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-log-output {
  min-height: 220px;
  height: 220px;
  max-height: 220px;
  overflow: auto;
}

.tall-log {
  height: 340px;
  max-height: 340px;
}

.badge.running,
.badge.queued,
.badge.stopping {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge.success,
.badge.active {
  background: var(--success-soft);
  color: var(--success);
}

.badge.error,
.badge.stopped,
.badge.interrupted,
.badge.disabled,
.badge.void,
.badge.used {
  background: var(--danger-soft);
  color: var(--danger);
}

.task-empty,
.video-empty,
.stack-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
  font-size: 14px;
}

.view {
  display: grid;
  gap: 16px;
}

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

.content-grid.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.secondary-grid {
  margin-top: 2px;
}

.admin-summary-grid {
  margin-top: 2px;
}

.admin-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 420px);
}

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

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

@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .topbar-nav {
    justify-content: flex-start;
  }

  .topbar-side {
    justify-items: stretch;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .dashboard-grid,
  .task-stage,
  .content-grid.two-col,
  .content-grid.three-col,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .task-form-grid {
    grid-template-columns: 1fr;
  }

  .task-list {
    border-right: 0;
    border-bottom: 1px solid rgba(110, 83, 44, 0.08);
  }

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

@media (max-width: 920px) {
  .auth-stage,
  .auth-points,
  .field-row,
  .captcha-block,
  .detail-stats,
  .context-grid,
  .compact-stats,
  .compact-context,
  .summary-grid,
  .notice-strip {
    grid-template-columns: 1fr;
  }

  .detail-stat-wide {
    grid-column: span 1;
  }

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

  .header-meta {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .auth-shell,
  .app-shell {
    padding: 12px;
  }

  .auth-showcase,
  .auth-panel,
  .topbar,
  .panel,
  .notice-card,
  .summary-card,
  .meta-badge {
    border-radius: 20px;
  }

  .auth-showcase,
  .auth-panel {
    padding: 22px;
  }

  .auth-copy h1,
  .main-header h2 {
    font-size: 30px;
  }

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

  .task-detail,
  .panel-head,
  .panel-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .task-form-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    flex-direction: column;
  }

  .topbar-actions .button {
    width: 100%;
  }

  .topbar-user {
    min-width: 0;
  }
}
