/* ============================================================
   Sistema Fast Delivery — Paleta y estilos propios (sin Tailwind)
   ============================================================ */

:root {
    --pink: #E8175D;
    --pink-dark: #C4114C;
    --ink: #14141A;
    --paper: #FAFAF9;
    --line: #ECEAE7;
    --muted: #6B6B72;
    --white: rgba(255, 255, 255, 1);
}

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

body {
    background: linear-gradient(160deg, #FAFAF9 0%, #F4F0ED 100%);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--pink);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ------------------------- Auth ------------------------- */

.auth-wrap {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(20, 20, 26, .08);
    width: 100%;
    max-width: 420px;
    padding: 36px 32px;
    text-align: center;
}

.auth-logo img {
    height: 52px;
}

.auth-card h1 {
    font-size: 1.5rem;
    margin: 12px 0 4px;
    font-weight: 700;
}

.auth-card .sub {
    color: var(--muted);
    font-size: .92rem;
    margin-bottom: 24px;
}

.auth-form {
    text-align: left;
}

.auth-form label {
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="tel"],
.auth-form input[type="number"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: .95rem;
    margin-bottom: 16px;
    background: #FCFCFB;
    transition: border .2s, box-shadow .2s;
    font-family: inherit;
    color: var(--ink);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(232, 23, 93, .12);
}

.btn-primary {
    width: 100%;
    background: var(--pink);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 13px;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, transform .2s;
    margin-top: 6px;
    font-family: inherit;
}

.btn-primary:hover {
    background: var(--pink-dark);
    transform: translateY(-1px);
}

.auth-alt {
    margin-top: 26px;
    font-size: .88rem;
    color: var(--muted);
    text-align: center;
    line-height: 1.7;
}

.auth-alt a {
    color: var(--pink);
    font-weight: 600;
}

.otp-hint {
    font-size: .9rem;
    color: var(--muted);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 18px;
}

.otp-hint strong {
    color: var(--ink);
}

.inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.inline-form .link-button {
    text-decoration: underline;
    font-size: .88rem;
}

.otp-code-input {
    letter-spacing: .45em;
    text-align: center;
    font-size: 1.25rem !important;
    font-weight: 700;
    text-transform: uppercase;
}

.btn-link {
    background: none;
    border: none;
    color: var(--pink);
    font-weight: 600;
    font-size: .88rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.btn-link:hover {
    color: var(--pink-dark);
}

.alert-success,
.alert-error {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: .85rem;
    margin-bottom: 16px;
    text-align: left;
}

.alert-error {
    background: #FDE9EF;
    color: #C4114C;
    border: 1px solid #F5C6D4;
}

.alert-success {
    background: #E7F9EF;
    color: #166534;
    border: 1px solid #BBF7D0;
}

.alert-error ul {
    margin: 0;
    padding-left: 18px;
}

.captcha-box {
    background: #FAFAF9;
    border: 1px dashed var(--line);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.captcha-box .math {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.auth-form .captcha-box input.captcha-answer,
.auth-form .captcha-box input[type="number"] {
    width: 200px;
    margin: 0;
    padding: 10px 8px;
    text-align: center;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font-size: .95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: border .2s, box-shadow .2s, background .2s;
    margin-bottom: 16px;
}

.btn-google:hover {
    border-color: #d4d2cf;
    background: #FAFAF9;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .06);
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 18px;
    color: var(--muted);
    font-size: .8rem;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.phone-group {
    display: flex;
    align-items: center;
    background: #FCFCFB;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 16px;
    transition: border .2s, box-shadow .2s;
}

.phone-prefix {
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: .95rem;
    font-weight: 700;
    color: var(--muted);
    white-space: nowrap;
    border-right: 1px solid #E9E7E4;
    align-self: stretch;
}

.auth-form .phone-group input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 12px 14px;
    border: none;
    margin-bottom: 0;
    background: transparent;
}

.phone-group:focus-within {
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(232, 23, 93, .12);
}

.phone-group:focus-within .phone-prefix {
    border-right-color: var(--pink);
}

.phone-group:focus-within input {
    border: none;
    box-shadow: none;
    outline: none;
}

.terms-line {
    font-size: .82rem;
    color: var(--muted);
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 16px;
    line-height: 1.5;
}

.terms-line input {
    margin-top: 2px;
}

.terms-line a {
    color: var(--pink);
    font-weight: 600;
}

.verify-text {
    color: var(--muted);
    font-size: .92rem;
    line-height: 1.7;
    margin-bottom: 20px;
}

.terms-text {
    text-align: left;
    margin-top: 6px;
    font-size: .9rem;
    line-height: 1.75;
    color: var(--ink);
}

.terms-text p {
    margin-bottom: 14px;
}

.auth-footer {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: .82rem;
}

.auth-footer a {
    color: var(--muted);
}

.auth-footer a:hover {
    color: var(--pink);
}

/* Enlace con apariencia de link (botón sin fondo) */
.link-button {
    background: none;
    border: none;
    padding: 0;
    color: var(--pink);
    font-weight: 600;
    font-size: inherit;
    font-family: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.link-button:hover {
    color: var(--pink-dark);
}

/* ------------------------- Modal ------------------------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal.open {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(20, 20, 26, .55);
    animation: modalFade .2s ease;
}

.modal-card {
    position: relative;
    background: var(--white);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 560px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 40px rgba(20, 20, 26, .18);
    animation: modalUp .25s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}

.modal-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.7rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0 4px;
    transition: color .2s;
    font-family: inherit;
}

.modal-close:hover {
    color: var(--ink);
}

.modal-body {
    padding: 20px 22px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--line);
}

.btn-primary-sm {
    width: auto;
    padding: 11px 26px;
    margin: 0;
}

body.no-scroll {
    overflow: hidden;
}

@keyframes modalFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalUp {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 640px) {
    .modal {
        align-items: center;
        padding: 24px;
    }

    .modal-card {
        border-radius: 20px;
        max-height: 84vh;
    }
}

/* ------------------------- Dashboard ------------------------- */

.topnav {
    background: var(--white);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
}

.topnav-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topnav-name {
    font-weight: 600;
    font-size: .95rem;
}

.btn-logout {
    background: var(--pink);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 8px 18px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    font-family: inherit;
}

.btn-logout:hover {
    background: var(--pink-dark);
}

.dash-container {
    max-width: 640px;
    margin: auto;
    padding: 40px 24px;
}

.dash-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(20, 20, 26, .08);
    width: 100%;
    padding: 36px 32px;
    text-align: left;
}

.dash-card h1 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.dash-card p {
    color: var(--muted);
    line-height: 1.7;
}

/* ------------------------- Responsive ------------------------- */

@media (max-width: 480px) {
    .auth-wrap {
        padding: 16px;
    }

    .auth-card {
        padding: 28px 20px;
    }

    .topnav {
        padding: 10px 16px;
    }

    .dash-container {
        padding: 24px 16px;
    }

    .dash-card {
        padding: 24px 20px;
    }
}

/* ------------------------- Configuración ------------------------- */

.topnav-link {
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    font-size: .9rem;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background .15s ease;
}

.topnav-link:hover {
    background: rgba(20, 20, 26, .06);
    text-decoration: none;
}

.dash-card .sub {
    color: var(--muted);
    margin-bottom: 20px;
}

.setting-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 18px;
}

.setting-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex: none;
    accent-color: var(--pink);
}

.setting-row span {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-row strong {
    font-weight: 600;
}

.setting-row small {
    color: var(--muted);
    line-height: 1.5;
}

/* ------------------------- App shell y menú ------------------------- */

.app-shell {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 57px);
}

.sidebar {
    width: 240px;
    flex: none;
    background: var(--white);
    border-right: 1px solid var(--line);
    padding: 18px 14px;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-link {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--ink);
    font-weight: 600;
    font-size: .92rem;
    text-decoration: none;
}

.menu-link:hover {
    background: rgba(20, 20, 26, .05);
    color: var(--ink);
    text-decoration: none;
}

.menu-link.is-active {
    background: rgba(232, 23, 93, .10);
    color: var(--pink);
}

.menu-sub {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 2px 0 8px 10px;
    padding-left: 10px;
    border-left: 2px solid var(--line);
}

.menu-sub-link {
    display: block;
    padding: 7px 10px;
    border-radius: 8px;
    color: var(--muted);
    font-size: .87rem;
    font-weight: 500;
    text-decoration: none;
}

.menu-sub-link:hover {
    background: rgba(20, 20, 26, .05);
    color: var(--ink);
    text-decoration: none;
}

.menu-sub-link.is-active {
    color: var(--pink);
    font-weight: 700;
}

.app-main {
    flex: 1;
    min-width: 0;
    padding: 26px 28px;
}

.page-head {
    margin-bottom: 20px;
}

.page-head h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.page-head .sub {
    color: var(--muted);
    font-size: .92rem;
}

.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(20, 20, 26, .05);
    max-width: 720px;
}

.card p {
    color: var(--muted);
    line-height: 1.7;
}

.form-field label {
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
}

.form-field .help {
    color: var(--muted);
    font-size: .8rem;
    line-height: 1.5;
    margin: -8px 0 16px;
}

.form-actions {
    margin-top: 4px;
}

.form-actions .btn-primary {
    width: auto;
    padding-left: 28px;
    padding-right: 28px;
}

@media (max-width: 720px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--line);
    }

    .app-main {
        padding: 18px 16px;
    }
}

