:root {
  --bg: #f5f7fb;
  --ink: #111827;
  --muted: #64748b;
  --line: #e2e8f0;
  --panel: #ffffff;
  --soft: #f8fafc;
  --accent: #0f766e;
  --accent-dark: #0f5f59;
  --accent-soft: #e7fbf7;
  --blue: #2563eb;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #dc2626;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 300px),
    var(--bg);
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;
  padding: 26px;
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.96), rgba(12, 74, 69, 0.98)),
    #0f766e;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 20px;
  font-weight: 900;
}

.brand strong,
.brand span,
.side-metrics span,
.side-metrics strong {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
}

.side-metrics {
  display: grid;
  gap: 12px;
}

.side-metrics div {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.10);
}

.side-metrics span {
  color: rgba(255, 255, 255, 0.70);
  font-size: 12px;
}

.side-metrics strong {
  margin-top: 6px;
  font-size: 14px;
}

.workspace {
  width: 100%;
  max-width: 1500px;
  padding: 30px;
}

.topbar {
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  font-weight: 900;
}

h2 {
  font-size: 18px;
  font-weight: 900;
}

.topbar p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.task-card,
.result-board {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.input-panel,
.output-panel {
  padding: 20px;
}

form {
  display: grid;
  gap: 16px;
}

.card-title,
.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card-title {
  justify-content: flex-start;
}

.card-title > span,
.section-kicker {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
}

.card-title p,
.board-header > span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.board-header {
  margin-bottom: 16px;
}

.board-header > span {
  margin-top: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  white-space: nowrap;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 132px;
  padding: 18px;
  border: 1px dashed #9ca3af;
  border-radius: 12px;
  background: var(--soft);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone input {
  display: none;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  font-size: 24px;
  line-height: 1;
}

.drop-title {
  font-size: 16px;
  font-weight: 900;
}

.drop-subtitle {
  display: block;
  max-width: 100%;
  margin-top: 7px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: #374151;
  font-size: 13px;
  font-weight: 800;
}

textarea,
select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  outline: none;
}

textarea {
  min-height: 250px;
  resize: vertical;
  padding: 13px;
  line-height: 1.6;
}

select,
input {
  height: 42px;
  padding: 0 11px;
}

textarea:focus,
select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.13);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 10px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 16px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  color: #ffffff;
  background: var(--accent);
}

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

.secondary-button {
  color: var(--accent-dark);
  background: #ffffff;
  border-color: #b7c6d8;
}

.secondary-button:hover {
  background: var(--accent-soft);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.progress-wrap {
  display: grid;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.progress-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
}

.progress-line strong {
  color: var(--ink);
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dde7f0;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s ease;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.stat-card {
  min-height: 92px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 12px;
  font-size: 29px;
  line-height: 1;
}

.download-panel {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.download-row {
  display: none;
  flex-wrap: wrap;
  gap: 10px;
}

.download-row.visible {
  display: flex;
}

.file-list {
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.file-list.visible {
  display: grid;
}

.file-list button {
  min-height: 38px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #374151;
  background: #ffffff;
  text-align: center;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.file-list button:hover {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.message {
  display: none;
  margin-bottom: 14px;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 14px;
}

.message.visible {
  display: block;
}

.message.error {
  color: var(--bad);
  background: #fff1f1;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.message.info {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid rgba(15, 118, 110, 0.18);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #475569;
  font-weight: 900;
}

tbody tr:hover {
  background: #f7fbfa;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-cell {
  height: 132px;
  color: var(--muted);
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-width: 48px;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-weight: 900;
}

.badge.auth {
  color: var(--ok);
  background: #e8f7ef;
}

.badge.normal {
  color: var(--warn);
  background: #fff7e8;
}

.badge.invalid {
  color: var(--bad);
  background: #fff1f1;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 16px 22px;
  }

  .side-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 360px;
  }

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

@media (max-width: 760px) {
  body {
    background: #eef3f7;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    gap: 14px;
    padding: 14px;
    border-radius: 0 0 18px 18px;
  }

  .brand {
    justify-content: center;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .side-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
  }

  .side-metrics div {
    padding: 10px;
    border-radius: 12px;
  }

  .side-metrics strong {
    font-size: 12px;
  }

  .workspace {
    padding: 14px;
  }

  .topbar {
    margin-bottom: 14px;
  }

  h1 {
    font-size: 24px;
  }

  .topbar p {
    font-size: 13px;
  }

  .layout {
    gap: 14px;
  }

  .input-panel,
  .output-panel {
    padding: 14px;
  }

  .task-card,
  .result-board {
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  }

  .card-title,
  .board-header {
    align-items: flex-start;
    gap: 10px;
  }

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

  .board-header > span {
    width: 100%;
    white-space: normal;
  }

  .drop-zone {
    min-height: 110px;
    border-radius: 14px;
  }

  .drop-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
  }

  textarea {
    min-height: 170px;
    border-radius: 14px;
  }

  .control-grid,
  .button-row {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button {
    min-height: 46px;
    border-radius: 14px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat-card {
    min-height: 76px;
    padding: 12px;
    border-radius: 14px;
  }

  .stat-card strong {
    margin-top: 9px;
    font-size: 24px;
  }

  .download-panel,
  .progress-wrap,
  .message {
    border-radius: 14px;
  }

  .download-row.visible {
    display: grid;
    grid-template-columns: 1fr;
  }

  .file-list.visible {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .file-list button {
    min-height: 42px;
    border-radius: 12px;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #ffffff;
  }

  td {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #edf2f7;
    white-space: normal;
    word-break: break-word;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
  }

  td:last-child {
    border-bottom: 0;
  }

  .empty-cell {
    display: block;
    height: auto;
    padding: 34px 16px;
    text-align: center;
  }

  .empty-cell::before {
    content: "";
  }
}
