:root {
    color-scheme: light;
    --ink: #17201c;
    --muted: #69736e;
    --paper: #f3f0e8;
    --surface: #fffdf8;
    --line: #d9d5cb;
    --blue: #2447d8;
    --blue-soft: #e8ecff;
    --lime: #caf45c;
    --red: #b93434;
    --red-soft: #fff0ed;
    --green: #27643f;
    --green-soft: #e9f8ed;
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.eyebrow {
    margin: 0 0 11px;
    color: var(--blue);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.17em;
    text-transform: uppercase;
}

.back-link {
    display: inline-block;
    color: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
}

.back-link:hover {
    color: var(--blue);
}

.login-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
    min-height: 100vh;
}

.login-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-direction: column;
    overflow: hidden;
    padding: clamp(32px, 6vw, 80px);
    background:
        radial-gradient(circle at 85% 80%, rgba(202, 244, 92, 0.75), transparent 19rem),
        var(--ink);
    color: #fff;
}

.login-intro .back-link {
    color: #fff;
}

.login-intro .eyebrow {
    color: var(--lime);
}

.login-intro h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3.1rem, 6.7vw, 7rem);
    font-weight: 400;
    letter-spacing: -0.065em;
    line-height: 0.9;
}

.login-intro h1 em {
    color: var(--lime);
    font-weight: 400;
}

.intro-copy {
    max-width: 500px;
    margin: 38px 0 0;
    color: rgba(255, 255, 255, 0.65);
    font-size: 1rem;
    line-height: 1.75;
}

.login-footnote {
    margin: 0;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.login-panel {
    display: grid;
    place-items: center;
    padding: 36px;
}

.login-card {
    width: min(100%, 470px);
    padding: clamp(30px, 5vw, 52px);
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: 0 28px 70px rgba(36, 44, 40, 0.1);
}

.login-heading {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 36px;
}

.login-heading .eyebrow {
    margin-bottom: 4px;
}

.login-heading h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.1rem;
    font-weight: 400;
    letter-spacing: -0.04em;
}

.lock-icon {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border-radius: 17px;
    color: var(--blue);
    background: var(--blue-soft);
}

.field {
    display: grid;
    gap: 8px;
}

.field + .field {
    margin-top: 20px;
}

.field > span {
    color: #3d4843;
    font-size: 0.78rem;
    font-weight: 800;
}

.field b {
    color: var(--blue);
}

.field small {
    margin-left: 4px;
    color: var(--muted);
    font-weight: 500;
}

.field input {
    width: 100%;
    min-height: 49px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: none;
    color: var(--ink);
    background: #fff;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(36, 71, 216, 0.12);
}

.primary-button,
.secondary-button,
.logout-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 0;
    font-weight: 800;
}

.primary-button {
    min-height: 50px;
    padding: 12px 20px;
    border-radius: 13px;
    color: #fff;
    background: var(--blue);
}

.primary-button:hover {
    background: #1735b1;
}

.login-card .primary-button {
    width: 100%;
    margin-top: 30px;
}

.alert {
    margin-bottom: 24px;
    padding: 15px 18px;
    border: 1px solid;
    border-radius: 13px;
    font-size: 0.85rem;
    line-height: 1.55;
}

.alert-error {
    border-color: #e6b8b1;
    color: #812a2a;
    background: var(--red-soft);
}

.alert-success {
    border-color: #b6ddbf;
    color: var(--green);
    background: var(--green-soft);
}

.alert ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.admin-shell {
    width: min(1240px, calc(100% - 40px));
    margin: 0 auto;
}

.admin-header {
    position: fixed;
    z-index: 100;
    top: 0;
    right: 0;
    left: 0;
    border-bottom: 1px solid rgba(23, 32, 28, 0.12);
    background: rgba(255, 253, 248, 0.92);
    box-shadow: 0 8px 30px rgba(23, 32, 28, 0.06);
    backdrop-filter: blur(16px);
}

.admin-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: min(1240px, calc(100% - 40px));
    min-height: 74px;
    margin: 0 auto;
}

.admin-brand {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}

.admin-brand-mark {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 10px;
    color: var(--ink);
    background: var(--lime);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.2rem;
    font-weight: 700;
}

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

.admin-brand strong {
    font-size: 0.88rem;
}

.admin-brand small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.admin-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-left: auto;
}

.admin-nav a {
    padding: 9px 12px;
    border-radius: 9px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-decoration: none;
    transition: color 150ms ease, background 150ms ease;
}

.admin-nav a:hover,
.admin-nav a:focus-visible {
    color: var(--ink);
    background: var(--blue-soft);
}

.logout-form {
    flex: 0 0 auto;
}

.admin-intro {
    padding: 64px 0 42px;
    border-bottom: 1px solid var(--line);
}

.admin-intro h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.6rem, 6vw, 5.2rem);
    font-weight: 400;
    letter-spacing: -0.055em;
    line-height: 0.9;
}

.admin-intro > p:last-child {
    max-width: 620px;
    margin: 22px 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.logout-button {
    padding: 11px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    background: transparent;
}

.logout-button:hover {
    border-color: var(--ink);
}

.admin-shell > main {
    padding: 74px 0 120px;
}

.anchor-section {
    scroll-margin-top: 96px;
}

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 28px 0 24px;
}

.admin-toolbar h2 {
    margin: 0;
    font-size: 1rem;
}

.admin-toolbar p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.secondary-button {
    padding: 11px 16px;
    border: 1px solid var(--ink);
    border-radius: 11px;
    color: var(--ink);
    background: transparent;
}

.secondary-button:hover {
    background: var(--lime);
}

