/* ============================================
   CONTADOR DE ANIMALES — Premium iOS PWA
   ============================================ */

:root {
    --bg-primary: #0a0a1a;
    --bg-card: rgba(255, 255, 255, 0.06);
    --bg-card-hover: rgba(255, 255, 255, 0.1);
    --bg-modal: rgba(20, 20, 40, 0.97);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.55);
    --text-tertiary: rgba(255, 255, 255, 0.35);
    --accent: #4f8cff;
    --accent-glow: rgba(79, 140, 255, 0.3);
    --green: #34d399;
    --green-bg: rgba(52, 211, 153, 0.12);
    --red: #f87171;
    --red-bg: rgba(248, 113, 113, 0.12);
    --orange: #fb923c;
    --border: rgba(255, 255, 255, 0.08);
    --radius: 18px;
    --radius-sm: 12px;
    --header-height: 64px;
    --tab-height: 82px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

html,
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    display: flex;
    flex-direction: column;
    padding-top: calc(var(--header-height) + var(--safe-top));
    padding-bottom: calc(var(--tab-height) + var(--safe-bottom));
}

/* ===== HEADER ===== */
#appHeader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: calc(var(--header-height) + var(--safe-top));
    padding-top: var(--safe-top);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
    padding-right: 16px;
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

#headerTitle {
    font-size: 20px;
    font-weight: 700;
    flex: 1;
    text-align: center;
    letter-spacing: -0.3px;
}

.header-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--accent);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.header-btn:active {
    background: rgba(79, 140, 255, 0.15);
}

.header-btn-add {
    background: rgba(79, 140, 255, 0.15);
    position: relative;
}

/* ===== LOGO ===== */
.header-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: contain;
    margin-right: -4px;
}

.welcome-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 16px;
    border-radius: 16px;
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

/* ===== LOGIN SCREEN ===== */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 20px 24px;
    text-align: center;
    width: 100%;
}

.login-logo {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    object-fit: contain;
    margin-bottom: 20px;
    animation: logoPulse 3s ease-in-out infinite;
}

.login-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 6px;
    letter-spacing: -0.5px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 32px;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 300px;
    padding: 14px 20px;
    background: white;
    color: #333;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-google:active {
    transform: scale(0.97);
}

.btn-google:hover {
    box-shadow: 0 4px 20px rgba(66, 133, 244, 0.3);
}

