/* Paleta tomada del logo de LMH Apps: azul marino profundo, azul acero y plata.
   Para cambiar la marca basta con editar las variables de :root. */
:root {
  color-scheme: light dark;
  --paper: #EEF1F6; --ink: #0A1830; --ink-soft: #4B5B73; --line: #CBD3E0; --card: #FFFFFF;
  --brand: #1E3F73; --brand-hover: #16305A; --brand-ink: #FFFFFF; --silver: #C8CED8;
  --pendiente: #8A5A00; --pendiente-bg: #F6EAD0;
  --enviado: #1F6B4A; --enviado-bg: #DCEEE5;
  --descartado: #9A3F36; --descartado-bg: #F3DCD8;
  --danger: #9A3F36;
  --radius: 8px; --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(10,24,48,.06), 0 6px 18px rgba(10,24,48,.07);
  --glow: radial-gradient(900px 360px at 50% -120px, rgba(30,63,115,.16), transparent 70%);
  --serif: Georgia, 'Times New Roman', serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #030E1F; --ink: #E6EBF4; --ink-soft: #9BA9BF; --line: #1B2D4A; --card: #0A1930;
    --brand: #7FA6E3; --brand-hover: #A3C0EE; --brand-ink: #030E1F; --silver: #C8CED8;
    --pendiente: #E0B05C; --pendiente-bg: #2E2410;
    --enviado: #6FD0A2; --enviado-bg: #0F2B22;
    --descartado: #E49A8B; --descartado-bg: #34191A; --danger: #E49A8B;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    --glow: radial-gradient(900px 360px at 50% -120px, rgba(79,120,196,.22), transparent 70%);
  }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #030E1F; --ink: #E6EBF4; --ink-soft: #9BA9BF; --line: #1B2D4A; --card: #0A1930;
  --brand: #7FA6E3; --brand-hover: #A3C0EE; --brand-ink: #030E1F; --silver: #C8CED8;
  --pendiente: #E0B05C; --pendiente-bg: #2E2410;
  --enviado: #6FD0A2; --enviado-bg: #0F2B22;
  --descartado: #E49A8B; --descartado-bg: #34191A; --danger: #E49A8B;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --glow: radial-gradient(900px 360px at 50% -120px, rgba(79,120,196,.22), transparent 70%);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--glow) no-repeat top center, var(--paper); background-attachment: scroll; color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 15px; line-height: 1.5;
  padding-top: env(safe-area-inset-top, 0); padding-bottom: env(safe-area-inset-bottom, 0);
}
a { color: inherit; }
.wrap { max-width: 860px; margin: 0 auto; padding: 24px 20px 60px; }
[hidden] { display: none !important; }

/* Cabecera */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 22px; text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand img { height: 42px; width: auto; border-radius: 10px; box-shadow: var(--shadow); }
.brand small { font-family: system-ui, sans-serif; font-size: 11px; color: var(--ink-soft); font-weight: 400; display: block; line-height: 1; margin-top: 2px; }
.top .right { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
nav.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
nav.tabs a { padding: 9px 14px; text-decoration: none; color: var(--ink-soft); font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
nav.tabs a:hover { color: var(--ink); }
nav.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); border-bottom-width: 3px; font-weight: 600; }
nav.tabs .n { font-size: 11px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; margin-left: 4px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; }
h1 { font-size: clamp(26px, 5vw, 36px); margin: 0 0 10px; }
h2 { font-size: 21px; margin: 0 0 6px; }
h3 { font-size: 16px; margin: 18px 0 6px; }
.sub { color: var(--ink-soft); max-width: 62ch; }
.muted { color: var(--ink-soft); font-size: 13px; }

/* Controles */
button, .btn {
  font: inherit; font-size: 13.5px; padding: 8px 13px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
button:hover, .btn:hover { border-color: var(--brand); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; box-shadow: var(--shadow); }
button.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
button.danger { color: var(--danger); border-color: var(--danger); }
button.link { border: none; background: none; padding: 0; text-decoration: underline; color: var(--ink-soft); }
button.arrep { border-color: var(--danger); color: var(--danger); font-weight: 600; }
button:disabled { opacity: .55; cursor: default; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-soft); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  font: inherit; font-size: 14px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink); width: 100%;
}
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
label.check, label.radio { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin: 8px 0; }
label.check input, label.radio input { margin-top: 3px; }
.row { display: grid; gap: 10px; grid-template-columns: 1fr 120px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.auth { max-width: 460px; margin: 5vh auto 0; }
.auth .brand-hero { display: block; width: min(300px, 70%); height: auto; margin: 0 auto 22px; border-radius: 16px; box-shadow: var(--shadow); }
.msg { font-size: 13.5px; padding: 8px 12px; border-left: 3px solid var(--line); margin: 12px 0; }
.msg.err { border-color: var(--danger); color: var(--danger); }
.msg.ok { border-color: var(--brand); }

/* Bloques y ofertas */
.status-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; margin-bottom: 14px; font-size: 13px; color: var(--ink-soft); }
.blocktabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.blocktabs button { border-radius: 999px; }
.blocktabs button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 999px; margin-right: 4px; color: var(--ink-soft); }
.tag.new { border-color: var(--brand); color: var(--brand); }
.tag.warn { border-color: var(--pendiente); color: var(--pendiente); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 14px; }
.chips a { font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; text-decoration: none; background: var(--card); }
.chips a:hover { border-color: var(--ink-soft); }
.item { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.item .info { flex: 1; min-width: 0; }
.item .titulo { font-weight: 600; }
.item .titulo a { text-decoration: none; }
.item .titulo a:hover { text-decoration: underline; }
.item .meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }
.item.descartado .titulo { text-decoration: line-through; color: var(--ink-soft); }
.item .extra { margin-top: 8px; display: grid; gap: 8px; grid-template-columns: 1fr 160px; }
.status { display: flex; gap: 4px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.status button { font-size: 12px; padding: 6px 9px; color: var(--ink-soft); }
.status button.active[data-s="pendiente"] { background: var(--pendiente-bg); color: var(--pendiente); border-color: var(--pendiente); }
.status button.active[data-s="enviado"] { background: var(--enviado-bg); color: var(--enviado); border-color: var(--enviado); }
.status button.active[data-s="descartado"] { background: var(--descartado-bg); color: var(--descartado); border-color: var(--descartado); }
.empty { padding: 28px 0; color: var(--ink-soft); }
form.add { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
form.add input { flex: 1 1 140px; width: auto; }

/* Modal / tutorial */
.overlay { position: fixed; inset: 0; background: rgba(3,14,31,.72); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--line); border-radius: var(--radius-lg); max-width: 520px; width: 100%; padding: 24px; max-height: 90vh; overflow: auto; }
.dots { display: flex; gap: 5px; margin: 14px 0; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--brand); }
.modal .actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; }

