:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --text: #1a2332;
    --muted: #5c6b7a;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --border: #e2e8f0;
    --success: #059669;
    --danger: #dc2626;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --sidebar-width: 240px;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-muted: #94a3b8;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }

/* --- Layout con menú lateral --- */
.app-body {
    margin: 0;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 200;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.12);
}

.sidebar-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    text-decoration: none;
    line-height: 1.3;
    display: block;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
}

.sidebar-section {
    margin: 0.75rem 1rem 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sidebar-muted);
}

.sidebar-link {
    display: block;
    padding: 0.65rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(37, 99, 235, 0.2);
    color: #fff;
    border-left-color: var(--primary);
    font-weight: 500;
}

/* Menú desplegable (mismo estilo que .sidebar-link) */
.sidebar-dropdown {
    margin: 0;
}

.sidebar-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: none;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

.sidebar-dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-dropdown.is-active > .sidebar-dropdown-toggle {
    color: #fff;
    font-weight: 500;
    border-left-color: var(--primary);
    background: rgba(37, 99, 235, 0.12);
}

.sidebar-dropdown-label {
    flex: 1;
    min-width: 0;
}

.sidebar-dropdown-icon {
    flex-shrink: 0;
    width: 0.45rem;
    height: 0.45rem;
    margin-left: 0.5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    opacity: 0.8;
}

.sidebar-dropdown.is-open .sidebar-dropdown-icon {
    transform: rotate(-135deg);
    margin-top: 0.15rem;
}

.sidebar-dropdown-menu {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.22s ease;
    background: rgba(0, 0, 0, 0.18);
    margin: 0 0.65rem 0.2rem 0.85rem;
    border-left: 2px solid rgba(255, 255, 255, 0.14);
    border-radius: 0 6px 6px 0;
}

.sidebar-dropdown.is-open .sidebar-dropdown-menu {
    grid-template-rows: 1fr;
}

.sidebar-dropdown-menu-inner {
    overflow: hidden;
    min-height: 0;
}

.sidebar-dropdown-item {
    padding-left: 1.35rem;
    padding-right: 1rem;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}

.sidebar-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-dropdown-item.active {
    border-left-color: var(--primary);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.sidebar-user-role {
    display: block;
    font-size: 0.8rem;
    color: var(--sidebar-muted);
    margin-top: 0.15rem;
}

.sidebar-user-sucursal {
    display: block;
    font-size: 0.75rem;
    color: #93c5fd;
    margin-top: 0.35rem;
}

.sidebar-logout { margin-top: 0.75rem; }

.btn-sidebar-logout {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.app-shell {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    padding: 0 1.5rem;
    min-height: 56px;
    display: flex;
    align-items: center;
}

.topbar-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
}

.main-content {
    flex: 1;
    padding: 1.5rem 2rem;
    max-width: 1200px;
    width: 100%;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 300;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 8px;
    background: var(--sidebar-bg);
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 150;
}

.sidebar-open .sidebar-backdrop {
    display: block;
}

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }

.btn-block { width: 100%; text-align: center; }

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #1e3a5f 0%, #2563eb 50%, #3b82f6 100%);
}

.auth-wrapper { width: 100%; max-width: 420px; padding: 1rem; }

.auth-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand h1 { margin: 0; font-size: 1.35rem; color: var(--primary); }
.auth-brand p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.9rem; }

.auth-form { box-shadow: none; padding: 0; background: transparent; }

.footer {
    padding: 1rem 1.5rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.85rem;
}

.hero h1 { margin: 0 0 0.5rem; }
.hero p { color: var(--muted); }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow);
    transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.card h2 { margin: 0 0 0.5rem; color: var(--primary); }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header h1 { margin: 0; font-size: 1.5rem; }

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #e2e8f0; color: var(--text); }