.login-divider {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 300px;
    margin: 24px 0;
    color: var(--text-tertiary);
    font-size: 13px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login-divider span {
    padding: 0 14px;
}

.login-form {
    width: 100%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.login-form input:focus {
    border-color: var(--accent);
}

.login-form input::placeholder {
    color: var(--text-tertiary);
}

.login-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s;
}

.login-btn:active {
    transform: scale(0.97);
}

.login-btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.login-btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.login-error {
    color: #ff6b6b;
    font-size: 13px;
    margin-top: 16px;
    min-height: 20px;
}

/* ===== ADMIN PANEL ===== */
.admin-header {
    text-align: center;
    padding: 16px 0 8px;
}

.admin-header h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.admin-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.admin-user-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-user-info {
    flex: 1;
    min-width: 0;
}

.admin-user-email {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-user-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.plan-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-badge.free {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.plan-badge.pro {
    background: rgba(52, 199, 89, 0.15);
    color: #34c759;
}

.plan-badge.admin {
    background: rgba(255, 204, 0, 0.15);
    color: #ffcc00;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-secondary);
    border-radius: 28px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked+.toggle-slider {
    background: #34c759;
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(22px);
}

/* ===== UPGRADE MODAL ===== */
.upgrade-modal {
    text-align: center;
}

.upgrade-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.upgrade-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 8px 0 16px;
}

.upgrade-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    text-align: left;
}

.upgrade-features li {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}

.upgrade-features li:last-child {
    border-bottom: none;
}

/* ===== SUBSCRIPTION PLANS ===== */
.plan-selector {
    display: flex;
    gap: 12px;
    margin: 20px 0;
}

.plan-option {
    flex: 1;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
    overflow: hidden;
}

.plan-option.selected {
    border-color: #34c759;
    background: rgba(52, 199, 89, 0.05);
}

.plan-option-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.plan-option.selected .plan-option-label {
    color: #34c759;
}

.plan-option-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 4px 0;
}

.plan-option-period {
    font-size: 12px;
    color: var(--text-tertiary);
}

.plan-option-save {
    font-size: 10px;
    font-weight: 700;
    color: #ff9500;
    margin-top: 6px;
    background: rgba(255, 149, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ===== CARD FORM ===== */
.card-form {
    margin-top: 16px;
    text-align: left;
}

.card-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.card-form-row {
    margin-bottom: 12px;
}

.card-form-row-half {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.card-form-col {
    flex: 1;
}

.expiry-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
}

.expiry-inputs input {
    flex: 1;
    text-align: center;
}

.expiry-separator {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 600;
}

.upgrade-step {
    animation: fadeInStep 0.25s ease;
}

@keyframes fadeInStep {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.step2-header {
    text-align: center;
    margin-bottom: 8px;
}

.step2-header h2 {
    margin: 8px 0 4px;
}

.step2-plan-summary {
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    margin: 0 0 6px;
}

.btn-back {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.2s;
}

.btn-back:hover {
    color: var(--text-primary);
}

.card-form input[type="text"],
.card-form input[type="email"],
.card-form select {
    width: 100%;
    background: var(--bg-primary);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text-primary);
    box-sizing: border-box;
    outline: none;
    transition: border 0.2s;
}

.card-form input:focus,
.card-form select:focus {
    border-color: var(--primary);
}

.payment-error {
    background: rgba(255, 69, 58, 0.1);
    color: #ff453a;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
    text-align: center;
}

/* ===== SIDEBAR ===== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 80vw;
    height: 100%;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
}

.sidebar-overlay.open .sidebar {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.sidebar-app-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sidebar-user-email {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-plan {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
    width: fit-content;
    color: #fff;
    background: var(--text-tertiary);
}

.sidebar-user-plan.pro {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: #1a1a1a;
}

.sidebar-user-plan.admin {
    background: linear-gradient(135deg, #9C27B0, #6A1B9A);
}

.sidebar-menu {
    flex: 1;
    padding: 12px 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 20px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.sidebar-item:active {
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-item.active {
    color: var(--accent);
    background: rgba(79, 140, 255, 0.08);
    font-weight: 600;
}

.sidebar-item-icon {
    font-size: 20px;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 8px 0;
}

.sidebar-logout {
    color: var(--red) !important;
}

.sidebar-upgrade {
    color: #FFD700 !important;
    font-weight: 600;
}

.sidebar-locked {
    opacity: 0.45;
    position: relative;
}

.sidebar-locked.unlocked {
    opacity: 1;
}

.sidebar-locked.unlocked .sidebar-lock-badge {
    display: none;
}

.sidebar-lock-badge {
    font-size: 12px;
    margin-left: auto;
}

.feature-card.coming-soon.unlocked {
    opacity: 1;
    cursor: pointer;
}

.feature-card.coming-soon.unlocked .feature-card-badge {
    display: none;
}

/* ===== PLAN COMPARISON ===== */
.plan-comparison {
    display: flex;
    gap: 10px;
    margin: 16px 0;
}

.plan-col {
    flex: 1;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--border);
}

.plan-col-free {
    background: rgba(255, 255, 255, 0.03);
}

.plan-col-pro {
    background: rgba(255, 215, 0, 0.06);
    border-color: rgba(255, 215, 0, 0.25);
}

.plan-col-header {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.plan-col-pro .plan-col-header {
    color: #FFD700;
    border-color: rgba(255, 215, 0, 0.2);
}

.plan-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.plan-col ul li {
    font-size: 12px;
    padding: 4px 0;
    color: var(--text-secondary);
    line-height: 1.4;
}

.plan-col-pro ul li {
    color: var(--text-primary);
}

.plan-no {
    color: var(--red) !important;
    opacity: 0.7;
}

.plan-yes {
    color: var(--green) !important;
    font-weight: 600;
}

/* ===== HOME SCREEN ===== */
.home-greeting {
    text-align: center;
    padding: 32px 16px 24px;
}

.home-greeting h2 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.home-greeting p {
    color: var(--text-secondary);
    font-size: 16px;
}

.feature-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 4px;
}

.feature-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
    width: 100%;
    font-family: inherit;
    color: inherit;
}

.feature-card:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.08);
}

