:root {
    --blue: #0a4d91;
    --blue2: #073766;
    --cyan: #eaf5ff;
    --red: #c9222a;
    --ink: #172033;
    --muted: #667085;
    --line: #dce5ef;
    --bg: #f4f7fb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
    font: inherit;
}

/* Encabezado */

.top {
    padding: 16px 24px;
    color: #fff;
    background: linear-gradient(135deg, var(--blue2), var(--blue));
}

.brand {
    width: 100%;
    max-width: 1200px;
    min-height: 82px;
    margin: auto;
    display: flex;
    align-items: center;
    gap: 50px;
}

.mark {
    width: 185px;
    height: 66px;
    flex: 0 0 185px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.mark img {
    display: block;
    width: 185px;
    height: 66px;
    object-fit: contain;
    object-position: left center;
}

.brand-text {
    min-width: 0;
    display: block;
}

.brand-text h1 {
    margin: 0;
    color: #fff;
    font-size: 21px;
    line-height: 1.25;
}

.brand-text p {
    margin: 5px 0 0;
    color: #fff;
    opacity: 0.8;
    font-size: 13px;
}

.adminlink {
    margin-left: auto;
    padding: 9px 14px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 9px;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.adminlink:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    text-decoration: none;
}

/* Contenedor general */

.wrap {
    width: 100%;
    max-width: 1480px;
    margin: 20px auto;
    padding: 0 20px;
}

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(17, 46, 81, 0.08);
}

/* Chat p¨˛blico */

.chat {
    width: 100%;
    max-width: 1000px;
    margin: auto;
    overflow: hidden;
}

.intro {
    padding: 28px 30px;
    border-bottom: 1px solid var(--line);
}

.intro h2 {
    margin: 0 0 8px;
    font-size: 25px;
}

.intro p {
    margin: 0;
    color: var(--muted);
}

.quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 17px;
}

.chip {
    padding: 8px 12px;
    color: var(--blue);
    background: #f5faff;
    border: 1px solid #b7d2eb;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.chip:hover {
    background: var(--cyan);
    border-color: #8dbce5;
}

.messages {
    height: clamp(520px, 58vh, 760px);
    padding: 28px 34px;
    overflow-y: auto;
    background: #fbfdff;
    scrollbar-gutter: stable;
}

.msg {
    max-width: 88%;
    margin: 0 0 14px;
    padding: 12px 15px;
    border-radius: 16px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.assistant {
    background: #fff;
    border: 1px solid var(--line);
}

.user {
    margin-left: auto;
    color: #fff;
    background: var(--blue);
}

/* Caja para escribir */

.composer {
    padding: 16px;
    display: flex;
    gap: 10px;
    border-top: 1px solid var(--line);
}

textarea {
    width: 100%;
    min-height: 54px;
    max-height: 150px;
    padding: 14px;
    resize: none;
    border: 1px solid #bdcad8;
    border-radius: 12px;
}

textarea:focus,
.field input:focus,
.field select:focus {
    border-color: var(--blue);
    outline: 2px solid rgba(10, 77, 145, 0.12);
}

.btn {
    padding: 11px 17px;
    color: #fff;
    background: var(--blue);
    border: 0;
    border-radius: 11px;
    cursor: pointer;
    font-weight: 650;
    transition: background 0.2s ease;
}

.btn:hover {
    background: var(--blue2);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-red {
    background: var(--red);
}

.btn-red:hover {
    background: #a91c23;
}

.note {
    padding: 0 18px 22px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

/* Panel administrativo */

.login-panel {
    max-width: 430px;
    margin: auto;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.panel {
    padding: 22px;
}

.panel h2,
.panel h3 {
    margin-top: 0;
}

.field {
    margin-bottom: 13px;
}

.field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 650;
}

.field input,
.field select {
    width: 100%;
    padding: 10px;
    border: 1px solid #bdcad8;
    border-radius: 9px;
}

.alert {
    margin-bottom: 18px;
    padding: 12px 15px;
    background: #fff4d6;
    border: 1px solid #efcf70;
    border-radius: 10px;
}

.docs {
    margin-top: 18px;
}

.doc {
    padding: 14px 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.doc:last-child {
    border-bottom: 0;
}

.doc small {
    display: block;
    color: var(--muted);
}

.actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.actions form {
    margin: 0;
}

.tiny {
    padding: 7px 10px;
    font-size: 12px;
}

.off {
    opacity: 0.5;
}

/* Adaptaci¨Žn para celulares */

@media (max-width: 720px) {
    .top {
        padding: 12px 16px;
    }

    .brand {
        min-height: auto;
        flex-wrap: wrap;
        gap: 10px 12px;
    }

    .mark {
        width: 145px;
        height: 54px;
        flex-basis: 145px;
    }

    .mark img {
        width: 145px;
        height: 54px;
    }

    .brand-text {
        width: calc(100% - 157px);
        display: block;
    }

    .brand-text h1 {
        font-size: 18px;
        line-height: 1.25;
    }

    .brand-text p {
        margin-top: 3px;
    }

    .adminlink {
        width: 100%;
        margin-left: 0;
        text-align: right;
    }

    .wrap {
        margin: 14px auto;
        padding: 0 12px;
    }

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

    .intro {
        padding: 22px 18px;
    }

    .intro h2 {
        font-size: 22px;
    }

    .messages {
        height: 50vh;
        min-height: 400px;
        padding: 20px 16px;
    }

    .composer {
        flex-direction: column;
    }

    .msg {
        max-width: 94%;
    }

    .doc {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 460px) {
    .mark {
        width: 120px;
        height: 48px;
        flex-basis: 120px;
    }

    .mark img {
        width: 120px;
        height: 48px;
    }

    .brand-text {
        width: calc(100% - 132px);
    }

    .brand-text p {
        display: none;
    }

    .messages {
        min-height: 360px;
    }
}
