:root {
  --bg: #f0f3f6;
  --surface: #ffffff;
  --card-bg: #e7e9ec;
  --ink: #14202b;
  --ink-muted: #5c6b7a;
  --line: #dbe2e9;
  --accent: #1e7a8c;
  --accent-strong: #0f4650;
  --accent-soft: #e3f1f3;
  --danger: #b23b3b;
  --danger-soft: #fbeaea;
  --ok: #1f7a4d;
  --ok-soft: #e8f5ee;
  /* Fijos a propósito: el botón primario no invierte con el tema, así el
     contraste queda garantizado en los dos casos sin duplicar la regla. */
  --btn-bg: #0f4650;
  --btn-fg: #ffffff;
  --font: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d141c;
    --surface: #16202b;
    --card-bg: #242b33;
    --ink: #e7edf2;
    --ink-muted: #8fa0af;
    --line: #263241;
    --accent: #4fb8cc;
    --accent-strong: #8fdce8;
    --accent-soft: #16323a;
    --danger: #d9695f;
    --danger-soft: #34201f;
    --ok: #4fbf8a;
    --ok-soft: #14291f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

.shell {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-logo {
  height: 120px;
  width: auto;
  display: block;
}

.card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 32px 28px;
  box-shadow: 0 1px 2px rgba(15, 27, 38, 0.04);
}
.card-wide {
  max-width: 560px;
}
.shell:has(.card-wide) {
  max-width: 560px;
}

h1 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.sub {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--ink-muted);
}

form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-top: 12px;
}
label:first-child { margin-top: 0; }

input[type="text"],
input[type="password"] {
  font: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
}
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hint {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13.5px;
}

.btn-primary {
  margin-top: 22px;
  padding: 11px 16px;
  border: none;
  border-radius: 6px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-ghost {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-muted); }
.btn-ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.upload-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}
.upload-header .sub { margin: 0; }

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  padding: 36px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
}
.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.dropzone-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}
.dropzone-sub {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.file-list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.file-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.file-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.file-name {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-status {
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  flex-shrink: 0;
}
.file-status.status-ok { color: var(--ok); }
.file-status.status-error { color: var(--danger); }
.file-status.status-busy { color: var(--accent-strong); }

.progress-track {
  margin-top: 8px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.15s ease;
}
.file-item.status-error .progress-fill { background: var(--danger); }
.file-item.status-ok .progress-fill { background: var(--ok); }

.retention-note {
  margin: 22px 0 0;
  font-size: 12.5px;
  color: var(--ink-muted);
  text-align: center;
}

[hidden] { display: none !important; }

@media (prefers-reduced-motion: no-preference) {
  .progress-fill { transition: width 0.15s ease; }
}