/* Manual */
details.manual { border-top: 1px solid var(--line); padding: 10px 0; }
details.manual summary { cursor: pointer; font-weight: 600; }
details.manual p, details.manual ul { color: var(--ink-soft); margin: 8px 0 0; }

footer.site { border-top: 1px solid var(--line); margin-top: 40px; padding-top: 16px; font-size: 12.5px; color: var(--ink-soft); display: flex; gap: 14px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
footer.site .links { display: flex; gap: 14px; flex-wrap: wrap; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } button, .btn { transition: none; } }
@media (max-width: 560px) { button, .btn { min-height: 40px; } .brand img { height: 36px; } .item { flex-direction: column; } .status { justify-content: flex-start; } .row { grid-template-columns: 1fr; } .item .extra { grid-template-columns: 1fr; } }

/* Interruptor de vista diurna / nocturna (ver theme.js) */
.theme-toggle {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 40;
  width: 44px; height: 44px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.theme-toggle:hover { color: var(--brand); border-color: var(--brand); }
@media print { .theme-toggle { display: none; } }

/* Pantalla de carga del celular: logo con animación hasta que aparece el inicio de sesión (ver hideSplash en app.js) */
#splash { display: none; }
@media (max-width: 700px) {
  #splash {
    position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
    background: #030E1F;
    transition: opacity .45s ease, visibility .45s ease;
    animation: splash-failsafe 0s 8s forwards;
  }
  #splash img { width: min(300px, 74vw); height: auto; animation: splash-logo .9s cubic-bezier(.2,.7,.2,1) both, splash-glow 2.4s ease-in-out .9s infinite; }
  #splash .bar { width: 132px; height: 3px; border-radius: 3px; background: rgba(200,206,216,.16); overflow: hidden; animation: splash-fade .6s .4s both; }
  #splash .bar i { display: block; width: 45%; height: 100%; border-radius: 3px; background: linear-gradient(90deg, transparent, #7FA6E3, #C8CED8); animation: splash-bar 1.2s ease-in-out infinite; }
  #splash.out { opacity: 0; visibility: hidden; pointer-events: none; }
  .auth { animation: rise .55s ease-out both; }
}
@keyframes splash-logo { from { opacity: 0; transform: scale(.88); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes splash-glow { 0%, 100% { filter: drop-shadow(0 0 0 rgba(127,166,227,0)); } 50% { filter: drop-shadow(0 0 18px rgba(127,166,227,.45)); } }
@keyframes splash-bar { from { transform: translateX(-110%); } to { transform: translateX(260%); } }
@keyframes splash-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes splash-failsafe { to { opacity: 0; visibility: hidden; pointer-events: none; } }
@media (prefers-reduced-motion: reduce) {
  #splash img, #splash .bar, #splash .bar i, .auth { animation: none; }
  #splash .bar i { width: 100%; }
}

/* Aviso de instalación (ver install.js) */
.install-banner {
  position: fixed; z-index: 45; left: 16px; bottom: 16px; width: min(340px, calc(100vw - 32px));
  display: grid; grid-template-columns: 44px 1fr; gap: 6px 12px; align-items: start;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 14px;
  animation: rise .45s ease-out both;
}
.install-banner img { width: 44px; height: 44px; border-radius: 10px; }
.install-banner strong { font-family: var(--serif); font-size: 16px; display: block; }
.install-banner p { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); }
.install-banner .act { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; justify-content: flex-end; }
.install-banner .act [hidden] { display: none; }
@media (max-width: 700px) {
  .install-banner { left: 12px; right: 12px; width: auto; bottom: max(12px, env(safe-area-inset-bottom)); }
  body.has-install .theme-toggle { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 150px); }
  body.has-install .wrap { padding-bottom: 190px; }
}
@media (prefers-reduced-motion: reduce) { .install-banner { animation: none; } }
@media print { .install-banner { display: none; } }

/* Suscripción */
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; border-left: 4px solid var(--brand); }
.paywall .price { font-family: var(--serif); font-size: 34px; margin: 6px 0 14px; }
