/* ── Botones ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    min-height: var(--touch);
    transition: background .15s, transform .08s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary,   .btn--primary   { background: var(--primary);  color: #fff; }
.btn-primary:hover, .btn--primary:hover { background: #235a3f; }
.btn-secondary, .btn--secondary { background: var(--bg);       color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover, .btn--secondary:hover { background: #eaeae4; }
.btn-danger,    .btn--danger    { background: var(--danger);   color: #fff; }
.btn-danger:hover, .btn--danger:hover { background: #c0303b; }
.btn-ghost,     .btn--ghost     { background: transparent;     color: var(--primary); }
.btn-ghost:hover, .btn--ghost:hover { background: var(--primary-xlt, #d8f3dc); }
.btn--outline   { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn--outline:hover { border-color: var(--primary); color: var(--primary); }
.btn--outline.active { border-color: var(--primary); background: var(--primary-xlt, #d8f3dc); color: var(--primary); }

.btn-sm, .btn--sm { padding: 6px 12px; font-size: 13px; min-height: 36px; }
.btn-lg, .btn--lg { padding: 14px 24px; font-size: 16px; }
.btn-full, .btn--full { width: 100%; }

/* ── Tarjetas ──────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    border: 1px solid var(--border);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.card-title { font-size: 15px; font-weight: 600; }

/* ── Badges / etiquetas ────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}
.badge-gestante,  .badge--gestante  { background: var(--primary-xlt, #d8f3dc); color: var(--primary); }
.badge-vacia,     .badge--vacia     { background: #eee;               color: var(--text-muted); }
.badge-baja,      .badge--baja      { background: var(--danger-lt);   color: var(--danger); }
.badge-pendiente, .badge--pendiente { background: var(--warning-lt);  color: #8a6e00; }
.badge-celo,      .badge--celo      { background: var(--accent-lt);   color: #a0520a; }
.badge--ok        { background: var(--primary-xlt, #d8f3dc); color: var(--primary); }
.badge--warning   { background: var(--warning-lt);  color: #8a6e00; }
.badge--danger    { background: var(--danger-lt);   color: var(--danger); }

/* Condición física */
.badge-condicion { background: var(--warning-lt); color: #8a6e00; }

/* Roles */
.badge-superadmin, .badge--rol-superadmin { background: #f3e8ff; color: #6b21a8; }
.badge-admin,      .badge--rol-admin      { background: var(--primary-xlt, #d8f3dc); color: var(--primary); }
.badge-user,       .badge--rol-user       { background: #e0f2fe; color: #0369a1; }

/* ── Formularios ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.form-control {
    display: block;
    width: 100%;
    padding: 11px 13px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: var(--font);
    outline: none;
    background: var(--surface);
    color: var(--text);
    transition: border-color .2s;
    min-height: var(--touch);
}
.form-control:focus { border-color: var(--green); }
select.form-control { cursor: pointer; }

.form-check { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.form-check input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; accent-color: var(--green); }
.form-check label { cursor: pointer; font-size: 14px; }

/* ── Tablas ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table, .tabla { width: 100%; border-collapse: collapse; background: var(--surface); }
.tabla--sm td, .tabla--sm th { padding: 8px 10px; font-size: 13px; }
.td-detalle { max-width: 220px; font-size: 12px; color: var(--text-muted); }
.td-actions { white-space: nowrap; }
.page-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
th {
    background: #f9f9f6;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafaf7; }

/* ── Modales ───────────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90dvh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-body    { padding: 20px; }
.modal-footer  { padding: 12px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }

.btn-modal-close {
    background: none; border: none; font-size: 22px;
    cursor: pointer; color: var(--text-muted); line-height: 1;
    width: var(--touch); height: var(--touch);
    display: flex; align-items: center; justify-content: center;
}

/* ── Bottom sheet (móvil) ──────────────────────────────────────────────────── */
.sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 400;
}
.sheet-overlay.open { display: block; }
.bottom-sheet {
    position: fixed;
    bottom: var(--nav-h);
    left: 0; right: 0;
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 16px 20px 24px;
    z-index: 401;
    transform: translateY(100%);
    transition: transform .25s;
    max-height: 80dvh;
    overflow-y: auto;
}
.bottom-sheet.open { transform: translateY(0); }

/* ── Paginación ────────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    padding: 16px 0;
}
.page-btn {
    min-width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    font-size: 14px;
    cursor: pointer;
}
.page-btn.active { background: var(--green); color: #fff; border-color: var(--green); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Stat cards (dashboard) ────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 16px;
    text-align: center;
}
.stat-value { font-size: 32px; font-weight: 700; color: var(--green); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ── Alert cards ───────────────────────────────────────────────────────────── */
.alert-card {
    background: var(--surface);
    border-radius: var(--radius);
    border-left: 4px solid var(--accent);
    padding: 12px 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.alert-card.alert-eco  { border-left-color: var(--warning); }
.alert-card.alert-celo { border-left-color: var(--accent); }
.alert-card-info { flex: 1; }
.alert-card-crotal { font-weight: 700; font-size: 15px; }
.alert-card-meta   { font-size: 13px; color: var(--text-muted); }
.alert-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 32px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
