:root {
    --ink: #2b211d;
    --muted: #736761;
    --line: #eadfd7;
    --surface: #ffffff;
    --canvas: #f8f4ef;
    --brand: #d22630;
    --brand-dark: #9f1821;
    --brand-soft: #fbe8e7;
    --accent: #b58c06;
    --accent-light: #e5c462;
    --cream: #fff7df;
    --shadow: 0 18px 55px rgba(83, 34, 28, 0.11);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}

svg {
    width: 1.2em;
    height: 1.2em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.directory-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 8% 0%, rgba(181, 140, 6, 0.16), transparent 25rem),
        radial-gradient(circle at 96% 12%, rgba(210, 38, 48, 0.08), transparent 24rem),
        var(--canvas);
}

.directory-shell {
    width: min(1180px, calc(100% - 40px));
    min-height: 100vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.directory-header {
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-logo {
    width: 62px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.brand-logo img {
    display: block;
    width: 62px;
    height: auto;
    filter: drop-shadow(0 5px 8px rgba(94, 37, 29, 0.18));
}

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

.brand strong {
    font-size: 15px;
    letter-spacing: -0.01em;
}

.brand small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
    transition: color 160ms ease;
}

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

.directory-main {
    flex: 1;
    padding: 46px 0 36px;
}

.directory-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 30px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.directory-intro h1,
.login-copy h1,
.agenda-preview h2 {
    margin: 0;
    letter-spacing: -0.045em;
}

.directory-intro h1 {
    font-size: clamp(38px, 5vw, 62px);
    line-height: 1;
}

.directory-intro p {
    max-width: 620px;
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.6;
}

.directory-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.export-link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid rgba(210, 38, 48, 0.18);
    border-radius: 12px;
    color: var(--brand);
    background: rgba(255, 255, 255, 0.72);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    transition: transform 160ms ease, border 160ms ease, background 160ms ease;
}

.export-link:hover {
    border-color: rgba(210, 38, 48, 0.32);
    background: var(--surface);
    transform: translateY(-1px);
}

.contact-count {
    min-width: 132px;
    padding: 15px 20px;
    border: 1px solid rgba(210, 38, 48, 0.14);
    border-radius: 16px;
    text-align: center;
    background: rgba(255, 255, 255, 0.6);
}

.contact-count strong,
.contact-count span {
    display: block;
}

.contact-count strong {
    color: var(--brand);
    font-size: 25px;
    line-height: 1;
}

.contact-count span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.search-box {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 12px;
    width: min(790px, calc(100% - 48px));
    min-height: 68px;
    margin: 0 24px -34px;
    padding: 8px 8px 8px 22px;
    border: 1px solid rgba(210, 38, 48, 0.16);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 12px 35px rgba(83, 34, 28, 0.14);
}

.search-box > svg {
    color: var(--brand);
    font-size: 21px;
}

.search-box input {
    min-width: 0;
    height: 48px;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
    font-size: 16px;
}

.search-box input::placeholder {
    color: #929d95;
}

.clear-search {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
}

.search-box button,
.empty-state-agenda a {
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: var(--brand);
    font-weight: 750;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease;
}

.search-box button {
    height: 50px;
    padding: 0 24px;
}

.search-box button:hover,
.empty-state-agenda a:hover {
    background: var(--brand-dark);
    transform: translateY(-1px);
}

.search-summary {
    margin: 48px 24px -22px;
    color: var(--muted);
    font-size: 14px;
}

.directory-card {
    min-height: 220px;
    padding-top: 58px;
    overflow: hidden;
    border: 1px solid rgba(210, 38, 48, 0.09);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.table-wrap {
    overflow-x: auto;
}

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

.contacts-table th,
.contacts-table td {
    padding: 17px 24px;
    text-align: left;
}

.contacts-table th {
    color: #79857d;
    background: #fcf9f5;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.contacts-table td {
    border-top: 1px solid var(--line);
    color: #3d4941;
    font-size: 14px;
}

.contacts-table tbody tr {
    transition: background 140ms ease;
}

.contacts-table tbody tr:hover {
    background: #fffaf6;
}

.person {
    display: flex;
    align-items: center;
    gap: 12px;
}

.person strong {
    color: var(--ink);
    font-size: 14px;
}

.avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--brand);
    background: var(--brand-soft);
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
}

