:root {
  color-scheme: dark;
  --background: #090a0c;
  --surface: #101215;
  --surface-raised: #15181c;
  --surface-hover: #191d21;
  --border: #25292e;
  --border-strong: #353b42;
  --text: #f1f3f5;
  --muted: #9299a2;
  --subtle: #626a74;
  --accent: #60a5fa;
  --accent-strong: #3b82f6;
  --accent-ink: #07111f;
  --danger: #fb7185;
  --danger-surface: rgba(251, 113, 133, 0.1);
  --radius: 14px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -20%, rgba(96, 165, 250, 0.075), transparent 35rem),
    var(--background);
  color: var(--text);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(37, 41, 46, 0.72);
  background: rgba(9, 10, 12, 0.82);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(960px, calc(100% - 40px));
  height: 66px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
}

.brand-mark svg { width: 18px; height: 18px; stroke-width: 2.1; }
.brand-centered { justify-content: center; }

.header-actions { display: flex; align-items: center; gap: 18px; }

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.connection-status.offline .status-dot { background: var(--danger); box-shadow: none; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: 0.6; }
.button svg { width: 17px; height: 17px; }
.button-small { min-height: 34px; padding: 0 11px; font-size: 13px; }
.button-full { width: 100%; }
.button-primary { background: var(--accent); color: var(--accent-ink); }
.button-primary:hover:not(:disabled) { background: #a7f3c2; }
.button-ghost { border-color: var(--border); background: var(--surface); color: #c9cdd2; }
.button-ghost:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-hover); color: var(--text); }
.button-secondary { border-color: var(--border); background: var(--surface-raised); }
.button-secondary:hover { background: var(--surface-hover); }
.button-danger { background: var(--danger); color: #21060b; }
.button-danger:hover { background: #fda4af; }

.dashboard { width: min(800px, calc(100% - 40px)); margin: 0 auto; padding: 78px 0 40px; }

.hero { margin-bottom: 42px; text-align: center; }
.eyebrow { margin: 0 0 15px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 0.14em; }
.hero h1 { margin: 0; font-size: clamp(35px, 5.5vw, 54px); font-weight: 700; letter-spacing: -0.045em; line-height: 1.04; }
.hero h1 span { color: #737a82; }
.hero > p:last-child { max-width: 550px; margin: 19px auto 0; color: var(--muted); font-size: 16px; line-height: 1.65; }

.drop-zone {
  display: flex;
  position: relative;
  width: 100%;
  min-height: 265px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
  border: 1px dashed var(--border-strong);
  border-radius: 18px;
  background: rgba(16, 18, 21, 0.72);
  cursor: pointer;
  outline: none;
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.drop-zone::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(96, 165, 250, 0.06), transparent 55%);
  opacity: 0;
  transition: opacity 180ms ease;
}

.drop-zone:hover, .drop-zone:focus-visible { border-color: #59616b; background: var(--surface); }
.drop-zone:hover::before, .drop-zone:focus-visible::before, .drop-zone.dragging::before { opacity: 1; }
.drop-zone.dragging { border-color: var(--accent-strong); background: rgba(59, 130, 246, 0.07); transform: scale(1.006); }

.drop-icon {
  display: grid;
  z-index: 1;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface-raised);
  color: var(--accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.drop-icon svg { width: 25px; height: 25px; }
.drop-copy { display: flex; z-index: 1; flex-direction: column; gap: 6px; }
.drop-copy strong { font-size: 17px; font-weight: 620; }
.drop-copy span { color: var(--muted); font-size: 13px; }
.drop-shortcut { display: flex; z-index: 1; align-items: center; gap: 5px; color: var(--subtle); font-size: 11px; }
kbd { padding: 3px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; background: #17191c; color: #aeb4bb; font: inherit; }
.upload-limit { margin: 12px 0 0; color: var(--subtle); font-size: 11px; text-align: center; }

.upload-queue-section, .files-section { margin-top: 54px; }
.upload-queue-section + .files-section { margin-top: 44px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 16px; }
.section-heading.compact { align-items: center; }
.section-heading h2 { margin: 0; font-size: 16px; font-weight: 630; letter-spacing: -0.01em; }
.section-heading p { margin: 5px 0 0; color: var(--subtle); font-size: 12px; }
.text-button { padding: 4px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; }
.text-button:hover { color: var(--text); }

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.icon-button:hover { border-color: var(--border-strong); color: var(--text); }
.icon-button svg { width: 16px; height: 16px; }
.icon-button.spinning svg { animation: spin 700ms linear infinite; }

.upload-queue, .files-list, .files-loading {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.12);
}

.upload-item { padding: 15px 17px; border-bottom: 1px solid var(--border); }
.upload-item:last-child { border-bottom: 0; }
.upload-item-top { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 20px; }
.upload-item strong { overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.upload-status { flex: none; color: var(--muted); font-size: 11px; }
.upload-complete .upload-status { color: var(--accent); }
.upload-error .upload-status, .upload-error p { color: var(--danger); }
.progress-track { height: 3px; margin-top: 12px; overflow: hidden; border-radius: 2px; background: #23272c; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent-strong); transition: width 100ms linear; }
.upload-error .progress-track span { background: var(--danger); }
.upload-item p { margin: 8px 0 0; color: var(--subtle); font-size: 10px; }

.file-row {
  display: grid;
  min-height: 78px;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  transition: background-color 150ms ease;
}
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: var(--surface-hover); }

.file-visual {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #191c20;
  color: #abb2ba;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.05em;
}
.file-visual img { width: 100%; height: 100%; object-fit: cover; }
.file-image { color: #93c5fd; }
.file-pdf { color: #fda4af; }
.file-archive { color: #fde68a; }
.file-text { color: #c4b5fd; }
.file-details { min-width: 0; }
.file-details h3 { overflow: hidden; margin: 0; font-size: 13px; font-weight: 570; text-overflow: ellipsis; white-space: nowrap; }
.file-details p { margin: 6px 0 0; color: var(--subtle); font-size: 11px; }
.file-actions { display: flex; gap: 6px; }
.file-action {
  display: inline-flex;
  height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 550;
}
.file-action:hover { border-color: var(--border-strong); background: #20242a; color: var(--text); }
.file-action.delete-action:hover { border-color: rgba(251, 113, 133, 0.3); background: var(--danger-surface); color: var(--danger); }
.file-action svg { width: 14px; height: 14px; }

.empty-state { padding: 64px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-align: center; }
.empty-icon { display: grid; width: 48px; height: 48px; margin: 0 auto 18px; place-items: center; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-raised); color: var(--subtle); }
.empty-icon svg { width: 23px; height: 23px; }
.empty-state h3 { margin: 0; font-size: 14px; font-weight: 600; }
.empty-state p { margin: 8px 0 0; color: var(--subtle); font-size: 12px; }

.files-loading { padding: 8px 15px; }
.skeleton { height: 62px; border-bottom: 1px solid var(--border); background: linear-gradient(90deg, transparent, rgba(255,255,255,.025), transparent); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.skeleton:last-child { border: 0; }

.site-footer { padding: 24px 20px 38px; color: var(--subtle); text-align: center; }
.site-footer p { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: 11px; }
.site-footer svg { width: 14px; height: 14px; }

.toast-region { display: flex; position: fixed; z-index: 100; right: 22px; bottom: 22px; width: min(360px, calc(100% - 44px)); flex-direction: column; gap: 9px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: rgba(24, 27, 31, 0.96); box-shadow: var(--shadow); color: #d7dbe0; font-size: 12px; opacity: 0; transform: translateY(8px); transition: opacity 220ms ease, transform 220ms ease; backdrop-filter: blur(12px); }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast-icon { display: grid; width: 19px; height: 19px; flex: none; place-items: center; border-radius: 50%; background: rgba(148, 163, 184, .13); color: #cbd5e1; font-size: 11px; font-weight: 800; }
.toast-success .toast-icon { background: rgba(59, 130, 246, .14); color: var(--accent); }
.toast-error .toast-icon { background: var(--danger-surface); color: var(--danger); }

.dialog { width: min(420px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 16px; background: transparent; color: var(--text); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.68); backdrop-filter: blur(4px); }
.dialog-card { padding: 27px; border: 1px solid var(--border-strong); border-radius: 16px; background: #121417; box-shadow: var(--shadow); text-align: center; }
.dialog-icon { display: grid; width: 46px; height: 46px; margin: 0 auto 18px; place-items: center; border-radius: 13px; background: var(--danger-surface); color: var(--danger); }
.dialog-icon svg { width: 21px; height: 21px; }
.dialog h2 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.dialog p { margin: 10px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.dialog p span { color: #d7dbe0; word-break: break-all; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

.login-page { display: grid; place-items: center; }
.login-shell { width: 100%; padding: 40px 20px; }
.login-card { width: min(430px, 100%); margin: 0 auto; padding: 32px; border: 1px solid var(--border); border-radius: 18px; background: rgba(16, 18, 21, 0.88); box-shadow: var(--shadow); }
.auth-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 28px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: #0d0f11; }
.auth-mode { height: 34px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--subtle); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.auth-mode:hover { color: var(--text); }
.auth-mode.active { background: #1b1e22; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.32); }
.login-heading { margin: 25px 0 24px; text-align: center; }
.login-heading h1 { margin: 0; font-size: 25px; letter-spacing: -0.035em; }
.login-heading p { margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.login-form { display: flex; flex-direction: column; }
.login-form[hidden] { display: none; }
.login-form label { margin: 0 0 8px; color: #cbd0d6; font-size: 12px; font-weight: 550; }
.login-form input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 9px; outline: 0; background: #0d0f11; color: var(--text); caret-color: var(--accent); transition: border-color 150ms ease, box-shadow 150ms ease; }
.login-form input:focus { border-color: rgba(96, 165, 250, .75); box-shadow: 0 0 0 3px rgba(96, 165, 250, .1); }
.login-form .field-label { margin-top: 17px; }
.form-hint { margin: 7px 0 0; color: var(--subtle); font-size: 10px; line-height: 1.45; }
.password-label { margin-top: 18px; }
.password-field { position: relative; }
.password-field input { padding-right: 42px; }
.password-toggle { display: grid; position: absolute; top: 0; right: 0; width: 42px; height: 44px; padding: 0; place-items: center; border: 0; background: none; color: var(--subtle); cursor: pointer; }
.password-toggle:hover { color: var(--text); }
.password-toggle svg { width: 17px; height: 17px; }
.eye-closed, .password-toggle.showing .eye-open { display: none; }
.password-toggle.showing .eye-closed { display: block; }
.form-error { min-height: 18px; margin: 11px 0 7px; color: var(--danger); font-size: 11px; line-height: 1.5; }
.spinner { display: none; width: 15px; height: 15px; border: 2px solid rgba(7,17,31,.25); border-top-color: var(--accent-ink); border-radius: 50%; animation: spin 700ms linear infinite; }
.button.loading .button-label { display: none; }
.button.loading .spinner { display: block; }
.secure-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 23px 0 0; color: var(--subtle); font-size: 10px; }
.secure-note svg { width: 12px; height: 12px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (max-width: 640px) {
  .header-inner, .dashboard { width: min(100% - 28px, 800px); }
  .header-inner { height: 60px; }
  .connection-status { display: none; }
  .button-ghost span { display: none; }
  .button-ghost { width: 34px; padding: 0; }
  .dashboard { padding-top: 50px; }
  .hero { margin-bottom: 32px; }
  .hero > p:last-child { font-size: 14px; }
  .drop-zone { min-height: 230px; }
  .upload-queue-section, .files-section { margin-top: 42px; }
  .file-row { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 11px; padding: 12px; }
  .file-visual { width: 40px; height: 40px; }
  .file-action { width: 34px; padding: 0; justify-content: center; font-size: 0; }
  .file-actions { gap: 5px; }
  .login-card { padding: 27px 22px; }
}

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