/* Identidad visual ATTRIM — tokens */
:root {
  --color-navy: #0B294C;
  --color-blue: #1578FA;
  --color-light-blue: #C4DAFE;
  --color-gray: #BDBFC8;
  --color-green: #80BD02;
  --color-error: #D93025;
  --color-bg: #FFFFFF;
  --color-bg-soft: #F6F8FC;
  --color-text: #0B294C;
  --color-text-muted: #5B6B80;
  --color-border: #E3E8F0;

  --font-display: Georgia, 'Times New Roman', serif;
  --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-label: 'IBM Plex Serif', Georgia, serif;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 8px rgba(11,41,76,.06);
  --shadow-md: 0 4px 24px rgba(11,41,76,.08);
  --shadow-lg: 0 8px 40px rgba(11,41,76,.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg-soft);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.center { text-align: center; }
.muted { color: var(--color-text-muted); }
h1, h2 { font-family: var(--font-display); margin: 0; }
h2 { font-size: 1.5rem; margin-bottom: 8px; }
p { line-height: 1.5; }

/* Cabecera */
.topbar {
  background: var(--color-navy);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top)) 20px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo { height: 40px; width: auto; display: block; }
.topbar-text { flex: 1; min-width: 0; }
.eyebrow {
  display: block;
  font-family: var(--font-label);
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.7);
}
.topbar h1 { font-size: 1.35rem; line-height: 1.2; }
.badge {
  font-family: var(--font-label);
  font-size: .65rem;
  letter-spacing: .08em;
  background: var(--color-blue);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* Pantallas de estado */
.screen { padding: 56px 24px; flex: 1; }
.screen p { color: var(--color-text-muted); }

/* Pestañas */
main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; }
.tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 20;
}
.tab {
  flex: 1;
  padding: 14px 8px;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  font: 600 .95rem var(--font-body);
  color: var(--color-text-muted);
  cursor: pointer;
}
.tab.active { color: var(--color-navy); border-bottom-color: var(--color-blue); }
.panel { padding: 20px 16px 32px; }

/* Acciones de subida */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.action-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.action-card:active { transform: scale(.98); box-shadow: var(--shadow-md); }
.action-card.wide { grid-column: 1 / -1; flex-direction: row; text-align: left; padding: 16px 18px; }
.action-card.wide .action-icon { margin-right: 10px; }
.action-card.wide .action-title { display: block; }
.action-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--color-light-blue);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.action-icon svg { width: 28px; height: 28px; fill: var(--color-navy); }
.action-title { font-weight: 600; font-size: 1rem; }
.action-sub { font-size: .78rem; color: var(--color-text-muted); }
.action-card.wide > span:not(.action-icon) { display: block; }
.action-card.wide .action-title + .action-sub { margin-left: 0; }
.action-card.wide { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 2px; align-items: center; }
.action-card.wide .action-icon { grid-row: 1 / span 2; margin: 0; }

/* Cola de subidas */
.queue { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.q-item {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
}
.q-thumb {
  width: 56px; height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--color-light-blue);
  display: block;
}
.q-name { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-status { font-size: .75rem; color: var(--color-text-muted); margin-top: 2px; }
.q-item.done .q-status { color: var(--color-green); font-weight: 600; }
.q-item.error .q-status { color: var(--color-error); font-weight: 600; }
.q-bar { height: 6px; background: var(--color-bg-soft); border-radius: var(--radius-pill); margin-top: 6px; overflow: hidden; }
.q-bar > span { display: block; height: 100%; width: 0; background: var(--color-blue); transition: width .2s; }
.q-item.done .q-bar > span { background: var(--color-green); }
.q-item.error .q-bar > span { background: var(--color-error); }
.q-retry {
  margin-top: 6px;
  font: 600 .75rem var(--font-body);
  color: var(--color-blue);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.summary { margin: 14px 0 0; font-size: .9rem; text-align: center; }
.privacy {
  margin: 28px 0 0;
  font-size: .75rem;
  color: var(--color-text-muted);
  text-align: center;
}

/* Botones */
.btn {
  font: 600 .9rem var(--font-body);
  padding: 10px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--color-blue); color: #fff; }
.btn-ghost { background: #fff; color: var(--color-navy); border-color: var(--color-border); padding: 7px 16px; font-size: .8rem; }

/* Galería */
.gallery-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: .8rem; }
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 6px; } }
.g-item {
  position: relative;
  aspect-ratio: 1;
  background: var(--color-light-blue);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  padding: 0; border: 0;
}
.g-item img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .25s; }
.g-item img.loaded { opacity: 1; }
.g-item .play {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
}
.g-item .play::after {
  content: "";
  width: 0; height: 0;
  border-style: solid;
  border-width: 11px 0 11px 19px;
  border-color: transparent transparent transparent #fff;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.5));
  margin-left: 4px;
}
.sentinel { height: 1px; }
#grid-loading { padding: 20px; }

/* Visor */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 15, 30, .96);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.lb-content { width: 100%; height: 100%; display: grid; place-items: center; }
.lb-content img, .lb-content video {
  max-width: 100%;
  max-height: calc(100% - 24px);
  object-fit: contain;
  display: block;
}
.lb-close, .lb-nav {
  position: absolute;
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 0;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 28px; line-height: 44px;
  cursor: pointer;
  z-index: 2;
}
.lb-close { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.lb-nav { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }
.lb-caption {
  position: absolute; bottom: calc(12px + env(safe-area-inset-bottom)); left: 0; right: 0;
  text-align: center;
  color: rgba(255,255,255,.7);
  font-family: var(--font-label);
  font-size: .75rem;
}

/* Pie */
.footer { padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); text-align: center; }
.footer-logo { height: 28px; opacity: .8; }

/* Spinner */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--color-light-blue);
  border-top-color: var(--color-blue);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin .8s linear infinite;
}
.spinner.small { width: 24px; height: 24px; border-width: 2px; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
