/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --topbar-bg:    #233350;
    --sidebar-bg:   #eef3f7;
    --content-bg:   #f6f9fd;
    --accent:       #7ca5b8;
    --accent-hover: #5d8fa6;
    --accent-light: #ddeaf0;
    --text-dark:    #1a2530;
    --text-mid:     #7a9aaa;
    --text-sub:     #4a6478;
    --border:       #d4e3ea;
    --error:        #ef4444;
    --info:         #7ca5b8;
    --sidebar-w:    260px;
    --topbar-h:     55px;
    /* legado — mantener por compatibilidad */
    --azul-dark:    #233350;
    --azul-nav:     #233350;
    --azul-hover:   #7ca5b8;
    --azul-light:   #ddeaf0;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--content-bg);
    color: var(--text-dark);
    height: 100vh;
    overflow: hidden;
}

/* ===== PANTALLA LOGIN ===== */
#screen-login {
    display: flex;
    height: 100vh;
}

.login-left {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.login-left img.bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.login-left .logo-overlay {
    position: absolute;
    top: 40px;
    left: 40px;
}

.login-left .logo-overlay img {
    width: 220px;
}

.login-right {
    width: 400px;
    background: #ffffff;
    padding: 60px 48px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    overflow-y: auto;
}

.login-right h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.login-right .subtitle {
    color: var(--text-mid);
    font-size: 14px;
    margin-bottom: 40px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
}

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

.field label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-mid);
    text-transform: uppercase;
}

.field input {
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
}

.field input:focus {
    border-color: var(--azul-hover);
}

.field input:disabled {
    background: #f8fafc;
    color: var(--text-mid);
}

.btn-primary {
    height: 44px;
    background: var(--topbar-bg);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    width: 100%;
    transition: background 0.15s;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }

.msg {
    font-size: 12px;
    font-weight: 700;
    min-height: 18px;
    margin-top: 8px;
}

.msg.error { color: var(--error); }
.msg.info  { color: var(--info); }

/* ===== LAYOUT APP ===== */
#screen-app {
    display: none;
    flex-direction: column;
    height: 100vh;
}

/* Top Bar */
.topbar {
    height: var(--topbar-h);
    background: var(--topbar-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.topbar img { height: 20px; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 13px;
}

.topbar-user svg { opacity: 0.8; }

/* Body bajo topbar */
.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.25s cubic-bezier(.4,0,.2,1);
    position: relative;
    z-index: 10;
    border-right: 1px solid var(--border);
}

.sidebar.collapsed {
    width: 0;
}

/* Cabecera del sidebar */
.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 14px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-titulo {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-sub);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-toggle {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: none;
    background: var(--accent-light);
    color: var(--text-sub);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.sidebar-toggle:hover { background: var(--accent-light); color: var(--accent-hover); }

/* Botón para abrir sidebar cuando está colapsado */
.sidebar-open-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 44px;
    background: var(--sidebar-bg);
    border: none;
    border-right: 1px solid var(--border);
    border-radius: 0 6px 6px 0;
    color: var(--text-sub);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9;
    transition: background 0.15s, color 0.15s;
    box-shadow: 2px 0 6px rgba(0,0,0,0.15);
}
.sidebar-open-btn:hover { background: var(--accent-light); color: var(--accent-hover); }
.sidebar-open-btn.visible { display: flex; }

/* Scroll del nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 0 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* Botón expandible (grupo/sección) */
.sidebar-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    padding: 0 14px 0 16px;
    background: transparent;
    border: none;
    color: var(--text-dark);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    gap: 8px;
    border-radius: 0;
}
.sidebar-btn:hover { background: var(--accent-light); color: var(--accent-hover); }

.sidebar-btn-label { flex: 1; }

.sidebar-btn .arrow {
    font-size: 10px;
    color: var(--border);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.sidebar-btn.open { color: var(--accent-hover); }
.sidebar-btn.open .arrow { transform: rotate(90deg); color: var(--accent); }

/* Sub-ítems (con animación de altura) */
.sidebar-sub {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.22s ease;
}
.sidebar-sub.open { max-height: 400px; }

.sidebar-sub-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 14px 0 32px;
    background: transparent;
    border: none;
    color: var(--text-sub);
    font-size: 13.5px;
    font-weight: 400;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    position: relative;
}

