:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-soft-2: #dbeafe;
  --danger: #dc2626;
  --danger-strong: #b91c1c;
  --danger-soft: #fef2f2;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --teal: #0d9488;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -18px rgba(15, 23, 42, 0.18);
  --shadow-md: 0 18px 50px -24px rgba(15, 23, 42, 0.28);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body.no-scroll {
  overflow: hidden;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 480px at 8% -8%, rgba(37, 99, 235, 0.08), transparent 62%),
    radial-gradient(900px 420px at 100% 0%, rgba(14, 165, 233, 0.06), transparent 58%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

strong {
  font-weight: 700;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex: none;
  vertical-align: -3px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm {
  width: 15px;
  height: 15px;
  vertical-align: -2px;
}

.icon-lg {
  width: 22px;
  height: 22px;
}

.icon-xl {
  width: 38px;
  height: 38px;
  stroke-width: 1.5;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--muted);
}

.app-shell {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 24px 56px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 13px 0;
  background: rgba(244, 247, 251, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.75);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  box-shadow: 0 8px 18px -8px rgba(37, 99, 235, 0.7);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand-name {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-sub {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 320px;
  max-width: 620px;
  margin: 0 auto;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.topbar-search:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.search-icon {
  position: absolute;
  left: 13px;
  color: var(--muted-2);
  pointer-events: none;
}

#search-input {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 40px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  border-radius: 12px;
}

#search-input::placeholder {
  color: var(--muted-2);
}

#search-input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  position: absolute;
  right: 5px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 1px;
}

.btn-primary {
  border-color: var(--primary);
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #ffffff;
  box-shadow: 0 8px 18px -10px rgba(37, 99, 235, 0.75);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  border-color: var(--primary-strong);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-danger {
  border-color: var(--danger);
  background: linear-gradient(180deg, #ef4444, #dc2626);
  color: #ffffff;
  box-shadow: 0 8px 18px -10px rgba(220, 38, 38, 0.75);
}

.btn-danger:hover {
  border-color: var(--danger-strong);
  background: linear-gradient(180deg, #dc2626, #b91c1c);
}

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

.btn.is-danger:hover {
  border-color: #fecaca;
  background: var(--danger-soft);
  color: var(--danger-strong);
}

.btn-sm {
  height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
}

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

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.icon-btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 1px;
}

.icon-btn.is-danger:hover {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: var(--danger);
}

.mobile-only {
  display: none;
}

.account {
  position: relative;
}

.account-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px 0 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.account-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #ffffff;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  flex: none;
  text-transform: uppercase;
}

.account-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 232px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  animation: pop 0.14s ease;
}

.menu-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
}

.menu-username {
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-role {
  font-size: 11px;
  color: var(--muted);
}

.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  text-align: left;
}

.menu-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.menu-item-danger {
  color: var(--danger);
}

.menu-item-danger:hover {
  background: var(--danger-soft);
  color: var(--danger-strong);
}

.layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-top: 18px;
}

