:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --panel: #ffffff;
  --text: #1f2528;
  --muted: #687177;
  --line: #dcd8cf;
  --accent: #1f6f78;
  --accent-strong: #124f56;
  --warn: #b54708;
  --danger: #b42318;
  --ok: #247a46;
  --shadow: 0 18px 60px rgba(40, 45, 49, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(31, 111, 120, 0.14), transparent 36%),
    linear-gradient(315deg, rgba(185, 84, 44, 0.12), transparent 38%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

.file-input {
  display: block;
  width: 100%;
  min-height: 46px;
  margin: 0 0 16px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.file-input::file-selector-button {
  min-height: 32px;
  margin-right: 12px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.shell {
  width: min(720px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.admin-shell {
  width: min(1120px, calc(100vw - 32px));
}

.panel {
  width: 100%;
  padding: 34px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(220, 216, 207, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.heading {
  margin-bottom: 26px;
}

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

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.02;
  letter-spacing: 0;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 120, 0.14);
}

.compact {
  margin: 0;
}

.dropzone {
  position: relative;
  min-height: 190px;
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 20px;
  padding: 26px;
  border: 1px dashed #9aa4a8;
  border-radius: 8px;
  background: #fbfaf7;
  transition:
    border-color 140ms ease,
    background 140ms ease;
}

.dropzone.dragging {
  border-color: var(--accent);
  background: #f4fbfa;
}

.dropzone-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 42px;
  line-height: 1;
}

.dropzone strong {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 22px;
}

.dropzone p {
  margin: 8px 0 0;
  color: var(--muted);
}

.actions,
.login-row {
  display: flex;
  gap: 12px;
  align-items: end;
  margin-top: 20px;
}

.login-row .field {
  flex: 1;
}

button {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

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

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

.secondary {
  background: #e9e5dc;
  color: var(--text);
}

.secondary:hover:not(:disabled) {
  background: #ddd6ca;
}

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

.meter {
  width: 100%;
  height: 12px;
  margin-top: 24px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e0d8;
}

.meter div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #d06b3c);
  transition: width 160ms ease;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.status-grid div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf7;
}

.status-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-grid strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.status-text {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.status-text.ok {
  color: var(--ok);
}

.status-text.warn {
  color: var(--warn);
}

.status-text.danger {
  color: var(--danger);
}

.mobile-fallback {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.mobile-fallback a {
  color: var(--accent);
  font-weight: 800;
}

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

.table-wrap {
  width: 100%;
  margin-top: 24px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

td:first-child {
  min-width: 260px;
  max-width: 460px;
  overflow-wrap: anywhere;
  white-space: normal;
}

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

.file-actions {
  display: flex;
  gap: 8px;
}

.link-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 12px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.danger-button {
  min-height: 36px;
  padding: 0 12px;
  background: #f5d7d4;
  color: var(--danger);
}

.empty {
  color: var(--muted);
  text-align: center;
}

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

  .panel {
    padding: 22px;
  }

  .dropzone {
    grid-template-columns: 1fr;
    min-height: 210px;
  }

  .actions,
  .login-row,
  .admin-topbar,
  .file-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  button,
  .link-button {
    justify-content: center;
    width: 100%;
  }
}