.feature-card.coming-soon {
    opacity: 0.5;
    cursor: default;
}

.feature-card.coming-soon:active {
    transform: none;
    background: rgba(255, 255, 255, 0.04);
}

.feature-card-icon {
    font-size: 36px;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 14px;
}

.feature-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.feature-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.feature-card-desc {
    font-size: 13px;
    color: var(--text-tertiary);
    line-height: 1.3;
}

.feature-card-arrow {
    flex-shrink: 0;
    color: var(--text-tertiary);
}

.feature-card-badge {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.view {
    display: none;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    padding-bottom: 24px;
}

.view.active {
    display: block;
}

/* Login view needs flex to center content vertically */
#viewLogin.active {
    display: flex;
    flex-direction: column;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 32px;
    animation: fadeInUp 0.6s ease;
}

.empty-icon {
    font-size: 72px;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

.empty-state h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.5;
}

/* ===== QUICK START BUTTONS ===== */
.quick-start-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 320px;
    margin: 20px 0 12px;
}

.quick-start-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 18px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
}

.quick-start-btn:active {
    transform: scale(0.97);
}

.quick-start-btn.cattle {
    border-color: rgba(76, 175, 80, 0.3);
    background: rgba(76, 175, 80, 0.08);
}

.quick-start-btn.cattle:active {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.5);
}

.quick-start-btn.general {
    border-color: rgba(79, 140, 255, 0.3);
    background: rgba(79, 140, 255, 0.08);
}

.quick-start-btn.general:active {
    background: rgba(79, 140, 255, 0.15);
    border-color: rgba(79, 140, 255, 0.5);
}

.quick-start-icon {
    font-size: 36px;
    line-height: 1;
}

.quick-start-label {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.quick-start-desc {
    font-size: 13px;
    color: var(--text-tertiary);
    line-height: 1.3;
}

.quick-start-hint {
    font-size: 13px !important;
    color: var(--text-tertiary) !important;
    margin-top: 4px;
}

/* ===== EMOJI BADGE (GANADO) ===== */
.emoji-option.cattle-emoji {
    position: relative;
    overflow: visible;
}

.emoji-badge {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 7px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #fff;
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    padding: 1px 5px;
    border-radius: 4px;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
}

/* ===== CATTLE HINT ===== */
.cattle-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 14px;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.25);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    animation: fadeInUp 0.3s ease;
}

.cattle-hint-prominent {
    background: rgba(255, 193, 7, 0.12);
    border: 2px solid rgba(255, 193, 7, 0.4);
    padding: 14px 16px;
    font-size: 13px;
}

.cattle-hint-icon {
    font-size: 24px;
    flex-shrink: 0;
}

/* ===== SYNC INDICATOR ===== */
.sync-indicator {
    font-size: 14px;
    opacity: 0.4;
    transition: all 0.3s ease;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.sync-indicator.synced {
    opacity: 1;
    filter: none;
}

.sync-indicator.syncing {
    opacity: 0.7;
    animation: pulse 1s infinite;
}

.sync-indicator.offline {
    opacity: 0.6;
    filter: grayscale(100%);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 0.3;
    }
}

/* ===== ADD BUTTON LABEL ===== */
.btn-add-label {
    font-size: 11px;
    font-weight: 700;
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    color: var(--accent);
    display: none;
}

/* ===== FREEMIUM USAGE ===== */
.freemium-usage {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
}

.freemium-usage-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.freemium-usage-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.freemium-usage-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ===== GROUP CARDS ===== */
.cards-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.group-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.4s ease backwards;
}

.group-card:active {
    transform: scale(0.98);
    background: var(--bg-card-hover);
}

.group-card-emoji {
    font-size: 42px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    flex-shrink: 0;
}

.group-card-info {
    flex: 1;
    min-width: 0;
}

.group-card-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}

.group-card-meta {
    color: var(--text-secondary);
    font-size: 14px;
}

.group-card-count {
    font-size: 32px;
    font-weight: 800;
    color: var(--accent);
    min-width: 50px;
    text-align: right;
    letter-spacing: -1px;
}