.group {
    color: #655852;
    font-weight: 600;
}

.type-badge {
    display: inline-flex;
    padding: 5px 9px;
    border: 1px solid #eadab5;
    border-radius: 999px;
    color: var(--brand);
    background: var(--cream);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.phone-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--brand);
    font-weight: 750;
    text-decoration: none;
}

.phone-link:hover {
    text-decoration: underline;
}

.phone-link svg {
    font-size: 15px;
}

.extension-link {
    padding: 6px 10px;
    border-radius: 9px;
    background: var(--brand-soft);
    text-decoration: none;
}

.extension-link:hover {
    background: #f7d8d7;
    text-decoration: none;
}

.empty-value {
    color: #a9b1ac;
}

.empty-state-agenda {
    padding: 46px 24px 56px;
    text-align: center;
}

.empty-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin: 0 auto 18px;
    border-radius: 18px;
    color: var(--brand);
    background: var(--brand-soft);
    font-size: 25px;
}

.empty-state-agenda h2 {
    margin: 0;
    font-size: 22px;
}

.empty-state-agenda p {
    margin: 10px 0 22px;
    color: var(--muted);
}

.empty-state-agenda a {
    display: inline-block;
    padding: 12px 18px;
    text-decoration: none;
}

.directory-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 26px 0 34px;
    color: #849087;
    font-size: 12px;
}

/* Login y portada */
.login-page {
    min-height: 100vh;
    padding: 24px;
    background: #eee7df;
}

.login-shell {
    width: min(1180px, 100%);
    min-height: calc(100vh - 48px);
    display: grid;
    grid-template-columns: minmax(390px, 0.82fr) minmax(480px, 1.18fr);
    margin: 0 auto;
    overflow: hidden;
    border-radius: 28px;
    background: var(--surface);
    box-shadow: 0 24px 80px rgba(77, 31, 25, 0.18);
}

.login-panel {
    display: flex;
    flex-direction: column;
    padding: clamp(36px, 5vw, 68px);
}

.login-brand {
    margin-bottom: auto;
}

.login-copy {
    margin-top: 70px;
}

.login-copy h1 {
    font-size: clamp(40px, 5vw, 58px);
}

.login-copy p {
    margin: 14px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.login-form {
    display: grid;
    gap: 18px;
    margin-top: 34px;
}

.field label {
    display: block;
    margin-bottom: 8px;
    color: #4d3e37;
    font-size: 13px;
    font-weight: 750;
}

.field input {
    width: 100%;
    height: 52px;
    padding: 0 15px;
    border: 1px solid #dfd3cc;
    border-radius: 12px;
    outline: 0;
    color: var(--ink);
    background: #fdfbf9;
    transition: border 160ms ease, box-shadow 160ms ease;
}

.field input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(210, 38, 48, 0.11);
}

.login-button {
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: var(--brand);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(159, 24, 33, 0.24);
    transition: transform 160ms ease, background 160ms ease;
}

.login-button:hover {
    background: var(--brand-dark);
    transform: translateY(-1px);
}

.login-message {
    padding: 11px 13px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 650;
}

.error-message {
    color: #842d2d;
    background: #fbeaea;
}

.success-message {
    color: #6f5700;
    background: var(--cream);
}

.login-help {
    margin: auto 0 0;
    padding-top: 50px;
    color: #89938c;
    font-size: 12px;
    line-height: 1.5;
}

