/* Inventario Digital de Especies — estilos */
:root {
  --bg: #080b12;
  --bg-green: #08181a;
  --card: #0a1618;
  --teal: #1b3d40;
  --yellow: #ffd400;
  --ink: #c9d6df;
  --muted: #8ea0ab;
  --beige: #dcc4a0;
  --white: #f4f8fb;
  --ok: #3f7a1f;
  --warn: #8a5a00;
  --danger: #ff7b7b;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --sans: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --cond: 'Open Sans Condensed', 'Open Sans', sans-serif;
  --display: 'PT Sans', 'Open Sans', system-ui, sans-serif;
  --gutter: clamp(20px, 5.5vw, 81px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
}
body.tone-green { background: var(--bg-green); }
img { max-width: 100%; display: block; }
a { color: var(--yellow); }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--yellow); color: #000; padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 0; }

/* ---------- Tipografía de marca ---------- */
.brand-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(30px, 4.6vw, 52px);
  line-height: 1;
  letter-spacing: -.01em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
}
.brand-sub {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(14px, 1.5vw, 19px);
  text-transform: uppercase;
  color: var(--ink);
  margin: 4px 0 0;
}
.brand-link { text-decoration: none; color: inherit; display: block; }

/* enlaces con flecha, estilo del diseño */
.arrow, .btn {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(17px, 2vw, 25px);
  color: var(--yellow);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.arrow::before, .btn::before { content: '→ '; content: '→ ' / ''; }
.arrow.end::before, .btn.end::before { content: none; }
.arrow.end::after, .btn.end::after { content: ' ←'; content: ' ←' / ''; }
.arrow.plain, .btn.plain { color: var(--ink); }
.arrow:hover, .btn:hover { text-decoration: underline; text-underline-offset: 5px; }
.btn { font-size: clamp(16px, 1.6vw, 20px); }
.btn.danger { color: var(--danger); }
.btn.small { font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: wait; }

/* ---------- Contenedores ---------- */
.page { padding: clamp(36px, 6vw, 80px) var(--gutter) 80px; max-width: 1456px; margin: 0 auto; }
.page-head {
  display: flex; gap: 24px 48px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap;
  margin-bottom: 32px;
}
.page-head nav { display: flex; flex-direction: column; gap: 10px; }
.section-title { font-family: var(--mono); font-weight: 700; font-size: clamp(22px, 2.6vw, 30px); color: var(--white); margin: 0; }
.row { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 28px; }
.muted { color: var(--muted); }
.empty { padding: 48px 0; font-family: var(--mono); color: var(--muted); }

/* ---------- Inicio ---------- */
.banner {
  height: clamp(150px, 22vw, 253px);
  border-radius: 2px;
  margin: 12px 0 28px;
  background:
    url('/assets/banner.jpg') center / cover no-repeat,
    radial-gradient(circle at 78% 42%, #c4651f 0 2.2%, #070707 2.4% 4.2%, #d6ee3a 4.4% 6.4%, transparent 6.6%),
    repeating-linear-gradient(115deg, rgba(255,255,255,.07) 0 2px, transparent 2px 14px),
    linear-gradient(100deg, #3e8d4a 0%, #8bd24a 28%, #7ad0b4 55%, #0d5560 85%, #031c20 100%);
}
.menu { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.menu-spacer { height: clamp(36px, 7vw, 90px); }
.menu-split { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* ---------- Tarjetas de especie (públicas) ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 32px 30px; }
.sp-card {
  display: block; text-decoration: none; background: var(--card);
  border-radius: 16px; padding: 12px 12px 14px;
  transition: transform .15s, box-shadow .15s;
}
.sp-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.thumb {
  width: 100%; aspect-ratio: 252 / 178; border-radius: 14px; background: #000 center / cover no-repeat;
  display: grid; place-items: center; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb svg { width: 38%; height: auto; color: #3a4a50; }
.sp-name { font-family: var(--sans); font-weight: 700; font-size: 24px; line-height: 1.2; color: var(--beige); margin: 12px 4px 0; }
.sp-sci { font-family: var(--cond); font-style: italic; font-weight: 300; font-size: 22px; color: var(--beige); margin: 0 4px; }

/* ---------- Tarjetas de especie (panel) ---------- */
.admin-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 40px 44px; }
.ad-card { display: flex; gap: 16px; background: var(--card); border-radius: 16px; padding: 12px; align-items: stretch; }
.ad-card .thumb { width: 252px; flex: none; align-self: flex-start; }
.ad-info { display: flex; flex-direction: column; gap: 4px; padding: 6px 4px; min-width: 0; }
.ad-info .sp-name, .ad-info .sp-sci { margin: 0; overflow-wrap: anywhere; }
.ad-state { font-family: var(--cond); font-weight: 300; font-size: 17px; color: var(--beige); margin-top: 8px; }
.ad-actions { display: flex; gap: 20px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
@media (max-width: 520px) { .ad-card { flex-direction: column; } .ad-card .thumb { width: 100%; } }

.badge {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  background: #fff; color: var(--ok); font-family: var(--cond); font-weight: 700; font-size: 15px;
  text-transform: uppercase; border-radius: 99px; padding: 1px 12px 1px 3px; line-height: 22px;
}
.badge::before {
  content: '✓'; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: #62b946; color: #fff; font-size: 13px; font-family: var(--sans);
}
.badge.pending { color: var(--warn); }
.badge.pending::before { content: '!'; background: #e2a21b; }

/* ---------- Barra de administración ---------- */
.admin-bar { display: flex; flex-wrap: wrap; background: var(--teal); min-height: 89px; }
.admin-bar .brand { background: #000; display: flex; align-items: center; padding: 0 36px; min-width: 261px; }
.admin-bar .brand a { font-family: var(--mono); font-weight: 700; font-size: 28px; color: #fff; text-decoration: none; }
.admin-bar .brand a::before { content: '→ '; content: '→ ' / ''; }
.admin-bar .brand a::after { content: ' ←'; content: ' ←' / ''; }
.admin-bar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px clamp(20px, 3.6vw, 52px); padding: 14px clamp(20px, 3vw, 44px); flex: 1; justify-content: space-between; }
.admin-bar nav a, .admin-bar nav button {
  font-family: var(--mono); font-weight: 700; font-size: 20px; color: var(--yellow); text-decoration: none;
  background: none; border: 0; cursor: pointer; padding: 0;
}
.admin-bar nav a::before, .admin-bar nav button::before { content: '→ '; content: '→ ' / ''; font-size: .85em; }
.admin-bar nav a[aria-current='page'] { color: #fff; }
.admin-bar nav a:hover, .admin-bar nav button:hover { text-decoration: underline; text-underline-offset: 5px; }

/* ---------- Panel ---------- */
.welcome { font-family: var(--mono); font-weight: 500; font-size: clamp(18px, 2vw, 24px); color: #fff; margin: 0; }
.welcome-name { font-family: var(--mono); font-weight: 500; font-size: clamp(36px, 5vw, 62px); color: #fff; margin: 0 0 clamp(32px, 6vw, 80px); line-height: 1.1; text-transform: uppercase; overflow-wrap: anywhere; }
.panel-banner { font-family: var(--mono); font-weight: 700; font-size: clamp(20px, 3.1vw, 44px); text-transform: uppercase; color: var(--yellow); text-align: center; margin: 0 0 clamp(32px, 6vw, 80px); line-height: 1.35; }
.today { font-family: var(--mono); font-weight: 500; font-size: clamp(16px, 1.9vw, 24px); color: #fff; margin: 0; }
.clock { font-family: var(--mono); font-weight: 500; font-size: clamp(54px, 9vw, 120px); color: #fff; line-height: 1.1; margin: 0; font-variant-numeric: tabular-nums; }
.stats { display: flex; flex-wrap: wrap; gap: 14px 40px; margin-top: 36px; font-family: var(--mono); color: var(--muted); }
.stats b { color: var(--yellow); font-size: 1.4em; margin-right: 6px; }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: minmax(220px, 398px) 1fr; gap: 28px 54px; align-items: stretch; }
@media (max-width: 860px) { .form-grid { grid-template-columns: 1fr; } }
.white-card { background: var(--white); color: #000; border-radius: 16px; padding: clamp(18px, 3vw, 44px) clamp(18px, 3vw, 46px); }
.img-tile {
  position: relative; display: grid; place-items: center; min-height: 260px; cursor: pointer; overflow: hidden;
  padding: 0; border: 0; width: 100%; font: inherit;
}
.img-tile svg { width: 56%; height: auto; color: #000; }
.img-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.img-tile .hint {
  position: absolute; left: 10px; right: 10px; bottom: 10px; background: rgba(0,0,0,.78); color: #fff;
  font: 500 14px var(--mono); padding: 6px 10px; border-radius: 8px; text-align: center;
}
.big-input {
  display: block; width: 100%; border: 0; background: transparent; color: #000; padding: 0 0 4px; margin: 0;
  border-bottom: 2px dashed transparent; font-family: var(--sans);
}
.big-input:hover, .big-input:focus { border-bottom-color: #9fb0b8; outline: none; }
.big-input.common { font-weight: 700; font-style: italic; font-size: clamp(28px, 4vw, 54px); line-height: 1.15; }
.big-input.sci { font-weight: 700; font-style: italic; font-size: clamp(18px, 2vw, 26px); margin-top: 4px; }
.big-input::placeholder { color: #000; opacity: .5; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label { font-family: var(--mono); font-size: 14px; font-weight: 500; color: #4a5a63; }
.white-card .field > span { color: #4a5a63; }
.dark-card { background: var(--card); border-radius: 16px; padding: clamp(18px, 3vw, 36px); }
.dark-card .field > span, .dark-card .field-label { color: var(--muted); }
input[type='text'], input[type='password'], input[type='search'], select, textarea {
  font: 400 16px var(--sans); color: #000; background: #fff; border: 1.5px solid #b9c7ce; border-radius: 10px; padding: 10px 12px; width: 100%;
}
.dark-card input[type='text'], .dark-card input[type='password'], .dark-card select, .dark-card textarea { background: #0e2124; color: var(--ink); border-color: #2d4a4e; }
.dark-card input::placeholder, .dark-card textarea::placeholder { color: #62777d; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--yellow); outline-offset: 1px; }
.tax-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px 20px; margin-top: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 32px; margin-top: 36px; align-items: center; }
.form-actions .btn { font-size: clamp(20px, 2.2vw, 28px); }
.stack { display: flex; flex-direction: column; gap: 28px; }
.error-msg { color: var(--danger); font-family: var(--mono); font-size: 15px; margin: 0; min-height: 1.2em; }
.check { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 15px; color: var(--ink); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--yellow); }
.search { max-width: 420px; background: #0e2124 !important; color: var(--ink) !important; border-color: #2d4a4e !important; font-family: var(--mono) !important; }

/* ---------- Ficha de especie / artículo ---------- */
.detail { display: grid; grid-template-columns: minmax(240px, 460px) 1fr; gap: 32px 56px; align-items: start; }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } }
.detail .thumb { aspect-ratio: 4/3; border-radius: 18px; }
.detail h1 { font-family: var(--sans); font-weight: 700; font-size: clamp(32px, 4.4vw, 56px); line-height: 1.1; color: var(--beige); margin: 0; }
.detail .sci { font-family: var(--cond); font-style: italic; font-weight: 300; font-size: clamp(24px, 3vw, 36px); color: var(--beige); margin: 4px 0 14px; }
.taxa { display: grid; grid-template-columns: max-content 1fr; gap: 6px 22px; margin: 24px 0 0; padding: 18px 22px; background: var(--card); border-radius: 14px; font-size: 16px; }
.taxa dt { font-family: var(--mono); font-size: 14px; color: var(--muted); text-transform: uppercase; align-self: center; }
.taxa dd { margin: 0; font-weight: 600; color: var(--ink); }
.taxa dd.sci-name { font-style: italic; }
.subhead { font-family: var(--mono); font-weight: 700; font-size: 22px; color: var(--white); margin: 44px 0 16px; }
.list-cards { display: grid; gap: 18px; }
.item-card { background: var(--card); border-radius: 14px; padding: 18px 22px; display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.item-card h3 { margin: 0; font-family: var(--sans); font-size: 20px; color: var(--beige); }
.item-card p { margin: 4px 0 0; color: var(--ink); }
.item-card .meta { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-top: 6px; }
.item-card .acts { display: flex; gap: 20px; flex-wrap: wrap; }
.tag { font-family: var(--mono); font-size: 12px; text-transform: uppercase; color: #000; background: var(--yellow); border-radius: 6px; padding: 2px 8px; margin-right: 8px; vertical-align: middle; }
.tabs { display: flex; gap: 12px 28px; flex-wrap: wrap; margin-bottom: 28px; }
.tabs button { font-family: var(--mono); font-weight: 700; font-size: 18px; background: none; border: 0; border-bottom: 3px solid transparent; color: var(--muted); cursor: pointer; padding: 4px 0; }
.tabs button[aria-pressed='true'] { color: var(--yellow); border-bottom-color: var(--yellow); }
.articles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px; }
.art-card { display: flex; flex-direction: column; background: var(--card); border-radius: 16px; padding: 12px 12px 18px; text-decoration: none; color: var(--ink); }
.art-card .thumb { aspect-ratio: 16/9; }
.art-card h3 { font-family: var(--sans); font-size: 22px; color: var(--beige); margin: 14px 6px 4px; line-height: 1.25; }
.art-card p { margin: 0 6px; }
.art-card .meta { font-family: var(--mono); font-size: 13px; color: var(--muted); margin: 10px 6px 0; }
.article { max-width: 820px; }
.article h1 { font-family: var(--sans); font-weight: 700; font-size: clamp(30px, 4vw, 48px); line-height: 1.15; color: var(--beige); margin: 0 0 8px; }
.article .meta { font-family: var(--mono); font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.article .cover { aspect-ratio: 16/9; border-radius: 16px; margin-bottom: 28px; }

/* ---------- Login ---------- */
.login-box { max-width: 460px; }
.login-box h2 { margin-top: 0; }

/* ---------- Editor Markdown ---------- */
.md-editor { border: 1.5px solid #b9c7ce; border-radius: 12px; overflow: hidden; background: #fff; color: #000; }
.md-bar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px 8px; background: #e8eef2; border-bottom: 1px solid #b9c7ce; }
.md-bar button { font: 600 14px var(--mono); min-width: 34px; height: 32px; border: 1px solid transparent; background: transparent; border-radius: 6px; cursor: pointer; color: #1c2a30; padding: 0 8px; }
.md-bar button:hover { background: #fff; border-color: #b9c7ce; }
.md-bar .sep { flex: 1; }
.md-bar .mode[aria-pressed='true'] { background: #1b3d40; color: #fff; }
.md-input { border: 0 !important; border-radius: 0 !important; min-height: 340px; resize: vertical; font: 400 15px/1.6 var(--mono) !important; display: block; }
.md-input:focus { outline-offset: -2px; }
.md-preview { min-height: 340px; padding: 18px 22px; background: #0c1417; color: var(--ink); }
.md-help { font-family: var(--mono); font-size: 13px; color: #4a5a63; margin: 8px 2px 0; }
.md-help a { color: #1b3d40; }
.dark-card .md-help { color: var(--muted); }
.dark-card .md-help a { color: var(--yellow); }

/* ---------- Markdown renderizado ---------- */
.md { color: var(--ink); font-size: 17px; line-height: 1.7; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { font-family: var(--sans); color: var(--white); line-height: 1.25; margin: 1.6em 0 .5em; }
.md h1 { font-size: 2em; } .md h2 { font-size: 1.55em; border-bottom: 1px solid #25393d; padding-bottom: .25em; } .md h3 { font-size: 1.25em; }
.md a { color: var(--yellow); text-underline-offset: 3px; }
.md img { border-radius: 12px; margin: 1em 0; height: auto; }
.md blockquote { margin: 1.2em 0; padding: .2em 1.2em; border-left: 4px solid var(--teal); background: rgba(27,61,64,.25); border-radius: 0 10px 10px 0; color: #b4c4cc; }
.md code { font-family: var(--mono); font-size: .88em; background: #14272b; padding: .15em .4em; border-radius: 6px; }
.md pre { background: #0d1117; border-radius: 12px; padding: 16px 18px; overflow: auto; }
.md pre code { background: none; padding: 0; font-size: .9em; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; margin: 1.2em 0; }
.md th, .md td { border: 1px solid #2d4a4e; padding: 8px 14px; }
.md th { background: #12292c; color: var(--white); }
.md tr:nth-child(even) td { background: rgba(255,255,255,.025); }
.md hr { border: 0; border-top: 1px solid #25393d; margin: 2em 0; }
.md ul.contains-task-list { list-style: none; padding-left: 1.2em; }
.md .task-list-item-checkbox { accent-color: var(--yellow); margin-right: .5em; }
.md mark { background: var(--yellow); color: #000; padding: 0 .25em; border-radius: 4px; }
.md dt { font-weight: 700; color: var(--white); margin-top: .8em; }
.md dd { margin-left: 1.6em; }
.md abbr[title] { text-decoration: underline dotted; cursor: help; }
.md .footnotes { font-size: .9em; color: var(--muted); }
.md .footnote-ref a, .md .footnote-backref { text-decoration: none; }
.md kbd { font-family: var(--mono); background: #14272b; border: 1px solid #2d4a4e; border-bottom-width: 2px; padding: .05em .4em; border-radius: 5px; font-size: .85em; }
.md details { background: #0e2124; border-radius: 10px; padding: .6em 1em; margin: 1em 0; }
.md summary { cursor: pointer; font-weight: 700; color: var(--white); }

/* ---------- Avisos ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 50; max-width: min(92vw, 420px); }
.toast { background: #12292c; color: #fff; border-left: 5px solid var(--yellow); border-radius: 10px; padding: 12px 16px; font-family: var(--mono); font-size: 15px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.toast.error { border-left-color: var(--danger); }
.loading { font-family: var(--mono); color: var(--muted); padding: 60px var(--gutter); }

/* ---------- Añadidos ---------- */
.banner.b2 {
  background:
    url('/assets/banner-2.jpg') center / cover no-repeat,
    linear-gradient(100deg, #3e8d4a 0%, #8bd24a 28%, #7ad0b4 55%, #0d5560 85%, #031c20 100%);
}
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; white-space: nowrap; }
.img-picker { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; align-self: start; width: 100%; }
.img-picker .img-card { width: 100%; display: flex; }
.img-card { padding: 0; overflow: hidden; }
.img-card .img-tile { background: transparent; min-height: 0; aspect-ratio: 437 / 388; }
.md-input[hidden], .md-preview[hidden] { display: none !important; }
.img-card .img-tile:hover .hint { background: #000; }
.modal { border: 1px solid #2d4a4e; color: var(--ink); width: min(92vw, 520px); padding: clamp(18px, 3vw, 32px); }
.modal::backdrop { background: rgba(0, 0, 0, .7); }
.modal .form-actions { margin-top: 20px; }
.btn[hidden] { display: none; }
select { appearance: auto; }
.row .search { flex: 1 1 280px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .admin-bar, #toasts { display: none; } body { background: #fff; color: #000; } }