.group-card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.group-card:hover .group-card-actions,
.group-card:focus-within .group-card-actions {
    opacity: 1;
}

.card-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.card-action-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

.card-action-btn.delete {
    color: var(--red);
}

/* ===== GROUP DETAIL — TOTAL CARD ===== */
.group-total-card {
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.15) 0%, rgba(52, 211, 153, 0.1) 100%);
    border: 1px solid rgba(79, 140, 255, 0.2);
    border-radius: 24px;
    padding: 28px 24px;
    text-align: center;
    margin-bottom: 20px;
    animation: fadeInUp 0.4s ease;
}

.group-total-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.group-total-number {
    font-size: 96px;
    font-weight: 900;
    letter-spacing: -4px;
    line-height: 1;
    margin: 8px 0;
    background: linear-gradient(135deg, #4f8cff, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.group-total-sublabel {
    color: var(--text-tertiary);
    font-size: 14px;
    font-weight: 500;
}

/* ===== ANIMAL CARDS ===== */
.animal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeInUp 0.4s ease backwards;
    position: relative;
}

.animal-card-info {
    flex: 1;
    min-width: 0;
}

.animal-card-name {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 2px;
    letter-spacing: -0.2px;
}

.animal-card-delete {
    font-size: 12px;
    color: var(--text-tertiary);
    cursor: pointer;
    border: none;
    background: none;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.animal-card-delete:active {
    color: var(--red);
    background: var(--red-bg);
}

/* ===== ADVANCED FIELDS TOGGLE ===== */
.btn-advanced-toggle {
    display: block;
    width: 100%;
    padding: 10px 16px;
    margin-bottom: 16px;
    border: 1px dashed var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-tertiary);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-advanced-toggle:active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.advanced-fields {
    animation: fadeInUp 0.3s ease;
    padding: 16px;
    margin-bottom: 8px;
    background: rgba(79, 140, 255, 0.04);
    border: 1px solid rgba(79, 140, 255, 0.12);
    border-radius: var(--radius-sm);
}

/* ===== ANIMAL CARD ADVANCED INFO ===== */
.animal-card-advanced {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
    letter-spacing: 0.2px;
}

.animal-card {
    cursor: pointer;
    transition: all 0.2s ease;
}

.animal-card:active {
    transform: scale(0.98);
    background: var(--bg-card-hover);
}

.animal-counter {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.counter-btn {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 16px;
    font-size: 26px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
}

.counter-btn:active {
    transform: scale(0.9);
}

.counter-btn.minus {
    background: var(--red-bg);
    color: var(--red);
}

.counter-btn.minus:active {
    background: rgba(248, 113, 113, 0.25);
}

.counter-btn.minus.disabled,
.counter-btn.minus:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
}

.counter-btn.plus {
    background: var(--green-bg);
    color: var(--green);
}

.counter-btn.plus:active {
    background: rgba(52, 211, 153, 0.25);
}

.counter-value {
    font-size: 28px;
    font-weight: 800;
    min-width: 48px;
    text-align: center;
    letter-spacing: -1px;
}

/* ===== MEGA DETAIL VIEW ===== */
.mega-detail-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mega-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    animation: fadeInUp 0.4s ease backwards;
}

.mega-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.mega-group-emoji {
    font-size: 36px;
}

.mega-group-name {
    font-size: 20px;
    font-weight: 700;
    flex: 1;
    letter-spacing: -0.3px;
}

.mega-group-total {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -1px;
}

.mega-animal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.mega-animal-row:last-child {
    border-bottom: none;
}

.mega-animal-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
}

.mega-animal-count {
    font-size: 20px;
    font-weight: 700;
}

.mega-grand-total {
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.18) 0%, rgba(52, 211, 153, 0.12) 100%);
    border: 1px solid rgba(79, 140, 255, 0.2);
    border-radius: 24px;
    padding: 32px 24px;
    text-align: center;
    animation: fadeInUp 0.3s ease;
}

.mega-grand-total-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

