:root {
  color-scheme: light;
  --ink: #173334;
  --muted: #556c6b;
  --line: #d4e1dc;
  --line-strong: #93aaa0;
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-soft: #edf5ee;
  --mint: #dff3e9;
  --mint-deep: #e1ece6;
  --teal: #08766d;
  --teal-dark: #07534f;
  --coral: #e47857;
  --focus: #c36b39;

  --success-bg: #e7f6ee;
  --success-ink: #0f5c41;
  --success-line: #9ad1b7;

  --warn-bg: #fef4e6;
  --warn-ink: #8a4b08;
  --warn-line: #edc48b;

  --danger-bg: #fdf0ed;
  --danger-ink: #9d2f24;
  --danger-line: #e5a399;

  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  font: 15px/1.6 "Microsoft YaHei UI", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  background-image: linear-gradient(90deg, rgba(214, 225, 215, 0.22) 1px, transparent 1px);
  background-size: 32px 32px;
}

main {
  width: min(68rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.35rem 0 1.75rem;
  border-top: 5px solid var(--teal-dark);
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 7px;
  background: var(--teal-dark);
  color: #f7df9b;
  box-shadow: 4px 4px 0 var(--coral);
}

.brand-mark svg {
  width: 1.4rem;
  height: 1.4rem;
}

.brand-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.brand-copy h1 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.2;
}

.brand-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 0.32rem 0.78rem;
  background: rgba(255, 255, 255, 0.86);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}

.status-pill::before {
  content: "";
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: var(--coral);
}

.status-pill[data-state="ready"]::before {
  background: var(--teal);
}

.status-pill[data-state="offline"]::before {
  background: #727a77;
}

/* Site Announcement Banner */
.announcement-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 1.1rem;
  padding: 0.78rem 0.95rem;
  border: 1px solid var(--warn-line);
  border-left: 3px solid var(--coral);
  border-radius: var(--radius-md);
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.announcement-banner[hidden] {
  display: none;
}

.announcement-tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 0.16rem 0.52rem;
  margin-top: 0.08rem;
  border-radius: var(--radius-pill);
  background: var(--coral);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.announcement-body {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.announcement-close {
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--warn-ink);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.65;
}

.announcement-close:hover {
  opacity: 1;
  background: rgba(138, 75, 8, 0.1);
}

/* Mobile collapsible notice */
.mobile-notice {
  display: none;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.mobile-notice summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.72rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--teal-dark);
  cursor: pointer;
  list-style: none;
}

.mobile-notice summary::-webkit-details-marker {
  display: none;
}

.mobile-notice .chevron {
  width: 1rem;
  height: 1rem;
  flex: none;
  transition: transform 0.18s ease;
}

.mobile-notice[open] .chevron {
  transform: rotate(180deg);
}

.mobile-notice .notice-list {
  margin: 0;
  padding: 0 0.9rem 0.8rem;
  border-top: 1px solid var(--line);
}

/* Layout */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(18rem, 0.82fr);
  gap: 2rem;
  margin-top: 1.35rem;
  align-items: start;
}

.workspace.detail {
  display: block;
  max-width: 44rem;
  margin: 1.5rem auto 0;
}

.panel,
aside {
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.6rem;
  margin-bottom: 0.95rem;
  border-bottom: 1px solid var(--line);
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.panel h2 {
  margin: 0;
  font-size: 1.02rem;
}

.detail-id {
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  background: var(--mint);
  color: var(--teal-dark);
  font: 600 0.78rem/1.4 Consolas, monospace;
}

.step {
  display: inline-grid;
  place-items: center;
  width: 1.95rem;
  height: 1.95rem;
  border-radius: 4px;
  background: var(--mint);
  color: var(--teal-dark);
  font: 700 0.84rem Consolas, monospace;
}

/* Form & Dropzones */
fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.dropzone {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.dropzone-ipa {
  grid-column: 1 / -1;
  border: 1px dashed var(--line-strong);
  background: var(--surface-soft);
}

.dropzone:hover {
  border-color: var(--teal);
}

.dropzone:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 118, 109, 0.18);
}

