:root {
  --paper: #f7f8fa;
  --surface: #ffffff;
  --ink: #0b0d12;
  --ink-soft: #4b5563;
  --ink-muted: #6b7280;
  --border: rgba(11, 13, 18, 0.08);
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-soft: rgba(37, 99, 235, 0.1);
  --accent: #0ea5e9;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.08);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.08);
  --shadow: 0 1px 2px rgba(11, 13, 18, 0.04), 0 8px 28px rgba(11, 13, 18, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }

/* Buttons */
.btn,
button,
input[type=submit] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
  line-height: 1.4;
}
.btn:hover,
button:hover:not(:disabled),
input[type=submit]:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn:focus-visible,
button:focus-visible,
input[type=submit]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}
.btn:disabled,
button:disabled,
input[type=submit]:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.btn-primary,
button.primary,
input[type=submit].primary {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}
.btn-primary:hover,
button.primary:hover,
input[type=submit].primary:hover { background: var(--brand-hover); }
.btn-danger,
button.danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}
.btn-danger:hover,
button.danger:hover { background: var(--danger-hover); }
.btn-ghost,
button.ghost {
  background: transparent;
  border-color: var(--border);
}
.btn-sm,
button.small {
  padding: 6px 10px;
  font-size: 13px;
}

/* Inputs */
input[type=text],
input[type=password],
input[type=email],
input[type=number],
textarea,
select {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
input:disabled,
textarea:disabled {
  background: #f3f4f6;
  cursor: not-allowed;
}

/* Layout */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--brand);
}
.nav { display: flex; align-items: center; gap: 8px; }
.nav a {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
}
.nav a:hover { color: var(--ink); background: rgba(11, 13, 18, 0.04); }

/* Hero */
.hero {
  padding: 80px 0 48px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 0 0 16px;
}
.hero p {
  color: var(--ink-soft);
  font-size: 17px;
  margin: 0 auto;
  max-width: 560px;
  line-height: 1.65;
}
.hero-actions {
  margin-top: 32px;
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.hero-actions .btn {
  padding: 12px 22px;
  font-size: 15px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card.small { padding: 16px; }
.card-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 32px 0 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.section-title h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.section-title .meta {
  font-size: 13px;
  color: var(--ink-muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* Feature grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}
@media (max-width: 780px) {
  .feature-grid { grid-template-columns: 1fr; }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}
.feature-grid .card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}
.feature-grid .card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
}
.feature-grid.two-col {
  grid-template-columns: repeat(2, 1fr);
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
@media (max-width: 640px) {
  .feature-grid.two-col { grid-template-columns: 1fr; }
}

/* Auth */
.auth-card {
  max-width: 420px;
  margin: 48px auto;
}
.auth-card h2 {
  margin: 0 0 20px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field-hint {
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 6px;
}

/* Tables */
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.tbl th,
table.tbl td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
table.tbl th {
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 13px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--brand-soft);
  color: var(--brand-hover);
}
.badge.danger { background: var(--danger-soft); color: var(--danger-hover); }
.badge.success { background: var(--success-soft); color: #14532d; }
.badge.warn { background: var(--warn-soft); color: #92400e; }
.badge.muted { background: rgba(11,13,18,0.06); color: var(--ink-soft); }

/* Progress */
.progress {
  height: 8px;
  background: rgba(11, 13, 18, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width 300ms ease;
}
.progress-accent > span { background: var(--accent); }

/* File list */
.file-list { display: flex; flex-direction: column; gap: 10px; }
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: background 150ms ease, border-color 150ms ease;
}
.file-item:hover {
  border-color: rgba(37, 99, 235, 0.25);
  background: #fbfcfe;
}
.file-item.previewable .file-info {
  cursor: pointer;
}
.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.file-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.file-icon.image { background: rgba(14, 165, 233, 0.1); color: #0369a1; }
.file-icon.video { background: rgba(217, 119, 6, 0.1); color: #92400e; }
.file-icon.audio { background: rgba(22, 163, 74, 0.1); color: #14532d; }
.file-icon.pdf { background: rgba(220, 38, 38, 0.1); color: #991b1b; }
.file-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta {
  color: var(--ink-soft);
  font-size: 12px;
  margin-top: 2px;
}
.file-actions { display: flex; align-items: center; gap: 8px; }

/* Dropzone */
.dropzone {
  border: 2px dashed #d1d5db;
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  color: var(--ink-soft);
  background: var(--surface);
  transition: border-color 150ms ease, background 150ms ease;
  cursor: pointer;
}
.dropzone:hover { border-color: var(--brand); background: #fbfcfe; }
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-hover); }
.dropzone-title { font-weight: 500; color: var(--ink); }
.dropzone-hint { font-size: 13px; color: var(--ink-muted); margin-top: 6px; }

/* Upload queue */
.upload-queue {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.upload-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
}
.upload-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.upload-item-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-item-status {
  font-size: 12px;
  color: var(--ink-muted);
  flex-shrink: 0;
}
.upload-item-status.done { color: var(--success); }
.upload-item-status.error { color: var(--danger); }

/* Modal / preview */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(11, 13, 18, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  position: relative;
  max-width: min(960px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(11,13,18,0.22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 12px;
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1;
}
.modal-close:hover { background: rgba(11,13,18,0.04); }
.modal-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  background: #0b0d12;
}
.modal-body img,
.modal-body video,
.modal-body audio {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  display: block;
}
.modal-body iframe {
  width: 100%;
  height: calc(100vh - 160px);
  min-height: 420px;
  border: 0;
}

/* Announcement */
.announcement-bar {
  background: var(--brand-soft);
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.announcement-bar + .announcement-bar { margin-top: -6px; }
.announcement-title {
  font-weight: 600;
  font-size: 14px;
  color: #1e3a8a;
  margin: 0 0 4px;
}
.announcement-body {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0;
}
.announcement-body p { margin: 0 0 6px; }
.announcement-body p:last-child { margin-bottom: 0; }

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 24px;
  color: var(--ink-soft);
}
.empty-title { font-weight: 500; color: var(--ink); margin-bottom: 4px; }
.empty-hint { font-size: 13px; }

/* Flash */
.flash {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid var(--border);
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 14px;
}
.flash.error { background: #fef2f2; color: #7f1d1d; border-color: #fecaca; }
.flash.success { background: #f0fdf4; color: #14532d; border-color: #bbf7d0; }

/* Utilities */
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex-1 { flex: 1; }
.text-right { text-align: right; }
.text-sm { font-size: 13px; }

/* Footer */
footer.foot {
  padding: 40px 0;
  color: var(--ink-muted);
  font-size: 13px;
  text-align: center;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tabs a {
  padding: 10px 14px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Form actions */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Responsive */
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .card { padding: 18px; }
  .hero { padding: 56px 0 32px; }
  .file-item { flex-direction: column; align-items: flex-start; }
  .file-actions { width: 100%; justify-content: flex-end; }
  .nav a { padding: 6px 8px; font-size: 13px; }
}
