:root {
  --bg: #f3f6fa;
  --panel: #ffffff;
  --text: #172033;
  --muted: #68738a;
  --line: #e1e7f0;
  --primary: #2264e5;
  --primary-dark: #164fc2;
  --good: #12845a;
  --danger: #c43b49;
  --warning: #a9690e;
  --shadow: 0 12px 32px rgba(33, 48, 77, .08);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; color: var(--text); background: var(--bg); font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
.topbar { position: sticky; z-index: 10; top: 0; color: white; background: #101a2e; box-shadow: 0 4px 18px rgba(0,0,0,.16); }
.topbar-inner { width: min(1240px, calc(100% - 32px)); min-height: 68px; margin: auto; display: flex; align-items: center; justify-content: space-between; }
.brand, .account { display: flex; align-items: center; gap: 12px; }
.brand div { display: flex; flex-direction: column; }
.brand small { color: #a9b7d2; font-size: 11px; letter-spacing: .05em; }
.brand-mark { width: 54px; height: 54px; display: inline-grid; place-items: center; border-radius: 16px; color: white; background: linear-gradient(135deg, #3479ff, #1fc4ad); font-weight: 800; letter-spacing: .05em; box-shadow: 0 8px 24px rgba(34,100,229,.3); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 12px; }
.container { width: min(1240px, calc(100% - 32px)); margin: 30px auto 60px; }
.page-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 22px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(25px, 3vw, 34px); line-height: 1.2; }
h2 { margin-bottom: 5px; font-size: 18px; }
.eyebrow { margin-bottom: 6px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.muted { color: var(--muted); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { min-height: 104px; padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.stat-card span { color: var(--muted); }
.stat-card strong { display: block; margin-top: 9px; font-size: 25px; }
.panel { margin-top: 18px; padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow); }
.panel-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px; }
.panel-heading p { margin-bottom: 0; color: var(--muted); }
.badge { padding: 5px 10px; color: var(--primary); background: #edf3ff; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.drop-zone { width: 100%; min-height: 154px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: var(--text); background: #f8faff; border: 1.5px dashed #9eb6e4; border-radius: 14px; transition: .18s ease; }
.drop-zone:hover, .drop-zone.dragging { color: var(--primary); background: #eef4ff; border-color: var(--primary); transform: translateY(-1px); }
.drop-zone span:last-child { color: var(--muted); font-size: 13px; }
.upload-icon { width: 38px; height: 38px; display: grid; place-items: center; color: white; background: var(--primary); border-radius: 50%; font-size: 24px; line-height: 1; }
.upload-queue { display: grid; gap: 10px; margin-top: 14px; }
.upload-item { padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.upload-meta { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 9px; }
.upload-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-track { height: 8px; overflow: hidden; background: #e9edf4; border-radius: 999px; }
.progress-bar { width: 0; height: 100%; background: linear-gradient(90deg, #2264e5, #18ad9b); border-radius: inherit; transition: width .2s ease; }
.progress-bar.failed { background: var(--danger); }
.button { min-height: 38px; padding: 8px 14px; color: var(--text); background: white; border: 1px solid var(--line); border-radius: 9px; font-weight: 700; transition: .15s ease; }
.button:hover { border-color: #aebbd0; transform: translateY(-1px); }
.button.primary { color: white; background: var(--primary); border-color: var(--primary); }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { color: var(--primary); border-color: #b5c9ee; }
.button.ghost { color: white; background: transparent; border-color: #495873; }
.button.danger { color: var(--danger); }
.button.wide { width: 100%; }
.small-button { min-height: 33px; padding: 5px 11px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 12px; color: var(--muted); background: #f7f9fc; text-align: left; font-size: 12px; white-space: nowrap; }
td { padding: 15px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
.file-name { max-width: 240px; font-weight: 750; overflow-wrap: anywhere; }
.file-id { display: block; margin-top: 3px; color: var(--muted); font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.hash { display: block; max-width: 210px; overflow: hidden; color: var(--muted); font: 11px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.state { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px #dff5ec; }
.state.off { color: var(--danger); }
.state.off::before { background: var(--danger); box-shadow: 0 0 0 3px #fae8eb; }
.actions { min-width: 155px; display: flex; flex-wrap: wrap; gap: 6px; }
.actions .button { min-height: 31px; padding: 4px 8px; font-size: 12px; }
.empty-state { padding: 44px 10px; color: var(--muted); text-align: center; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: min(420px, calc(100% - 44px)); padding: 12px 16px; color: white; background: #18243a; border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.22); }
.toast.error { background: #a82f3c; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 10% 10%, #e2ecff, transparent 35%), radial-gradient(circle at 90% 90%, #dff8f3, transparent 30%), #f5f7fb; }
.login-shell { width: min(430px, 100%); }
.login-card { display: grid; gap: 21px; padding: 34px; background: rgba(255,255,255,.96); border: 1px solid white; border-radius: 21px; box-shadow: 0 24px 70px rgba(25,44,78,.16); }
.login-card h1 { font-size: 27px; }
.login-card p { margin-bottom: 0; }
.login-form { display: grid; gap: 15px; }
.login-form label { display: grid; gap: 6px; font-weight: 700; }
.login-form input { width: 100%; height: 44px; padding: 9px 11px; color: var(--text); background: white; border: 1px solid #cfd7e5; border-radius: 9px; outline: 0; }
.login-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(34,100,229,.13); }
.alert { padding: 10px 12px; border-radius: 9px; }
.alert.error { color: #8f2632; background: #fdecef; border: 1px solid #f4cbd1; }
@media (max-width: 820px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-heading { align-items: flex-start; }
  .panel { padding: 16px; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tbody { display: grid; gap: 12px; }
  tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
  td { padding: 0; border: 0; }
  td:first-child, td:nth-child(3), td:last-child { grid-column: 1 / -1; }
  .file-name, .hash { max-width: none; }
}
@media (max-width: 520px) {
  .container, .topbar-inner { width: min(100% - 20px, 1240px); }
  .container { margin-top: 20px; }
  .account > span { display: none; }
  .page-heading, .panel-heading { align-items: stretch; flex-direction: column; }
  .stats-grid { gap: 9px; }
  .stat-card { min-height: 88px; padding: 15px; }
  .stat-card strong { font-size: 20px; }
  .login-card { padding: 25px; }
}
