﻿/* Estilos locales tipo utility para no depender de CDN en la red de planta. */
:root {
    --blue: #1a73e8;
    --blue-strong: #1558c8;
    --blue-soft: #e8f1ff;
    --blue-ink: #0d3b77;
    --text: #1f2937;
    --muted: #5f6b7a;
    --line: #dfe7f1;
    --line-strong: #c9d8ec;
    --bg: #edf4ff;
    --surface: rgba(255, 255, 255, 0.96);
    --surface-soft: #f5f9ff;
    --danger: #d93025;
    --green: #1e8e3e;
    --yellow: #f9ab00;
    --white: #ffffff;
    --shadow-soft: 0 8px 24px rgba(26, 62, 118, 0.08);
    --shadow-raised: 0 18px 38px rgba(31, 50, 82, 0.14);
    --font-ui: "Google Sans Text", "Google Sans", "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif;
    --font-display: "Google Sans", "Aptos Display", "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background-color: #dcecff;
    background-image: linear-gradient(rgba(246, 250, 255, 0.72), rgba(246, 250, 255, 0.72)), url('../img/%E2%80%94Slidesdocs%E2%80%94azul%20resumen%20textura%20pol%C3%ADgono%20tecnolog%C3%ADa_7644160408.jpg');
    background-position: center;
    background-attachment: fixed;
    background-size: cover;
    background-repeat: no-repeat;
    font-family: var(--font-ui);
}

h1,
h2,
h3,
.admin-header h1 {
    font-family: var(--font-display);
    font-weight: 700;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select {
    font: inherit;
}

.profile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid var(--blue);
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

.profile-avatar {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7d5af6, #3e78ff);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

.profile-avatar-large {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
}

.profile-menu {
    position: absolute;
    top: 72px;
    right: 24px;
    z-index: 30;
    width: min(280px, 82vw);
    padding: 12px 0 8px;
    border: 2px solid var(--blue);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(60, 64, 67, 0.2);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.profile-menu.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.profile-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px 12px;
    border-bottom: 1px solid #edf0f1;
}

.profile-user div {
    display: grid;
    gap: 2px;
}

.profile-user strong {
    font-size: 1rem;
}

.profile-user span {
    color: var(--muted);
    font-size: 0.8rem;
}

.profile-navigation {
    display: grid;
    gap: 2px;
    margin: 8px 0;
    padding: 0 8px 8px;
    border-bottom: 1px solid #edf0f1;
}

.profile-navigation a,
.profile-links a {
    display: block;
    padding: 9px 8px;
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    text-decoration: none;
}

.profile-navigation a:hover,
.profile-navigation a.is-active,
.profile-links a:hover {
    background: var(--blue-soft);
    color: var(--blue);
}

.profile-menu-section {
    padding: 0 8px;
}

.profile-menu-section-title {
    display: block;
    padding: 10px 8px 4px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.profile-menu-collapsible {
    margin-top: 2px;
}

.profile-menu-collapsible > summary {
    cursor: pointer;
    list-style: none;
}

.profile-menu-collapsible > summary::-webkit-details-marker {
    display: none;
}

.profile-menu-collapsible > summary::after {
    float: right;
    content: '+';
    color: var(--blue);
    font-size: 1rem;
    line-height: 1;
}

.profile-menu-collapsible[open] > summary::after {
    content: '-';
}

.profile-links a {
    display: block;
    padding: 9px 8px;
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    text-decoration: none;
}

.profile-links a:hover {
    background: var(--blue-soft);
    color: var(--blue);
}

.profile-imports {
    display: grid;
    gap: 2px;
    margin: 8px 0;
    padding: 8px;
    max-height: 170px;
    overflow-y: scroll;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    border-bottom: 1px solid #edf0f1;
}

.profile-imports button {
    padding: 9px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
}

.profile-imports button:hover,
.profile-imports button:focus-visible {
    background: var(--blue-soft);
    color: var(--blue);
    outline: 0;
}

.import-file-input {
    display: none;
}

.profile-links {
    list-style: none;
    margin: 0;
    padding: 0 8px;
}

.auth-page {
    position: relative;
    isolation: isolate;
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background-image: linear-gradient(rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.08)), url('../img/sadasdaa.webp');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.auth-page::before {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: transparent;
    content: '';
}

.auth-card {
    width: min(410px, 100%);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.42);
    backdrop-filter: blur(12px);
    padding: 34px;
    box-shadow: 0 18px 48px rgba(32, 33, 36, 0.18);
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 13px;
    background: var(--blue);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
}

.auth-logo {
    width: min(150px, 62%);
    height: auto;
    margin: 0 auto 18px;
    object-fit: contain;
}

.auth-card > .eyebrow {
    margin-top: 0;
    text-align: center;
}

.auth-card > h1,
.auth-card > .muted {
    text-align: center;
}

.eyebrow {
    margin: 18px 0 6px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-card h1,
.admin-header h1 {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 700;
}

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

.auth-card form {
    display: grid;
    gap: 8px;
    margin-top: 28px;
}

.auth-card label,
.dialog-header + label,
dialog label {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.78rem;
}

.auth-card input,
dialog input,
dialog select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 10px 12px;
}

.auth-card input:focus,
dialog input:focus,
dialog select:focus {
    border-color: var(--blue);
    outline: 2px solid var(--blue-soft);
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
    cursor: pointer;
    border: 0;
    border-radius: 999px;
    padding: 10px 16px;
    font: inherit;
}

.primary-button {
    background: var(--blue);
    color: #fff;
}

.secondary-button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
}

.text-button {
    background: transparent;
    color: var(--blue);
    padding: 5px;
}

.form-message {
    min-height: 18px;
    color: var(--danger);
    font-size: 0.78rem;
}

dialog {
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    margin: auto;
    overflow: auto;
    border: 1px solid #d9e2f0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 64px rgba(32, 33, 36, 0.24);
    padding: 0;
    color: var(--text);
}

dialog::backdrop {
    background: rgba(32, 33, 36, 0.42);
    backdrop-filter: blur(2px);
}

#user-form {
    display: grid;
    gap: 8px;
    padding: 24px;
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: -24px -24px 10px;
    border-bottom: 1px solid #edf0f2;
    background: linear-gradient(135deg, #f8fbff, #fff);
    padding: 18px 24px 16px;
}

.dialog-header h2 {
    margin: 0;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
}

.icon-button {
    display: inline-grid;
    width: 32px;
    height: 32px;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid #d9e2f0;
    border-radius: 50%;
    background: #fff;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
}

.icon-button:hover,
.icon-button:focus-visible {
    border-color: var(--blue);
    background: var(--blue-soft);
    color: var(--blue);
    outline: 0;
}

#user-form > label {
    margin-top: 4px;
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 700;
}

