:root {
  color-scheme: light;
  --ink: #192023;
  --muted: #667074;
  --line: #d8e0df;
  --panel: #ffffff;
  --soft: #eef5f2;
  --accent: #136f63;
  --accent-dark: #0d5048;
  --warn: #b45309;
  --error: #b42318;
  --shadow: 0 18px 45px rgba(23, 42, 38, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, #f4f8f6 0%, #ffffff 45%, #eef4f7 100%);
}

.shell {
  width: 100%;
  min-height: 100vh;
  padding: 32px;
}

.workspace {
  max-width: 1120px;
  margin: 0 auto;
}

.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 34px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .08em;
}

.page-nav a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.intro {
  margin-bottom: 22px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.intro p:last-child {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.tool-panel,
.result {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.history-panel {
  margin-top: 28px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.82);
}

.history-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 16px;
}

.history-head > span,
.history-empty,
.history-row span {
  color: var(--muted);
  font-size: 13px;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.5fr) repeat(3, minmax(90px, .55fr)) minmax(170px, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid #e5ebe9;
  border-radius: 7px;
  background: #fff;
}

.history-row div {
  display: grid;
  gap: 4px;
}

.history-row strong,
.history-row b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-time {
  text-align: right;
}

.history-time .available { color: var(--accent); }
.history-time .expired { color: var(--warn); }

.history-download {
  justify-self: end;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.history-download:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.tool-panel {
  padding: 18px;
}

.drop-zone {
  display: grid;
  min-height: 160px;
  place-items: center;
  padding: 24px;
  border: 1px dashed #91aaa6;
  border-radius: 8px;
  background: var(--soft);
  cursor: pointer;
  text-align: center;
}

.drop-zone:hover {
  border-color: var(--accent);
  background: #e7f2ef;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop-icon {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 22px;
  font-weight: 700;
}

.drop-title {
  display: block;
  font-size: 18px;
  font-weight: 700;
}

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

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  margin-top: 16px;
  align-items: end;
}

label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input[type="text"] {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(19, 111, 99, 0.14);
}

button,
.download-primary,
.file-link {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

button,
.download-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  color: #fff;
  background: var(--accent);
}

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

button:disabled {
  cursor: wait;
  background: #8aa39f;
}

.button-icon {
  font-size: 16px;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 14px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9aa6a4;
}

.status.busy .status-dot {
  background: var(--warn);
}

.status.ok .status-dot {
  background: var(--accent);
}

.status.error {
  color: var(--error);
}

.status.error .status-dot {
  background: var(--error);
}

.result {
  padding: 18px;
}

.hidden {
  display: none;
}

.result-head {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

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

.stats div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.stats span {
  display: block;
  font-size: 26px;
  font-weight: 800;
}

.stats p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.retention-note {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: #31413e;
  background: #eef5f2;
  font-weight: 800;
}

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

.file-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  color: var(--accent-dark);
  background: #e7f2ef;
}

.summary-module {
  margin-top: 64px;
  padding-top: 52px;
  border-top: 1px solid var(--line);
}

.summary-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  margin-bottom: 22px;
}

.summary-intro h2 {
  font-size: 34px;
}

.summary-intro p:last-child {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.summary-db {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid #cddcd7;
  border-radius: 999px;
  color: var(--accent-dark);
  background: #f5faf8;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.summary-db i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(19,111,99,.12);
}

.summary-tool-panel,
.summary-result,
.summary-history-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary-tool-panel {
  padding: 18px;
}

.summary-drop-zone {
  display: grid;
  min-height: 154px;
  place-items: center;
  padding: 24px;
  border: 1px dashed #b7a376;
  border-radius: 8px;
  background: linear-gradient(135deg, #fbfaf4, #f3f7f4);
  cursor: pointer;
  text-align: center;
}

.summary-drop-zone:hover {
  border-color: #987627;
  background: #f8f4e8;
}

.summary-drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.summary-result {
  padding: 18px;
}

.summary-result-head p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.summary-downloads {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.summary-download {
  min-height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.summary-download.secondary {
  color: var(--accent-dark);
  border: 1px solid var(--line);
  background: #fff;
}

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

.summary-stats div {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdfc;
}

.summary-stats span {
  display: block;
  color: var(--accent-dark);
  font-size: 25px;
  font-weight: 800;
}

.summary-stats p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.summary-table-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.summary-table-tools input {
  width: min(430px, 100%);
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
}

.summary-table-tools input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(19,111,99,.12);
}

.summary-table-tools span {
  color: var(--muted);
  font-size: 12px;
}

.summary-table-wrap {
  max-height: 540px;
  overflow: auto;
}

.summary-table-wrap table {
  min-width: 920px;
}

.summary-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #fff;
  background: #21443d;
}

.summary-table-wrap td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.summary-table-wrap tr[hidden] {
  display: none;
}

.summary-history-panel {
  margin-top: 22px;
  padding: 22px;
  box-shadow: none;
  background: rgba(255,255,255,.82);
}

.summary-history-list {
  display: grid;
  gap: 8px;
}

.summary-history-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 90px 110px minmax(190px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid #e5ebe9;
  border-radius: 7px;
  background: #fff;
}

.summary-history-row > div {
  display: grid;
  gap: 4px;
}

.summary-history-row span {
  color: var(--muted);
  font-size: 12px;
}

.summary-history-row strong,
.summary-history-row b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-history-links {
  display: flex !important;
  grid-auto-flow: column;
  gap: 6px !important;
}

.summary-history-links a {
  min-height: 32px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.summary-history-links a:last-child {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

@media (max-width: 720px) {
  .shell {
    padding: 18px;
  }

  h1 {
    font-size: 28px;
  }

  .field-grid,
  .stats {
    grid-template-columns: 1fr;
  }

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

  .page-nav,
  .history-head,
  .summary-intro {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .history-row > div:first-child,
  .history-time {
    grid-column: 1 / -1;
    text-align: left;
  }

  .history-download { justify-self: start; }

  .summary-stats {
    grid-template-columns: 1fr 1fr;
  }

  .summary-table-tools,
  .summary-result-head {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-downloads {
    justify-content: flex-start;
  }

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

  .summary-history-row > div:first-child,
  .summary-history-row > div:nth-child(4),
  .summary-history-links {
    grid-column: 1 / -1;
  }
}
