:root {
    --cp-primary: #1e3a5f;
    --cp-primary-dark: #0f2744;
    --cp-accent: #0ea5e9;
    --cp-accent-2: #14b8a6;
    --cp-bg: #e8f4fc;
    --cp-surface: rgba(255, 255, 255, 0.88);
    --cp-muted: #64748b;
    --cp-ok: #15803d;
    --cp-err: #b91c1c;
    --cp-radius: 16px;
    --cp-shadow: 0 12px 40px rgba(15, 39, 68, 0.1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Outfit, system-ui, sans-serif;
    color: var(--cp-primary-dark);
    background: linear-gradient(160deg, #dbeafe 0%, var(--cp-bg) 40%, #ecfdf5 100%);
}

a { color: inherit; text-decoration: none; }

.cp-header {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px clamp(16px, 4vw, 40px);
    background: linear-gradient(135deg, var(--cp-primary) 0%, #134e4a 100%);
    color: #ecfdf5;
}

.cp-header__icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 1.25rem;
}

.cp-header__brand {
    display: flex;
    gap: 14px;
    flex: 1 1 280px;
}

.cp-header__eyebrow {
    margin: 0 0 4px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.85;
}

.cp-header h1 {
    margin: 0;
    font-size: clamp(1.35rem, 3vw, 1.85rem);
    font-weight: 800;
}

.cp-header__desc {
    margin: 6px 0 0;
    font-size: 0.95rem;
    opacity: 0.9;
    max-width: 52ch;
}

.cp-header__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.cp-header__user {
    font-size: 0.92rem;
    opacity: 0.9;
    margin-right: 4px;
}

.cp-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px clamp(16px, 4vw, 32px) 48px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
    background: linear-gradient(135deg, var(--cp-accent), var(--cp-accent-2));
    color: #fff;
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.25);
}

.btn-soft {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

.cp-main .btn-soft {
    background: #fff;
    color: var(--cp-primary);
    border-color: rgba(30, 58, 95, 0.15);
}

.btn-ghost {
    background: transparent;
    color: inherit;
    border-color: rgba(255, 255, 255, 0.3);
}

.cp-main .btn-ghost {
    color: var(--cp-primary);
    border-color: rgba(30, 58, 95, 0.2);
}

.btn-success { background: #16a34a; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn.full { width: 100%; }

.panel {
    background: var(--cp-surface);
    border: 1px solid rgba(30, 58, 95, 0.1);
    border-radius: var(--cp-radius);
    padding: 20px 22px;
    box-shadow: var(--cp-shadow);
    margin-bottom: 20px;
}

.panel h2 { margin: 0 0 12px; font-size: 1.2rem; }

.hint {
    margin: 0 0 12px;
    color: var(--cp-muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.cp-flash {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 600;
}

.cp-flash--ok { background: #dcfce7; color: var(--cp-ok); }
.cp-flash--err { background: #fee2e2; color: var(--cp-err); }

.cp-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.cp-card {
    background: var(--cp-surface);
    border-radius: var(--cp-radius);
    overflow: hidden;
    border: 1px solid rgba(30, 58, 95, 0.1);
    box-shadow: var(--cp-shadow);
    display: flex;
    flex-direction: column;
}

.cp-card__cover {
    position: relative;
    aspect-ratio: 3/4;
    background: var(--cp-primary-dark);
    overflow: hidden;
}

.cp-card__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cp-card__body {
    padding: 16px 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.cp-card__tag {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--cp-accent);
}

.cp-card__body h3 { margin: 0; font-size: 1.15rem; }

.cp-card__body p {
    margin: 0;
    color: var(--cp-muted);
    font-size: 0.92rem;
    flex: 1;
}

.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.badge--pub { background: #bbf7d0; color: #166534; }
.badge--draft { background: #fde68a; color: #92400e; }

.cp-form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 16px;
}

.cp-form-grid label {
    display: grid;
    gap: 6px;
    font-weight: 600;
    font-size: 0.92rem;
}

.cp-form-grid input,
.cp-form-grid select,
.cp-form-grid textarea {
    font: inherit;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(30, 58, 95, 0.18);
    background: #fff;
}

.cp-form-grid__full { grid-column: 1 / -1; }

.cp-table-wrap { overflow-x: auto; }

.cp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.cp-table th,
.cp-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(30, 58, 95, 0.1);
    vertical-align: top;
}

.cp-table th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cp-muted);
}

.pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.pill--ok { background: #dcfce7; color: var(--cp-ok); }
.pill--off { background: #f1f5f9; color: var(--cp-muted); }

.cp-stats {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin-bottom: 20px;
}

.cp-stat {
    padding: 18px;
    border-radius: var(--cp-radius);
    background: var(--cp-surface);
    border: 1px solid rgba(30, 58, 95, 0.1);
}

.cp-stat__label {
    margin: 0 0 6px;
    font-size: 0.85rem;
    color: var(--cp-muted);
}

.cp-stat__value {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
}

.cp-login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.cp-login-card {
    width: min(100%, 420px);
    padding: 28px 24px;
    border-radius: 20px;
    background: var(--cp-surface);
    box-shadow: var(--cp-shadow);
    border: 1px solid rgba(30, 58, 95, 0.1);
}

.cp-login-card h1 { margin: 0 0 8px; font-size: 1.5rem; }

.cp-login-card label {
    display: grid;
    gap: 6px;
    margin-top: 14px;
    font-weight: 600;
}

.cp-login-card input {
    font: inherit;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(30, 58, 95, 0.18);
}

.cp-login-card .btn { margin-top: 18px; }

.cp-assign-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin: 12px 0 16px;
}

.cp-assign-card {
    display: flex;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(30, 58, 95, 0.14);
    background: #fff;
    cursor: pointer;
}

.cp-assign-card input { margin-top: 4px; width: auto; }

.cp-reader-hero {
    position: relative;
    border-radius: var(--cp-radius);
    overflow: hidden;
    min-height: 320px;
    margin-bottom: 24px;
    background: var(--cp-primary-dark);
}

.cp-reader-hero img {
    width: 100%;
    height: 100%;
    min-height: 320px;
    object-fit: cover;
    display: block;
}

.cp-reader-hero__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    background: linear-gradient(180deg, transparent 30%, rgba(15, 39, 68, 0.88));
    color: #fff;
}

.cp-reader-hero__overlay h2 {
    margin: 0 0 8px;
    font-size: clamp(1.5rem, 4vw, 2.2rem);
}

.cp-species { display: grid; gap: 20px; }

.cp-species-card {
    display: grid;
    gap: 16px;
    padding: 20px;
    border-radius: var(--cp-radius);
    background: var(--cp-surface);
    border: 1px solid rgba(30, 58, 95, 0.1);
}

@media (min-width: 720px) {
    .cp-species-card.has-image { grid-template-columns: 220px 1fr; }
}

.cp-species-card img {
    width: 100%;
    border-radius: 12px;
    aspect-ratio: 4/3;
    object-fit: cover;
    background: #f1f5f9;
}

.cp-species-card h3 { margin: 0 0 4px; }
.cp-species-card .sci { margin: 0 0 10px; color: var(--cp-muted); font-style: italic; }

.cp-activity {
    margin-top: 12px;
    padding: 12px;
    border-radius: 12px;
    background: #f0fdfa;
    border: 1px solid rgba(20, 184, 166, 0.2);
}

.cp-activity button { margin-top: 8px; margin-right: 8px; }

.cp-species-editor {
    border: 1px dashed rgba(30, 58, 95, 0.2);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
}

.hidden { display: none !important; }
.oculto { display: none !important; }
