:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #edf1f3;
  --surface-strong: #e3e9eb;
  --ink: #182326;
  --muted: #647277;
  --line: #d8e0e2;
  --accent: #1f6f63;
  --accent-soft: #dcecea;
  --accent-ink: #15564d;
  --amber: #b56b12;
  --amber-soft: #fff0d7;
  --red: #b23a3a;
  --red-soft: #fbe4e3;
  --blue: #366f9f;
  --blue-soft: #e1edf6;
  --shadow: 0 14px 38px rgba(25, 45, 50, 0.08);
  --radius: 8px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111719;
  --surface: #182124;
  --surface-soft: #202b2e;
  --surface-strong: #283539;
  --ink: #edf3f2;
  --muted: #99a9ac;
  --line: #2d3a3e;
  --accent: #63b6a9;
  --accent-soft: #173a36;
  --accent-ink: #92d3c9;
  --amber: #e3a64f;
  --amber-soft: #392b18;
  --red: #ef8580;
  --red-soft: #3d2223;
  --blue: #7db4df;
  --blue-soft: #203243;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
a,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 38%, transparent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

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

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  min-height: 64px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 91%, transparent);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand span {
  display: grid;
  gap: 1px;
}

.brand strong {
  font-size: 13px;
  letter-spacing: 0.08em;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
}

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

.location strong {
  color: var(--ink);
}

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

.icon-button,
.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.icon-button {
  width: 38px;
  padding: 0;
  color: var(--muted);
}

.button {
  padding: 0 13px;
  white-space: nowrap;
}

.icon-button:hover,
.button:hover {
  border-color: color-mix(in srgb, var(--muted) 45%, var(--line));
  background: var(--surface-soft);
}

.icon-button:active,
.button:active {
  transform: translateY(1px);
}

.button-primary {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.button-primary:hover {
  border-color: var(--accent-ink);
  color: #ffffff;
  background: var(--accent-ink);
}

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

.button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.theme-icon-dark {
  display: none;
}

:root[data-theme="dark"] .theme-icon-light {
  display: none;
}

:root[data-theme="dark"] .theme-icon-dark {
  display: block;
}

.page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 34px 28px 64px;
}

.overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  padding-bottom: 27px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.section-kicker {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.13em;
}

.overview h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
}

.overview p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
}

.storage-summary {
  display: flex;
  min-width: 280px;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.storage-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  color: var(--blue);
  background: var(--blue-soft);
}

.storage-summary > div:last-child {
  display: grid;
  min-width: 0;
}

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

.storage-summary strong {
  font-size: 16px;
}

.storage-summary small {
  color: var(--muted);
  font-size: 11px;
}

.upload-panel {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2,
.section-heading h2 {
  margin: 0;
  font-size: 19px;
}

.auth-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
}

.auth-state.is-verified {
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
  background: var(--accent-soft);
}

.auth-state.is-verified .status-dot {
  background: var(--accent);
}

.auth-state.is-error {
  color: var(--red);
  background: var(--red-soft);
}

.auth-state.is-error .status-dot {
  background: var(--red);
}

.auth-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  margin-top: 16px;
}

.password-field,
.search-box {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.password-field:focus-within,
.search-box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.password-field .icon,
.search-box .icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.password-field input,
.search-box input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

input::placeholder {
  color: color-mix(in srgb, var(--muted) 78%, transparent);
}

.drop-zone {
  display: grid;
  min-height: 170px;
  place-items: center;
  align-content: center;
  gap: 5px;
  margin-top: 14px;
  padding: 25px;
  border: 1px dashed color-mix(in srgb, var(--muted) 38%, var(--line));
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-soft);
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone strong {
  color: var(--ink);
  font-size: 15px;
}

.drop-zone > span:last-child {
  font-size: 12px;
}

.drop-icon {
  display: grid;
  width: 46px;
  height: 46px;
  margin-bottom: 4px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.upload-queue {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.queue-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px auto;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.queue-name {
  min-width: 0;
}

.queue-name strong,
.file-name strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-name span,
.file-name span,
.file-meta {
  color: var(--muted);
  font-size: 11px;
}

.progress-track {
  position: relative;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 120ms linear;
}

.queue-status {
  width: 66px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.queue-item.is-error .queue-status {
  color: var(--red);
}

.queue-item.is-complete .queue-status {
  color: var(--accent);
}

.files-section {
  margin-top: 34px;
}

.result-count {
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px auto;
  gap: 10px;
  margin: 15px 0 12px;
}

.search-box {
  min-height: 42px;
}

select {
  min-height: 42px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
}

.file-list {
  display: grid;
  gap: 8px;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(130px, 0.55fr) minmax(120px, 0.5fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.file-row:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: 0 8px 24px rgba(25, 45, 50, 0.06);
}

.file-name {
  display: grid;
  min-width: 0;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
}

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

.file-actions {
  display: flex;
  gap: 7px;
}

.file-actions .button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.file-actions .icon {
  width: 16px;
  height: 16px;
}

.danger-button {
  color: var(--red);
}

.empty-state {
  padding: 66px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty-state > span {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
}

.empty-state h3 {
  margin: 12px 0 4px;
  color: var(--ink);
  font-size: 16px;
}

.empty-state p {
  margin: 0;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: min(380px, calc(100vw - 32px));
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .file-row {
    grid-template-columns: minmax(180px, 1fr) auto;
  }

  .file-meta:nth-of-type(2),
  .file-meta:nth-of-type(3) {
    display: none;
  }
}

@media (max-width: 700px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 16px;
  }

  .location {
    display: none;
  }

  .brand small {
    display: none;
  }

  .page {
    padding: 26px 16px 48px;
  }

  .overview {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .storage-summary {
    width: 100%;
    min-width: 0;
  }

  .auth-row,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .auth-row .button,
  .toolbar .button,
  .toolbar select {
    width: 100%;
  }

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

  .progress-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 520px) {
  .drop-zone {
    min-height: 150px;
    padding: 18px;
  }

  .file-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .file-meta {
    display: block;
  }

  .file-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .file-actions .button {
    flex: 1 1 100px;
  }
}

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