.table-wrap {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

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

.table th, .table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th { background: #f8fafc; font-size: 0.85rem; color: var(--muted); }

.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.thumb-placeholder { color: var(--muted); }

.actions { white-space: nowrap; }
.actions a, .actions .btn-link { margin-right: 0.75rem; font-size: 0.9rem; }
.actions a { color: var(--primary); text-decoration: none; }

.inline-form { display: inline; }
.btn-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-link.danger { color: var(--danger); }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
}
.badge-success { background: #d1fae5; color: var(--success); }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-danger { background: #fee2e2; color: var(--danger); }
.badge-muted { background: #e2e8f0; color: var(--muted); }

.btn-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary);
    cursor: pointer;
    font-size: inherit;
    text-decoration: underline;
}

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

.modal-dialog {
    border: none;
    border-radius: var(--radius);
    padding: 0;
    max-width: 420px;
    width: calc(100% - 2rem);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
}

.modal-form {
    padding: 1.5rem;
}

.modal-title {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
}

.modal-text {
    margin: 0 0 0.5rem;
    color: var(--muted);
}

.modal-hint {
    margin: 0 0 1rem;
    font-size: 0.85rem;
    color: var(--primary);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.modal-actions .btn-modal-tipo {
    flex: 1;
}

.modal-cancel {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 0.25rem;
}

/* --- Módulo comprobantes --- */
.comprobantes-resumen {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.comprobantes-stat {
    flex: 1;
    min-width: 120px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow);
}

.comprobantes-stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.comprobantes-stat-label {
    font-size: 0.85rem;
    color: var(--muted);
}

.comprobantes-stat-boleta .comprobantes-stat-value { color: #1d4ed8; }
.comprobantes-stat-factura .comprobantes-stat-value { color: #7c3aed; }

.comprobantes-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.comprobantes-tab {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
}

.comprobantes-tab:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.comprobantes-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.comprobantes-subtabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.comprobantes-subtab {
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.85rem;
    color: var(--muted);
    background: #f1f5f9;
    border: 1px solid transparent;
}

.comprobantes-subtab:hover {
    color: var(--primary);
}

.comprobantes-subtab.active {
    background: #eff6ff;
    color: var(--primary);
    border-color: #bfdbfe;
    font-weight: 500;
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.modal-serie-group {
    margin: 0.75rem 0 1rem;
    text-align: left;
}

.modal-serie-group select {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
}

.text-muted {
    color: var(--muted);
    font-size: 0.9rem;
}

.d-block {
    display: block;
}

.gastos-resumen .comprobantes-stat-value {
    color: #b45309;
}

.ingresos-resumen .comprobantes-stat-value {
    color: #15803d;
}

/* --- Módulo caja --- */
.caja-periodo-tabs {
    margin-bottom: 0.75rem;
}

.caja-periodo-etiqueta {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    color: var(--text);
}

.caja-filtro-moneda {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.caja-filtro-moneda-field {
    max-width: 280px;
    margin: 0;
}

.caja-rango-colapsado {
    display: none;
}

.caja-resumen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.caja-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
}

.caja-panel-title {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    color: var(--primary);
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.caja-panel-simbolo {
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 500;
}

.caja-panel-list {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.45rem 1rem;
    margin: 0 0 1rem;
}

.caja-panel-list dt {
    margin: 0;
    font-weight: 500;
    color: var(--text);
}

.caja-panel-list dd {
    margin: 0;
    text-align: right;
    font-weight: 600;
}

.caja-monto-entrada {
    color: #15803d;
}

.caja-monto-salida {
    color: #b45309;
}

.caja-saldo {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.caja-saldo-label {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
}

.caja-saldo-valor {
    font-size: 1.35rem;
    font-weight: 700;
}

.caja-saldo-positivo .caja-saldo-valor {
    color: #15803d;
}

.caja-saldo-negativo .caja-saldo-valor {
    color: #b91c1c;
}

.comprobantes-filtros {
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.form-grid-inline {
    align-items: flex-end;
}

.form-group-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge-factura {
    background: #ede9fe;
    color: #6d28d9;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }

.form {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 0 0 1.5rem;
    padding: 1rem 1.25rem 1.25rem;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

legend { font-weight: 600; padding: 0 0.5rem; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-group-full { grid-column: 1 / -1; }

.form-group label { display: block; margin-bottom: 0.35rem; font-size: 0.9rem; font-weight: 500; }

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
}

.checkbox { display: flex; align-items: center; gap: 0.5rem; font-weight: normal; }
.hint { font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; }

.form-actions { margin-top: 1rem; }

.detail-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.detail-photo img { max-width: 100%; border-radius: var(--radius); }

.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 0.5rem 1rem; margin: 0; }
.detail-list dt { color: var(--muted); font-weight: 500; }
.detail-list dd { margin: 0; }

.detail-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.detail-sections section {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.detail-sections h2 { margin: 0 0 1rem; font-size: 1rem; color: var(--primary); }

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

.section-title { margin: 2rem 0 1rem; font-size: 1.1rem; }

.text-right { text-align: right; }

.card-featured {
    border-color: var(--primary);
    background: linear-gradient(135deg, #eff6ff 0%, #fff 100%);
}

.venta-lineas-toolbar { margin-bottom: 1rem; }

.venta-lineas-wrap {
    width: 100%;
}

.venta-lineas-table .col-cant { width: 110px; }
.venta-lineas-table .col-precio { width: 130px; }
.venta-lineas-table .col-subtotal { width: 120px; }

.venta-lineas-table select,
.venta-lineas-table input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
}

.venta-lineas-table .linea-subtotal-cell {
    white-space: nowrap;
}

.venta-totales {
    margin-top: 1.5rem;
    max-width: 360px;
    margin-left: auto;
    background: var(--surface);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.venta-totales-list {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem 1.5rem;
    margin: 0;
}

.venta-totales-list dt { color: var(--muted); font-weight: 500; margin: 0; }
.venta-totales-list dd { margin: 0; text-align: right; font-weight: 500; }

.venta-total-final {
    font-size: 1.15rem;
    color: var(--primary);
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .app-shell {
        margin-left: 0;
    }

    .topbar-inner {
        padding-left: 3.5rem;
    }

    .main-content {
        padding: 1rem;
    }
}

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .config-grid { grid-template-columns: 1fr; }

    .form {
        padding: 1rem;
    }

    fieldset {
        padding: 0.85rem 0.75rem 1rem;
    }

    .venta-totales {
        max-width: none;
        width: 100%;
        margin-left: 0;
    }

    /* Líneas de venta: tarjetas en lugar de tabla ancha */
    .venta-lineas-wrap {
        overflow: visible;
        background: transparent;
        box-shadow: none;
    }

    .venta-lineas-table {
        width: 100%;
        min-width: 0;
    }

    .venta-lineas-table thead {
        display: none;
    }

    .venta-lineas-table tbody {
        display: block;
    }

    .venta-lineas-table .venta-linea {
        display: block;
        margin-bottom: 0.85rem;
        padding: 0.85rem;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
    }

    .venta-lineas-table .venta-linea td {
        display: grid;
        grid-template-columns: minmax(5.25rem, 36%) 1fr;
        align-items: center;
        gap: 0.35rem 0.65rem;
        padding: 0.45rem 0;
        border-bottom: none;
    }

    .venta-lineas-table .venta-linea td::before {
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--muted);
    }

    .venta-lineas-table .venta-linea td:nth-child(1)::before { content: "Producto"; }
    .venta-lineas-table .venta-linea td:nth-child(2)::before { content: "Cantidad"; }
    .venta-lineas-table .venta-linea td:nth-child(3)::before { content: "Precio unit."; }
    .venta-lineas-table .venta-linea td:nth-child(4)::before { content: "Subtotal"; }

    .venta-lineas-table .venta-linea td:last-child {
        grid-template-columns: 1fr;
        justify-items: end;
        padding-top: 0.55rem;
        margin-top: 0.35rem;
        border-top: 1px solid var(--border);
    }

    .venta-lineas-table .venta-linea td:last-child::before {
        display: none;
    }

    .venta-lineas-table .col-cant,
    .venta-lineas-table .col-precio,
    .venta-lineas-table .col-subtotal {
        width: auto;
    }
}

@media (min-width: 641px) and (max-width: 900px) {
    .venta-lineas-table {
        min-width: 32rem;
    }
}

/* --- Marca de empresa --- */
.empresa-marca {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empresa-marca-logo {
    max-height: 56px;
    max-width: 120px;
    object-fit: contain;
    flex-shrink: 0;
}

.empresa-marca-texto {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.empresa-marca-nombre {
    font-size: 1.05rem;
    color: var(--text);
}

.empresa-marca-razon,
.empresa-marca-ruc,
.empresa-marca-ubicacion,
.empresa-marca-contacto {
    font-size: 0.85rem;
    color: var(--muted);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.sidebar-logo-img {
    max-height: 36px;
    max-width: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-logo-text {
    line-height: 1.3;
}

.auth-logo {
    display: block;
    max-height: 72px;
    max-width: 180px;
    margin: 0 auto 0.75rem;
    object-fit: contain;
}

.auth-razon,
.auth-ruc {
    margin: 0.15rem 0 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.config-preview-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.config-preview-card .empresa-marca {
    margin-bottom: 0;
    box-shadow: none;
}

.config-preview h2 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
}

.logo-preview-img {
    max-height: 80px;
    max-width: 160px;
    object-fit: contain;
    margin-top: 0.5rem;
}

.form-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem 0.25rem;
    margin-bottom: 1.25rem;
    background: var(--surface);
}

.form-section legend {
    font-weight: 600;
    padding: 0 0.35rem;
    color: var(--text);
}

.field-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.field-inline input[type="text"] {
    flex: 1 1 12rem;
    min-width: 10rem;
}

.field-inline-doc select {
    flex: 0 0 auto;
    min-width: 9rem;
}

.ruc-preview {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}

.ruc-preview-dl {
    margin: 0;
}

.hint.text-danger {
    color: #b42318;
}