#user-form input,
#user-form select {
    min-height: 40px;
    border-color: #cbd6e5;
    background: #fff;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#user-form input:focus,
#user-form select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
    outline: 0;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
    border-top: 1px solid #edf0f2;
    padding-top: 16px;
}

.success-message {
    color: var(--green);
}

.admin-header {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 18px clamp(18px, 4vw, 56px) 0;
    padding: 14px 20px;
    border: 1px solid rgba(164, 182, 211, 0.95);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(12px);
}
    .admin-header-brand h1,
    .auth-card h1 {
        font-size: 1.5rem;
    }

.admin-header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.admin-header-brand img {
    width: 62px;
    height: 62px;
    flex: 0 0 auto;
    object-fit: contain;
}

.admin-header-brand .eyebrow {
    margin-top: 0;
}

.admin-header-brand h1 {
    white-space: nowrap;
    font-size: 1.8rem;
    font-weight: 700;
}

.header-actions,
.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    color: var(--muted);
    font-weight: 600;
}

.admin-menu-toggle {
    display: grid;
    width: 42px;
    height: 42px;
    align-content: center;
    gap: 4px;
    border: 0;
    border-radius: 50%;
    background: var(--blue);
    padding: 0 11px;
    cursor: pointer;
}

.admin-menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
}

.admin-content {
    width: min(1180px, calc(100% - 24px));
    margin: 0 auto;
    padding: 22px 0 36px;
}

.toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    padding: 8px 0 18px;
}

.toolbar h2 {
    margin: 0;
    font-size: clamp(1.9rem, 2vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #1f2937;
}

.toolbar .muted {
    margin-top: 8px;
    font-size: 0.95rem;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-actions .primary-button,
.toolbar-actions .secondary-button {
    min-height: 42px;
    padding: 0 18px;
    border-radius: 12px;
    font-weight: 600;
}

.table-card {
    overflow: hidden;
    border: 1px solid rgba(179, 199, 228, 0.9);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.table-scroll {
    max-height: 430px;
    overflow: auto;
}

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

.table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, #f4f7fb 0%, #edf3ff 100%);
    color: #3b4a63;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: none;
}

.table-scroll th,
.table-scroll td {
    padding: 16px 18px;
    border-bottom: 1px solid #edf0f1;
    text-align: left;
    vertical-align: middle;
}

.table-scroll tbody tr {
    transition: background-color 0.15s ease;
}

.table-scroll tbody tr:hover {
    background: rgba(26, 115, 232, 0.03);
}

.table-scroll td {
    color: #273244;
    font-size: 0.98rem;
}

.switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.switch input {
    width: 18px;
    height: 18px;
    accent-color: var(--blue);
}

.permissions-card {
    margin-top: 28px;
    border: 1px solid rgba(179, 199, 228, 0.9);
    border-radius: 20px;
    background: var(--surface);
    padding: 22px 20px 18px;
    box-shadow: var(--shadow-soft);
}

.authorization-admin-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px 16px;
}

.authorization-admin-form label {
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
}

.authorization-admin-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 10px;
}