.sidebar-sub-btn::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    transition: background 0.12s;
}

.sidebar-sub-btn:hover { color: var(--text-dark); background: var(--accent-light); }
.sidebar-sub-btn:hover::before { background: var(--accent); }
.sidebar-sub-btn.active { color: var(--accent-hover); background: var(--accent-light); font-weight: 600; }
.sidebar-sub-btn.active::before { background: var(--accent); }
.sidebar-sub-btn:disabled { color: var(--border); cursor: not-allowed; }
.sidebar-sub-btn:disabled::before { background: var(--border); }

/* Divider */
.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 16px;
}

/* Botón volver al inicio */
.sidebar-home-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 38px;
    padding: 0 14px 0 16px;
    background: transparent;
    border: none;
    color: var(--text-sub);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: color 0.12s, background 0.12s;
    white-space: nowrap;
    margin-bottom: 2px;
}
.sidebar-home-btn:hover { color: var(--text-dark); background: var(--accent-light); }

/* ===== MÓDULO DASHBOARD PLACEHOLDER ===== */
.modulo-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    opacity: 0.4;
    user-select: none;
    pointer-events: none;
}

.modulo-welcome-titulo {
    font-size: 30px;
    font-weight: 700;
    color: var(--azul-dark);
    letter-spacing: 0.04em;
}

.modulo-welcome-sub {
    font-size: 13px;
    color: var(--text-mid);
}

/* Área de contenido */
.content-area {
    flex: 1;
    overflow: hidden;   /* el scroll lo maneja cada panel internamente */
    padding: 0;
    background: var(--content-bg);
    display: flex;
    flex-direction: column;
}

/* ===== LAUNCHER (menú principal) ===== */
.launcher {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 20px;
}

.launcher h2 {
    font-size: 36px;
    font-weight: 700;
    color: var(--topbar-bg);
    margin-bottom: 40px;
    letter-spacing: 0.04em;
}

.launcher-grid {
    display: grid;
    grid-template-columns: repeat(4, 160px);
    gap: 24px;
}

.launcher-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 16px;
    border-radius: 12px;
    transition: background 0.15s, transform 0.15s;
    border: none;
    background: transparent;
}

.launcher-item:hover:not(:disabled) {
    background: #e0f2fe;
    transform: scale(1.04);
}

.launcher-item:disabled { cursor: not-allowed; }
.launcher-item:disabled img { opacity: 0.25; }

.launcher-item img { width: 130px; height: 130px; object-fit: contain; }
.launcher-item span { font-size: 13px; font-weight: 600; color: var(--text-dark); }
.launcher-item:disabled span { color: var(--text-mid); }

/* ===== CONTENT PANELS ===== */
.panel {
    background: #fff;
    border-radius: 10px;
    margin: 20px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    overflow-y: auto;
    flex: 1;
}

.panel h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--azul-dark);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* Tabla base */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

thead th {
    background: #f1f7fa;
    color: var(--text-sub);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 2;
}

tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:hover { background: #f8fafc; }
tbody td { padding: 10px 14px; }

/* ===== UTILITIES ===== */
.hidden { display: none !important; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.mt-16 { margin-top: 16px; }

/* ===== MÓDULO USUARIOS ===== */

/* Panel sin padding lateral del .panel base */
.usuarios-panel {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    /* Ocupa exactamente el alto disponible del content-area */
    height: 100%;
    max-height: 100%;
}

/* Cabecera del panel — fija, no cede al scroll */
.panel-header {
    padding: 16px 24px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.panel-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title-row h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    border: none;
    flex: 1;
}

/* Botón X de cierre del panel */
.panel-close-btn {
    width: 30px; height: 30px;
    border-radius: 7px;
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--text-sub);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, border-color .12s, color .12s;
    margin-left: auto;
    flex-shrink: 0;
}
.panel-close-btn:hover { background: #fee2e2; border-color: #fca5a5; color: var(--error); }

/* Card de formulario — fija, no scrollea */
.form-card {
    margin: 16px 24px;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-shrink: 0;
}

.form-card-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-sub);
    text-transform: uppercase;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.form-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* Inputs del form */
.form-card .field input,
.form-card .field select {
    height: 38px;
    padding: 0 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-dark);
    outline: none;
    background: #fff;
    width: 100%;
    transition: border-color .15s;
}