/* ------------------------- Tablas ------------------------- */

.card-wide {
    max-width: 100%;
}

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

.table th,
.table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table th {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 700;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-action {
    text-align: right;
    white-space: nowrap;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
    background: rgba(20, 20, 26, .07);
    color: var(--muted);
}

.badge-admin {
    background: rgba(232, 23, 93, .12);
    color: var(--pink);
}

/* ------------------------- Secciones de menú y roles ------------------------- */

.menu-title {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-weight: 700;
    padding: 14px 12px 6px;
}

.muted {
    color: var(--muted);
}

.user-card {
    margin-bottom: 16px;
}

.user-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.user-head strong {
    margin-right: 8px;
}

.user-head .muted {
    font-size: .85rem;
}

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

.role-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
}

.role-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex: none;
    accent-color: var(--pink);
}

.role-option span {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.role-option small {
    color: var(--muted);
    line-height: 1.4;
}

.plain-list {
    margin: 12px 0 0;
    padding-left: 20px;
    color: var(--muted);
    line-height: 1.9;
}

/* ------------------------- Formularios de configuración ------------------------- */

.fieldset {
    padding-top: 18px;
    margin-bottom: 6px;
    border-top: 1px solid var(--line);
}

.fieldset:first-of-type {
    border-top: none;
    padding-top: 0;
}

.fieldset-title {
    font-weight: 700;
    font-size: .95rem;
    margin-bottom: 16px;
    color: var(--ink);
}

.auth-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: .95rem;
    margin-bottom: 16px;
    background: #FCFCFB;
    font-family: inherit;
    color: var(--ink);
    resize: vertical;
    transition: border .2s, box-shadow .2s;
}

