:root {
    color-scheme: light;
    --bg: #f5f7f8;
    --surface: #ffffff;
    --surface-muted: #f0f3f4;
    --text: #17201c;
    --muted: #68736d;
    --line: #dbe1de;
    --accent: #148451;
    --accent-dark: #0d653d;
    --accent-soft: #e8f4ee;
    --danger: #c63f3f;
    --danger-soft: #faecec;
    --shadow: 0 10px 28px rgba(26, 39, 32, 0.08);
}

* { box-sizing: border-box; }

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

button, input { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.shell { width: min(1080px, calc(100% - 40px)); margin: 0 auto; }

.topbar {
    height: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.topbar-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; color: white; background: var(--accent); border-radius: 6px; }
.brand-mark svg { width: 19px; height: 19px; }

.storage-summary { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.storage-track { width: 120px; height: 6px; overflow: hidden; background: var(--surface-muted); border-radius: 3px; }
.storage-track span { display: block; width: 0; height: 100%; background: var(--accent); border-radius: inherit; transition: width 240ms ease; }

main { padding: 42px 0 64px; }
.upload-section, .files-section { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.upload-section { padding: 28px; }
.files-section { margin-top: 24px; overflow: hidden; }

.section-heading, .files-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 11px; font-weight: 700; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 22px; line-height: 1.25; }
h2 { margin: 0; font-size: 17px; }
h3 { font-size: 18px; }
.limit { padding: 6px 9px; color: var(--muted); background: var(--surface-muted); border-radius: 4px; font-size: 12px; white-space: nowrap; }

.dropzone {
    min-height: 168px;
    margin-top: 24px;
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    border: 1px dashed #aebbb4;
    border-radius: 6px;
    background: #fbfcfc;
    transition: border-color 160ms ease, background 160ms ease;
    outline: none;
}
.dropzone:focus-visible, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone > svg { width: 34px; height: 34px; color: var(--accent); }
.dropzone-copy { display: grid; gap: 4px; min-width: 150px; }
.dropzone-copy strong { font-size: 15px; }
.dropzone-copy span { color: var(--muted); font-size: 13px; }

.primary-button, .secondary-button, .danger-button, .icon-button {
    min-height: 38px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.primary-button { padding: 0 16px; color: white; background: var(--accent); }
.primary-button:hover { background: var(--accent-dark); }
.primary-button svg { width: 17px; height: 17px; }
.secondary-button { padding: 0 16px; color: var(--text); background: white; border-color: var(--line); }
.danger-button { padding: 0 16px; color: white; background: var(--danger); }
.icon-button { width: 38px; padding: 0; color: var(--muted); background: white; border-color: var(--line); }
.icon-button:hover { color: var(--text); border-color: #aeb8b3; }
.icon-button svg { width: 17px; height: 17px; }
.icon-fallback { font-size: 11px; }
.icons-ready .icon-fallback { display: none; }

.upload-queue { margin-top: 18px; border-top: 1px solid var(--line); }
.queue-item { padding: 14px 0 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; }
.queue-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.queue-status { color: var(--muted); font-size: 12px; }
.queue-track { grid-column: 1 / -1; height: 5px; background: var(--surface-muted); border-radius: 3px; overflow: hidden; }
.queue-progress { display: block; width: 0; height: 100%; background: var(--accent); transition: width 120ms linear; }
.queue-item.failed .queue-progress { background: var(--danger); }
.queue-item.failed .queue-status { color: var(--danger); }

.files-toolbar { min-height: 72px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.title-group { display: flex; align-items: center; gap: 9px; }
.count { min-width: 24px; height: 24px; display: grid; place-items: center; color: var(--muted); background: var(--surface-muted); border-radius: 4px; font-size: 12px; }
.toolbar-actions { display: flex; gap: 8px; }
.search-box { width: 240px; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 5px; background: white; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box svg { width: 16px; color: var(--muted); flex: none; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }

.table-head, .file-row { display: grid; grid-template-columns: minmax(260px, 1fr) 110px 170px 92px; align-items: center; gap: 16px; }
.table-head { min-height: 42px; padding: 0 20px; color: var(--muted); background: #fafbfb; border-bottom: 1px solid var(--line); font-size: 12px; }
.file-row { min-height: 66px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: #fafcfb; }
.file-main { min-width: 0; display: flex; align-items: center; gap: 12px; }
.file-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); border-radius: 5px; }
.file-icon svg { width: 18px; height: 18px; }
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file-size, .file-date { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; justify-content: flex-end; gap: 7px; }
.delete-button:hover { color: var(--danger); border-color: #e9b7b7; background: var(--danger-soft); }

.empty-state { min-height: 220px; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--muted); }
.empty-state svg { width: 32px; height: 32px; }
.empty-state[hidden] { display: none; }

.confirm-dialog { width: min(400px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 24px 70px rgba(20, 28, 24, 0.22); }
.confirm-dialog::backdrop { background: rgba(18, 25, 21, 0.45); }
.confirm-dialog form { padding: 26px; }
.dialog-icon { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 18px; color: var(--danger); background: var(--danger-soft); border-radius: 6px; }
.dialog-icon svg { width: 20px; }
.confirm-dialog h3 { margin-bottom: 8px; }
.confirm-dialog p { min-height: 20px; margin-bottom: 24px; color: var(--muted); overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(380px, calc(100% - 40px)); padding: 12px 15px; color: white; background: #25322c; border-radius: 6px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity 160ms ease, transform 160ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

@media (max-width: 760px) {
    .shell { width: min(100% - 24px, 1080px); }
    .topbar { height: auto; min-height: 64px; }
    .topbar-inner { padding: 12px 0; align-items: flex-start; }
    .storage-summary { flex-direction: column; align-items: flex-end; gap: 5px; }
    .storage-track { width: 96px; }
    main { padding: 24px 0 40px; }
    .upload-section { padding: 20px; }
    .dropzone { min-height: 210px; flex-direction: column; gap: 14px; text-align: center; }
    .dropzone-copy { min-width: 0; }
    .files-toolbar { align-items: flex-start; flex-direction: column; }
    .toolbar-actions, .search-box { width: 100%; }
    .table-head { display: none; }
    .file-row { min-height: 92px; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main actions" "meta actions"; gap: 8px 12px; }
    .file-main { grid-area: main; }
    .file-size { grid-area: meta; padding-left: 46px; }
    .file-date { grid-area: meta; padding-left: 116px; }
    .row-actions { grid-area: actions; }
}

@media (max-width: 420px) {
    .section-heading { align-items: flex-start; }
    .file-row { padding: 12px; }
    .file-date { display: none; }
    .file-size { padding-left: 46px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