.dropzone.is-dragover {
  border-style: solid;
  border-color: var(--teal);
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(8, 118, 109, 0.18);
}

.dropzone[data-state="valid"] {
  border-style: solid;
  border-color: var(--success-line);
  background: var(--surface);
}

.dropzone[data-state="warn"] {
  border-style: solid;
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.dropzone[data-state="invalid"] {
  border-style: solid;
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

fieldset:disabled .dropzone {
  opacity: 0.65;
  pointer-events: none;
}

.dropzone-trigger {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  min-width: 0;
  padding: 0.85rem 0.95rem;
  cursor: pointer;
}

.sr-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.field-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding-right: 1.5rem;
}

.field-title {
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--ink);
}

.field-limit {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 400;
}

.dropzone-empty {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.dropzone-empty code {
  padding: 0.04rem 0.28rem;
  border-radius: 3px;
  background: rgba(7, 83, 79, 0.08);
  color: var(--teal-dark);
  font-family: Consolas, monospace;
  font-size: 0.8rem;
}

.dz-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
  color: var(--teal);
}

.dropzone-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--teal-dark);
}

.dropzone[data-state="invalid"] .file-name {
  color: var(--danger-ink);
}

.file-size {
  flex: none;
  padding: 0.08rem 0.42rem;
  border-radius: var(--radius-pill);
  background: var(--mint);
  color: var(--teal-dark);
  font: 600 0.74rem/1.4 Consolas, monospace;
}

.dropzone[data-state="invalid"] .file-size {
  background: rgba(157, 47, 36, 0.12);
  color: var(--danger-ink);
}

.field-error {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--danger-ink);
}

.provision-meta {
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--success-ink);
  overflow-wrap: anywhere;
}

.provision-meta[data-expired="true"] {
  color: var(--danger-ink);
  font-weight: 600;
}

/* Password card */
.password-card {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.password-card .field-head {
  padding-right: 0;
}

.password-box {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.password-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 118, 109, 0.18);
}

.password-box input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 0.55rem 0.8rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.96rem;
  outline: none;
}

.password-box input::placeholder {
  color: #6b807a;
  opacity: 1;
}

.password-box input:disabled {
  background: #f1f4f1;
  cursor: not-allowed;
}

/* Optional CDK Card */
.cdk-card {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  padding: 0.78rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.cdk-card .field-head {
  padding-right: 0;
}

.cdk-card[data-state="valid"] {
  border-color: var(--success-line);
  background: var(--success-bg);
}

.cdk-card[data-state="invalid"] {
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

.cdk-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cdk-row input {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 0.42rem 0.72rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: 0.88rem/1.3 Consolas, monospace;
  text-transform: uppercase;
}

.cdk-row input::placeholder {
  font-family: "Microsoft YaHei UI", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
  text-transform: none;
  color: #6b807a;
  opacity: 1;
}

.cdk-row input:focus-visible {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 118, 109, 0.18);
}

.cdk-row input:disabled {
  background: #f1f4f1;
  cursor: not-allowed;
}

.cdk-status {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}

.cdk-status[data-tone="valid"] {
  color: var(--success-ink);
}

.cdk-status[data-tone="invalid"] {
  color: var(--danger-ink);
}

.cdk-status[data-tone="info"] {
  color: var(--muted);
}

/* Form Footer: Turnstile + Action Buttons */
.form-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.captcha-wrap {
  min-height: 65px;
  flex: 0 1 auto;
}

.captcha-wrap:empty {
  display: none;
}

.form-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.42rem;
  margin-left: auto;
  flex: 1 1 13rem;
}

.ready-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
  line-height: 1.4;
}

.ready-hint[data-tone="error"] {
  color: var(--danger-ink);
  font-weight: 600;
}

.submit-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Buttons */
button,
.action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.05rem;
  background: var(--teal-dark);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

button:hover:not(:disabled),
.action:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(7, 83, 79, 0.16);
  background: var(--teal);
  color: #ffffff;
}

button:disabled {
  cursor: not-allowed;
  background: #c7d3cc;
  color: #465a53;
  box-shadow: none;
  transform: none;
}