.auth-form textarea:focus {
    outline: none;
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(232, 23, 93, .12);
}

.image-field {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.image-field input {
    flex: 1;
}

.image-preview {
    height: 46px;
    width: auto;
    max-width: 130px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 4px;
    flex: none;
}

.image-preview-lg {
    height: 70px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.file-field {
    margin: -8px 0 8px;
}

.file-field input[type="file"] {
    font-family: inherit;
    font-size: .85rem;
    color: var(--muted);
    max-width: 100%;
}

.file-field input[type="file"]::file-selector-button {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 13px;
    font-family: inherit;
    font-size: .84rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    margin-right: 10px;
    transition: border-color .2s, color .2s;
}

.file-field input[type="file"]::file-selector-button:hover {
    border-color: var(--pink);
    color: var(--pink);
}

/* ------------------------- Panel de seguridad (fail2ban) ------------------------- */

.head-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-ghost {
    display: inline-block;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 9px 18px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    transition: border-color .2s, color .2s;
}

.btn-ghost:hover {
    border-color: var(--pink);
    color: var(--pink);
    text-decoration: none;
}

.head-actions .btn-primary {
    width: auto;
    margin-top: 0;
    padding-left: 20px;
    padding-right: 20px;
}

.stat-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 18px;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stats-paises {
    margin-top: -6px;
}

.stat-card-sm {
    min-width: 110px;
    padding: 10px 14px;
    border-radius: 12px;
}

.stat-card-sm .stat-num {
    font-size: 1.15rem;
    color: var(--ink);
}

.stat-card-sm .stat-lbl {
    font-size: .76rem;
}

.stat-num {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--pink);
    line-height: 1;
}

.stat-lbl {
    font-size: .78rem;
    color: var(--muted);
    line-height: 1.35;
}

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

.table td {
    vertical-align: top;
}

.small {
    font-size: .78rem;
}

.badge + .badge {
    margin-left: 4px;
}

.badge-jail {
    background: rgba(20, 20, 26, .08);
    color: var(--ink);
}

.badge-user {
    background: #FDE9EF;
    color: var(--pink-dark);
}

.badge-warn {
    background: #FFF4D6;
    color: #92700A;
}

.detail-cell {
    max-width: 340px;
}

.detail-cell summary {
    cursor: pointer;
    color: var(--pink);
    font-weight: 600;
    font-size: .84rem;
}

.code-block {
    margin-top: 8px;
    background: #14141A;
    color: #E7E7EA;
    border-radius: 10px;
    padding: 10px 12px;
    max-height: 240px;
    overflow: auto;
}

.code-line {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .74rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.code-line:last-child {
    border-bottom: none;
}

/* ------------------------- Cloudflare (asistente de activación) ------------------------- */

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 18px;
}

.cf-step {
    display: flex;
    gap: 16px;
    padding: 18px 0;
    border-top: 1px solid var(--line);
}

.cf-step:first-of-type {
    border-top: none;
    padding-top: 0;
}

.cf-num {
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: .88rem;
    background: rgba(20, 20, 26, .08);
    color: var(--muted);
}

.cf-step.is-done .cf-num {
    background: #E7F9EF;
    color: #166534;
}

.cf-body {
    flex: 1;
    min-width: 0;
}

.cf-body h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 700;
}

