/* ══════════════════════════════════════
   Vercel Design System — Variables
   ══════════════════════════════════════ */

:root {
  --bg: #fafafa;
  --surface: #fff;
  --surface-hover: #fafafa;
  --surface-subtle: #f5f5f5;
  --text: #171717;
  --text-secondary: #404040;
  --muted: #737373;
  --faint: #a3a3a3;
  --line: #e5e5e5;
  --line-strong: #d4d4d4;
  --black: #000;
  --danger: #e00;
  --success: #0070f3;
  --warning: #f5a623;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.02);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.02);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  --transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ══════════════════════════════════════
   Reset & Base
   ══════════════════════════════════════ */

html {
  scrollbar-gutter: stable;
}

@supports not (scrollbar-gutter: stable) {
  html { overflow-y: scroll; }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

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

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

.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* ══════════════════════════════════════
   Top Bar
   ══════════════════════════════════════ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.72);
  backdrop-filter: saturate(180%) blur(20px);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 1200px;
  height: 64px;
  margin: 0 auto;
  padding: 0 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: 16px;
  padding: 0 4px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.nav a:not(.brand),
.nav .link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  transition: color var(--transition), background var(--transition);
}

.nav a:not(.brand):hover,
.nav .link-button:hover {
  color: var(--text);
  background: var(--surface-subtle);
}

.nav a:not(.brand):focus-visible,
.nav .link-button:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}

.nav a.active {
  color: var(--text);
  font-weight: 500;
  background: var(--surface-subtle);
}

.session {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.link-button {
  margin-left: auto;
}

/* ── Nav right group ── */

.nav-right {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nav-user {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-subtle);
  color: var(--text) !important;
  font-size: 13px;
  font-weight: 500;
}

.nav-user:hover {
  background: var(--surface);
  border-color: var(--line-strong);
}

.nav-user span {
  font-weight: 600;
}

.nav-user .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.nav-user .icon:last-child:hover {
  color: var(--danger);
}

/* ── Mobile hamburger toggle ── */

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  flex-direction: column;
}

.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ── Nav collapse container ── */

.nav-collapse {
  display: contents;
}

/* ══════════════════════════════════════
   Layout
   ══════════════════════════════════════ */

.container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 24px;
}

/* ══════════════════════════════════════
   Panels & Cards
   ══════════════════════════════════════ */

.notice,
.panel,
.uploader,
.results {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.notice {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 12px;
}

.notice strong {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-subtle);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
}

.panel { padding: 16px; }