.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 42px;
  padding: 0.6rem 1.05rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--teal-dark);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.secondary:hover:not(:disabled) {
  background: var(--surface-soft);
  border-color: var(--teal);
  color: var(--teal-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(7, 83, 79, 0.1);
}

.secondary:disabled {
  background: #f0f4f1;
  border-color: var(--line);
  color: #798c85;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.small-btn,
.secondary.small-btn {
  min-height: 32px;
  padding: 0.34rem 0.68rem;
  font-size: 0.82rem;
  line-height: 1.2;
}

button.clear-file {
  position: absolute;
  top: 0.58rem;
  right: 0.58rem;
  display: inline-grid;
  place-items: center;
  min-height: 0;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

button.clear-file:hover:not(:disabled) {
  background: rgba(23, 51, 52, 0.08);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

button.clear-file:disabled {
  background: transparent;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
}

button.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-height: 0;
  width: 2.5rem;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

button.icon-btn svg {
  width: 1.12rem;
  height: 1.12rem;
}

button.icon-btn:hover:not(:disabled) {
  background: var(--surface-soft);
  color: var(--teal-dark);
  transform: none;
  box-shadow: none;
}

button.icon-btn:disabled {
  background: #f1f4f1;
  color: #8c9d97;
}

.link-btn,
.danger-link-btn {
  min-height: 28px;
  padding: 0.2rem 0.45rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 600;
}

.link-btn {
  color: var(--muted);
}

.link-btn:hover:not(:disabled) {
  background: var(--surface-soft);
  color: var(--teal-dark);
  transform: none;
  box-shadow: none;
}

.danger-link-btn {
  color: var(--danger-ink);
  background: var(--danger-bg);
}

.danger-link-btn:hover:not(:disabled) {
  background: #f8ddd8;
  color: var(--danger-ink);
  transform: none;
  box-shadow: none;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Upload Progress */
.upload-progress {
  margin-top: 0.85rem;
  padding: 0.78rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.upload-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--teal-dark);
}

.upload-progress-meta {
  margin: 0.42rem 0 0;
  color: var(--muted);
  font: 0.76rem/1.35 Consolas, monospace;
}

progress {
  display: block;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: var(--radius-pill);
  overflow: hidden;
  appearance: none;
  background: var(--mint);
}

progress::-webkit-progress-bar {
  background: var(--mint);
  border-radius: var(--radius-pill);
}

progress::-webkit-progress-value {
  background: var(--teal);
  border-radius: var(--radius-pill);
  transition: width 0.2s ease;
}

progress::-moz-progress-bar {
  background: var(--teal);
  border-radius: var(--radius-pill);
}

/* Inline Alert */
.alert {
  margin: 0.8rem 0 0;
  padding: 0.65rem 0.88rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.5;
}

.alert:empty {
  display: none;
}

.alert[data-tone="info"] {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--teal-dark);
}

.alert[data-tone="success"] {
  background: var(--success-bg);
  border-color: var(--success-line);
  color: var(--success-ink);
}

.alert[data-tone="warn"] {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn-ink);
}

.alert[data-tone="error"] {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  color: var(--danger-ink);
}

/* Right Column: Back Link, History & Status Box */
#backHome {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
  color: var(--teal-dark);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

#backHome:hover {
  text-decoration: underline;
}

#history {
  margin-bottom: 0.9rem;
}

#history #storageWarning {
  margin-top: 0;
  margin-bottom: 0.7rem;
}

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

.history-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: var(--radius-pill);
  background: var(--mint);
  color: var(--teal-dark);
  font: 700 0.74rem Consolas, monospace;
}

.confirm-group {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

#taskList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 14rem;
  overflow-y: auto;
}

.task-row {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.task-row.selected {
  border-color: var(--teal);
  border-left: 3px solid var(--teal);
  background: #f4faf7;
}

.task-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
}

.task-select:hover:not(:disabled) {
  background: transparent;
  color: var(--teal-dark);
  transform: none;
  box-shadow: none;
}

.task-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  flex: none;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  background: #e9efec;
  color: #465a53;
}