.authorization-admin-form .permissions-footer {
    grid-column: 1 / -1;
}

.permissions-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid #eef0f1;
    padding-bottom: 18px;
}

.permissions-heading h2 {
    margin: 0;
    font-size: clamp(1.7rem, 2vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.role-selector {
    display: grid;
    gap: 6px;
    min-width: 230px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 600;
}

.role-selector select {
    min-height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
    padding: 9px 12px;
    font-size: 0.95rem;
    color: var(--text);
    box-shadow: inset 0 1px 1px rgba(17, 24, 39, 0.02);
}

.permissions-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 12px 18px;
    max-height: 440px;
    overflow-y: auto;
    padding: 20px 8px 18px 0;
    scrollbar-gutter: stable;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    border: 1px solid #e7edf6;
    border-radius: 14px;
    background: linear-gradient(180deg, #f7fbff 0%, #f1f7ff 100%);
    padding: 10px 12px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.permission-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(26, 115, 232, 0.06);
}

.permission-item:has(input:checked) {
    border-color: #8bb7ff;
    background: linear-gradient(180deg, #eef6ff 0%, #e2eeff 100%);
}

.permission-item input {
    width: 18px;
    height: 18px;
    accent-color: var(--blue);
    margin: 0;
}

.permission-item span {
    display: grid;
    gap: 5px;
    line-height: 1.3;
}

.permission-item strong {
    font-size: 0.82rem;
    color: #1e2a39;
}

.permission-item small {
    color: var(--muted);
    font-size: 0.7rem;
}

.permissions-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid #eef0f1;
    padding-top: 18px;
}

.permissions-footer .form-message {
    margin: 0;
}

.admin-sidebar {
    position: fixed;
    top: 78px;
    right: 24px;
    z-index: 30;
    width: 300px;
    border: 1px solid #edf0f2;
    border-radius: 4px 4px 12px 12px;
    background: #fff;
    padding: 18px 14px 14px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px) scale(0.98);
    transform-origin: top right;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px rgba(60, 64, 67, 0.15);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.admin-menu-open .admin-sidebar {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 18px;
    border-bottom: 1px solid #f1f3f4;
}

.admin-sidebar-brand strong,
.admin-sidebar-brand small {
    display: block;
}

.admin-sidebar-brand small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.72rem;
}

.admin-sidebar-brand .brand-mark {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
}

.admin-sidebar-nav {
    display: grid;
    gap: 3px;
    padding-top: 12px;
}

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

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

.admin-sidebar-nav span {
    margin-left: 8px;
    font-size: 0.9rem;
}

.admin-sidebar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    border-top: 1px solid #f1f3f4;
    padding: 14px;
    color: var(--muted);
    font-size: 0.72rem;
}

.admin-sidebar-status span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
}

.admin-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9;
    background: transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.admin-menu-open .admin-menu-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.admin-menu-open {
    overflow: hidden;
}

.plant-access {
    display: grid;
    gap: 8px;
    margin: 8px 0 4px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
}

.plant-access legend {
    width: auto;
    margin: 0;
    padding: 0 4px;
    color: var(--muted);
    font-size: 0.78rem;
}

.plant-access label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text);
    font-size: 0.8rem;
}

.plant-access input {
    width: 16px;
    height: 16px;
    accent-color: var(--blue);
}

.plant-access small {
    color: var(--muted);
    font-size: 0.68rem;
}

@media (max-width: 980px) {
    .permissions-list {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

@media (max-width: 700px) {
    .admin-header,
    .toolbar,
    .permissions-heading,
    .permissions-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions,
    .toolbar-actions {
        flex-wrap: wrap;
    }

    .permissions-list {
        grid-template-columns: 1fr;
        max-height: 420px;
    }

    .admin-header {
        margin: 14px 14px 0;
        padding: 14px 16px;
    }

    .admin-sidebar {
        top: 142px;
        right: 12px;
        width: min(300px, calc(100vw - 24px));
    }
}
