/* JCM — estilos compartidos */

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: #333;
    background-color: #f9f9f9;
    min-height: 100vh;
}

.header {
    background-color: #2c3e50;
    color: white;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.header-brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.header-brand:hover {
    text-decoration: none;
}

.logo-jcm {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
}

.logo-name {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 400;
    letter-spacing: 0.5px;
}

.header a {
    color: white;
    text-decoration: none;
    font-size: 14px;
}

.header a:hover {
    text-decoration: underline;
}

.header-acciones {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logout {
    color: white;
    font-size: 14px;
    text-decoration: none;
}

.header > .header-logout {
    margin-left: auto;
}

.btn-crear {
    background-color: #fff;
    color: #2c3e50;
    padding: 10px 20px;
    border-radius: 4px;
    border: none;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-crear:hover {
    background-color: #ecf0f1;
    color: #1a253a;
    text-decoration: none;
}

a.btn-crear {
    text-decoration: none;
    color: #2c3e50;
}

.nav-modulos {
    background: #34495e;
    padding: 10px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.nav-modulos a,
.nav-modulos .btn-nav {
    color: #fff;
    padding: 8px 14px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    background: transparent;
    font-family: inherit;
}

.nav-modulos a:hover {
    background: rgba(255, 255, 255, 0.15);
}

.nav-modulos .btn-nav:disabled,
.nav-modulos a.btn-nav-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-modulos a.activo {
    background: rgba(255, 255, 255, 0.2);
}

.main {
    padding: 24px 20px;
}

.main-narrow {
    max-width: 1100px;
    margin: 0 auto;
}

.main-wide {
    max-width: 1200px;
    margin: 0 auto;
}

.main-card {
    max-width: 800px;
    margin: 0 auto;
}

.main-full {
    max-width: 100%;
}

.toolbar {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e0e0e0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.toolbar label {
    font-size: 13px;
    color: #555;
    font-weight: 500;
}

.toolbar input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 260px;
    box-sizing: border-box;
}

.toolbar input:disabled {
    background: #f0f0f0;
    color: #888;
    cursor: not-allowed;
}

.tabla-filtro-wrap {
    position: relative;
    max-width: 320px;
}

.tabla-filtro-wrap .fa-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.tabla-filtro-wrap input {
    padding-left: 36px;
}

.sugerencias-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.sugerencias-dropdown.visible {
    display: block;
}

.sugerencias-dropdown .sug-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
}

.sugerencias-dropdown .sug-item:last-child {
    border-bottom: none;
}

.sugerencias-dropdown .sug-item:hover,
.sugerencias-dropdown .sug-item:focus {
    background: #f0f7ff;
    outline: none;
}

.sugerencias-dropdown .sug-item small {
    color: #666;
    margin-left: 6px;
}

.btn-tabla {
    background: #2c3e50;
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-tabla:hover {
    background: #1a253a;
}

.btn-tabla:disabled {
    opacity: 0.7;
    cursor: wait;
}

.planilla-wrap {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
    overflow: hidden;
    display: none;
}

.planilla-wrap.visible {
    display: block;
}

.planilla-wrap h2 {
    margin: 0;
    padding: 16px 20px;
    font-size: 17px;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.planilla-scroll {
    overflow: auto;
    max-height: 70vh;
    max-width: 100%;
}

.planilla-table {
    border-collapse: collapse;
    font-size: 12px;
    min-width: max-content;
}

.planilla-table th,
.planilla-table td {
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    text-align: left;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.planilla-table th {
    background: #2c3e50;
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.planilla-table tbody tr:hover {
    background: #f5f9ff;
}

.planilla-table td {
    background: #fff;
}

.planilla-vacia,
.planilla-cargando,
.tabla-vacia,
.tabla-cargando {
    padding: 40px 20px;
    text-align: center;
    color: #666;
}

.planilla-cargando,
.tabla-cargando {
    color: #999;
}

.contador {
    font-size: 13px;
    color: #666;
    margin-left: auto;
}

.tabla-scroll {
    overflow-x: auto;
}

.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
    padding: 24px;
    margin-bottom: 24px;
}

.card h2 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #444;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2c3e50;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 520px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.btn {
    padding: 10px 22px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background-color: #2c3e50;
    color: white;
}

.btn-primary:hover {
    background-color: #1a253a;
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #444;
}

.btn-secondary:hover {
    background-color: #d0d0d0;
}

.btn-danger {
    background: #c0392b;
    color: white;
}

.btn-danger:hover {
    background: #a93226;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

table.tabla-simple {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table.tabla-simple th,
table.tabla-simple td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

table.tabla-simple th {
    background: #2c3e50;
    color: white;
    font-weight: 600;
    white-space: nowrap;
}

table.tabla-simple tr:hover {
    background: #f8f9fa;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-admin {
    background: #2c3e50;
    color: white;
}

.badge-user {
    background: #95a5a6;
    color: white;
}

.acciones {
    display: flex;
    gap: 8px;
}

.checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-wrap input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

footer {
    text-align: center;
    padding: 20px;
    font-size: 11px;
    color: #999;
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-page .container {
    text-align: center;
    max-width: 90%;
    padding: 20px;
}

.login-page .logo-jcm {
    font-size: 60px;
    color: #2c3e50;
    letter-spacing: -2px;
    margin-bottom: 5px;
}

.login-page .logo-name {
    font-size: 14px;
    color: #666;
    letter-spacing: 1px;
    margin-bottom: 30px;
}

.user-select-wrap,
.password-container {
    margin-bottom: 20px;
    text-align: left;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.password-container {
    display: none;
    position: relative;
}

.user-select-wrap select,
.password-input {
    width: 100%;
    padding: 12px 40px 12px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}

.user-select-wrap label,
.password-container label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #666;
}

.login-btn {
    display: inline-block;
    background-color: #2c3e50;
    color: white;
    padding: 12px 30px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    border: none;
    font-size: 16px;
    min-width: 150px;
    cursor: pointer;
}

.login-btn:hover {
    background-color: #1a253a;
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.error-msg {
    color: #c0392b;
    font-size: 14px;
    margin-top: 10px;
    display: none;
}

.login-page footer {
    margin-top: 40px;
    padding: 0;
}

@media (max-width: 600px) {
    .login-page .logo-jcm {
        font-size: 48px;
    }
}
