:root {
  --bg: #f5f5f7;
  --bg-card: #ffffff;
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --primary: #0071e3;
  --primary-hover: #0077ed;
  --danger: #d32f2f;
  --danger-hover: #b71c1c;
  --border: #d2d2d7;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1d1f;
    --bg-card: #2d2d2f;
    --text: #f5f5f7;
    --text-muted: #a1a1a6;
    --border: #424245;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}

.title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.auth-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-email {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.card-title {
  margin: 0 0 16px;
  font-size: 1.125rem;
  font-weight: 600;
}

/* Login */
.login-card {
  max-width: 400px;
}

.login-form .label,
.label {
  display: block;
  margin: 12px 0 4px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.login-form .label:first-of-type,
.label:first-of-type {
  margin-top: 0;
}

.input {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.2s;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
}

.input::placeholder {
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  .btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
  }
}

.btn-danger {
  background: var(--danger);
  padding: 6px 12px;
  font-size: 0.875rem;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn-block {
  width: 100%;
  margin-top: 20px;
}

.error {
  margin: 8px 0 0;
  font-size: 0.875rem;
  color: var(--danger);
}

.success {
  margin: 8px 0 0;
  font-size: 0.875rem;
  color: #2e7d32;
}

@media (prefers-color-scheme: dark) {
  .success {
    color: #66bb6a;
  }
}

/* Upload */
.upload-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.file-input {
  flex: 1;
  min-width: 180px;
  padding: 8px;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.upload-progress {
  margin-top: 12px;
}

.upload-progress-text {
  margin: 0 0 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.2s ease;
}

/* List */
.list-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.table tbody tr:hover {
  background: rgba(0, 0, 0, 0.03);
}

@media (prefers-color-scheme: dark) {
  .table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
  }
}

.table a {
  color: var(--primary);
  text-decoration: none;
}

.table a:hover {
  text-decoration: underline;
}

.loading,
.empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  font-size: 0.875rem;
  color: #fff;
  background: var(--text);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* 小屏：表格改为卡片式 */
@media (max-width: 600px) {
  .table thead {
    display: none;
  }

  .table tbody tr {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }

  .table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border: none;
  }

  .table td::before {
    content: attr(data-label);
    font-weight: 500;
    color: var(--text-muted);
    margin-right: 8px;
  }

  .table td:first-child { padding-top: 0; }
  .table td:last-child { padding-bottom: 0; border-bottom: none; }
}
