/* ==========================================================
   HUB DE COBRO - STYLE.CSS CONSOLIDADO
   Reemplazar completo:
   _lc-core-7842/admin/assets/style.css
   ========================================================== */

:root {
    --bg: #0e1118;
    --panel: #151a24;
    --panel-soft: #1d2430;
    --text: #eef2f8;
    --muted: #a9b2c3;
    --border: #2a3344;
    --accent: #e1b653;
    --danger: #ff6b6b;
    --success: #51d18a;
    --warning: #ffd166;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

code {
    color: var(--accent);
}

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

/* ==========================================================
   LAYOUT GENERAL
   ========================================================== */

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
    background: #090c12;
    border-right: 1px solid var(--border);
    padding: 22px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 28px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #111;
    font-weight: 800;
}

.brand span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar nav a {
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--muted);
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: var(--panel-soft);
    color: var(--text);
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 10px;
    color: var(--muted);
}

.logout {
    color: var(--danger);
    text-decoration: none;
}

.main {
    min-width: 0;
    padding: 26px;
}

.topbar {
    margin-bottom: 24px;
}

.topbar h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
}

/* ==========================================================
   TARJETAS Y GRIDS
   ========================================================== */

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 22px;
    clear: both;
}

.card h2 {
    margin-top: 0;
}

.grid {
    display: grid;
    gap: 18px;
    margin-bottom: 24px;
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Corrección fuerte para dashboard */
.dashboard-metrics,
.grid.grid-4 {
    margin-bottom: 34px !important;
    gap: 20px !important;
}

.dashboard-metrics + .card,
.dashboard-metrics + .dashboard-recent-orders,
.grid.grid-4 + .card {
    margin-top: 0 !important;
    clear: both;
}

.metric {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.metric small {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}

.metric strong {
    font-size: 30px;
    line-height: 1;
}

/* ==========================================================
   TABLAS
   ========================================================== */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
}

td {
    min-width: 90px;
}

/* Evita que formularios de acciones se pisen dentro de tablas */
td form {
    display: inline-flex;
    align-items: center;
    margin: 4px 8px 4px 0 !important;
    vertical-align: middle;
}

td form button {
    margin: 0 !important;
}

/* Contenedor específico de acciones de archivos */
.file-actions-stack {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center !important;
    min-width: 220px;
}

.file-action-form {
    display: inline-flex !important;
    margin: 0 !important;
}

.file-actions-stack .btn {
    margin: 0 !important;
    white-space: nowrap;
}

/* ==========================================================
   BOTONES
   ========================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 9px 14px;
    background: var(--accent);
    color: #111;
    border: 0;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.1;
    white-space: nowrap;
}

.btn:hover {
    filter: brightness(1.05);
}

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

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

.actions,
.action-row,
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Separación general para botones consecutivos */
.btn + .btn,
.btn + form,
form + .btn,
form + form {
    margin-left: 0;
}

/* ==========================================================
   FORMULARIOS
   ========================================================== */

.form {
    display: grid;
    gap: 16px;
    max-width: 760px;
}

.field {
    display: grid;
    gap: 6px;
}

label {
    color: var(--muted);
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    background: #0b0f16;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 12px;
    font: inherit;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    vertical-align: middle;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.form-row {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* En tablas los inputs no deben romper toda la pantalla */
td input,
td select,
td textarea {
    max-width: 260px;
}

/* ==========================================================
   FLASH / ALERTAS / BADGES
   ========================================================== */

.flash {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}

.flash.success {
    border-color: rgba(81, 209, 138, .4);
    background: rgba(81, 209, 138, .09);
}

.flash.error {
    border-color: rgba(255, 107, 107, .4);
    background: rgba(255, 107, 107, .09);
}

.badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    background: var(--panel-soft);
    color: var(--muted);
    white-space: nowrap;
}

.badge-paid,
.badge-completed,
.badge-active,
.badge-processed,
.badge-verified {
    color: var(--success);
}

.badge-failed,
.badge-error,
.badge-denied,
.badge-revoked,
.badge-blocked,
.badge-inactive {
    color: var(--danger);
}

.badge-pending,
.badge-approved,
.badge-received,
.badge-not_verified {
    color: var(--warning);
}

/* ==========================================================
   LOGIN
   ========================================================== */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 26px;
}

.login-card h1 {
    margin: 0 0 6px;
}

.login-card p {
    color: var(--muted);
    margin-top: 0;
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 1100px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .grid-4,
    .form-row {
        grid-template-columns: 1fr;
    }

    .main {
        padding: 18px;
    }

    .dashboard-metrics,
    .grid.grid-4 {
        margin-bottom: 28px !important;
    }

    .metric {
        min-height: 96px;
    }
}

@media (max-width: 640px) {
    .card {
        padding: 16px;
    }

    th,
    td {
        padding: 10px;
    }

    .btn {
        min-height: 36px;
        padding: 8px 12px;
    }

    td form {
        display: flex;
        margin: 6px 0 !important;
    }

    .file-actions-stack {
        display: grid !important;
        gap: 8px !important;
        min-width: 160px;
    }
}