.cf-body p {
    margin: 0 0 10px;
    line-height: 1.6;
}

.cf-help {
    background: #FAFAF9;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.cf-help summary {
    cursor: pointer;
    font-weight: 600;
    font-size: .88rem;
}

.cf-ol {
    margin: 10px 0 0;
    padding-left: 20px;
    color: var(--muted);
    font-size: .88rem;
    line-height: 1.7;
}

.cf-ns {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cf-ns code {
    background: #14141A;
    color: #E7E7EA;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: .85rem;
    display: inline-block;
}

code {
    background: rgba(20, 20, 26, .06);
    padding: 1px 6px;
    border-radius: 6px;
    font-size: .85em;
}

.btn-primary:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

/* ------------------------- Repartidores ------------------------- */

.card + .card { margin-top: 16px; }

.badge-ok { background: #E7F9EF; color: #166534; }
.badge-info { background: #E6F0FB; color: #1E4E8C; }
.badge-danger { background: #FDE9EF; color: #C4114C; }
.badge-muted { background: rgba(20, 20, 26, .07); color: var(--muted); }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 16px;
}

.cards-grid > .card + .card { margin-top: 0; }

.driver-card { max-width: 100%; }
.driver-card.is-off { opacity: .65; }

.driver-top { display: flex; gap: 14px; align-items: flex-start; }

.driver-photo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
    border: 1px solid var(--line);
    background: #fff;
}

.driver-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FDE9EF;
    color: var(--pink-dark);
    font-weight: 800;
    font-size: 1.3rem;
}

.driver-photo-lg {
    width: 140px;
    height: 140px;
    border-radius: 16px;
    object-fit: cover;
    border: 1px solid var(--line);
    display: block;
    margin-bottom: 12px;
}

.driver-head { min-width: 0; }
.driver-name { font-weight: 700; }
.driver-contact { font-size: .85rem; }
.driver-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.driver-meta {
    list-style: none;
    margin: 16px 0 0;
    padding: 14px 0 0;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: .87rem;
    color: var(--muted);
}

.driver-meta li { display: flex; align-items: center; gap: 7px; }

.veh-icon { display: inline-flex; width: 18px; height: 18px; color: var(--pink); flex: none; }
.veh-icon svg { width: 100%; height: 100%; }

.driver-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; }