.mega-grand-total-number {
    font-size: 80px;
    font-weight: 900;
    letter-spacing: -3px;
    background: linear-gradient(135deg, #4f8cff, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mega-grand-total-sub {
    color: var(--text-tertiary);
    font-size: 13px;
    margin-top: 4px;
}

.mega-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.mega-empty .empty-icon {
    font-size: 60px;
    margin-bottom: 16px;
}

/* ===== TAB BAR ===== */
#tabBar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: calc(var(--tab-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    display: flex;
    background: rgba(10, 10, 26, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    background: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: color 0.2s;
    padding: 8px 0;
}

.tab.active {
    color: var(--accent);
}

.tab svg {
    transition: transform 0.2s;
}

.tab.active svg {
    transform: scale(1.1);
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    padding-bottom: calc(16px + var(--safe-bottom));
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 28px 24px;
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-sm {
    padding: 24px;
}

.modal h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.3px;
}

.modal-field {
    margin-bottom: 20px;
}

.modal-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-field input[type="text"],
.modal-field input[type="number"],
.modal-field input[type="date"] {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 17px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.modal-field input:focus {
    border-color: var(--accent);
    background: rgba(79, 140, 255, 0.06);
}

.modal-field input::placeholder {
    color: var(--text-tertiary);
}

.modal p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Emoji Picker */
.emoji-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.emoji-option {
    width: 100%;
    aspect-ratio: 1;
    font-size: 28px;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.emoji-option:active {
    transform: scale(0.9);
}

.emoji-option.selected {
    border-color: var(--accent);
    background: rgba(79, 140, 255, 0.15);
}

/* Buttons */
.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    flex: 1;
    padding: 16px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:active {
    transform: scale(0.97);
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:active {
    background: #3a70d4;
}

.btn-danger {
    background: var(--red);
    color: #fff;
}

.btn-danger:active {
    background: #e05555;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: calc(var(--tab-height) + var(--safe-bottom) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 500;
    z-index: 300;
    pointer-events: none;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast-undo-btn {
    background: rgba(79, 140, 255, 0.25);
    color: var(--accent);
    border: 1px solid rgba(79, 140, 255, 0.4);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.toast-undo-btn:active {
    background: rgba(79, 140, 255, 0.4);
    transform: scale(0.95);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.count-animate {
    animation: pulse 0.2s ease;
}

/* ===== GROUP ACTIONS BAR ===== */
.group-actions-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: fadeInUp 0.3s ease;
}

.quick-add-config {
    animation: fadeIn 0.3s ease;
}

.counter-btn.plus-x {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    font-size: 14px;
    font-weight: 700;
    min-width: 42px;
    padding: 0 8px;
}

.counter-btn.plus-x:active {
    transform: scale(0.9);
}

.group-action-btn {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.group-action-btn:active {
    transform: scale(0.97);
    background: var(--bg-card-hover);
}

.history-btn {
    border-color: rgba(79, 140, 255, 0.2);
    background: rgba(79, 140, 255, 0.08);
    color: var(--accent);
}

.export-btn {
    border-color: rgba(52, 211, 153, 0.25);
    background: rgba(52, 211, 153, 0.08);
    color: var(--green);
}

.export-btn:active {
    background: rgba(52, 211, 153, 0.18);
}

.export-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.export-bar .export-btn {
    flex: none;
    padding: 10px 20px;
    font-size: 14px;
}

/* ===== SEX & SIZE PICKERS ===== */
.sex-picker,
.size-picker {
    display: flex;
    gap: 8px;
}

.sex-option,
.size-option {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.sex-option.selected,
.size-option.selected {
    border-color: var(--accent);
    background: rgba(79, 140, 255, 0.15);
    color: var(--text-primary);
}

.sex-option:active,
.size-option:active {
    transform: scale(0.97);
}

.modal-field-row {
    display: flex;
    gap: 12px;
}

.modal-field-row .modal-field {
    flex: 1;
}

/* ===== CATTLE TABLE ===== */
.cattle-stats {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    animation: fadeInUp 0.3s ease;
}

.cattle-stat {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 8px;
    text-align: center;
}

.cattle-stat-value {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.cattle-stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
    font-weight: 600;
}

.cattle-table {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    animation: fadeInUp 0.4s ease;
}

.cattle-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
}

.cattle-row {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: background 0.15s;
    animation: fadeInUp 0.3s ease backwards;
    position: relative;
}

.cattle-row:active {
    background: rgba(255, 255, 255, 0.06);
}

.cattle-row:last-child {
    border-bottom: none;
}

.cattle-col {
    font-size: 14px;
    font-weight: 500;
}

.cattle-col.caravana {
    flex: 2;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.2px;
}

.cattle-col.sexo {
    flex: 0 0 45px;
    text-align: center;
    font-weight: 700;
}

.cattle-col.sexo.macho {
    color: var(--accent);
}

.cattle-col.sexo.hembra {
    color: #f472b6;
}

.cattle-col.fecha {
    flex: 0 0 50px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.cattle-col.peso {
    flex: 0 0 55px;
    text-align: right;
    font-weight: 700;
    color: var(--green);
}

.cattle-delete {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    background: var(--red-bg);
    color: var(--red);
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.cattle-row:hover .cattle-delete,
.cattle-row:active .cattle-delete {
    opacity: 1;
}

/* Mobile: always show delete */
@media (hover: none) {
    .cattle-delete {
        opacity: 0.7;
    }
}

.locked-value {
    font-size: 32px;
    min-width: 60px;
}

/* ===== SCROLLBAR ===== */
.view::-webkit-scrollbar {
    width: 0;
}

/* ===== RESPONSIVE TWEAKS ===== */
@media (min-width: 500px) {
    .cards-list {
        max-width: 460px;
        margin: 0 auto;
    }

    .group-total-card,
    .mega-grand-total {
        max-width: 460px;
        margin-left: auto;
        margin-right: auto;
    }

    .mega-detail-content {
        max-width: 460px;
        margin: 0 auto;
    }

    .group-total-card {
        margin-bottom: 20px;
    }
}

/* ===== UPGRADE MODAL & CARD FORM ===== */
.upgrade-modal {
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
}

.upgrade-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 8px;
}

.upgrade-desc {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.upgrade-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.upgrade-features li {
    padding: 6px 0;
    font-size: 15px;
    color: var(--text-secondary);
}

.plan-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.plan-option {
    flex: 1;
    padding: 14px 12px;
    border: 2px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-family: inherit;
    color: var(--text-secondary);
    position: relative;
}

.plan-option.selected {
    border-color: var(--accent);
    background: rgba(79, 140, 255, 0.1);
    color: var(--text-primary);
}

.plan-option-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.plan-option-price {
    display: block;
    font-size: 22px;
    font-weight: 800;
}

.plan-option-period {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
}

.plan-option-save {
    display: block;
    font-size: 11px;
    color: var(--green);
    font-weight: 600;
    margin-top: 4px;
}

.step2-header {
    margin-bottom: 16px;
}

.step2-header h2 {
    margin-bottom: 4px;
}

.btn-back {
    border: none;
    background: none;
    color: var(--text-tertiary);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 0;
    margin-bottom: 8px;
}

.step2-plan-summary {
    font-size: 14px;
    color: var(--accent);
    font-weight: 600;
    margin: 0;
}

/* Card Form Layout */
.card-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card-form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-form-row label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-form-row-half {
    display: flex;
    gap: 10px;
}

.card-form-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-form-col label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* MercadoPago iframe containers */
.mp-iframe-container {
    height: 44px;
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.06);
    transition: border-color 0.2s, background 0.2s;
}

.mp-iframe-container:focus-within {
    border-color: var(--accent);
    background: rgba(79, 140, 255, 0.06);
}

.mp-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Card form inputs & selects */
.card-form input[type="text"],
.card-form input[type="email"] {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.card-form input[type="text"]:focus,
.card-form input[type="email"]:focus {
    border-color: var(--accent);
    background: rgba(79, 140, 255, 0.06);
}

.card-form input::placeholder {
    color: var(--text-tertiary);
}

.card-form select {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.2s;
}

.card-form select:focus {
    border-color: var(--accent);
}

/* Payment error */
.payment-error {
    background: var(--red-bg);
    color: var(--red);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(248, 113, 113, 0.2);
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 4px;
    border: none;
    border-radius: 2px;
    background: var(--border);
    appearance: none;
    -webkit-appearance: none;
}

.progress-bar::-webkit-progress-bar {
    background: var(--border);
    border-radius: 2px;
}

.progress-bar:indeterminate {
    background: linear-gradient(90deg, var(--border) 25%, var(--accent) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: progressIndeterminate 1.5s linear infinite;
}

@keyframes progressIndeterminate {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}

/* ===== ADMIN PANEL ===== */
.admin-header {
    padding: 20px 0;
    text-align: center;
}

.admin-subtitle {
    color: var(--text-tertiary);
    font-size: 14px;
    margin-top: 4px;
}

.admin-user-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: fadeInUp 0.3s ease backwards;
}

.admin-user-info {
    flex: 1;
    min-width: 0;
}

.admin-user-email {
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-user-meta {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.plan-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.plan-badge.free {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-tertiary);
}

.plan-badge.pro {
    background: rgba(52, 211, 153, 0.15);
    color: var(--green);
}

.plan-badge.admin {
    background: rgba(79, 140, 255, 0.15);
    color: var(--accent);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--text-tertiary);
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s;
}

input:checked+.toggle-slider {
    background: var(--green);
}

input:checked+.toggle-slider::before {
    transform: translateX(22px);
    background: #fff;
}

/* ===== SUGGESTION BADGE ===== */
.suggestion-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    line-height: 1;
    margin-left: 6px;
    animation: pulse 1.5s ease infinite;
}

.sidebar-item-with-badge {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== SUGGESTION CARDS ===== */
.suggestion-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    animation: fadeInUp 0.4s ease backwards;
    transition: all 0.2s;
}

.suggestion-card.unread {
    border-color: rgba(79, 140, 255, 0.4);
    background: rgba(79, 140, 255, 0.05);
}

.suggestion-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.suggestion-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.suggestion-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse 2s ease infinite;
}

.suggestion-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.suggestion-action-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.suggestion-action-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.12);
}

.suggestion-action-btn.delete:active {
    background: var(--red-bg);
}

.suggestion-card-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
    white-space: pre-wrap;
    word-break: break-word;
}

.suggestion-card-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-tertiary);
    flex-wrap: wrap;
}

/* ===== SUGGESTION MODAL TEXTAREA ===== */
.suggestion-textarea {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s, background 0.2s;
}

.suggestion-textarea:focus {
    border-color: var(--accent);
    background: rgba(79, 140, 255, 0.06);
}

.suggestion-textarea::placeholder {
    color: var(--text-tertiary);
}

/* ============================================
   DESKTOP / TABLET RESPONSIVE
   ============================================ */
@media (min-width: 768px) {

    /* --- Login: compact and centered on desktop --- */
    .login-container {
        padding: 10px 40px;
    }

    .login-logo {
        width: 64px;
        height: 64px;
        border-radius: 14px;
        margin-bottom: 12px;
    }

    .login-title {
        font-size: 22px;
        margin-bottom: 4px;
    }

    .login-subtitle {
        font-size: 13px;
        margin-bottom: 20px;
    }

    .btn-google {
        max-width: 340px;
        padding: 10px 20px;
        font-size: 14px;
    }

    .login-divider {
        max-width: 340px;
        margin: 16px 0;
    }

    .login-form {
        max-width: 340px;
        gap: 8px;
    }

    .login-form input {
        padding: 10px 14px;
        font-size: 14px;
    }

    .login-btn {
        padding: 10px;
        font-size: 14px;
    }

    /* --- Views get a centered max-width container --- */
    .view {
        max-width: 720px;
        margin-left: auto;
        margin-right: auto;
        padding: 24px 32px;
    }

    /* --- Header adapts --- */
    #appHeader {
        padding-left: 24px;
        padding-right: 24px;
    }

    /* --- Feature cards row on desktop --- */
    .feature-cards {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px;
    }

    .feature-card {
        flex: 1 1 calc(50% - 8px);
        min-width: 280px;
    }

    /* --- Modals wider on desktop --- */
    .modal {
        max-width: 480px;
        width: 90%;
    }

    /* --- Admin cards wider --- */
    .cards-list {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }

    /* --- Home greeting bigger text --- */
    .home-greeting h2 {
        font-size: 32px;
    }

    .home-greeting p {
        font-size: 18px;
    }
}