.form-card .field input:focus,
.form-card .field select:focus {
    border-color: var(--accent);
}

.form-card .field input[readonly] {
    background: #f8fafc;
    color: var(--text-sub);
}

/* Botón ícono redondo */
.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, border-color .15s;
    margin-bottom: 0;
}
.icon-btn:hover { background: var(--accent-light); border-color: var(--accent); }

/* Botones de acción */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    white-space: nowrap;
}

.btn-save   { background: var(--topbar-bg); color: #fff; }
.btn-save:hover { background: var(--accent-hover); }

.btn-edit   { background: #059669; color: #fff; }
.btn-edit:hover { background: #047857; }

.btn-cancel { background: transparent; color: var(--text-sub); border: 1.5px solid var(--border); }
.btn-cancel:hover { background: var(--accent-light); color: var(--text-dark); }

/* Tiles grandes de acción, ícono + etiqueta chica (ej: modal de comprobante) */
.cob-comp-tile {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 92px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform .12s, opacity .12s, box-shadow .12s;
}
.cob-comp-tile span { font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.cob-comp-tile:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.12); opacity: .94; }

/* Barra del listado — fija, no scrollea */
.list-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-sub);
    text-transform: uppercase;
    border-top: 1px solid var(--border);
    background: #fafcfd;
    flex-shrink: 0;
}

/* Input de búsqueda dentro del list-bar */
.list-bar-input {
    height: 32px;
    padding: 0 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
    outline: none;
    background: #fff;
    transition: border-color .15s;
}
.list-bar-input:focus { border-color: var(--accent); }
.list-bar-input::placeholder { color: var(--text-sub); font-weight: 400; }

/* Switch toggle (solo activos) */
.switch-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
}

.switch-label input { display: none; }

.switch-track {
    width: 34px;
    height: 18px;
    background: var(--border);
    border-radius: 9px;
    position: relative;
    transition: background .2s;
}

.switch-track::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: transform .2s;
}

.switch-label input:checked + .switch-track { background: var(--accent); }
.switch-label input:checked + .switch-track::after { transform: translateX(16px); }

/* Tabla — único elemento que scrollea */
.usuarios-panel .table-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 0 24px 24px;
    min-height: 0; /* necesario para que flex-child scrollee correctamente */
}

.usuarios-panel table { font-size: 13px; }