.badge[data-status="queued"],
.badge[data-status="processing"] {
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.badge[data-status="succeeded"] {
  background: var(--success-bg);
  color: var(--success-ink);
}

.badge[data-status="failed"],
.badge[data-status="expired"],
.badge[data-status="missing"] {
  background: var(--danger-bg);
  color: var(--danger-ink);
}

.task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.task-short-id {
  font-family: Consolas, monospace;
}

.row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.4rem;
}

.row-actions a,
.row-actions button {
  min-height: 26px;
  padding: 0.18rem 0.5rem;
  font-size: 0.76rem;
  line-height: 1.2;
}

/* Status Box */
.status-box {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.65rem;
  min-height: 10.5rem;
  padding: 1.1rem;
  border-radius: var(--radius-md);
  background: var(--mint-deep);
  background-image: repeating-linear-gradient(135deg, transparent 0 15px, rgba(252, 255, 248, 0.15) 15px 16px);
  color: #124e47;
}

.package-art {
  display: block;
  color: #38796b;
  width: 112px;
  height: 77px;
  transition: width 0.2s ease, height 0.2s ease;
}

.status-box[data-state="active"] .package-art,
.status-box[data-state="succeeded"] .package-art,
.status-box[data-state="error"] .package-art {
  width: 72px;
  height: 50px;
}

/* 3-Step Progress Indicator */
.progress-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0.55rem 0.6rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.65);
  font-size: 0.75rem;
}

.progress-steps li {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  color: var(--muted);
  font-weight: 600;
}

.step-dot {
  width: 0.52rem;
  height: 0.52rem;
  border-radius: 50%;
  flex: none;
  background: #b9cac3;
}

.progress-steps li[data-step-state="done"] {
  color: var(--teal-dark);
}

.progress-steps li[data-step-state="done"] .step-dot {
  background: var(--teal);
}

.progress-steps li[data-step-state="active"] {
  color: var(--teal-dark);
}

.progress-steps li[data-step-state="active"] .step-dot {
  background: var(--coral);
  animation: pulseDot 1.2s ease-in-out infinite;
}

.progress-steps li[data-step-state="error"] {
  color: var(--danger-ink);
}

.progress-steps li[data-step-state="error"] .step-dot {
  background: var(--danger-ink);
}

@keyframes pulseDot {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(228, 120, 87, 0.45);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(228, 120, 87, 0);
  }
}

#message {
  margin: 0;
  color: #1f443e;
  font-size: 0.92rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.status-box[data-state="error"] #message {
  color: var(--danger-ink);
}

.task-action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.panel-kicker {
  margin: 0.42rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

#output {
  margin-top: 0.25rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(8, 118, 109, 0.2);
  overflow-wrap: anywhere;
}

#filename {
  display: block;
  color: var(--teal-dark);
  font-size: 0.96rem;
}

#details {
  margin: 0.3rem 0 0.55rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.expiry-bar {
  height: 6px;
  margin-bottom: 0.75rem;
  background: rgba(8, 118, 109, 0.16);
}

/* WebKit/Blink paint the track via the pseudo-element, not the element background. */
.expiry-bar::-webkit-progress-bar {
  background: rgba(8, 118, 109, 0.16);
}

.expiry-bar[data-level="mid"]::-webkit-progress-value {
  background: var(--warn-ink);
}

.expiry-bar[data-level="mid"]::-moz-progress-bar {
  background: var(--warn-ink);
}

.expiry-bar[data-level="low"]::-webkit-progress-value {
  background: var(--danger-ink);
}

.expiry-bar[data-level="low"]::-moz-progress-bar {
  background: var(--danger-ink);
}

#download[aria-busy="true"] {
  opacity: 0.75;
  pointer-events: none;
}

.manual-copy {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 600;
}

.manual-copy input {
  width: 100%;
  padding: 0.48rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: 0.82rem Consolas, monospace;
}

/* Notes */
.notes {
  margin-top: 1.15rem;
}

.notes h2 {
  margin: 0 0 0.45rem;
  font-size: 0.94rem;
}

.notice-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.notice-list li {
  position: relative;
  margin: 0.5rem 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.notice-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.52rem;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--coral);
}