.agenda-preview {
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: clamp(50px, 7vw, 92px);
    color: #fff;
    background:
        linear-gradient(145deg, rgba(125, 18, 25, 0.98), rgba(210, 38, 48, 0.94)),
        radial-gradient(circle at 80% 20%, #ef5a61, transparent 42%);
}

.agenda-preview::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.11;
    background-image:
        linear-gradient(rgba(255,255,255,.18) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.18) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.agenda-preview-content {
    position: relative;
    z-index: 1;
    max-width: 510px;
}

.preview-icon {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    margin-bottom: 34px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 19px;
    color: #ffe58f;
    background: rgba(255,255,255,.09);
    font-size: 28px;
    backdrop-filter: blur(8px);
}

.eyebrow.light {
    color: #ffe08a;
}

.agenda-preview h2 {
    max-width: 500px;
    font-size: clamp(36px, 4.5vw, 59px);
    line-height: 1.04;
}

.agenda-preview p {
    max-width: 500px;
    margin: 22px 0 0;
    color: rgba(255,255,255,.72);
    font-size: 16px;
    line-height: 1.7;
}

.preview-stats {
    display: flex;
    gap: 46px;
    margin: 36px 0;
    padding: 26px 0;
    border-top: 1px solid rgba(255,255,255,.15);
    border-bottom: 1px solid rgba(255,255,255,.15);
}

.preview-stats strong,
.preview-stats span {
    display: block;
}

.preview-stats strong {
    font-size: 22px;
}

.preview-stats span {
    margin-top: 4px;
    color: rgba(255,255,255,.58);
    font-size: 12px;
}

.agenda-cta {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    border-radius: 12px;
    color: #7d171d;
    background: #fff8e6;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 12px 28px rgba(73, 10, 15, .2);
    transition: transform 160ms ease;
}

.agenda-cta:hover {
    transform: translateY(-2px);
}

.agenda-preview-decoration {
    position: absolute;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 50%;
}

.decoration-one {
    width: 420px;
    height: 420px;
    right: -230px;
    top: -120px;
}

.decoration-two {
    width: 230px;
    height: 230px;
    right: -80px;
    bottom: -90px;
}

@media (max-width: 900px) {
    .login-page {
        padding: 0;
    }

    .login-shell {
        min-height: 100vh;
        grid-template-columns: 1fr;
        border-radius: 0;
    }

    .login-brand {
        margin-bottom: 0;
    }

    .login-copy {
        margin-top: 52px;
    }

    .login-help {
        margin-top: 0;
        padding-top: 32px;
    }

    .agenda-preview {
        min-height: 520px;
    }
}

@media (max-width: 700px) {
    .directory-shell {
        width: min(100% - 28px, 1180px);
    }

    .directory-header {
        min-height: 78px;
    }

    .back-link {
        font-size: 0;
    }

    .back-link svg {
        font-size: 20px;
    }

    .directory-main {
        padding-top: 28px;
    }

    .directory-intro {
        align-items: flex-start;
    }

    .contact-count {
        display: none;
    }

    .directory-intro p {
        font-size: 15px;
    }

    .search-box {
        width: calc(100% - 24px);
        grid-template-columns: auto 1fr auto;
        margin-right: 12px;
        margin-left: 12px;
        padding-left: 16px;
    }

    .clear-search {
        display: none;
    }

    .search-box button {
        padding: 0 16px;
    }

    .directory-card {
        padding: 52px 14px 14px;
        border-radius: 20px;
    }

    .contacts-table,
    .contacts-table tbody,
    .contacts-table tr,
    .contacts-table td {
        display: block;
        width: 100%;
    }

    .contacts-table thead {
        display: none;
    }

    .contacts-table tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 13px 16px;
        margin-bottom: 12px;
        padding: 17px;
        border: 1px solid var(--line);
        border-radius: 15px;
        background: #fff;
    }

    .contacts-table tr:last-child {
        margin-bottom: 0;
    }

    .contacts-table td {
        padding: 0;
        border: 0;
    }

    .contacts-table td:first-child {
        grid-column: 1 / -1;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--line);
    }

    .contacts-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 5px;
        color: #8b958e;
        font-size: 10px;
        font-weight: 800;
        letter-spacing: .08em;
        text-transform: uppercase;
    }

    .contacts-table td:first-child::before {
        display: none;
    }

    .person strong {
        font-size: 15px;
    }

    .directory-footer {
        flex-direction: column;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .brand small {
        display: none;
    }

    .directory-intro h1 {
        font-size: 39px;
    }

    .search-box button {
        width: 48px;
        padding: 0;
        overflow: hidden;
        color: transparent;
    }

    .search-box button::after {
        content: "→";
        display: grid;
        place-items: center;
        color: #fff;
        font-size: 20px;
    }

    .login-panel,
    .agenda-preview {
        padding: 34px 26px;
    }

    .login-copy {
        margin-top: 50px;
    }

    .agenda-preview {
        min-height: 540px;
    }

    .agenda-preview h2 {
        font-size: 38px;
    }

    .preview-stats {
        gap: 28px;
    }
}
