:root {
    --accent-50: #EEEDFE;
    --accent-100: #CECBF6;
    --accent-200: #AFA9EC;
    --accent-400: #7F77DD;
    --accent-600: #534AB7;
    --accent-800: #3C3489;
    --accent-900: #26215C;

    --ink: #1F2430;
    --ink-muted: #6B7280;
    --surface: #FFFFFF;
    --surface-alt: #F5F6F8;
    --border: #E5E7EB;

    --amber-bg: #FAEEDA;
    --amber-text: #633806;
    --green-bg: #EAF3DE;
    --green-text: #27500A;
    --sky-bg: #E6F1FB;
    --sky-text: #0C447C;
    --red-bg: #FCEBEB;
    --red-text: #791F1F;
}

* {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: var(--surface-alt);
    color: var(--ink);
    margin: 0;
    font-size: 15px;
}

/* Barra superior compartida por todas las páginas admin */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar .brand {
    font-weight: 600;
    font-size: 15px;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar .brand i {
    color: var(--accent-600);
}

.topbar nav {
    display: flex;
    gap: 4px;
}

.topbar nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--ink-muted);
    text-decoration: none;
}

.topbar nav a:hover,
.topbar nav a.active {
    background: var(--accent-50);
    color: var(--accent-800);
}

.topbar .logout {
    font-size: 13px;
    color: var(--ink-muted);
    text-decoration: none;
}

.topbar .logout:hover {
    color: var(--red-text);
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

.page-title {
    font-size: 25px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title i {
    color: var(--accent-600);
}

/* Tarjetas */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.metric {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
}

.metric .label {
    font-size: 13px;
    color: var(--ink-muted);
    margin: 0;
}

.metric .value {
    font-size: 28px;
    font-weight: 600;
    margin: 4px 0 0;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 18px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background: var(--surface-alt);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

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

.btn-primary:hover {
    background: var(--accent-800);
    border-color: var(--accent-800);
}

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

.btn-danger:hover {
    background: var(--red-bg);
}

.btn-success {
    background: #fff;
    border-color: #97C459;
    color: var(--green-text);
}

.btn-success:hover {
    background: var(--green-bg);
}

/* Badges de estado */
.badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-disponible { background: var(--surface-alt); color: var(--ink-muted); }
.badge-pendiente  { background: var(--amber-bg); color: var(--amber-text); }
.badge-pagada     { background: var(--green-bg); color: var(--green-text); }
.badge-usada      { background: var(--sky-bg); color: var(--sky-text); }
.badge-anulada    { background: var(--red-bg); color: var(--red-text); }

/* Formularios */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="file"],
select,
textarea {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 15px;
    width: 100%;
    background: var(--surface);
    color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-400);
    box-shadow: 0 0 0 3px var(--accent-50);
}

label {
    font-size: 14px;
    color: var(--ink-muted);
    display: block;
    margin-bottom: 5px;
}

/* Tabla */
table.datos {
    width: 100%;
    border-collapse: collapse;
}

table.datos th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ink-muted);
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

table.datos td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

/* Barra superior mobile (comprador / revendedor) */
.mobile-topbar {
    background: var(--accent-900);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-topbar .eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.75;
    margin: 0;
}

.mobile-topbar .title {
    font-size: 17px;
    font-weight: 600;
    margin: 2px 0 0;
}

.hidden {
    display: none !important;
}

/* ============ Sidebar oscuro (layout admin) ============ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: #1A1740;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
}

.sidebar .brand .icon-box {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--accent-600);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
}

.sidebar .group-label {
    color: #7A78A8;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 18px 0 8px;
}

.sidebar .group-label:first-of-type {
    margin-top: 0;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #C7C5E8;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    margin-bottom: 3px;
}

.sidebar a:hover {
    background: #2A2660;
    color: #fff;
}

.sidebar a.active {
    background: var(--accent-600);
    color: #fff;
}

.sidebar .sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #322D66;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar .sidebar-footer a {
    margin: 0;
    padding: 4px;
    color: #C7C5E8;
}

.avatar-mini {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-600);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-content {
    flex: 1;
    padding: 30px 40px;
    max-width: 1300px;
}

/* ============ Login split-screen ============ */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: var(--surface-alt);
}

.login-split {
    width: 100%;
    max-width: 760px;
    margin: auto;
    display: flex;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.login-left {
    flex: 1.1;
    background: #1A1740;
    padding: 40px 34px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-left .icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--accent-600);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    margin-bottom: 14px;
}

.login-left .title {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.login-left .subtitle {
    color: #B4B2D8;
    font-size: 13px;
    margin: 4px 0 22px;
}

.login-left .feature {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #D6D4EE;
    font-size: 13px;
    margin-bottom: 12px;
}

.login-left .feature i {
    color: var(--accent-400);
}

.login-right {
    flex: 1;
    background: var(--surface);
    padding: 40px 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ============ Stepper de compra ============ */
.stepper-header {
    background: var(--accent-900);
    padding: 20px 24px 24px;
}

.stepper-dots {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 260px;
    margin: 0 auto;
    position: relative;
}

.stepper-dots::before {
    content: '';
    position: absolute;
    top: 13px;
    left: 13px;
    right: 13px;
    height: 1px;
    background: #4A4590;
    z-index: 0;
}

.step-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    z-index: 1;
    background: #3C3489;
    color: #B4B2D8;
}

.step-circle.done {
    background: var(--accent-400);
    color: #fff;
}

.step-circle.current {
    background: #fff;
    color: var(--accent-900);
}

.stepper-labels {
    display: flex;
    justify-content: space-between;
    max-width: 260px;
    margin: 6px auto 0;
    font-size: 10px;
    color: #B4B2D8;
}

.stepper-labels .current {
    color: #fff;
    font-weight: 500;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
}

.qty-btn.filled {
    background: var(--accent-600);
    color: #fff;
    border-color: var(--accent-600);
}

/* ============ Grillas reutilizables (se apilan en celular) ============ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-main-aside { display: grid; grid-template-columns: 3fr 1fr; gap: 16px; }
.grid-tiles-aside { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* ============ Barra superior mobile (solo pantallas admin) ============ */
.mobile-admin-topbar {
    display: none;
    background: #1A1740;
    color: #fff;
    padding: 14px 16px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
}

.mobile-admin-topbar .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
}

.mobile-admin-topbar button {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    padding: 4px 8px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 90;
}

@media (max-width: 860px) {
    .mobile-admin-topbar {
        display: flex;
    }

    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 100;
        width: 250px;
    }

    .sidebar.abierto {
        transform: translateX(0);
    }

    .sidebar-overlay.abierto {
        display: block;
    }

    .app-content {
        padding: 18px 16px;
        max-width: 100%;
    }

    .grid-2,
    .grid-3,
    .grid-main-aside,
    .grid-tiles-aside {
        grid-template-columns: 1fr;
    }
}

.mobile-topbar a {
    color: #fff;
    font-size: 13px;
    text-decoration: none;
    opacity: 0.9;
}