/* Footer */
.page-footer {
  margin-top: 1.6rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1.1rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--teal-dark);
  text-decoration: underline;
}

/* Topbar & Static Info Pages (/about, /faq, /privacy) */
.brand-link {
  color: inherit;
  text-decoration: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.site-nav a {
  padding: 0.32rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.site-nav a:hover {
  background: var(--surface-soft);
  color: var(--teal-dark);
}

.site-nav a[aria-current="page"] {
  background: var(--mint);
  color: var(--teal-dark);
}

.doc-article {
  max-width: 860px;
  margin: 1.6rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.doc-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.6rem;
}

.doc-kicker {
  display: inline-block;
  margin-bottom: 0.45rem;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--mint);
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 700;
}

.doc-hero h2 {
  margin: 0 0 0.55rem;
  font-size: 1.42rem;
  line-height: 1.3;
  color: var(--ink);
}

.doc-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.95rem;
}

.doc-card,
.doc-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.3rem;
}

.doc-card h3,
.doc-section h3 {
  margin: 0 0 0.5rem;
  font-size: 1.02rem;
  color: var(--teal-dark);
}

.doc-card p,
.doc-section p {
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
}

.doc-steps,
.doc-bullets {
  margin: 0.35rem 0 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.9rem;
}

.doc-steps li strong,
.doc-bullets li strong {
  color: var(--teal-dark);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.95rem 1.2rem;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  font-size: 0.95rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  color: var(--teal);
  font-size: 1.15rem;
  font-weight: 700;
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin: 0.7rem 0 0;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.faq-item a {
  color: var(--teal-dark);
}

.doc-cta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.doc-cta .action {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 0.62rem 1.2rem;
  border-radius: var(--radius-sm);
  background: var(--teal);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9rem;
}

.doc-cta .action:hover {
  background: var(--teal-dark);
}

.doc-cta-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 0.6rem 1.05rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9rem;
}

.doc-cta-link:hover {
  background: var(--surface-soft);
}

/* Public Runtime Stats Strip */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.72rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}

.stat-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}

.stat-val {
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-sub {
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-dot {
  display: inline-block;
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #179b68;
  flex-shrink: 0;
}

.stat-tile[data-load="active"] .live-dot {
  background: var(--teal);
}

.stat-tile[data-load="busy"] .live-dot {
  background: var(--coral);
}

@media (max-width: 700px) {
  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }
  .doc-grid {
    grid-template-columns: 1fr;
  }
  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 100;
  transform: translateX(-50%);
  max-width: min(26rem, calc(100vw - 2rem));
  padding: 0.6rem 1.05rem;
  border-radius: var(--radius-pill);
  background: var(--teal-dark);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 26px rgba(7, 83, 79, 0.25);
}

.toast[data-tone="error"] {
  background: var(--danger-ink);
}

/* Responsive */
@media (max-width: 48rem) {
  main {
    padding: 1rem 0 2rem;
  }

  .mobile-notice {
    display: block;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 1.1rem;
  }

  #notes {
    display: none;
  }

  .status-box {
    min-height: 0;
  }

  .package-art {
    width: 84px;
    height: 58px;
  }
}

@media (max-width: 34rem) {
  .brand-copy h1 {
    font-size: 1.22rem;
  }

  .brand-sub {
    font-size: 0.74rem;
  }

  .status-pill {
    padding: 0.26rem 0.62rem;
    font-size: 0.74rem;
  }

  .fields {
    grid-template-columns: 1fr;
  }

  .dropzone-ipa {
    grid-column: auto;
  }

  .form-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions {
    width: 100%;
    align-items: stretch;
    margin-left: 0;
  }

  .ready-hint {
    text-align: left;
  }

  .submit-row {
    flex-direction: column-reverse;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  button,
  .action,
  .secondary,
  .dropzone,
  .password-box,
  .mobile-notice .chevron,
  .package-art,
  progress::-webkit-progress-value {
    transition: none;
  }

  .progress-steps li[data-step-state="active"] .step-dot {
    animation: none;
  }
}
