/* ============================================
   Generador de Documentos CIME
   ============================================ */

:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #3b82f6;
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-muted: #64748b;
    --success: #059669;
    --danger: #dc2626;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.05);
    --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

.app-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.sidebar-header h2 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 12px;
    background: var(--bg);
}

.input-search:focus {
    outline: none;
    border-color: var(--primary-light);
    background: white;
}

.lista-clientes {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.lista-clientes li {
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.lista-clientes li:hover {
    background: var(--bg);
}

.lista-clientes li.activo {
    background: #dbeafe;
    color: var(--primary-dark);
}

.lista-clientes .cliente-info {
    flex: 1;
    min-width: 0;
}

.lista-clientes .cliente-nombre {
    font-weight: 500;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lista-clientes .cliente-ci {
    font-size: 11px;
    color: var(--text-muted);
}

.lista-clientes .btn-eliminar {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

.lista-clientes li:hover .btn-eliminar {
    opacity: 1;
}

.lista-clientes .btn-eliminar:hover {
    color: var(--danger);
    background: #fef2f2;
}

.sidebar-footer {
    padding-top: 12px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    text-align: center;
}

.sin-clientes {
    text-align: center;
    color: var(--text-muted);
    padding: 30px 12px;
    font-size: 13px;
}

/* ============================================
   Main content
   ============================================ */
.main-content {
    padding: 24px 32px 40px;
    overflow-y: auto;
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.main-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

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

.header-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   Form
   ============================================ */
.form-grid {
    display: grid;
    gap: 16px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px 22px;
    box-shadow: var(--shadow);
}

.card legend {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    padding: 0 8px;
    margin-left: -8px;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    margin-top: 12px;
}

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

.row label.col-2 { grid-column: span 2; }
.row label.col-3 { grid-column: span 3; }

.row label span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.row input,
.row select,
.row textarea {
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.row input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    padding: 9px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-secondary:hover {
    background: #eff6ff;
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-ghost:hover {
    background: var(--bg);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* ============================================
   Preview
   ============================================ */
.preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.preview-toolbar {
    width: 100%;
    max-width: 850px;
    background: white;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
    flex-wrap: wrap;
    gap: 12px;
    position: sticky;
    top: 20px;
    z-index: 10;
}

.preview-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.tab {
    background: transparent;
    border: 1px solid transparent;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-muted);
    font-family: inherit;
}

.tab:hover {
    background: var(--bg);
    color: var(--text);
}

.tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.preview-actions {
    display: flex;
    gap: 8px;
}

.preview-content {
    width: 100%;
    max-width: 850px;
}

/* ============================================
   Documento (página A4)
   ============================================ */
.documento {
    background: white;
    width: 210mm;
    min-height: 297mm;
    padding: 22mm 20mm;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
    font-family: "Times New Roman", Georgia, serif;
    font-size: 11pt;
    line-height: 1.5;
    color: #000;
}

.doc-header {
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.doc-header .doc-logo {
    height: 70px;
    width: auto;
    flex-shrink: 0;
    object-fit: contain;
}

.doc-header .doc-brand {
    font-family: Arial, sans-serif;
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 13pt;
    letter-spacing: 0.5px;
    flex: 1;
}

.doc-header .doc-brand small {
    display: block;
    font-size: 8pt;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.doc-header .doc-meta {
    font-size: 9pt;
    color: var(--text-muted);
    text-align: right;
}

.doc-titulo {
    text-align: center;
    font-weight: 700;
    font-size: 13pt;
    text-transform: uppercase;
    margin: 14px 0 18px;
    letter-spacing: 0.5px;
}

.doc-subtitulo {
    text-align: center;
    font-weight: 600;
    font-size: 11pt;
    margin: 4px 0 18px;
}

.doc p {
    margin: 0 0 10px;
    text-align: justify;
}

.doc strong { font-weight: 700; }

.doc .clausula {
    margin-bottom: 10px;
    text-align: justify;
}

.doc .firmas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 60px;
    text-align: center;
}

.doc .firma-linea {
    border-top: 1px solid #000;
    padding-top: 4px;
    font-size: 10pt;
    font-weight: 600;
}

.doc .campo-relleno {
    display: inline-block;
    border-bottom: 1px solid #000;
    min-width: 80px;
    padding: 0 4px;
    font-weight: 600;
}

.doc .label-campo {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 10pt;
}

.doc .fila-datos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 8px 0;
}

.doc .fila-datos.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.doc .campo {
    border-bottom: 1px solid #000;
    padding: 2px 4px;
    min-height: 18px;
}

.doc .campo-label {
    font-size: 8pt;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-top: 2px;
}

.doc .recuadro {
    border: 1px solid #000;
    padding: 10px 12px;
    margin: 10px 0;
}

.doc .croquis-grid {
    border: 1px solid #000;
    height: 130px;
    background-color: #fff;
    background-image:
        linear-gradient(to right, #c9c9c9 1px, transparent 1px),
        linear-gradient(to bottom, #c9c9c9 1px, transparent 1px);
    background-size: 18px 18px;
    background-position: 0 0;
}

/* ============================================
   Presupuesto — formulario (lista de deudas)
   ============================================ */
.card-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 4px 0 12px;
}

.lista-deudas {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.deuda-row {
    display: grid;
    grid-template-columns: 1fr 180px 36px;
    gap: 10px;
    align-items: center;
}

.deuda-row input {
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: var(--text);
}

.deuda-row input[data-deuda="monto"] {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.deuda-row input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-borrar-deuda {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 1px solid var(--border-strong);
    background: white;
    color: var(--danger);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-borrar-deuda:hover {
    background: #fef2f2;
    border-color: var(--danger);
}

.presupuesto-totales {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.totales-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text);
}

.total-row strong {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.total-row.total-final {
    font-size: 15px;
    padding-top: 6px;
    border-top: 1px dashed var(--border-strong);
    margin-top: 4px;
}
.total-row.total-final strong {
    color: var(--primary-dark);
    font-size: 16px;
}

.totales-sep {
    border: none;
    border-top: 1px solid var(--border);
    margin: 6px 0;
}

.input-pct {
    width: 56px;
    padding: 2px 6px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    font-size: 13px;
    text-align: right;
}

#presup-diferencia.diff-ok    { color: var(--success); }
#presup-diferencia.diff-bad   { color: var(--danger); }
#presup-diferencia.diff-neutral { color: var(--text-muted); }

/* ============================================
   Presupuesto — documento (tabla)
   ============================================ */
.doc .tabla-presupuesto {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 11pt;
}

.doc .tabla-presupuesto th,
.doc .tabla-presupuesto td {
    border: 1px solid #444;
    padding: 8px 10px;
    vertical-align: middle;
}

.doc .tabla-presupuesto thead th {
    background: #e8f0ee;
    color: #1a3a36;
    text-transform: uppercase;
    font-size: 10pt;
    letter-spacing: 0.3px;
}

.doc .tabla-presupuesto .cell-num {
    width: 36px;
    text-align: center;
}

.doc .tabla-presupuesto .cell-monto {
    width: 160px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.doc .tabla-presupuesto .cell-label {
    text-align: right;
    font-weight: 600;
}

.doc .tabla-presupuesto tfoot tr.row-subtotal td,
.doc .tabla-presupuesto tfoot tr.row-comision td {
    background: #fafafa;
}

.doc .tabla-presupuesto tfoot tr.row-total td {
    background: #d9ebe7;
    font-size: 12pt;
}

.doc .tabla-presupuesto tfoot tr.row-credito td,
.doc .tabla-presupuesto tfoot tr.row-diferencia td {
    background: #f4f4f4;
    font-size: 10pt;
}

/* ============================================
   Recibo de dinero — formato simple, sin membrete
   ============================================ */
.doc.doc-recibo {
    padding-top: 60px;
}

.doc-recibo .recibo-encabezado {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #000;
    padding-bottom: 10px;
    margin-bottom: 28px;
}

.doc-recibo .recibo-titulo {
    font-size: 22pt;
    font-weight: 700;
    letter-spacing: 4px;
    margin: 0;
}

.doc-recibo .recibo-monto-box {
    border: 1px solid #000;
    padding: 8px 18px;
    font-size: 13pt;
    font-variant-numeric: tabular-nums;
}

.doc-recibo .recibo-cuerpo {
    font-size: 12pt;
    line-height: 1.8;
    text-align: justify;
    margin: 14px 0;
}

.doc-recibo .recibo-fecha {
    margin-top: 28px;
    font-size: 11pt;
}

.doc-recibo .recibo-firma {
    margin-top: 90px;
    text-align: center;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.doc-recibo .recibo-firma .firma-linea {
    border-top: 1px solid #000;
    padding-top: 4px;
}

/* ============================================
   Print
   ============================================ */
@media print {
    @page {
        size: A4;
        margin: 0;
    }

    body {
        background: white;
    }

    .no-print { display: none !important; }

    .preview-overlay {
        position: static;
        background: white;
        padding: 0;
        display: block;
    }

    .preview-content {
        max-width: none;
    }

    .documento {
        box-shadow: none;
        margin: 0;
        page-break-after: always;
        width: 100%;
        min-height: 100vh;
        padding: 18mm 18mm;
    }

    .documento:last-child {
        page-break-after: auto;
    }
}

/* ============================================
   Login screen
   ============================================ */
.login-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.login-box {
    background: white;
    border-radius: 12px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

.login-title {
    margin: 0 0 6px;
    font-size: 22px;
    color: var(--text);
    text-align: center;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin: 0 0 24px;
    font-size: 14px;
}

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-box label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.login-box label span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.login-box input {
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.login-box input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-block {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
}

.login-error {
    color: var(--danger);
    font-size: 13px;
    text-align: center;
    margin: 4px 0 0;
    min-height: 18px;
}

/* ============================================
   User menu (header)
   ============================================ */
.user-menu {
    position: relative;
}

#btn-user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-badge {
    font-size: 10px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.role-badge.admin {
    background: #fef3c7;
    color: #92400e;
}

.role-badge.registrador {
    background: #dbeafe;
    color: #1e40af;
}

.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    display: none;
    z-index: 50;
}

.dropdown.open {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 10px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
    font-family: inherit;
}

.dropdown-item:hover {
    background: var(--bg);
}

/* Cuando el usuario NO es admin, ocultar elementos admin-only */
body.role-registrador .admin-only {
    display: none !important;
}

body.role-registrador input,
body.role-registrador select,
body.role-registrador textarea {
    /* Cuando hay un cliente cargado y el rol es registrador, los inputs se vuelven readonly via JS */
}

body.cliente-cargado.role-registrador #form-cliente input:not([type="file"]),
body.cliente-cargado.role-registrador #form-cliente select {
    background: #f8fafc;
    pointer-events: none;
}

body.cliente-cargado.role-registrador #btn-guardar {
    display: none;
}

/* ============================================
   Estado del cliente
   ============================================ */
.estado-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.estado-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.estado-badge.pendiente { background: #fef3c7; color: #92400e; }
.estado-badge.aprobado  { background: #d1fae5; color: #065f46; }
.estado-badge.cerrado   { background: #e0e7ff; color: #3730a3; }
.estado-badge.cancelado { background: #fee2e2; color: #991b1b; }

#estado-controles {
    display: flex;
    gap: 8px;
    align-items: center;
}

#estado-select {
    padding: 7px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    font-size: 13px;
    background: white;
}

/* Mini-badge en la lista */
.lista-clientes .mini-badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.lista-clientes .mini-badge.pendiente { background: #f59e0b; }
.lista-clientes .mini-badge.aprobado  { background: #10b981; }
.lista-clientes .mini-badge.cerrado   { background: #6366f1; }
.lista-clientes .mini-badge.cancelado { background: #ef4444; }

/* ============================================
   Filtros de estado
   ============================================ */
.filtros-estado {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.filtro-btn {
    padding: 4px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    font-family: inherit;
}

.filtro-btn.activo {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ============================================
   Lista de documentos
   ============================================ */
.lista-documentos {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

.doc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 6px;
    font-size: 13px;
}

.doc-item .doc-icon {
    width: 28px;
    height: 28px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 10px;
    flex-shrink: 0;
}

.doc-item .doc-icon.contrato { background: #dbeafe; color: #1e40af; }
.doc-item .doc-icon.pagare    { background: #d1fae5; color: #065f46; }
.doc-item .doc-icon.carta_poder { background: #fef3c7; color: #92400e; }
.doc-item .doc-icon.solicitud { background: #e0e7ff; color: #3730a3; }
.doc-item .doc-icon.otro      { background: #f3e8ff; color: #6b21a8; }

.doc-item .doc-info {
    flex: 1;
    min-width: 0;
}

.doc-item .doc-nombre {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-item .doc-meta {
    color: var(--text-muted);
    font-size: 11px;
}

.doc-item .doc-actions {
    display: flex;
    gap: 4px;
}

.doc-item .icon-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    color: var(--text-muted);
}

.doc-item .icon-btn:hover {
    background: white;
    color: var(--text);
}

.docs-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 16px;
    font-size: 13px;
    font-style: italic;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.modal-body {
    padding: 22px 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body h3 {
    margin: 0 0 12px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
}

.modal-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

.users-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.users-form .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.aviso-info {
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    padding: 10px 14px;
    font-size: 12px;
    color: #92400e;
    border-radius: 4px;
    margin: 8px 0;
}

.comando-pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 14px;
    border-radius: 6px;
    font-size: 11px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: "Courier New", monospace;
    margin-top: 10px;
}

.lista-usuarios {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.usuario-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg);
    border-radius: 6px;
}

.usuario-item .usuario-info {
    flex: 1;
    min-width: 0;
}

.usuario-item .usuario-nombre {
    font-weight: 500;
    font-size: 13px;
}

.usuario-item .usuario-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.usuario-item select {
    padding: 5px 8px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    font-size: 12px;
    background: white;
}

/* ============================================
   Toast
   ============================================ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0f172a;
    color: white;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    z-index: 250;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    max-width: 320px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success { background: #059669; }
.toast.error { background: #dc2626; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: relative;
        height: auto;
        max-height: 300px;
    }
    .row {
        grid-template-columns: 1fr;
    }
    .row label.col-2,
    .row label.col-3 {
        grid-column: span 1;
    }
}
