:root {
    --primary:        #7c3aed;   /* morado principal */
    --primary-dark:   #6d28d9;   /* hover / activo */
    --primary-light:  #ede9fe;   /* fondos suaves morado */
    --green:          #10b981;   /* verde acción */
    --green-dark:     #059669;   /* verde hover */
    --green-light:    #d1fae5;   /* verde fondo suave */
    --nav-bg:         #ffffff;   /* nav blanco */
    --nav-link:       #6d28d9;
    --nav-link-hover: #1e1b2e;
    --subnav-bg:      #f5f3ff;   /* lavanda muy suave */
    --subnav-border:  #e9d5ff;
    --body-bg:        #f8f7ff;
    --text:           #1e1b2e;
    --muted:          #6b7280;
}

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

body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--body-bg);
    color: var(--text);
    line-height: 1.6;
}

/* ── Nav ── */
nav {
    background: var(--nav-bg);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 52px;
    gap: 0;
    overflow: visible;
    border-bottom: 1px solid #ede9fe;
    box-shadow: 0 1px 4px rgba(109,40,217,0.06);
}
.brand { color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none; flex-shrink: 0; display: flex; align-items: center; }
.brand-logo { height: 28px; width: auto; display: block; object-fit: contain; }
.plan-badge {
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.15rem 0.45rem; border-radius: 4px; flex-shrink: 0; margin-left: 0.5rem;
    position: relative; cursor: default;
}
.plan-badge--free  { background: #4c2889; color: #c4b5fd; }
.plan-badge--basic { background: var(--green-dark); color: #fff; }
.plan-badge--pro   { background: #f59e0b; color: #1c1003; }

/* Plan comparison tooltip */
.plan-tooltip {
    display: none;
    position: absolute; top: calc(100% + 10px); left: 0;
    background: #1a1030; border: 1px solid #4c2889;
    border-radius: 8px; padding: 0.75rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 9999; min-width: 320px;
    color: #e9e0ff; font-size: 0.78rem; font-weight: 400;
    text-transform: none; letter-spacing: 0;
    white-space: nowrap;
}
.plan-tooltip::before {
    content: ""; position: absolute; top: -6px; left: 12px;
    width: 10px; height: 10px; background: #1a1030;
    border-left: 1px solid #4c2889; border-top: 1px solid #4c2889;
    transform: rotate(45deg);
}
.plan-badge--has-tooltip:hover .plan-tooltip { display: block; }

.plan-table { border-collapse: collapse; width: 100%; }
.plan-table th, .plan-table td {
    padding: 0.35rem 0.65rem; text-align: center; border-bottom: 1px solid #2e1f50;
}
.plan-table th { font-weight: 700; font-size: 0.75rem; color: #a78bfa; padding-bottom: 0.5rem; }
.plan-table td:first-child { text-align: left; color: #c4b5fd; font-weight: 500; padding-left: 0; }
.plan-table tr:last-child td { border-bottom: none; }
/* active plan column */
.plan-col--active {
    background: rgba(124,58,237,0.25); color: #fff !important;
    font-weight: 700;
}
.plan-table thead .plan-col--active {
    color: #f59e0b !important;
    border-bottom: 2px solid #f59e0b;
}
/* ✓ / ✗ colors */
.plan-table td:not(:first-child) { color: #a78bfa; }
.plan-table td.plan-col--active { color: #fff; }
.nav-sep { width: 1px; height: 22px; background: #ddd6fe; margin: 0 1.25rem; flex-shrink: 0; }
.nav-username { color: #6d28d9; font-size: 0.85rem; font-weight: 600; flex-shrink: 0; }
.nav-links { display: flex; align-items: center; gap: 1.25rem; flex: 1; }
.nav-links a, .nav-right a { color: var(--nav-link); text-decoration: none; font-size: 0.9rem; }
.nav-links a:hover, .nav-right a:hover { color: var(--nav-link-hover); }
.nav-right { display: flex; align-items: center; gap: 1.25rem; margin-left: auto; }
.link-btn {
    background: none; border: none; color: var(--nav-link);
    cursor: pointer; font-size: 0.9rem; font-family: inherit; padding: 0;
}
.link-btn:hover { color: var(--nav-link-hover); }

/* ── Admin sub-nav ── */
.admin-subnav {
    background: var(--subnav-bg);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0;
    height: 38px;
    border-bottom: 1px solid var(--subnav-border);
}
.admin-subnav a {
    color: #6d28d9;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    border-bottom: 3px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.admin-subnav a:hover  { color: #1e1b2e; border-bottom-color: #7c3aed; }
.admin-subnav a.active { color: #1e1b2e; border-bottom-color: #7c3aed; }
.admin-subnav__title {
    color: #7c3aed;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0 0.75rem 0 0.25rem;
    flex-shrink: 0;
}
.admin-subnav__sep {
    width: 1px;
    height: 18px;
    background: rgba(0,0,0,0.12);
    margin-right: 0.25rem;
    flex-shrink: 0;
}

/* ── Layout ── */
main { max-width: min(96%, 1700px); margin: 2rem auto; padding: 0 1.5rem; }
.main--wide { max-width: min(96%, 1700px); margin: 2rem auto; padding: 0 1.5rem; }

.page-header { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; }
.page-header small { color: var(--muted); }

.event-table--full { width: 100%; }
.ev-detail--pre { white-space: pre-wrap; font-family: monospace; font-size: 0.78rem; max-width: none; word-break: break-all; }

/* ── Stats grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--muted); }

/* ── Auth box ── */
.auth-box {
    max-width: 400px; margin: 5rem auto;
    background: #fff; padding: 2rem 2.5rem;
    border-radius: 10px; box-shadow: 0 2px 12px rgba(0,0,0,0.10);
}
.auth-box h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.subtitle { color: #888; margin-bottom: 1.5rem; font-size: 0.9rem; }
.auth-alt { margin-top: 1.25rem; text-align: center; font-size: 0.9rem; }
.auth-alt a { color: var(--primary); font-weight: 600; }

/* ── Cards ── */
.card {
    background: #fff; border-radius: 10px;
    padding: 1.5rem; margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.card h2 { font-size: 1.1rem; margin-bottom: 1.1rem; color: #333; }

/* ── Alerts (inline, e.g. Telegram warning) ── */
.alert {
    padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1.25rem;
    font-size: 0.9rem; display: flex; align-items: flex-start; gap: 0.6rem;
}
.alert-warning  { background: #fff8e1; border: 1px solid #ffe082; color: #7a5c00; }
.alert-warning a { color: #7a5c00; font-weight: 600; }
.alert-success  { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.alert-error    { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-info     { background: #f0fdf9; border: 1px solid #6ee7b7; color: #065f46; }
.alert-dismiss {
    margin-left: auto; background: none; border: none; cursor: pointer;
    font-size: 1rem; opacity: 0.5; line-height: 1; padding: 0;
}
.alert-dismiss:hover { opacity: 1; }

/* ── Flash toast (top-left, no layout shift) ── */
@keyframes toast-in  { from { opacity:0; transform: translateY(-14px); } to { opacity:1; transform: translateY(0); } }
@keyframes toast-out { from { opacity:1; transform: translateY(0); }  to { opacity:0; transform: translateY(-14px); } }
.flash-toast {
    position: fixed; top: 4.5rem; left: 1.5rem; z-index: 8000;
    max-width: 420px; min-width: 260px;
    padding: 1rem 1.25rem; border-radius: 10px;
    font-size: 1rem; font-weight: 600;
    display: flex; align-items: center; gap: 0.75rem;
    box-shadow: 0 6px 28px rgba(0,0,0,0.28);
    border-left-width: 5px; border-left-style: solid;
    animation: toast-in 0.25s ease;
    cursor: default;
}
.flash-toast.toast-hiding { animation: toast-out 0.35s ease forwards; }
.flash-toast.alert-warning { background: #fffbeb; border-color: #f59e0b; color: #78350f; }
.flash-toast.alert-success { background: #f0fdf4; border-color: #16a34a; color: #14532d; }
.flash-toast.alert-error   { background: #fef2f2; border-color: #dc2626; color: #7f1d1d; }
.flash-toast.alert-info    { background: #f0fdf9; border-color: #0891b2; color: #164e63; }

/* ── Forms ── */
form label {
    display: flex; flex-direction: column; gap: 0.3rem;
    margin-bottom: 1rem; font-size: 0.9rem; font-weight: 500; color: #444;
}
form input, form select, form textarea,
.admin-form-section input[type="text"], .admin-form-section input[type="number"],
.admin-form-section select, .admin-form-section textarea {
    padding: 0.5rem 0.7rem; border: 1px solid #ccc;
    border-radius: 5px; font-size: 0.95rem; font-family: inherit;
    transition: border-color 0.15s;
}
form input[type="checkbox"] { width: auto; padding: 0; border: none; border-radius: 0; box-shadow: none; flex-shrink: 0; }
form input:focus, form select:focus, form textarea:focus,
.admin-form-section input[type="text"]:focus, .admin-form-section input[type="number"]:focus,
.admin-form-section select:focus, .admin-form-section textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}
.row-2 { display: flex; gap: 1rem; }
.row-2 label { flex: 1; }

/* ── Buttons ── */
button[type="submit"], .btn-secondary, .btn-danger, .btn-telegram {
    border: none; padding: 0.55rem 1.1rem; border-radius: 5px;
    cursor: pointer; font-size: 0.9rem; font-family: inherit; font-weight: 500;
}
button[type="submit"] { background: var(--green); color: #fff; }
button[type="submit"]:hover { background: var(--green-dark); }
.btn-secondary { background: var(--primary-light); color: var(--primary-dark); }
.btn-secondary:hover { background: #ddd6fe; }
.btn-danger { background: #e53935; color: #fff; }
.btn-danger:hover { background: #c62828; }
.btn-telegram { background: #0088cc; color: #fff; }
.btn-telegram:hover { background: #006fa8; }

/* ── Errors ── */
.error {
    color: #c0392b; background: #fdecea;
    padding: 0.6rem 0.75rem; border-radius: 5px;
    font-size: 0.875rem; margin-bottom: 1rem;
}

/* ── Search cards ── */
.searches-list { display: flex; flex-direction: column; gap: 0.75rem; }

/* Dashboard two-column layout */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.dashboard-grid__new { position: sticky; top: 1rem; }
@media (max-width: 860px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-grid__new { position: static; }
}
@media (max-width: 600px) {
    main { padding: 0 0.75rem; }
}
.search-card {
    background: #fff; border-radius: 8px;
    padding: 1rem 1.25rem 1rem 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    display: flex; gap: 0; align-items: stretch;
    position: relative; overflow: hidden;
}
/* dark overlay on inactive cards */
.search-card.inactive::after {
    content: ""; position: absolute; inset: 0;
    background: rgba(30,16,53,0.45); border-radius: 8px;
    pointer-events: none;
}
/* index bubble on left */
.search-index {
    font-size: 1rem; font-weight: 700; color: var(--primary-dark);
    background: var(--primary-light); border-radius: 50%;
    width: 2.4rem; height: 2.4rem; min-width: 2.4rem;
    display: flex; align-items: center; justify-content: center;
    align-self: center;
    margin: 0 0.5rem 0 0.75rem; flex-shrink: 0;
}
/* inner content wrapper */
.search-card__body { flex: 1; min-width: 0; padding: 0.75rem 1.25rem 0.75rem 0; }

.search-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 0.3rem;
}
.search-header strong { font-size: 1rem; }
.price-range { color: #555; font-size: 0.875rem; }
.search-meta { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.search-meta:last-of-type { margin-bottom: 0.4rem; }
.tag {
    font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 3px;
}
.tag-cat  { background: var(--green-light); color: var(--green-dark); }
.tag-cond { background: var(--primary-light); color: var(--primary-dark); }
.tag-paused { background: #fef9c3; color: #854d0e; }
.notes { color: #666; font-size: 0.85rem; margin: 0.25rem 0 0.5rem; }
.search-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; flex-wrap: wrap; }

/* Scanner status bar */
.scanner-status-bar {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
    background: #f8f7ff; border: 1px solid #ede9fe; border-radius: 8px;
    padding: 0.5rem 0.9rem; margin-bottom: 1rem; font-size: 0.82rem; color: #555;
}
.ssb-left, .ssb-right { display: flex; align-items: center; gap: 0.4rem; }
.ssb-sep { color: #ccc; }
.ssb-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ssb-dot--ok   { background: #22c55e; box-shadow: 0 0 0 2px #dcfce7; }
.ssb-dot--idle { background: #f59e0b; box-shadow: 0 0 0 2px #fef3c7; }

/* Per-search history line */
.search-hist { font-size: 0.78rem; color: #9ca3af; margin-top: 0.35rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.empty { color: #888; text-align: center; padding: 2rem; }

/* ── Alert quota card ── */
.alert-quota-card {
    background: #fff; border-radius: 8px; padding: 0.75rem 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07); margin-bottom: 0.75rem;
}
.aq-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.4rem; }
.aq-label { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.aq-count { font-size: 0.85rem; font-weight: 700; color: var(--primary); }
.aq-bar-wrap { height: 6px; background: var(--primary-light); border-radius: 3px; overflow: hidden; }
.aq-bar { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; min-width: 2px; }
.aq-bar--full { background: #f59e0b; }

/* ── Settings two-column layout ── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.settings-col { display: flex; flex-direction: column; gap: 1.25rem; }
@media (max-width: 860px) {
    .settings-grid { grid-template-columns: 1fr; }
}

/* ── Telegram link ── */
.tg-link {
    display: inline-block; margin-top: 0.5rem;
    color: #0088cc; word-break: break-all; font-size: 0.9rem;
}

/* ── Password length bar ── */
.pw-bar-wrap {
    height: 6px; background: #e5e7eb; border-radius: 3px;
    margin-top: 6px; overflow: hidden;
}
.pw-bar {
    height: 100%; width: 0; border-radius: 3px;
    background: var(--primary);
    transition: width 0.15s ease, background 0.2s ease;
}
.pw-bar--over { background: #dc2626; }
.pw-meta {
    display: flex; justify-content: flex-end; margin-top: 3px;
}
#pw-count { font-size: 0.75rem; color: #888; }
.pw-count--over { color: #dc2626 !important; font-weight: 600; }
.pw-warning {
    display: none; color: #dc2626;
    font-size: 0.82rem; margin: 4px 0 0;
}

/* -- Results grid -- */
.results-header-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}
.result-card {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
    overflow: hidden; display: flex; flex-direction: column;
    transition: box-shadow 0.15s, opacity 0.3s, transform 0.3s;
}
.result-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.result-card--seen { opacity: 0.5; }
.result-card--seen .result-title { color: #6b7280; }
.result-thumb { display: block; width: 100%; aspect-ratio: 4/3; overflow: hidden; background: #f3f4f6; }
.result-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
.result-thumb:hover img { transform: scale(1.04); }
.result-thumb--empty { display: flex; align-items: center; justify-content: center; color: #9ca3af; font-size: 0.8rem; text-decoration: none; }
.result-body { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.result-title { font-weight: 600; font-size: 0.9rem; color: #111; text-decoration: none; line-height: 1.3; }
.result-title:hover { color: var(--primary); }
.result-meta { display: flex; gap: 0.75rem; align-items: center; }
.result-price { font-size: 1rem; font-weight: 700; color: var(--primary); }
.result-city { font-size: 0.8rem; color: #6b7280; }
.result-seller { font-size: 0.78rem; color: #9ca3af; }
.result-seller::before { content: "· "; }
.result-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 0.4rem; border-top: 1px solid #f3f4f6; }
.result-time { font-size: 0.75rem; color: #9ca3af; }
.result-actions { display: flex; gap: 0.4rem; padding: 0.5rem 0.75rem; border-top: 1px solid #f3f4f6; background: #fafafa; }
.btn-action { flex: 1; padding: 0.35rem 0.5rem; font-size: 0.78rem; font-family: inherit; border: 1px solid #e5e7eb; border-radius: 5px; cursor: pointer; background: #fff; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.btn-seen { color: #6b7280; }
.btn-seen:hover, .btn-seen.is-seen { background: #f0fdf4; color: #15803d; border-color: #86efac; }
.btn-hide { color: #6b7280; }
.btn-hide:hover { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }
.btn-rescue { color: #2563eb; }
.btn-rescue:hover { background: #eff6ff; border-color: #93c5fd; }
.result-notes { padding: 0.5rem 0.75rem; border-top: 1px solid #f3f4f6; background: #fafafa; }

/* Filter bar */
.results-filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.75rem 0 0.5rem; }
.filter-label { font-size: 0.78rem; color: #888; font-weight: 500; margin-right: 0.25rem; }
.filter-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.75rem; border: 1.5px solid var(--primary); border-radius: 999px; background: #fff; color: var(--primary); font-size: 0.8rem; font-weight: 500; cursor: pointer; transition: background 0.15s, color 0.15s; }
.filter-chip:hover { background: rgba(15,169,104,0.08); }
.filter-chip.active { background: var(--primary); color: #fff; }
.filter-chip-price { font-size: 0.72rem; opacity: 0.8; }
.filter-clear { padding: 0.3rem 0.75rem; border: 1.5px solid #d1d5db; border-radius: 999px; background: #fff; color: #666; font-size: 0.8rem; cursor: pointer; transition: background 0.15s; }
.filter-clear:hover { background: #f3f4f6; }
.result-notes-input { width: 100%; resize: vertical; border: 1px solid #e5e7eb; border-radius: 5px; padding: 0.35rem 0.5rem; font-size: 0.78rem; font-family: inherit; background: #fff; line-height: 1.4; transition: border-color 0.15s; }
.result-notes-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(15,169,104,0.12); }
.result-notes { position: relative; }
.result-notes-saved { position: absolute; bottom: 0.45rem; left: 0.45rem; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: #15803d; color: #fff; font-size: 0.75rem; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; transition: opacity 0.2s; }
.result-notes-saved.visible { opacity: 1; }

/* -- Modal -- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 1rem;
}
.modal-box {
    background: #fff; border-radius: 10px; width: 100%;
    max-width: 480px; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    display: flex; flex-direction: column;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem 0;
}
.modal-header h2 { margin: 0; font-size: 1.1rem; }
.modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.4rem; line-height: 1; opacity: 0.5;
}
.modal-close:hover { opacity: 1; }
.modal-box form { padding: 1.25rem 1.5rem 1.5rem; display: flex; flex-direction: column; gap: 0.9rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 0.5rem; }

/* ── Category picker ── */
/* ── Category dropdown ── */
.cat-dropdown { position: relative; margin-bottom: 1rem; }
.cat-dropdown-trigger {
    width: 100%; text-align: left;
    padding: 0.5rem 0.75rem;
    background: #fff; border: 1px solid #ccc; border-radius: 5px;
    cursor: pointer; font-size: 0.95rem; font-family: inherit; font-weight: 400; color: #444;
    display: flex; justify-content: space-between; align-items: center;
    transition: border-color 0.15s;
}
.cat-dropdown-trigger:hover { border-color: var(--primary); }
.cat-dropdown.open .cat-dropdown-trigger {
    border-color: var(--primary);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 0 0 0 3px rgba(15,169,104,0.12);
}
.cat-trigger-arrow { font-size: 0.75rem; color: #888; transition: transform 0.15s; }
.cat-dropdown.open .cat-trigger-arrow { transform: rotate(180deg); }
.cat-picker {
    display: none;
    position: absolute; z-index: 300;
    width: 100%;
    border: 1px solid var(--primary); border-top: none;
    border-bottom-left-radius: 5px; border-bottom-right-radius: 5px;
    max-height: 260px; overflow-y: auto;
    padding: 0.25rem 0;
    background: #fff; font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.cat-dropdown.open .cat-picker { display: block; }
.cat-group-label {
    padding: 0.35rem 0.75rem 0.15rem;
    font-weight: 700;
    font-size: 0.78rem;
    color: #374151;
    background: #f3f4f6;
    border-top: 1px solid #e5e7eb;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.cat-group-label:first-child { border-top: none; }
.cat-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
    font-weight: 400;
    margin-bottom: 0;
}
.cat-item:hover { background: var(--primary-light); }
.cat-item input[type="checkbox"] { width: auto; padding: 0; border: none; flex-shrink: 0; margin: 0; }
.cat-search {
    position: sticky; top: 0; z-index: 1;
    width: 100%; box-sizing: border-box;
    padding: 0.4rem 0.6rem;
    border: none; border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem; font-family: inherit;
    outline: none; background: #fff;
}
.cat-search:focus { border-bottom-color: var(--primary); box-shadow: none; }
.cat-no-results { padding: 0.5rem 0.75rem; color: #aaa; font-size: 0.85rem; font-style: italic; display: none; }

/* ── Condition checkboxes ── */
.cond-group { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-bottom: 0.5rem; }
.cond-label { display: flex; align-items: center; gap: 0.3rem; font-size: 0.875rem; font-weight: 400; margin-bottom: 0; cursor: pointer; }
.cond-label input[type="checkbox"] { width: auto; padding: 0; border: none; }

/* ── Event log ── */
.event-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.event-filters input, .event-filters select { min-width: 120px; flex: 1; }
.event-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.event-table th { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 2px solid #e5e7eb; background: #f9fafb; font-weight: 600; }
.event-table td { padding: 0.45rem 0.75rem; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.event-table tr:hover td { background: #f7fdf8; }
.ev-ts { white-space: nowrap; color: #666; font-size: 0.8rem; }
.ev-user { color: #555; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-detail { color: #444; word-break: break-word; }
.ev-summary { cursor: pointer; font-family: monospace; font-size: 0.78rem; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 500px; display: inline-block; }
.ev-summary:hover { color: var(--primary-dark); }
.ev-pre { white-space: pre-wrap; font-family: monospace; font-size: 0.78rem; margin-top: 0.4rem; background: #f8f8f8; padding: 0.5rem 0.75rem; border-radius: 4px; border-left: 3px solid #e53935; word-break: break-all; }
.ev-type { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; background: #e5e7eb; color: #374151; }
.ev-type--user     { background: #dbeafe; color: #1d4ed8; }
.ev-type--search   { background: #d1fae5; color: #065f46; }
.ev-type-sub--search_run        { background: #d1fae5; color: #065f46; }
.ev-type-sub--search_create     { background: #a7f3d0; color: #047857; }
.ev-type-sub--search_edit       { background: #6ee7b7; color: #065f46; }
.ev-type-sub--search_toggle     { background: #34d399; color: #fff; }
.ev-type-sub--search_deactivate { background: #10b981; color: #fff; }
.ev-type--telegram { background: #ede9fe; color: #6d28d9; }
.ev-type--categories { background: #fef3c7; color: #92400e; }
.ev-type--admin    { background: #e0e7ff; color: #3730a3; }
.ev-type--error    { background: #ffe4e6 !important; color: #9f1239 !important; }
.ev-pagination { display: flex; align-items: center; gap: 1rem; justify-content: center; margin-top: 1rem; font-size: 0.9rem; }
.ev-pagination a { color: var(--primary); text-decoration: none; }
.ev-pagination a:hover { text-decoration: underline; }

.ev-filter-bar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1rem; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 0.65rem 1rem; }
.ev-filter-bar input[type="text"],
.ev-filter-bar input[type="datetime-local"],
.ev-filter-bar select {
    flex: 2; min-width: 140px;
    padding: 0.45rem 0.7rem; border: 1px solid #d1d5db;
    border-radius: 6px; font-size: 0.9rem; font-family: inherit;
    background: #f9fafb; transition: border-color 0.15s, box-shadow 0.15s;
    color: #374151;
}
.ev-filter-bar input[type="text"]:focus,
.ev-filter-bar input[type="datetime-local"]:focus,
.ev-filter-bar select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15,169,104,0.12); background: #fff;
}
.ev-filter-bar input[type="text"]::placeholder { color: #9ca3af; }
.ev-filter-bar .btn-clear { background: none; border: none; color: #9ca3af; font-size: 0.85rem; cursor: pointer; padding: 0.3rem 0.5rem; border-radius: 5px; white-space: nowrap; }
.ev-filter-bar .btn-clear:hover { color: #ef4444; background: #fee2e2; }
.ev-date-label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.75rem; font-weight: 600; color: #888; flex: 1.5; min-width: 160px; }
.ev-date-label input { margin: 0; }

/* Info tags (categories / conditions display) */
.tag-display { display: flex; flex-wrap: wrap; gap: 0.4rem; min-height: 1.8rem; }
.info-tag { display: inline-block; padding: 0.25rem 0.65rem; border-radius: 20px; font-size: 0.8rem; font-weight: 500; }
.info-tag--cat  { background: var(--primary-light); color: var(--primary-dark); }
.info-tag--cond { background: #e0e7ff; color: #3730a3; }

/* Admin CRUD */
.badge { display: inline-block; padding: 0.1rem 0.45rem; border-radius: 10px; font-size: 0.72rem; font-weight: 700; vertical-align: middle; }
.badge--active   { background: var(--primary-light); color: var(--primary-dark); }
.badge--inactive { background: #fee2e2; color: #991b1b; }
.badge--plan--free  { background: #f3f4f6; color: #6b7280; }
.badge--plan--basic { background: #dbeafe; color: #1e40af; }
.badge--plan--pro   { background: #fef3c7; color: #92400e; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-sm { padding: 0.2rem 0.55rem !important; font-size: 0.78rem !important; }
.admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 800px) { .admin-form-grid { grid-template-columns: 1fr; } }
.admin-form-section { background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.07); padding: 1.25rem; }
.admin-form-section h2 { font-size: 1rem; font-weight: 700; margin: 0 0 1rem; color: #374151; border-bottom: 1px solid #e5e7eb; padding-bottom: 0.5rem; }
.danger-zone { background: #fff8f8 !important; border: 1px solid #fca5a5 !important; box-shadow: none !important; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid #f0f0f0; font-size: 0.88rem; }
.stat-row:last-child { border-bottom: none; }
.stat-value { font-size: 0.9rem; font-weight: 700; color: var(--primary-dark); text-align: right; }
.checkbox-label { flex-direction: row !important; align-items: center !important; gap: 0.5rem !important; cursor: pointer; font-weight: 400 !important; }

/* ── Toggle switch ── */
.toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
}
.toggle-wrap input[type="checkbox"] { display: none; }
/* override default form label styles inside a toggle-wrap */
.toggle-wrap label { margin-bottom: 0; flex-direction: row; gap: 0; }
label.toggle {
    position: relative;
    display: block;
    width: 42px; height: 23px;
    border-radius: 12px;
    background: #d1d5db;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    margin-bottom: 0;
}
label.toggle::after {
    content: "";
    position: absolute;
    top: 2.5px; left: 2.5px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
input[type="checkbox"]:checked + label.toggle          { background: var(--green); }
input[type="checkbox"]:checked + label.toggle::after   { transform: translateX(19px); }
label.toggle-label {
    font-size: 0.9rem; font-weight: 500; color: #444;
    cursor: pointer; margin-bottom: 0;
}
/* Red toggle (danger: active=red, inactive=grey) */
.toggle-danger input[type="checkbox"]:checked + label.toggle { background: #e53935; }
/* Platform toggle: active=green (default), inactive=red */
.toggle-platform input[type="checkbox"]:not(:checked) + label.toggle { background: #e53935; }

/* ── Config row (inline form layout) ── */
.config-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.config-row > label {
    flex-direction: row;
    align-items: center;
    margin-bottom: 0;
    gap: 0.45rem;
    white-space: nowrap;
}
.config-row input[type="number"] { width: 4.5rem; }
.config-row-actions { display: flex; align-items: center; gap: 0.65rem; margin-left: auto; }

/* ── Admin breadcrumb ── */
.admin-breadcrumb { background: #f3f0ff; border-bottom: 1px solid #e0d9ff; padding: 0.5rem 0; margin-bottom: 1.25rem; }
.admin-breadcrumb a { color: var(--primary-dark); text-decoration: none; font-size: 0.85rem; font-weight: 600; }
.admin-breadcrumb a:hover { text-decoration: underline; }

/* ── Half-row: two fields side by side (50% each) ── */
.half-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 600px) { .half-row { grid-template-columns: 1fr; } }

/* ── Platform status badge (Server Config page) ── */
.platform-badge {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.25rem 0.75rem; border-radius: 20px;
    font-size: 0.82rem; font-weight: 700;
}
.platform-badge--on  { background: var(--green-light); color: var(--green-dark); }
.platform-badge--off { background: #fee2e2; color: #991b1b; }

/* ── Auth split layout (TASK 009) ── */
main.main--auth { max-width: none; margin: 0; padding: 0; }
.auth-split { display: flex; min-height: 100vh; }
.auth-split__form {
    flex: 0 0 460px;
    display: flex; align-items: center; justify-content: center;
    padding: 2rem; background: var(--body-bg);
}
.auth-split .auth-box { margin: 0; width: 100%; max-width: 360px; }
.auth-split__hero {
    flex: 1;
    background: linear-gradient(150deg, #7c3aed 0%, #4c1d95 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 3rem 4rem; color: #fff;
}
.auth-hero { max-width: 380px; }
.auth-hero__logo-img {
    height: 52px; width: auto;
    margin-bottom: 1.25rem; display: block;
    /* invierte el logo oscuro a blanco sobre el fondo morado */
    filter: brightness(0) invert(1);
}
.auth-hero__tagline {
    font-size: 1.2rem; line-height: 1.5;
    color: #e9d5ff; margin-bottom: 2rem;
}
.auth-hero__benefits {
    list-style: none; margin-bottom: 2rem;
    display: flex; flex-direction: column; gap: 0.9rem;
}
.auth-hero__benefits li {
    font-size: 0.97rem; color: #ede9fe;
    display: flex; align-items: center; gap: 0.75rem;
}
.auth-hero__icon { font-size: 1.2rem; flex-shrink: 0; }
.auth-hero__plans {
    display: inline-block; color: #c4b5fd; text-decoration: none;
    font-size: 0.9rem; font-weight: 600;
    border: 1px solid rgba(196,181,253,0.4);
    padding: 0.5rem 1rem; border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.auth-hero__plans:hover { background: rgba(255,255,255,0.1); color: #fff; }
@media (max-width: 720px) {
    .auth-split { flex-direction: column; }
    .auth-split__form { flex: none; width: 100%; padding: 1.5rem; }
    .auth-split__hero { flex: none; width: 100%; padding: 1.75rem 1.5rem; order: -1; }
    .auth-hero__logo { font-size: 2rem; margin-bottom: 0.4rem; }
    .auth-hero__tagline { font-size: 1rem; margin-bottom: 0.75rem; }
    .auth-hero__benefits { display: none; }
    .auth-hero__plans { font-size: 0.82rem; padding: 0.4rem 0.75rem; }
}

/* ── Empty state (TASK 010) ── */
.empty-state {
    text-align: center; padding: 3rem 2rem;
    background: #fff; border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.empty-state__icon { font-size: 2.75rem; margin-bottom: 0.75rem; }
.empty-state h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--text); }
.empty-state p {
    color: var(--muted); max-width: 320px; margin: 0 auto 1.25rem;
    font-size: 0.9rem; line-height: 1.55;
}
.empty-state__hint {
    font-size: 0.83rem; color: var(--muted);
    background: #f5f3ff; border-radius: 6px;
    padding: 0.55rem 1rem; display: inline-block;
}
.empty-state__hint a { color: var(--primary); font-weight: 600; }

/* ── Pricing page (TASK 011) ── */
.pricing-page { max-width: 900px; margin: 3rem auto; padding: 0 1.5rem; }
.pricing-header { text-align: center; margin-bottom: 3rem; }
.pricing-brand { display: inline-block; margin-bottom: 0.5rem; line-height: 1; text-decoration: none; }
.pricing-brand__img { height: 52px; width: auto; display: block; }
.pricing-tagline { color: var(--muted); font-size: 1rem; margin-top: 0.5rem; }
.pricing-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem; align-items: start; margin-bottom: 2rem;
}
@media (max-width: 640px) { .pricing-grid { grid-template-columns: 1fr; } }
.pricing-card {
    background: #fff; border-radius: 12px; padding: 1.75rem 1.5rem;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    border: 2px solid transparent; position: relative;
    display: flex; flex-direction: column; gap: 1rem;
}
.pricing-card--featured {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(124,58,237,0.18);
}
.pricing-card__badge {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--primary); color: #fff;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
    padding: 0.2rem 0.75rem; border-radius: 20px; white-space: nowrap;
}
.pricing-card__name { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.pricing-card__price { display: flex; align-items: baseline; gap: 0.25rem; }
.pricing-card__amount { font-size: 2.25rem; font-weight: 800; color: var(--primary); line-height: 1; }
.pricing-card__period { font-size: 0.9rem; color: var(--muted); }
.pricing-card__features {
    list-style: none; display: flex; flex-direction: column;
    gap: 0.55rem; flex: 1;
}
.pricing-card__features li { font-size: 0.88rem; color: #374151; }
.pricing-card__features li.off { color: #9ca3af; }
.btn-pricing {
    display: block; text-align: center;
    padding: 0.65rem 1rem; border-radius: 6px;
    font-weight: 600; font-size: 0.9rem; text-decoration: none;
    background: var(--primary); color: #fff;
    transition: background 0.15s;
}
.btn-pricing:hover { background: var(--primary-dark); }
.btn-pricing--outline {
    background: #fff; color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-pricing--outline:hover { background: var(--primary-light); }
.pricing-footer { text-align: center; color: var(--muted); font-size: 0.9rem; }
.pricing-footer a { color: var(--primary); font-weight: 600; text-decoration: none; }
.pricing-footer a:hover { text-decoration: underline; }

/* ── Pricing hero (full-width band) ── */
main.main--pricing { max-width: none; margin: 0; padding: 0; }
.pricing-hero {
    background: linear-gradient(150deg, #7c3aed 0%, #4c1d95 100%);
    text-align: center; padding: 3rem 1.5rem 2.5rem;
    color: #fff;
}
.pricing-hero__logo { height: 56px; width: auto; filter: brightness(0) invert(1); margin-bottom: 1rem; }
.pricing-hero__tagline { font-size: 1.2rem; color: #ede9fe; margin-bottom: 0.4rem; font-weight: 500; }
.pricing-hero__sub { font-size: 0.9rem; color: #c4b5fd; }
.pricing-page { max-width: 900px; margin: 0 auto; padding: 2.5rem 1.5rem 3rem; }

/* ── Nav countdown ── */
.nav-next-run {
    font-size: 0.78rem; font-weight: 600; color: var(--muted);
    white-space: nowrap; flex-shrink: 0;
}

/* ── Plan usage card in Settings (TASK 012) ── */
.plan-usage { margin-top: 0.75rem; }
.plan-usage__header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; }
.plan-usage__compare { font-size: 0.8rem; color: var(--primary); text-decoration: none; margin-left: auto; font-weight: 600; }
.plan-usage__compare:hover { text-decoration: underline; }
.plan-usage__label { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.3rem; }
.plan-usage__count { font-weight: 700; color: var(--primary); }
.plan-usage__count--full { color: #f59e0b; }

/* ── Recent items (TASK 014) ── */
.recent-items { margin-top: 2rem; }
.recent-items__header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.75rem; }
.recent-items__header h2 { font-size: 1.1rem; }
.recent-items__more { font-size: 0.85rem; color: var(--primary); text-decoration: none; font-weight: 600; }
.recent-items__more:hover { text-decoration: underline; }
.recent-items__grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}
@media (max-width: 900px) { .recent-items__grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 540px) { .recent-items__grid { grid-template-columns: repeat(2, 1fr); } }
.recent-item {
    background: #fff; border-radius: 8px; overflow: hidden;
    border: 1px solid #e5e7eb; text-decoration: none; color: inherit;
    display: flex; flex-direction: column;
    transition: box-shadow 0.15s;
}
.recent-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.09); }
.recent-item__thumb {
    width: 100%; aspect-ratio: 4/3; background: #f3f4f6;
    overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.recent-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.recent-item__nophoto { font-size: 0.7rem; color: #9ca3af; }
.recent-item__body { padding: 0.5rem 0.6rem; display: flex; flex-direction: column; gap: 0.2rem; }
.recent-item__title { font-size: 0.78rem; font-weight: 600; color: #111; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.recent-item__meta { display: flex; gap: 0.4rem; align-items: baseline; }
.recent-item__price { font-size: 0.82rem; font-weight: 700; color: var(--primary); }
.recent-item__city { font-size: 0.7rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item__time { font-size: 0.68rem; color: #9ca3af; }
