:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #172033;
  --muted: #647184;
  --line: #d8dee8;
  --line-strong: #b7c0ce;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --danger: #c24132;
  --green: #15803d;
  --shadow: 0 12px 28px rgba(29, 39, 61, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
}

.brand,
.top-actions,
.section-head,
.upload-actions,
.table-toolbar,
.stats,
.selected-item,
.file-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand {
  align-items: baseline;
  min-width: 190px;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
}

h1 {
  font-size: 21px;
  white-space: nowrap;
}

h2 {
  font-size: 16px;
}

.sync-state,
.muted,
.limit-text {
  color: var(--muted);
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  border-color: var(--line-strong);
  background: #f8fafc;
}

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

.btn.primary:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.btn.danger {
  color: var(--danger);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input {
  min-height: 36px;
  padding: 7px 10px;
}

textarea {
  min-height: 108px;
  max-height: 260px;
  resize: vertical;
  padding: 9px 10px;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 13px;
  line-height: 1.5;
}

input:focus,
textarea:focus,
.drop-zone:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

.page {
  display: grid;
  gap: 14px;
  width: min(1720px, calc(100% - 28px));
  margin: 14px auto 28px;
}

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

.upload-panel {
  padding: 14px;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(320px, 1fr);
  gap: 12px;
  align-items: stretch;
}

.form-stack {
  display: grid;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  min-height: 172px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fbfcfe;
  outline: none;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: #f3f8ff;
}

.drop-zone input {
  display: none;
}

.selected-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.selected-item {
  justify-content: space-between;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfe;
}

.selected-name,
.file-name {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.selected-meta,
.file-meta {
  color: var(--muted);
  font-size: 12px;
}

.upload-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.file-panel {
  overflow: hidden;
}

.table-toolbar {
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.search-box {
  display: inline-flex;
  align-items: center;
  flex: 1 1 380px;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.search-box input {
  max-width: 620px;
}

.stats span {
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #edf2f7;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

tbody tr:hover {
  background: #f8fbff;
}

.col-name {
  width: 30%;
}

.col-size {
  width: 9%;
}

.col-author {
  width: 10%;
}

.col-note {
  width: 18%;
}

.col-time {
  width: 14%;
}

.col-count {
  width: 7%;
}

.col-action {
  width: 12%;
}

.file-actions {
  align-items: flex-start;
}

.empty-row {
  padding: 36px 12px;
  color: var(--muted);
  text-align: center;
}

.tone-ok {
  color: var(--green);
}

.tone-error {
  color: var(--danger);
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .table-toolbar {
    align-items: stretch;
  }

  .search-box {
    flex-basis: 100%;
  }
}