.panel h1 {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

/* ══════════════════════════════════════
   Buttons
   ══════════════════════════════════════ */

.btn,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

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

.btn.primary {
  background: var(--black);
  border-color: var(--black);
  color: #fff;
}

.btn.primary:hover {
  background: #262626;
  border-color: #262626;
}

.btn.danger {
  border-color: var(--line);
  color: var(--danger);
  background: transparent;
}

.btn.danger:hover {
  border-color: var(--danger);
  background: #fff5f5;
}

.btn.small {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.btn.active {
  background: var(--black);
  border-color: var(--black);
  color: #fff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: -2px;
}

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

/* ══════════════════════════════════════
   Form Elements
   ══════════════════════════════════════ */

input,
textarea {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

textarea {
  height: auto;
  padding: 6px 10px;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

input[type="checkbox"] {
  height: 16px;
  width: 16px;
  padding: 0;
  accent-color: var(--black);
}

select {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

select:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

output {
  color: var(--muted);
  font-size: 12px;
}

.status,
.stats,
.muted {
  color: var(--muted);
}

.status { margin-left: auto; }

/* ══════════════════════════════════════
   Home / Upload Page
   ══════════════════════════════════════ */

.home-container { max-width: 1140px; }

.home-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.home-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-pills {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.home-pills span {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

/* ── Uploader ── */

.uploader {
  overflow: hidden;
  padding: 0;
}

.drop-title {
  display: grid;
  min-height: 200px;
  place-items: center;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  color: var(--faint);
  font-size: 14px;
  transition: all var(--transition);
  cursor: pointer;
}

.drop-title:hover {
  border-color: var(--muted);
  color: var(--muted);
}

.uploader.dragging .drop-title {
  border-color: var(--black);
  border-style: solid;
  background: var(--surface);
  color: var(--text);
}

.uploader.has-files .drop-title { display: none; }

.file-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: background var(--transition);
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.actions.right { justify-content: flex-end; }

.uploader .file-list {
  display: block;
  max-height: 260px;
  margin: 0;
  overflow-y: auto;
}

.uploader .file-list:empty { display: none; }

.uploader.has-files .file-list {
  min-height: 354px;
  max-height: 354px;
  background: var(--surface-subtle);
}

.uploader .file-item {
  position: relative;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 48px;
  padding: 6px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
}

.uploader .file-item.uploading {
  background: linear-gradient(90deg, rgba(0,112,243,0.04) var(--progress), var(--surface) 0);
}

.uploader .file-item.uploading::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--success) var(--progress), transparent 0);
}

.uploader .file-item.done { background: var(--surface); }

.file-thumb {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.file-thumb.image {
  display: block;
  border-color: var(--line);
  object-fit: cover;
}

.file-meta { min-width: 0; }

.file-size {
  color: var(--faint);
  font-size: 12px;
}

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

.file-percent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
  text-align: right;
}

.file-percent.uploading {
  background: var(--black);
  color: #fff;
}

.file-percent.failed {
  background: var(--danger);
  color: #fff;
}

.file-complete {
  display: inline-flex;
  color: #22c55e;
}

.file-complete .icon {
  width: 20px;
  height: 20px;
  fill: #22c55e;
  stroke: #fff;
}

.file-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.file-action:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.file-action:first-child:hover { color: var(--success); }

.file-action.danger:hover {
  color: var(--danger);
  background: #fff5f5;
}

.uploader .drop-title {
  min-height: 120px;
  border-width: 1px 0;
  border-radius: 0;
  background: var(--surface);
  font-size: 13px;
}

.uploader .actions {
  min-height: 36px;
  margin: 0;
  padding: 0 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
}

.uploader .actions .btn {
  height: 32px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
}

.uploader .actions .btn:hover { color: var(--text); }

.uploader .actions .btn.primary {
  background: transparent;
  color: var(--black);
  font-weight: 600;
}

.uploader .status {
  margin-left: auto;
  color: var(--faint);
  font-size: 12px;
}

.copy-current {
  min-width: 110px;
  height: 32px;
  font-size: 13px;
}

.copy-current .icon {
  width: 14px;
  height: 14px;
}

/* ══════════════════════════════════════
   Results Tabs
   ══════════════════════════════════════ */

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.tabs {
  display: flex;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
}

.tab {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.tab:hover { color: var(--text); }

.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.result-box {
  display: none;
  width: 100%;
  min-height: 160px;
  padding: 12px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
}

.result-box:focus {
  border-color: transparent;
  box-shadow: none;
  outline: none;
}

.result-box.active { display: block; }

.result-body {
  padding: 12px;
  background: var(--surface);
}

/* ══════════════════════════════════════
   Login Page
   ══════════════════════════════════════ */

.login-page {
  min-height: 100vh;
  background: var(--bg);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(380px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.login-brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.login-heading { margin: 24px 0 20px; }

.login-heading h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.login-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label {
  display: grid;
  gap: 4px;
}

.login-form label span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.login-form .btn {
  width: 100%;
  height: 36px;
  margin-top: 2px;
}

.login-home {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-top: 20px;
  color: var(--muted);
  font-size: 13px;
  transition: color var(--transition);
}

.login-home:hover { color: var(--text); }

/* ══════════════════════════════════════
   Admin Shell
   ══════════════════════════════════════ */

.admin-shell {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 84px;
  height: calc(100vh - 84px - 24px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.side-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.side-link:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.side-link.active {
  background: var(--surface-subtle);
  color: var(--text);
  font-weight: 500;
}

.admin-content { min-width: 0; }

.admin-auth-pending .container { display: none; }

/* ── Admin Panel ── */

.admin-page .panel {
  padding: 0;
  overflow: hidden;
}

.admin-page .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.admin-page .panel h1 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.admin-page .panel-head .stats {
  font-size: 11px;
  color: var(--faint);
}

.admin-page #storageForm,
.admin-page #uploadForm,
.admin-page #apiForm {
  padding: 16px;
}

/* ── Settings ── */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

.settings-grid label {
  display: grid;
  gap: 6px;
}

.settings-grid label.wide { grid-column: 1 / -1; }

.settings-grid label span {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ── Storage Groups ── */

.import-box {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

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

.import-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.import-target {
  height: 32px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
}

.import-status {
  color: var(--muted);
  font-size: 12px;
}

.storage-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.storage-group {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.storage-group legend {
  padding: 0 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.danger-border { border-color: #fecaca; }

.storage-group label {
  display: grid;
  gap: 6px;
}

.storage-group label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.checkbox-row {
  align-items: center;
  grid-template-columns: auto 1fr;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
}

/* ── API Form ── */

.api-form {
  display: grid;
  gap: 16px;
}

.api-form label {
  display: grid;
  gap: 6px;
}

.api-form label span {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.api-form small {
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
}

/* ══════════════════════════════════════
   File Management
   ══════════════════════════════════════ */

.file-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
}

.filter-row {
  display: inline-flex;
  gap: 1px;
  padding: 2px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
}

.filter-row .btn.small {
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  height: 26px;
  padding: 0 10px;
  transition: background var(--transition), color var(--transition);
}

.filter-row .btn.small:hover { color: var(--text); }

.filter-row .btn.small.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow-xs);
}

.filter-row .btn.small.danger { color: var(--muted); }
.filter-row .btn.small.danger:hover { color: var(--danger); }

.filter-row .btn.small.danger.active {
  background: var(--surface);
  color: var(--danger);
  font-weight: 500;
  box-shadow: var(--shadow-xs);
}

.file-tools {
  display: flex;
  gap: 6px;
  align-items: center;
}

.file-search {
  width: 160px;
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  background: transparent;
  border-color: var(--line);
}

.file-search:focus {
  border-color: var(--black);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.05);
}

.file-search::placeholder { color: var(--faint); }

/* ── Table ── */

.table-wrap { overflow-x: auto; }

.file-table th:first-child,
.file-table td:first-child {
  width: 32px;
  text-align: center;
}

.file-table th:nth-child(2),
.file-table td:nth-child(2) { width: 52px; }

.file-table th:nth-child(4),
.file-table td:nth-child(4),
.file-table th:nth-child(5),
.file-table td:nth-child(5),
.file-table th:nth-child(6),
.file-table td:nth-child(6),
.file-table th:nth-child(7),
.file-table td:nth-child(7),
.file-table th:nth-child(8),
.file-table td:nth-child(8) {
  white-space: nowrap;
}

.file-table input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  border: none;
  box-shadow: none;
  accent-color: var(--black);
  cursor: pointer;
  outline: none;
}

.file-table input[type="checkbox"]:focus {
  box-shadow: none;
  border: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th, td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 12px;
}

tr:last-child td { border-bottom: 0; }

th {
  background: var(--surface);
  color: var(--faint);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr { transition: background 0.08s; }
tbody tr:hover { background: rgba(0,0,0,0.02); }

.file-preview {
  display: block;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  object-fit: cover;
}

.file-preview.placeholder {
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.file-main {
  display: grid;
  gap: 2px;
  min-width: 120px;
}

.file-main a {
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
  display: block;
  transition: color var(--transition);
}

.file-main a:hover { color: var(--success); }

.file-main code {
  color: var(--faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
  display: block;
}

.file-main .muted { font-size: 11px; color: var(--faint); }

.storage-cell { display: grid; gap: 1px; }

.storage-cell strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}

.storage-cell span {
  color: var(--faint);
  font-size: 11px;
}

/* ── Badge ── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

.badge.suspicious { color: var(--danger); }
.badge.suspicious::before { background: #ef4444; }

/* ── Row Actions ── */

.row-actions {
  display: flex;
  gap: 0;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

.row-actions .btn.small {
  border: none;
  padding: 0;
  width: 28px;
  height: 28px;
  color: var(--faint);
  background: transparent;
  font-size: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.row-actions .btn.small:hover {
  background: var(--surface-subtle);
  color: var(--text);
  box-shadow: none;
  border: none;
}

.row-actions .btn.small.danger:hover {
  color: var(--danger);
  background: #fff5f5;
}

.row-actions .btn.small[data-approve]:hover {
  color: #22c55e;
  background: #f0fdf4;
}

.row-actions .icon { width: 15px; height: 15px; }

.empty-row {
  height: 200px;
  color: var(--faint);
  text-align: center;
  font-size: 13px;
}

/* ── Pagination ── */

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
}

.page-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-left .muted {
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
}

.page-size-select {
  height: 28px;
  padding: 0 24px 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}

.page-num:hover {
  border-color: var(--line-strong);
  background: var(--surface-subtle);
}

.page-num.active {
  border-color: var(--black);
  background: var(--black);
  color: #fff;
  font-weight: 500;
}

.page-num:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.page-num.ellipsis {
  cursor: default;
  border: none;
  background: transparent;
  color: var(--faint);
  min-width: 24px;
  pointer-events: none;
}

/* ══════════════════════════════════════
   Modal
   ══════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}

.modal-overlay[hidden] { display: none; }

@keyframes fadeIn { from { opacity: 0; } }

.modal-card {
  width: min(400px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
}

.modal-message {
  margin: 0 0 20px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-actions .btn { min-width: 72px; }

/* ══════════════════════════════════════
   Toast
   ══════════════════════════════════════ */

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 40px));
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.2s ease;
}

/* ══════════════════════════════════════
   Responsive
   ══════════════════════════════════════ */

@media (max-width: 760px) {
  .home-header {
    align-items: stretch;
    flex-direction: column;
  }

  .home-pills { justify-content: flex-start; }

  .uploader .file-item {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .file-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .nav {
    gap: 2px;
    height: auto;
    min-height: 56px;
    padding: 0 14px;
    flex-wrap: wrap;
  }

  .brand { margin-right: 4px; }

  /* Mobile hamburger */
  .nav-toggle {
    display: flex;
  }

  /* Mobile collapse panel */
  .nav-collapse {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 2px;
    padding: 8px 0 12px;
  }

  .nav-collapse.is-open {
    display: flex;
  }

  .nav-collapse a:not(.brand),
  .nav-collapse .link-button {
    width: 100%;
    height: 36px;
    padding: 0 10px;
  }

  .nav-right {
    margin-left: 0;
    width: 100%;
    border-top: 1px solid var(--line);
    padding-top: 8px;
    margin-top: 4px;
  }

  .container {
    margin: 16px auto;
    padding: 0 14px;
  }

  .notice,
  .panel-head,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .status,
  .link-button { margin-left: 0; }

  .tabs { overflow-x: auto; }

  .results-head {
    align-items: stretch;
    flex-direction: column;
  }

  .copy-current { width: 100%; }

  .admin-shell { display: block; }

  .admin-sidebar {
    position: static;
    display: flex;
    flex-direction: row;
    height: auto;
    overflow-x: auto;
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
  }

  .side-link {
    min-width: auto;
    justify-content: center;
    white-space: nowrap;
    padding: 0 14px;
    font-size: 12px;
  }

  .storage-groups { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }

  .file-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .file-tools { flex-wrap: wrap; }

  .file-search {
    width: 100%;
    flex: 1 1 100%;
  }

  .filter-row {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .import-head {
    align-items: stretch;
    flex-direction: column;
  }
}