.filters { padding: 18px 20px; }

.filters-form {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

.filters-form .form-field { margin: 0; }
.filters-form .form-field label { font-size: .78rem; font-weight: 600; margin-bottom: 5px; display: block; }

.filters-form input[type="text"],
.filters-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: .9rem;
    background: #FCFCFB;
    font-family: inherit;
    color: var(--ink);
}

.filters-form input:focus,
.filters-form select:focus {
    outline: none;
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(232, 23, 93, .12);
}

.filters-actions { display: flex; gap: 8px; align-items: center; }

@media (max-width: 1100px) {
    .filters-form { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
    .filters-form { grid-template-columns: 1fr; }
}

.pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 20px; }

.pager-btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: .87rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    background: #fff;
}

.pager-btn:hover { border-color: var(--pink); color: var(--pink); text-decoration: none; }
.pager-btn.is-disabled { opacity: .45; pointer-events: none; }
.pager-info { font-size: .85rem; color: var(--muted); }

.form-2col { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; align-items: start; }
.form-2col-sm { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

@media (max-width: 900px) {
    .form-2col { grid-template-columns: 1fr; }
    .form-2col-sm { grid-template-columns: 1fr; }
}

.auth-form select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: .95rem;
    margin-bottom: 16px;
    background: #FCFCFB;
    font-family: inherit;
    color: var(--ink);
}

.auth-form select:focus {
    outline: none;
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(232, 23, 93, .12);
}

.detail-list { list-style: none; margin: 0; padding: 0; }

.detail-list li {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
    font-size: .9rem;
}

.detail-list li:last-child { border-bottom: none; }
.detail-list li > span { color: var(--muted); }
.detail-list li > strong,
.detail-list li > a { text-align: right; }

.status-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* Metricas del repartidor (entregas / calificacion / DNI) */

.driver-metrics {
    display: flex;
    justify-content: space-between;
    text-align: center;
    gap: 10px;
    padding: 14px 0 0;
    margin-top: 14px;
    border-top: 1px solid var(--line);
}

.driver-metrics .metric {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.metric-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-weight: 800;
    font-size: 1.02rem;
    color: var(--ink);
}

.metric-doc {
    font-size: .82rem;
    font-weight: 600;
    word-break: break-all;
}

.metric-label {
    font-size: .74rem;
    color: var(--muted);
}

.star {
    width: 15px;
    height: 15px;
    color: #F5A623;
    flex: none;
}

.driver-metrics-lg {
    padding: 6px 0 0;
    margin-top: 0;
    border-top: none;
    gap: 24px;
    justify-content: flex-start;
}

.driver-metrics-lg .metric { flex: 0 0 auto; text-align: left; }

.driver-metrics-lg .metric-value {
    font-size: 1.8rem;
    justify-content: flex-start;
}

.driver-metrics-lg .star { width: 24px; height: 24px; }
.driver-metrics-lg .metric-label { font-size: .8rem; }