/* Badges de rol */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.badge-blue   { background: #e0f2fe; color: #0369a1; }
.badge-yellow { background: #fef3c7; color: #92400e; }

/* Botones de acción en tabla */
.row-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.tbl-btn {
    width: 30px; height: 30px;
    border-radius: 6px;
    border: none;
    background: #f1f5f9;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, transform .1s;
    flex-shrink: 0;
}
.tbl-btn:hover:not(:disabled) { transform: scale(1.08); }
.tbl-btn:disabled { opacity: .3; cursor: not-allowed; }

/* Colores individuales por acción */
.tbl-btn-edit    { background: #e0f2fe; color: #0369a1; }
.tbl-btn-edit:hover:not(:disabled)    { background: #bae6fd; }

.tbl-btn-broom   { color: #92400e; }  /* color se pasa por style inline (dinámico) */
.tbl-btn-broom[disabled] { background: #f1f5f9; }

.tbl-btn-lock    { color: #15803d; }  /* color dinámico */

.tbl-btn-toggle-on  { background: #dcfce7; color: #15803d; }
.tbl-btn-toggle-on:hover:not(:disabled)  { background: #bbf7d0; }

.tbl-btn-toggle-off { background: #fee2e2; color: #dc2626; }
.tbl-btn-toggle-off:hover:not(:disabled) { background: #fecaca; }

/* Drag & drop reordenamiento */
tr.fp-drag-over td { background: #eff6ff; border-top: 2px solid #3b82f6; }

/* ===== MODALES ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    flex-shrink: 0;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* Inputs, selects y labels dentro de modales — igual al sistema */
.modal-box .field label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-mid);
    text-transform: uppercase;
}

.modal-box .field input,
.modal-box .field select {
    height: 38px;
    padding: 0 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-dark);
    outline: none;
    background: #fff;
    width: 100%;
    transition: border-color .15s;
    appearance: auto;
}

.modal-box .field input:focus,
.modal-box .field select:focus {
    border-color: var(--accent);
}

.modal-box .field input[readonly] {
    background: #f8fafc;
    color: var(--text-sub);
}

/* ── Árbol de permisos ── */

/* Nodo contenedor */
.perm-nodo {
    display: flex;
    flex-direction: column;
}

/* Fila visible de cada ítem */
.perm-fila {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 5px;
    padding-bottom: 5px;
    padding-right: 12px;
    border-bottom: 1px solid #f1f5f9;
    user-select: none;
    transition: background .1s;
}
.perm-fila:hover { background: #f8fafc; }

/* Estilos por nivel — tipografía uniforme, sin jerarquía visual */
.perm-nivel-1,
.perm-nivel-2,
.perm-nivel-3,
.perm-nivel-4 { background: #fff; }

.perm-nivel-1 .perm-label,
.perm-nivel-2 .perm-label,
.perm-nivel-3 .perm-label,
.perm-nivel-4 .perm-label { font-size: 13px; font-weight: 500; color: var(--text-dark); }

/* Chevron */
.perm-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    flex-shrink: 0;
    color: var(--text-sub);
    transition: transform .18s ease;
}
.perm-chevron.perm-chevron-open {
    transform: rotate(90deg);
}

/* Label — ver definición completa más abajo */

/* Checkbox wrap — stop propagation del clic de expand */
.perm-chk-wrap {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 2px 4px;
}

.perm-chk-wrap input[type=checkbox] {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    cursor: pointer;
    margin: 0;
}

/* Contenedor de hijos */
.perm-children {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.perm-children.perm-collapsed {
    display: none;
}

/* Ítems del buscador de empleados */
.emp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .12s;
}
.emp-item:hover { background: var(--accent-light); }

/* Animación toast */
@keyframes fadeInUp {
    from { opacity:0; transform:translateY(10px); }
    to   { opacity:1; transform:translateY(0); }
}

/* ===== MÓDULO PERMISOS — campos de código ===== */

.codigo-wrap {
    display: flex;
    flex-direction: row;   /* fuerza horizontal */
    align-items: center;
    gap: 4px;
    height: 38px;
    flex-wrap: nowrap;
}

/* Anula el width:100% del .form-card .field input para los cod-field */
.codigo-wrap .cod-field {
    width: 38px !important;
    min-width: 38px;
    max-width: 38px;
    height: 38px;
    text-align: center;
    font-family: monospace;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    outline: none;
    background: #fff;
    transition: border-color .15s;
    padding: 0;
    flex-shrink: 0;
}
.codigo-wrap .cod-field:focus { border-color: var(--accent); }

.cod-sep {
    font-size: 16px;
    color: var(--border);
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

/* Árbol de permisos — label en línea */
.perm-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0;
    line-height: 1.3;
    overflow: hidden;
}

/* ID badge */
.perm-id {
    font-family: monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-light);
    padding: 1px 5px;
    border-radius: 4px;
    margin-right: 8px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Código monospace */
.perm-cod {
    font-family: monospace;
    font-size: 11px;
    color: var(--text-sub);
    margin-right: 8px;
    flex-shrink: 0;
    white-space: nowrap;
}

