:root {
  color-scheme: light;
  --green: #0b2c1a;
  --green-2: #2d7043;
  --ink: #17261c;
  --muted: #56665b;
  --line: #dce7de;
  --paper: #ffffff;
  --background: #f1f6f2;
  --danger: #a12622;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--background); color: var(--ink); }
button, input { font: inherit; }
.repo-header { min-height: 76px; padding: 14px clamp(18px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand img { width: 44px; height: 44px; border-radius: 12px; }
.brand span { display: grid; }
.brand strong { font-size: 18px; }
.brand small { color: var(--muted); }
.repo-main { width: min(1060px, calc(100% - 32px)); margin: 46px auto 80px; }
h1 { margin: 2px 0 8px; font-size: clamp(30px, 5vw, 48px); line-height: 1.05; }
h2 { margin: 10px 0 5px; }
.eyebrow { margin: 0; color: var(--green-2); font-size: 12px; font-weight: 800; letter-spacing: .14em; }
.lead { color: var(--muted); max-width: 660px; line-height: 1.55; }
.auth-card { width: min(520px, 100%); margin: 7vh auto; padding: clamp(24px, 5vw, 42px); background: var(--paper); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 20px 50px rgba(18, 61, 37, .08); }
form { display: grid; gap: 16px; margin-top: 30px; }
label { display: grid; gap: 7px; font-weight: 700; }
input { width: 100%; min-height: 48px; border: 1px solid #aeb9b1; border-radius: 12px; padding: 0 13px; background: #fff; color: var(--ink); }
input:focus { outline: 3px solid rgba(31, 102, 59, .18); border-color: var(--green-2); }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 64px; }
.password-field button { position: absolute; right: 6px; top: 6px; height: 36px; border: 0; background: transparent; color: var(--green-2); font-weight: 800; cursor: pointer; }
.button { min-height: 44px; border: 1px solid var(--green); border-radius: 12px; padding: 10px 17px; font-weight: 800; cursor: pointer; }
.button:disabled { opacity: .55; cursor: wait; }
.primary { background: var(--green); color: white; }
.ghost { background: white; color: var(--green); }
.text-button { border: 0; background: transparent; color: var(--green-2); font-weight: 750; cursor: pointer; }
.error { min-height: 20px; margin: -4px 0; color: var(--danger); font-weight: 700; }
.auth-status { min-height: 20px; margin: -10px 0 0; color: var(--green-2); font-weight: 700; line-height: 1.45; }
.hero-row { display: flex; align-items: end; justify-content: space-between; gap: 22px; }
.upload-button { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.notice { display: flex; gap: 10px 22px; margin: 30px 0; padding: 18px 20px; border: 1px solid #cbdccf; border-radius: 16px; background: #eaf3ed; }
.notice span { color: #46604f; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list-toolbar div { display: flex; gap: 14px; align-items: baseline; }
.list-toolbar span { color: var(--muted); font-size: 14px; }
.status { min-height: 24px; color: var(--green-2); font-weight: 700; }
.backup-list { display: grid; gap: 12px; }
.backup-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; }
.file-info { min-width: 0; }
.file-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.file-meta { display: flex; gap: 7px; margin-top: 6px; color: var(--muted); font-size: 13px; }
.file-actions { display: flex; gap: 8px; }
.file-actions a { text-decoration: none; display: inline-flex; align-items: center; }
.danger { border-color: #d9a6a3; background: #fff; color: var(--danger); }
.empty-state { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty-icon { width: 68px; height: 68px; margin: auto; display: grid; place-items: center; border-radius: 18px; background: #dfece3; color: var(--green); font-weight: 900; }
footer { display: flex; justify-content: center; gap: 18px; padding: 25px; color: var(--muted); font-size: 13px; }
footer a { color: var(--green-2); }
[hidden] { display: none !important; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.return-button { text-decoration: none; white-space: nowrap; }
@media (max-width: 650px) {
  .repo-main { margin-top: 28px; }
  .hero-row, .notice { align-items: stretch; flex-direction: column; }
  .upload-button { width: 100%; }
  .backup-item { grid-template-columns: 1fr; }
  .file-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .file-actions .button { justify-content: center; text-align: center; }
  .header-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .header-actions .button { justify-content: center; text-align: center; }
  footer { flex-direction: column; align-items: center; }
}

/* Sistema visual compartido con la aplicacion principal. */
:root {
  --surface-soft: #eef4ef;
  --line-soft: rgba(18, 61, 37, .13);
  --line-strong: rgba(18, 61, 37, .26);
  --shadow-xs: 0 1px 2px rgba(8, 31, 16, .05);
  --shadow-sm: 0 7px 20px rgba(8, 31, 16, .08);
  --shadow-md: 0 18px 50px rgba(8, 31, 16, .12);
  --radius-control: 14px;
  --radius-card: 22px;
  --focus-ring: 0 0 0 3px rgba(31, 102, 59, .2);
}

html { color-scheme: light; }
body {
  background:
    radial-gradient(circle at 15% 0%, rgba(82, 145, 98, .08), transparent 30%),
    linear-gradient(180deg, #f7faf8, #eef3ef);
  font-feature-settings: "kern" 1, "tnum" 1;
  line-height: 1.45;
}

::selection { background: rgba(31, 102, 59, .2); color: var(--green); }

.repo-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom-color: var(--line-soft);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 4px 18px rgba(8, 31, 16, .05);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.brand img {
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-xs);
}

.auth-card,
.backup-item,
.notice,
.empty-state {
  border-color: var(--line-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

.auth-card {
  background: rgba(255, 255, 255, .97);
  box-shadow: var(--shadow-md);
}

.backup-item {
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.backup-item:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

input {
  border-color: var(--line-strong);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, .9);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:hover { border-color: rgba(18, 61, 37, .4); }
input:focus { outline: none; border-color: var(--green-2); box-shadow: var(--focus-ring); }

.button {
  min-height: 46px;
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-xs);
  transition: transform 100ms ease, filter 100ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.button.primary,
.primary {
  background: linear-gradient(145deg, #235b31, #173d21);
  box-shadow: 0 7px 16px rgba(19, 72, 34, .18);
}

.button.ghost,
.ghost {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, .92);
}

.button:hover { transform: translateY(-1px); }
.button:active { transform: scale(.98); }

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(76, 166, 101, .55);
  outline-offset: 2px;
}

.notice {
  background: linear-gradient(180deg, #edf6ef, #e5f0e8);
}

.empty-state {
  border-style: dashed;
  background: rgba(255, 255, 255, .6);
}

@media (max-width: 650px) {
  .repo-header {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }
  .repo-main { width: min(100% - 24px, 1060px); }
  .auth-card { border-radius: 20px; }
}

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

@media (prefers-contrast: more) {
  :root { --line-soft: rgba(18, 61, 37, .3); --line-strong: rgba(18, 61, 37, .62); }
}

/* Identidad forestal del repositorio: la pagina conserva su lectura documental
   y se integra visualmente con la aplicacion sin afectar la gestion de ZIP. */
.repo-header {
  border-bottom-color: rgba(221, 240, 223, .16);
  background: linear-gradient(135deg, #082b18, #1b5734);
  box-shadow: 0 8px 26px rgba(5, 29, 14, .2);
}

.brand { color: #ffffff; }
.brand small { color: #c8e4cd; }
.brand img {
  border-color: rgba(224, 242, 225, .22);
  box-shadow: 0 5px 14px rgba(0, 0, 0, .18);
}

.repo-header .button.ghost,
.repo-header .ghost {
  border-color: rgba(224, 242, 225, .24);
  background: rgba(255, 255, 255, .1);
  color: #f7fcf7;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.repo-header .button.ghost:hover,
.repo-header .ghost:hover { background: rgba(255, 255, 255, .18); }

.eyebrow { color: #2b7646; }
.notice {
  border-color: rgba(39, 111, 66, .18);
  background: linear-gradient(145deg, #edf7ef, #e2efe5);
  box-shadow: var(--shadow-xs);
}

.backup-item {
  background: linear-gradient(155deg, #ffffff, #f6faf7);
}

.empty-icon {
  border: 1px solid rgba(35, 91, 49, .14);
  background: linear-gradient(145deg, #dcecdf, #cde4d2);
  color: var(--green);
}

/*
 * Cuota de almacenamiento.
 *
 * La barra existe para que el limite se vea antes de chocar con el: una cifra
 * sola no dice si queda mucho o poco, y quien sube un ZIP de 400 MB en campo
 * necesita saberlo antes de empezar, no cuando el servidor lo rechaza.
 */
.storage { margin: 14px 0 4px; }
.storage-text { margin: 0 0 6px; font-size: .88rem; opacity: .85; }
.storage-bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(127, 127, 127, .25);
  overflow: hidden;
}
.storage-bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: #2E7D46;
  transition: width .3s ease;
}
.storage[data-nivel="aviso"] .storage-bar > span { background: #C9931F; }
.storage[data-nivel="critico"] .storage-bar > span { background: #C0392B; }
.storage[data-nivel="critico"] .storage-text { opacity: 1; font-weight: 600; }