.sidebar {
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-title {
  padding: 0 11px 7px;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.12em;
  color: var(--muted-2);
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 650;
  text-align: left;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-item .icon {
  width: 17px;
  height: 17px;
  opacity: 0.82;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.is-active {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.nav-item.is-active .icon {
  opacity: 1;
}

.cat-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.13);
}

.cat-all { background: #94a3b8; }
.cat-apps { background: #2563eb; }
.cat-images { background: #10b981; }
.cat-videos { background: #8b5cf6; }
.cat-archives { background: #f59e0b; }
.cat-other { background: #64748b; }

.quota-card {
  padding: 14px;
  border: 1px solid var(--primary-soft-2);
  border-radius: 14px;
  background: linear-gradient(160deg, #f8fbff 0%, #eff6ff 100%);
}

.quota-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.quota-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
}

.quota-percent {
  font-size: 12px;
  font-weight: 750;
  color: var(--primary-strong);
  font-variant-numeric: tabular-nums;
}

.quota-numbers {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.quota-numbers strong {
  color: var(--text-soft);
  font-weight: 650;
}

.quota-note {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
}

.sidebar-tip {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 11px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.sidebar-tip .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(2px);
}

.main {
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 2px 0 16px;
  min-height: 46px;
}

.page-head h1 {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 750;
}

.page-head p {
  margin-top: 6px;
  font-size: 13px;
}

.page-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.files-panel {
  position: relative;
  min-height: 180px;
}

.files-head,
.file-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 64px 80px 64px 76px 132px 88px 152px;
  gap: 10px;
  align-items: center;
  padding-left: 16px;
  padding-right: 16px;
}

.files-head {
  height: 42px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.file-row {
  min-height: 66px;
  padding-top: 11px;
  padding-bottom: 11px;
  border-top: 1px solid var(--border);
  transition: background 0.14s ease;
}

.file-row:first-child {
  border-top: 0;
}

.file-row:hover {
  background: #fbfdff;
}

.file-row.is-deleted {
  background: linear-gradient(90deg, rgba(254, 242, 242, 0.55), transparent 42%);
}

.cell {
  min-width: 0;
}

.cell-name {
  display: flex;
  align-items: center;
  min-width: 0;
}

.file-name-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.file-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--primary-soft);
  color: var(--primary);
}

.file-icon.cat-apps { background: #eff6ff; color: #2563eb; }
.file-icon.cat-images { background: #ecfdf5; color: #059669; }
.file-icon.cat-videos { background: #f5f3ff; color: #7c3aed; }
.file-icon.cat-archives { background: #fffbeb; color: #d97706; }
.file-icon.cat-other { background: #f1f5f9; color: #64748b; }

.file-name-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.file-name {
  font-size: 13.5px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name-btn:hover .file-name {
  color: var(--primary);
}

.badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.badge-public {
  border-color: #bbf7d0;
  background: var(--success-soft);
  color: #047857;
}

.badge-private {
  border-color: var(--border);
  background: var(--surface-3);
  color: var(--muted);
}

.badge-deleted {
  border-color: #fecaca;
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-warn {
  border-color: #fde68a;
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-info {
  border-color: #bfdbfe;
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.badge-role {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #4338ca;
}

.file-sub {
  display: none;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-cat,
.cell-size,
.cell-ver,
.cell-down,
.cell-date,
.cell-owner {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-down,
.cell-size {
  font-variant-numeric: tabular-nums;
}

.cell-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.row-action {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px 16px;
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #dbeafe;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
}

.empty-icon {
  width: 68px;
  height: 68px;
  margin-bottom: 14px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--muted-2);
  border: 1px solid var(--border);
}

.empty-icon .icon {
  width: 30px;
  height: 30px;
}

.empty-state h3 {
  font-size: 15px;
  font-weight: 700;
}

.empty-state p {
  max-width: 420px;
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.55;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px 0;
}

.pager-info {
  font-size: 12.5px;
  color: var(--muted);
}

.pager-buttons {
  display: flex;
  gap: 8px;
}

.app-progress {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-3);
}

.app-progress::-webkit-progress-bar {
  background: var(--surface-3);
  border-radius: 999px;
}

.app-progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  transition: width 0.25s ease;
}

.app-progress::-moz-progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
}

.quota-progress {
  height: 10px;
  margin: 10px 0;
  background: #dbeafe;
}

.quota-progress::-webkit-progress-bar {
  background: #dbeafe;
}

.app-progress.is-warning::-webkit-progress-value {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.app-progress.is-warning::-moz-progress-bar {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.app-progress.is-danger::-webkit-progress-value {
  background: linear-gradient(90deg, #f87171, #dc2626);
}

.app-progress.is-danger::-moz-progress-bar {
  background: linear-gradient(90deg, #f87171, #dc2626);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-icon.teal { background: #f0fdfa; color: var(--teal); }
.stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-icon.amber { background: var(--warning-soft); color: var(--warning); }
.stat-icon.red { background: var(--danger-soft); color: var(--danger); }
.stat-icon.slate { background: var(--surface-3); color: var(--muted); }

.stat-text {
  min-width: 0;
}

.stat-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}

.stat-value {
  margin-top: 3px;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-value.is-small {
  font-size: 14px;
  line-height: 1.45;
  white-space: normal;
  letter-spacing: 0;
}

.stat-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-head p {
  margin-top: 4px;
  font-size: 12px;
}

.panel-head-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chart-panel {
  margin-bottom: 18px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-visits { background: #2563eb; }
.dot-downloads { background: #f59e0b; }
.dot-visitors { background: #0d9488; }

.chart-wrap {
  position: relative;
  padding: 12px 16px 10px;
}

.chart-canvas {
  display: block;
  width: 100%;
  height: 280px;
}

.empty-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  color: var(--muted);
  font-size: 13px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.top-files {
  display: flex;
  flex-direction: column;
  max-height: 390px;
  overflow: auto;
}

.top-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-top: 1px solid var(--border);
  min-width: 0;
}

.top-file-row:first-child {
  border-top: 0;
}

.top-rank {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.top-rank.is-top {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.top-file-name {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-file-name:hover {
  color: var(--primary);
}

.top-downloads {
  flex: none;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.create-user-form {
  padding: 16px 18px 18px;
}

.admin-table {
  max-height: 560px;
  overflow: auto;
}

.admin-table-head,
.admin-row {
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 10px 18px;
}

.users-table .admin-table-head,
.users-table .admin-row {
  grid-template-columns: minmax(120px, 1.3fr) 92px 82px minmax(130px, 1.1fr) 150px;
}

.audit-table .admin-table-head,
.audit-table .admin-row {
  grid-template-columns: 168px minmax(90px, 0.8fr) 104px minmax(160px, 1.6fr);
}

.admin-table-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
}

.admin-row {
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-soft);
  min-width: 0;
}

.admin-row:first-child {
  border-top: 0;
}

.admin-row:hover {
  background: #fbfdff;
}

.admin-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-name {
  font-weight: 650;
  color: var(--text);
}

.admin-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  overflow: visible;
}

.admin-note {
  font-size: 11.5px;
  color: var(--muted);
}

.admin-empty {
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(5px);
  animation: fade 0.16s ease;
}

.modal {
  width: min(560px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  box-shadow: 0 32px 90px -20px rgba(15, 23, 42, 0.5);
  overflow: hidden;
  animation: pop 0.18s ease;
}

.modal-sm { width: min(430px, 100%); }
.modal-xs { width: min(410px, 100%); }
.modal-lg { width: min(780px, 100%); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.modal-head h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-body {
  padding: 18px;
  overflow: auto;
  min-height: 0;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  font-size: 13.5px;
  outline: 0;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.field input {
  height: 40px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted-2);
}

.field-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.field-row .field {
  flex: 1 1 180px;
}

.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
}

.field-inline .field-label {
  white-space: nowrap;
}

.field-inline input {
  width: 160px;
}

.field-grow {
  flex: 1 1 240px;
}

.field-grow input {
  width: 100%;
}

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.check-field input {
  margin: 2px 0 0;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex: none;
}

.form-hint {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}

.form-error {
  padding: 9px 11px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.45;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.confirm-message {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-preview {
  display: grid;
  place-items: center;
  min-height: 120px;
  max-height: 360px;
  overflow: hidden;
  border-radius: 14px;
  background:
    radial-gradient(600px 200px at 50% 0%, rgba(37, 99, 235, 0.18), transparent 65%),
    #0f172a;
}

.detail-preview img,
.detail-preview video {
  display: block;
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.preview-fallback {
  padding: 28px 18px;
  color: #cbd5e1;
  font-size: 12.5px;
  text-align: center;
}

.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-name {
  font-size: 20px;
  font-weight: 750;
  line-height: 1.35;
  letter-spacing: -0.02em;
  word-break: break-word;
  min-width: 0;
}

.meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px 22px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.meta-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.meta-row.is-wide {
  grid-column: 1 / -1;
}

.meta-label {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
}

.meta-value {
  font-size: 13px;
  color: var(--text-soft);
  word-break: break-word;
}

.meta-value code {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-soft);
  word-break: break-all;
}

.detail-description-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-description-wrap h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.detail-description {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.upload-help {
  margin-bottom: 12px;
  font-size: 12.5px;
  line-height: 1.55;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 26px 20px;
  border: 2px dashed var(--border-strong);
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdff, #f5f9ff);
  text-align: center;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.dropzone.is-drag {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: scale(1.005);
}

.dropzone-icon {
  color: var(--primary);
}

.dropzone-text {
  font-size: 12.5px;
  color: var(--muted);
}

.upload-options {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px;
  margin: 14px 0 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 10px;
}

.section-head h3 {
  font-size: 14px;
  font-weight: 700;
}

.upload-queue,
.resume-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card,
.resume-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.task-top,
.resume-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.task-name,
.resume-name {
  min-width: 0;
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-status {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.task-status.is-uploading,
.task-status.is-creating,
.task-status.is-hashing,
.task-status.is-completing {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.task-status.is-done {
  background: var(--success-soft);
  color: var(--success);
}

.task-status.is-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.task-progress {
  margin-top: 9px;
}

.task-meta,
.resume-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.task-error {
  margin-top: 7px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--danger);
  word-break: break-word;
}

.task-actions,
.resume-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  flex-wrap: wrap;
}

.resume-card {
  background: var(--surface-2);
}

.resume-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.list-empty {
  padding: 22px 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  background: var(--surface-2);
}

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: toastIn 0.2s ease;
  cursor: pointer;
}

.toast .icon {
  margin-top: 1px;
  color: var(--primary);
}

.toast-message {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-soft);
  word-break: break-word;
}

.toast-success { border-left-color: var(--success); }
.toast-success .icon { color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-error .icon { color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning .icon { color: var(--warning); }
.toast-info { border-left-color: var(--primary); }

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 1240px) {
  .files-head,
  .file-row {
    grid-template-columns: minmax(140px, 1fr) 56px 72px 54px 70px 120px 144px;
  }

  .cell-owner {
    display: none;
  }
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 224px minmax(0, 1fr);
    gap: 18px;
  }

  .topbar-search {
    max-width: 480px;
  }
}

@media (max-width: 960px) {
  .app-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .brand-sub {
    display: none;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 14px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    width: min(84vw, 310px);
    border-radius: 0 20px 20px 0;
    border-left: 0;
    transform: translateX(-104%);
    transition: transform 0.22s ease;
    overflow: auto;
    padding-top: 22px;
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .mobile-only {
    display: inline-flex;
  }

  .topbar-search {
    max-width: none;
  }

  .admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }

  .topbar-search {
    order: 4;
    flex-basis: 100%;
    max-width: none;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .files-head,
  .file-row {
    grid-template-columns: minmax(140px, 1fr) 56px 72px 54px 70px 120px 144px;
  }

  .cell-date {
    display: none;
  }

  .files-head,
  .file-row {
    grid-template-columns: minmax(140px, 1fr) 56px 72px 54px 70px 144px;
  }
}

@media (max-width: 720px) {
  .files-head {
    display: none;
  }

  .file-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
    padding: 14px 16px;
  }

  .file-row .cell-cat,
  .file-row .cell-size,
  .file-row .cell-ver,
  .file-row .cell-down,
  .file-row .cell-date,
  .file-row .cell-owner {
    display: none;
  }

  .file-name {
    white-space: normal;
    word-break: break-word;
  }

  .file-sub {
    display: block;
    white-space: normal;
    line-height: 1.45;
  }

  .cell-actions {
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
  }

  .row-action {
    width: 34px;
    height: 34px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meta-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal-overlay {
    padding: 10px;
  }

  .modal {
    max-height: 94vh;
    border-radius: 16px;
  }

  .users-table .admin-table-head,
  .audit-table .admin-table-head {
    display: none;
  }

  .users-table .admin-row,
  .audit-table .admin-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    margin: 10px 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
  }

  .users-table .admin-row:first-child,
  .audit-table .admin-row:first-child {
    margin-top: 12px;
  }

  .admin-cell {
    display: flex;
    gap: 8px;
    white-space: normal;
    word-break: break-word;
  }

  .admin-cell::before {
    content: attr(data-label);
    flex: none;
    min-width: 58px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.7;
  }

  .admin-actions {
    justify-content: flex-start;
    padding-top: 2px;
  }

  .admin-actions::before {
    content: none;
  }

  .chart-canvas {
    height: 240px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand-name {
    font-size: 15.5px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .topbar-actions .btn {
    padding: 0 10px;
  }

  .topbar-actions .btn-label {
    display: none;
  }

  .topbar-actions .btn {
    width: 38px;
    padding: 0;
  }

  .account-name {
    display: none;
  }

  .account-btn {
    padding: 0 8px 0 5px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .page-head h1 {
    font-size: 21px;
  }

  .page-head-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .stats-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .chart-legend {
    display: none;
  }

  .upload-options {
    flex-direction: column;
    align-items: stretch;
  }

  .field-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .field-inline input {
    width: 100%;
  }

  .detail-name {
    font-size: 18px;
  }

  .toasts {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