.btn-ghost-sm { padding: 7px 14px; font-size: .83rem; }
.btn-ghost.is-current { border-color: var(--pink); color: var(--pink); font-weight: 700; }

/* ------------------------- Solicitud de repartidor ------------------------- */

.progress {
    height: 10px;
    background: rgba(20, 20, 26, .08);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--pink);
    border-radius: 999px;
    transition: width .3s ease;
}

.doc-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 10px;
    background: #FCFCFB;
}

.doc-row.is-ok { border-color: #BBF7D0; background: #F6FEF9; }
.doc-row.is-bad { border-color: #F5C6D4; background: #FDF2F6; }

.doc-info { min-width: 0; flex: 1 1 220px; }
.doc-info strong { display: inline-block; margin-right: 8px; }

.doc-upload,
.doc-review {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.doc-upload input[type="file"] {
    font-family: inherit;
    font-size: .82rem;
    color: var(--muted);
    max-width: 230px;
}

.doc-upload input[type="file"]::file-selector-button {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 11px;
    font-family: inherit;
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    margin-right: 8px;
}

.doc-review select,
.doc-review input {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: .85rem;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
}

.doc-review input { min-width: 190px; }

@media (max-width: 700px) {
    .doc-row { flex-direction: column; align-items: stretch; }
    .doc-upload input[type="file"],
    .doc-review input { max-width: 100%; min-width: 0; width: 100%; }
}

/* ------------------------- Catálogo público ------------------------- */

.pub-body { background: var(--paper); padding-top: 0; }

.pub-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 6vw;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.pub-logo { display: inline-flex; align-items: center; text-decoration: none; }
.pub-links { display: flex; align-items: center; gap: 16px; }
.pub-links a { font-weight: 600; font-size: .92rem; color: var(--ink); text-decoration: none; }
.pub-links a:hover { color: var(--pink); }

.pub-main { max-width: 1180px; margin: 0 auto; padding: 28px 6vw 60px; }

.pub-head { margin-bottom: 26px; }
.pub-head h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 800; margin: 0 0 8px; }
.pub-head p { color: var(--muted); margin: 0; }
.pub-head a { color: var(--pink); font-weight: 600; }

.pub-title { font-size: 1.25rem; font-weight: 800; margin: 34px 0 14px; }

.pub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
}

.pub-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    text-decoration: none;
    color: var(--ink);
    transition: box-shadow .2s ease, transform .2s ease;
}

.pub-card:hover { box-shadow: 0 16px 34px rgba(20, 20, 26, .09); transform: translateY(-3px); text-decoration: none; }

.pub-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }

.pub-card-body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 3px; }
.pub-card-body strong { font-size: .98rem; }

.pub-grid-products { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

.pub-product {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: var(--ink);
}

.pub-product img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.pub-product-body { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 3px; }

.pub-price { font-weight: 800; color: var(--pink); margin-top: 4px; display: flex; align-items: baseline; gap: 8px; }
.pub-price-old { font-weight: 500; font-size: .8rem; color: var(--muted); text-decoration: line-through; }

.pub-negocio {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 18px;
}

.pub-negocio-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.pub-negocio-head > div { flex: 1; min-width: 0; }

.pub-logo-sm { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); flex: none; }
.pub-logo-md { width: 68px; height: 68px; border-radius: 16px; object-fit: cover; border: 1px solid var(--line); flex: none; }

.pub-negocio-hero { margin-bottom: 8px; }
.pub-cover { width: 100%; height: 200px; object-fit: cover; border-radius: 18px; display: block; margin-bottom: 14px; }
.pub-negocio-info { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.pub-negocio-info h1 { font-size: 1.5rem; font-weight: 800; margin: 0 0 6px; }
.pub-negocio-info p { margin: 0 0 6px; }

.pub-footer {
    border-top: 1px solid var(--line);
    padding: 20px 6vw;
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: .85rem;
    flex-wrap: wrap;
    gap: 10px;
}