.site-editors {
    display: grid;
    gap: 20px;
}

.site-editor,
.group-editor {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 14px 36px rgba(38, 44, 41, 0.05);
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 19px 23px;
    border-bottom: 1px solid var(--line);
    background: #f9f7f1;
}

.editor-number {
    margin: 0 0 4px;
    color: var(--blue);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.editor-header h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: -0.03em;
}

.editor-actions {
    display: flex;
    gap: 6px;
}

.editor-actions button {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--muted);
    background: #fff;
}

.editor-actions button:hover {
    border-color: var(--ink);
    color: var(--ink);
}

.editor-actions .danger-action {
    color: var(--red);
}

.editor-actions .danger-action:hover {
    border-color: #dfaaa2;
    background: var(--red-soft);
}

.preview-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--blue);
    background: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    text-decoration: none;
}

.preview-link:hover {
    border-color: var(--blue);
}

.identity-grid,
.environment-editors {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    padding: 24px;
}

.identity-grid {
    padding-bottom: 4px;
}

.identity-grid .field + .field,
.environment-editor .field + .field {
    margin-top: 0;
}

.environment-editor {
    min-width: 0;
    margin: 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
}

.environment-editor legend {
    padding: 0 8px;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.environment-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 7px;
    border-radius: 50%;
    background: var(--blue);
}

.production .environment-dot {
    background: #90bc1f;
}

.environment-editor .field + .field {
    margin-top: 16px;
}

.ftp-fields {
    display: grid;
    gap: 16px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.favicon-preview {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 17px 0 0;
    color: var(--muted);
    font-size: 0.7rem;
}

.preview-icon {
    display: block;
    width: 23px;
    height: 23px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background-color: #fff;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 16px;
}

.favicon-preview code {
    color: var(--ink);
    font-size: inherit;
}

.groups-section {
    margin-top: 90px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.admin-toolbar code {
    color: var(--ink);
    font-size: inherit;
}

.group-editors {
    display: grid;
    gap: 20px;
}

.group-identity {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    padding: 24px 24px 4px;
}

.group-identity .field + .field {
    margin-top: 0;
}

.site-selector {
    min-width: 0;
    margin: 20px 24px 24px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
}

.site-selector legend {
    padding: 0 8px;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.site-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.site-option {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 150ms ease, background 150ms ease;
}

.site-option:has(input:checked) {
    border-color: var(--blue);
    background: var(--blue-soft);
}

.site-option input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: var(--blue);
}

.site-option span,
.site-option strong,
.site-option small {
    display: block;
    min-width: 0;
}

.site-option strong {
    overflow: hidden;
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-option small {
    overflow: hidden;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selector-empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.empty-editors {
    display: grid;
    min-height: 320px;
    place-items: center;
    align-content: center;
    gap: 9px;
    padding: 40px;
    border: 1px dashed #b8b4aa;
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

.empty-editors[hidden] {
    display: none;
}

.empty-editors > span {
    display: grid;
    width: 52px;
    height: 52px;
    margin-bottom: 8px;
    place-items: center;
    border-radius: 50%;
    color: var(--blue);
    background: var(--blue-soft);
    font-size: 1.6rem;
}

.empty-editors strong {
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.5rem;
    font-weight: 400;
}

.empty-editors p {
    margin: 0 0 13px;
    font-size: 0.85rem;
}

.save-bar {
    position: sticky;
    z-index: 10;
    bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 24px;
    padding: 15px 17px 15px 22px;
    border: 1px solid rgba(23, 32, 28, 0.12);
    border-radius: 16px;
    color: #fff;
    background: rgba(23, 32, 28, 0.96);
    box-shadow: 0 18px 50px rgba(23, 32, 28, 0.2);
    backdrop-filter: blur(14px);
}

.save-bar p {
    margin: 0;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.78rem;
}

.save-bar .primary-button {
    min-height: 43px;
    color: var(--ink);
    background: var(--lime);
}

.save-bar .primary-button:hover {
    background: #dbff7f;
}

@media (max-width: 860px) {
    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-intro {
        min-height: 440px;
    }

    .login-panel {
        min-height: 600px;
    }

    .identity-grid,
    .environment-editors,
    .group-identity {
        grid-template-columns: 1fr;
    }

    .site-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .admin-shell {
        width: min(100% - 24px, 1240px);
    }

    .admin-header-inner {
        width: min(100% - 24px, 1240px);
        min-height: 66px;
        gap: 10px;
    }

    .admin-brand small,
    .admin-nav a:last-child,
    .logout-button {
        display: none;
    }

    .admin-nav {
        gap: 2px;
    }

    .admin-nav a {
        padding: 8px 9px;
        font-size: 0.72rem;
    }

    .logout-form::after {
        display: block;
        padding: 8px;
        color: var(--red);
        content: "Salir";
        font-size: 0.72rem;
        font-weight: 800;
        pointer-events: none;
    }

    .logout-form {
        position: relative;
    }

    .logout-form .logout-button {
        position: absolute;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        padding: 0;
        opacity: 0;
    }

    .admin-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .editor-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .editor-actions {
        width: 100%;
    }

    .editor-actions .danger-action {
        margin-left: auto;
    }

    .identity-grid,
    .environment-editors,
    .group-identity {
        padding-right: 16px;
        padding-left: 16px;
    }

    .site-selector {
        margin-right: 16px;
        margin-left: 16px;
    }

    .site-options {
        grid-template-columns: 1fr;
    }

    .save-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .save-bar .primary-button {
        width: 100%;
    }

    .login-intro,
    .login-panel {
        padding: 26px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
