:root {
    font-family: Inter, system-ui, Segoe UI, Arial, sans-serif;
    color: #192c40;
}

* {
    box-sizing: border-box;
}

html {
    background-color: #E7D9B9;
}

body {
    margin: 0;
    background-color: #E7D9B9;
    min-height: 100vh;
}


a:hover {
    text-decoration: underline;
}

/* Main header */
header {
    background: #0b2c4d;
    color: #fff;
    height: 50px;
    min-height: 50px;
    padding: 0 max(22px, calc((100vw - 1180px) / 2));
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: nowrap;
    overflow: hidden;
}

header a {
    color: #cde6fc;
}

/* Header logo: fixed size, scaled without distortion */
header img.header-logo {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px;
    min-height: 38px;
    max-width: 38px !important;
    max-height: 38px !important;
    object-fit: contain;
    flex: 0 0 38px !important;
}

header > strong {
    font-size: 22px;
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0;
}

header > span {
    white-space: nowrap;
    flex-shrink: 0;
}

header nav {
    display: flex;
    gap: 17px;
    flex-wrap: nowrap;
    align-items: center;
    margin-left: auto;
    white-space: nowrap;
}

header nav > span {
    white-space: nowrap;
}

header nav form {
    margin: 0;
    flex-shrink: 0;
}

header nav button {
    white-space: nowrap;
}

/* Main content */
main {
    max-width: 1180px;
    margin: 28px auto;
    padding: 0 20px;
}

.card {
    background: white;
    border: 1px solid #dde7ef;
    border-radius: 15px;
    padding: 21px;
    margin: 0 0 18px;
    box-shadow: 0 3px 14px #18304a09;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
    gap: 15px;
}

.grid .card {
    margin: 0;
}

.num {
    font-size: 30px;
    font-weight: 750;
    margin-top: 8px;
}

.muted {
    color: #667b8f;
}

.small {
    font-size: 12px;
}

h1 {
    font-size: 25px;
    margin: 0 0 18px;
}

h2 {
    font-size: 19px;
    margin: 0 0 13px;
}

label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin: 8px 0 5px;
}

input,
select {
    border: 1px solid #bbcede;
    background: white;
    border-radius: 9px;
    padding: 11px;
    width: 100%;
    font: inherit;
}

input[type=checkbox] {
    width: auto;
}

.formgrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.btn,
button {
    border: 0;
    background: #087ca7;
    color: white;
    padding: 11px 17px;
    border-radius: 9px;
    font-weight: 650;
    cursor: pointer;
    font: inherit;
    display: inline-block;
}

.btn:hover,
button:hover {
    background: #066385;
    color: white;
    text-decoration: none;
}

.subtle {
    background: #eaf1f7;
    color: #144463;
}

.pill {
    display: inline-block;
    background: #e8f5ed;
    color: #217044;
    border-radius: 30px;
    padding: 4px 10px;
    font-size: 12px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

td,
th {
    padding: 11px;
    border-bottom: 1px solid #e8eef3;
    text-align: left;
    vertical-align: top;
}

th {
    font-size: 13px;
    color: #52677a;
}

.scroll {
    overflow-x: auto;
}

/* Alerts */
.alert {
    background: #fff4df;
    padding: 14px;
    border-radius: 9px;
    border-left: 4px solid #efad34;
    margin: 12px 0;
}

.error {
    background: #ffeded;
    border-color: #d44949;
}

.success {
    background: #e5f6e9;
    border-color: #32a264;
}

/* Conversation messages */
.msg {
    padding: 12px;
    border-radius: 10px;
    margin: 9px 0;
    background: #f4f7fa;
}

.msg.user {
    background: #fff0e0;
    border-left: 4px solid #f28c28;
}

.msg.agent {
    border-left: 4px solid #0b93af;
}

/* Footer and usage meter */
footer {
    color: #728398;
    text-align: center;
    padding: 24px;
}

footer .footer-copyright {
    font-size: 12px;
    margin-top: 6px;
    color: #8796a7;
}

.meter {
    background: #e3edf2;
    height: 11px;
    border-radius: 11px;
    overflow: hidden;
}

.meter > span {
    height: 100%;
    display: block;
    background: #19a78e;
}

.stack {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}

.stack > div {
    flex: 1;
    min-width: 190px;
}

/* Conversation detail push drawer */
body.drawer-open {
    overflow-x: hidden;
}

body.drawer-open header,
body.drawer-open main,
body.drawer-open footer {
    width: calc(100% - min(560px, 48vw));
    margin-left: 0;
    margin-right: auto;
    max-width: none;
}

body.drawer-open header {
    padding-left: 22px;
    padding-right: 22px;
}

body.drawer-open main {
    padding-left: 20px;
    padding-right: 20px;
}

.conversation-drawer {
    position: fixed;
    z-index: 1001;
    top: 0;
    right: 0;
    width: min(560px, 48vw);
    height: 100dvh;
    background: #fff;
    border-left: 1px solid #d6e1eb;
    box-shadow: -12px 0 36px #18304a18;
    transform: translateX(102%);
    transition: transform .25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.conversation-drawer.open {
    transform: translateX(0);
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #0b2c4d20;
}

.drawer-backdrop[hidden],
.drawer-error[hidden] {
    display: none;
}

.drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 20px;
    border-bottom: 1px solid #e3ebf2;
}

.drawer-header h2 {
    margin: 5px 0 0;
    overflow-wrap: anywhere;
}

.drawer-close {
    white-space: nowrap;
}

.drawer-tabs {
    display: flex;
    gap: 5px;
    padding: 10px 18px 0;
    border-bottom: 1px solid #e3ebf2;
}

.drawer-tab {
    background: #f4f7fa;
    color: #52677a;
    border-radius: 8px 8px 0 0;
    border-bottom: 3px solid transparent;
    padding: 11px 15px;
    transition: background .15s ease, color .15s ease;
}

.drawer-tab:hover {
    background: #e5edf4;
    color: #144463;
}

.drawer-tab.active {
    color: #fff;
    border-bottom-color: #064e75;
    background: #0b2c4d;
}

.drawer-tab.active:hover {
    background: #08243e;
    color: #fff;
}

.drawer-content {
    padding: 18px 20px 30px;
    overflow: auto;
    flex: 1;
    min-height: 0;
}

.drawer-content h3 {
    font-size: 16px;
    margin: 22px 0 9px;
}

.drawer-content p {
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.drawer-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.drawer-meta-item {
    background: #f4f7fa;
    border-radius: 9px;
    padding: 11px;
    min-width: 0;
}

.drawer-meta-item .muted {
    font-size: 12px;
    margin-bottom: 5px;
}

.drawer-meta-item strong {
    overflow-wrap: anywhere;
}

.drawer-content .msg {
    line-height: 1.45;
}

.drawer-content audio {
    width: 100%;
    margin: 8px 0;
}

.drawer-loading {
    padding: 22px 4px;
    color: #667b8f;
}

.conversation-open {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 7px;
    background: #eaf1f7;
}

@media (max-width: 850px) {
    body.drawer-open header,
    body.drawer-open main,
    body.drawer-open footer {
        width: 100%;
        max-width: 100%;
    }

    .conversation-drawer {
        width: min(560px, 92vw);
    }

    body.drawer-open header,
    body.drawer-open main,
    body.drawer-open footer {
        transform: translateX(-12px);
    }
}

@media (max-width: 560px) {
    body.drawer-open header,
    body.drawer-open main,
    body.drawer-open footer {
        display: none;
    }

    .conversation-drawer {
        width: 100vw;
    }

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

@media (prefers-reduced-motion: reduce) {
    .conversation-drawer {
        transition: none;
    }
}

/* Additional conversation metadata placeholders and selected row */
.conversation-row-selected {
    background: #eaf3fa;
}

.conversation-row-selected td {
    border-bottom-color: #c5d9e9;
}

.conversation-open-selected {
    background: #0b2c4d !important;
    color: #fff !important;
    box-shadow: 0 0 0 2px #b9d4e8;
}

.conversation-extra-metadata {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #e3ebf2;
}

.conversation-extra-metadata h3 {
    margin-top: 0;
}

.future-metadata-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.future-metadata-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    padding: 11px;
    background: #f4f7fa;
    border: 1px dashed #cbd8e3;
    border-radius: 9px;
}

.future-metadata-item span {
    font-size: 12px;
    color: #667b8f;
}

.future-metadata-item strong {
    font-size: 13px;
    color: #52677a;
    font-weight: 600;
}

.future-metadata-notes {
    grid-column: 1 / -1;
    min-height: 64px;
}

@media (max-width: 560px) {
    .future-metadata-grid {
        grid-template-columns: 1fr;
    }

    .future-metadata-notes {
        grid-column: auto;
    }
}

/* Conversation search filters */
.conversation-filters {
    display: grid;
    grid-template-columns:
        minmax(0, 1.35fr)
        minmax(0, .82fr)
        minmax(0, .82fr)
        minmax(0, 1fr)
        minmax(0, 1.25fr)
        auto;
    gap: 12px;
    align-items: end;
    width: 100%;
}

.conversation-filters > div {
    min-width: 0;
}

.conversation-filters label {
    white-space: nowrap;
}

.conversation-filters input,
.conversation-filters select {
    min-width: 0;
    width: 100%;
}

.conversation-filters .filter-submit {
    display: flex;
    gap: 8px;
    align-self: end;
}

.conversation-filters .filter-submit button {
    white-space: nowrap;
}

@media (max-width: 1050px) {
    .conversation-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .conversation-filters .filter-transcript {
        grid-column: span 2;
    }
}

@media (max-width: 650px) {
    .conversation-filters {
        grid-template-columns: minmax(0, 1fr);
    }

    .conversation-filters .filter-agent,
    .conversation-filters .filter-transcript,
    .conversation-filters .filter-submit {
        grid-column: auto;
    }
}

/* Conversation table: dedicated speaker icon column */
.conversations-table {
    table-layout: auto;
}

.conversations-table th.audio-column,
.conversations-table td.audio-column {
    width: 62px;
    min-width: 62px;
    max-width: 62px;
    padding-left: 4px;
    padding-right: 4px;
    text-align: center;
    vertical-align: middle;
}

.conversations-table td.audio-column {
    white-space: nowrap;
}

.audio-indicator {
    display: inline-block;
    line-height: 1;
    font-size: 15px;
}

.audio-indicator[hidden] {
    display: none;
}

.balance-indicator {
    display: inline-block;
    line-height: 1;
    font-size: 15px;
    margin-right: 4px;
    cursor: default;
}

.conversations-table th.open-column,
.conversations-table td.open-column {
    white-space: nowrap;
    vertical-align: middle;
}

.conversations-table td.open-column {
    padding-left: 8px;
}

/* Responsive header safeguards */
@media (max-width: 1050px) {
    header {
        gap: 14px;
        padding-left: 16px;
        padding-right: 16px;
    }

    header nav {
        gap: 12px;
    }

    header > strong {
        font-size: 18px;
    }
}

@media (max-width: 760px) {
    header {
        height: auto;
        min-height: 86px;
        padding-top: 12px;
        padding-bottom: 12px;
        flex-wrap: wrap;
    }

    header nav {
        width: 100%;
        margin-left: 0;
        flex-wrap: wrap;
    }
}

/* Administration tabs */
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #d6e3ed;
}

.admin-tabs .admin-tab-button {
    background: #eaf1f7;
    color: #144463;
    border: 1px solid #d6e3ed;
    border-radius: 9px;
    padding: 11px 20px;
    font-weight: 650;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.admin-tabs .admin-tab-button:hover {
    background: #dceaf5;
    color: #0b2c4d;
}

.admin-tabs .admin-tab-button.active {
    background: #0b2c4d;
    color: #fff;
    border-color: #0b2c4d;
}

.admin-tab-panel {
    display: none;
    min-width: 0;
}

.admin-tab-panel.active {
    display: block;
}

.admin-tab-panel > .card {
    margin-bottom: 18px;
}

@media (max-width: 560px) {
    .admin-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-tabs .admin-tab-button {
        width: 100%;
        padding: 10px 8px;
    }
}

/* Administration tabs — styled like the conversation drawer */
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 10px 18px 0;
    margin: 18px 0 20px;
    border-bottom: 1px solid #e3ebf2;
}

.admin-tabs .admin-tab-button {
    background: #f4f7fa;
    color: #52677a;
    border-radius: 8px 8px 0 0;
    border-bottom: 3px solid transparent;
    padding: 11px 15px;
    font-weight: 500;
    transition: background .15s ease, color .15s ease;
}

.admin-tabs .admin-tab-button:hover {
    background: #e5edf4;
    color: #144463;
}

.admin-tabs .admin-tab-button.active {
    color: #fff;
    border-bottom-color: #064e75;
    background: #0b2c4d;
}

.admin-tabs .admin-tab-button.active:hover {
    background: #08243e;
    color: #fff;
}

.admin-tab-panel {
    display: none;
    min-width: 0;
}

.admin-tab-panel.active {
    display: block;
}

.admin-tab-panel[hidden] {
    display: none !important;
}

.admin-tab-panel > .card {
    margin-bottom: 18px;
}

@media (max-width: 560px) {
    .admin-tabs {
        gap: 5px;
        padding-left: 0;
        padding-right: 0;
    }

    .admin-tabs .admin-tab-button {
        flex: 1 1 auto;
        padding: 10px;
    }
}

/* Administration tabs: match the conversation drawer */
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 18px 0 0;
    padding: 10px 18px 0;
    border-bottom: 1px solid #e3ebf2;
}

.admin-tabs .admin-tab-button {
    display: inline-block;
    margin: 0;
    padding: 11px 15px;
    background: #f4f7fa;
    color: #52677a;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 8px 8px 0 0;
    box-shadow: none;
    font-weight: 500;
}

.admin-tabs .admin-tab-button:hover {
    background: #e5edf4;
    color: #144463;
}

.admin-tabs .admin-tab-button.active {
    background: #0b2c4d;
    color: #fff;
    border-bottom-color: #064e75;
    border-radius: 8px 8px 0 0;
}

.admin-tabs .admin-tab-button.active:hover {
    background: #08243e;
    color: #fff;
}

.admin-tab-panel {
    display: none;
    min-width: 0;
}

.admin-tab-panel.active {
    display: block;
}

.admin-tab-panel[hidden] {
    display: none !important;
}

/* Institution creation drawer */
.institution-drawer {
    position: fixed;
    z-index: 1101;
    top: 0;
    right: 0;
    width: min(620px, 94vw);
    height: 100dvh;
    background: #fff;
    border-left: 1px solid #d6e1eb;
    box-shadow: -12px 0 36px #18304a18;
    transform: translateX(102%);
    transition: transform .25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.institution-drawer.open {
    transform: translateX(0);
}

.institution-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: #0b2c4d35;
}

.institution-drawer-backdrop[hidden] {
    display: none;
}

.institution-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px;
    border-bottom: 1px solid #e3ebf2;
}

.institution-drawer-header h2 {
    margin: 5px 0 0;
}

.institution-drawer-close {
    white-space: nowrap;
}

.institution-drawer-content {
    padding: 22px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.institution-drawer-content .formgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.institution-drawer-content input:not([type="checkbox"]),
.institution-drawer-content select {
    width: 100%;
}

.institution-drawer-content input[type="checkbox"] {
    width: auto;
}

.institution-drawer-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
}

body.institution-drawer-open {
    overflow: hidden;
}

@media (max-width: 560px) {
    .institution-drawer {
        width: 100vw;
    }

    .institution-drawer-content .formgrid {
        grid-template-columns: 1fr;
    }

    .institution-drawer-header,
    .institution-drawer-content {
        padding: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .institution-drawer {
        transition: none;
    }
}

/* Compact button wrapper retained for compatibility */
.institution-create-button {
    margin: 12px 0;
    padding: 0;
}

/* Institutions heading with create button on the right */
.institutions-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    margin-bottom: 16px;
}

.institutions-header h2 {
    margin: 0;
    flex: 1;
}

.institutions-header button {
    flex-shrink: 0;
    margin-left: auto;
}

@media (max-width: 560px) {
    .institutions-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .institutions-header h2 {
        flex: 1;
    }

    .institutions-header button {
        flex-shrink: 0;
    }
}
/* Fix: keep institution title and button on the same row */
.card .institutions-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    justify-content: initial !important;
    gap: 16px !important;
    width: 100% !important;
    margin-bottom: 16px !important;
}

.card .institutions-header h2 {
    margin: 0 !important;
    min-width: 0;
}

.card .institutions-header button#openInstitutionDrawer {
    display: inline-block !important;
    width: auto !important;
    margin: 0 !important;
    justify-self: end;
    white-space: nowrap;
}

@media (max-width: 560px) {
    .card .institutions-header {
        grid-template-columns: minmax(0, 1fr) auto !important;
        gap: 8px !important;
    }

    .card .institutions-header h2 {
        font-size: 16px;
    }

    .card .institutions-header button#openInstitutionDrawer {
        padding: 9px 10px;
        font-size: 13px;
    }
}

/* Institution table: match the compact Conversations "Abrir" control */
.card .scroll table button.edit-institution-button {
    appearance: none !important;
    -webkit-appearance: none !important;
    display: inline-block !important;
    box-sizing: border-box !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 5px 9px !important;
    border: 0 !important;
    border-radius: 7px !important;
    background: #eaf1f7 !important;
    color: #11639f !important;
    font-family: inherit !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: normal !important;
    text-align: center !important;
    text-decoration: none !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    box-shadow: none !important;
}

.card .scroll table button.edit-institution-button:hover,
.card .scroll table button.edit-institution-button:focus-visible {
    background: #dceaf5 !important;
    color: #11639f !important;
}

.card .scroll table button.edit-institution-button:focus-visible {
    outline: 2px solid #11639f !important;
    outline-offset: 2px !important;
}
/* Force the Retro Terminal page background */
html,
body {
    background-color: #E7D9B9 !important;
}

/* Retro Terminal: thicker section and card borders */

/* Main content sections */
main > .card {
    border: 3px solid #8B7958;
}

/* Cards nested inside sections */
.card .card {
    border: 2px solid #B5A17B;
}

/* Form controls */
input,
select,
textarea {
    border: 2px solid #B5A17B;
}

/* Tables: stronger row separators */
td,
th {
    border-bottom: 1px solid #C8B894;
}

/* Retro Terminal: Administration section borders */

/* Main panels, including Administration */
.card {
    border: 3px solid #8B7958;
}

/* Cards nested inside panels */
.card .card {
    border-width: 2px;
    border-color: #B5A17B;
}

/* Administration tab navigation */
.tabs,
.tab-list {
    border-bottom: 2px solid #8B7958;
}

/* Form controls */
input,
select,
textarea {
    border: 2px solid #B5A17B;
}
/* Restore thick borders on portal sections */
.card {
    border: 3px solid #8B7958;
}

/* ================== SGS: SUPPORT TICKETING ================== */
.sgs{max-width:1140px;margin:auto;color:#102234}
 .sgs *{box-sizing:border-box}
 .sgs .sgs-card{background:#fff;border:1px solid #d7c8ae;border-radius:16px;padding:25px;margin:16px 0;box-shadow:0 2px 12px rgba(20,35,53,.06)}
 .sgs h2,.sgs h3{color:#0d2333;margin:0 0 12px}
 .sgs p,.sgs label,.sgs td,.sgs th{color:#172638}
 .sgs .sgs-muted{color:#657184;font-size:13px}
 .sgs .sgs-grid{display:grid;grid-template-columns:1fr 1fr;gap:17px}
 .sgs label{display:block;font-weight:700;font-size:13px;margin-bottom:6px}
 .sgs input:not([type=hidden]):not([type=checkbox]),.sgs textarea,.sgs select{width:100%;border:1px solid #c9d4df;border-radius:9px;background:white;color:#111827;padding:12px;font-size:14px;max-width:100%}
 .sgs textarea{min-height:128px;resize:vertical}
 .sgs button,.sgs .sgs-button{display:inline-flex;justify-content:center;align-items:center;gap:7px;background:#101c2c;color:white;border:0;border-radius:9px;padding:12px 18px;font-size:14px;font-weight:700;text-decoration:none;cursor:pointer}
 .sgs .sgs-light{background:#e9eef3;color:#102234}
 .sgs .sgs-table{width:100%;border-collapse:collapse}
 .sgs .sgs-table th,.sgs .sgs-table td{text-align:left;padding:12px;border-bottom:1px solid #e8edf1;font-size:13px}
 .sgs .sgs-tag{display:inline-block;background:#e9edf5;border-radius:100px;padding:5px 10px;font-size:12px;font-weight:700;color:#102234}
 .sgs .sgs-message{background:#f7f9fc;border:1px solid #e2e8f0;padding:15px;border-radius:11px;margin:11px 0;white-space:pre-wrap;overflow-wrap:anywhere}
 .sgs .sgs-alert{background:#eaf7ef;border:1px solid #a6d5b3;border-radius:9px;padding:12px;color:#163d28}
 .sgs a:not(.sgs-button){color:#123e74;text-decoration:underline}
 .sgs .sgs-tabs{display:flex;gap:6px;flex-wrap:wrap;margin:18px 0 0}
 .sgs .sgs-tab{display:inline-flex;align-items:center;justify-content:center;padding:13px 20px;border-radius:10px 10px 0 0;border:1px solid #d7c8ae;border-bottom:0;background:#eef2f6;color:#4e647d;font-weight:700;text-decoration:none;min-width:140px}
 .sgs .sgs-tab.active{background:#0b3a63;color:#fff;border-color:#0b3a63}
 .sgs .sgs-tab-panel{margin-top:0}
 @media(max-width:690px){.sgs .sgs-grid{grid-template-columns:1fr}.sgs .sgs-card{padding:16px}.sgs .sgs-table{display:block;overflow-x:auto}.sgs .sgs-tab{border-radius:10px;min-width:auto;flex:1}}

/* Match the Administration tabs exactly: same .admin-tabs and .admin-tab-button styles. */
.support-tabs .admin-tab-button {
    display: inline-block;
    text-decoration: none;
    margin: 0;
}
.support-tabs .admin-tab-button:hover,
.support-tabs .admin-tab-button:focus-visible { text-decoration: none; }
.support-tabs + .support-tab-panel { margin-top: 0; }
/* Retain the surrounding Administration-style panel border. */
.sgs .support-tab-panel { border: 3px solid #8B7958; }
/* Classes extracted from index.php inline styles. */
.channel-icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; }
.channel-icon img { display: block; object-fit: contain; }
.login-card { max-width: 430px; }
.audio-detail-card { margin-top: 20px; }
.conversation-audio { width: 100%; max-width: 650px; }
.conversation-duration { margin-top: 8px; }
.kb-placeholder { min-height: 180px; }
.sgs .sgs-alert-error { background: #fff1f2; color: #8f1122; }
.sgs-table-scroll { overflow-x: auto; }
/* Native progress bar replaces dynamic inline width without losing function. */
.meter-progress {
    display: block;
    width: 100%; height: 100%;
    border: 0; border-radius: inherit;
    appearance: none;
    -webkit-appearance: none;
    background: #e3edf2;
}
.meter-progress::-webkit-progress-bar { background: #e3edf2; border-radius: 11px; }
.meter-progress::-webkit-progress-value { background: #19a78e; border-radius: 11px; }
.meter-progress::-moz-progress-bar { background: #19a78e; border-radius: 11px; }

/* ===== SGS Ticket drawer: same side-panel behavior as Conversations ===== */
body.sgs-drawer-open { overflow-x:hidden; }
body.sgs-drawer-open header,
body.sgs-drawer-open main,
body.sgs-drawer-open footer { width:calc(100% - min(620px,50vw)); margin-left:0; margin-right:auto; max-width:none; }
.sgs-drawer-backdrop { position:fixed;inset:0;z-index:1190;background:rgba(11,44,77,.18); }
.sgs-drawer-backdrop[hidden] { display:none; }
.sgs-drawer { position:fixed;z-index:1191;top:0;right:0;width:min(620px,50vw);height:100dvh;background:#fff;border-left:1px solid #d6e1eb;box-shadow:-12px 0 36px #18304a18;transform:translateX(102%);transition:transform .25s ease;display:flex;flex-direction:column;overflow:hidden;visibility:hidden; }
.sgs-drawer.open { transform:translateX(0);visibility:visible; }
.sgs-drawer-header { display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding:20px;border-bottom:1px solid #e3ebf2; }
.sgs-drawer-header h2 { margin:6px 0 0;overflow-wrap:anywhere; }
.sgs-drawer-header button { flex-shrink:0; }
.sgs-drawer-content { padding:12px 20px 30px;overflow-y:auto;flex:1;min-height:0;max-width:none; }
.sgs-drawer-content .sgs-card { margin:13px 0;border:1px solid #d7c8ae; }
.sgs-drawer-content .sgs-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.sgs-drawer-content .sgs-message {overflow-wrap:anywhere;}
.sgs-drawer-content .sgs-detail-back {display:none;}
.sgs-drawer-content .sgs-alert{margin:12px 0;}
.sgs .sgs-ticket-open {display:inline-block;padding:5px 9px;border-radius:7px;background:#eaf1f7;text-decoration:none!important;}
.sgs .sgs-ticket-open.selected {background:#0b2c4d;color:#fff!important;}
@media(max-width:920px){
 body.sgs-drawer-open header,body.sgs-drawer-open main,body.sgs-drawer-open footer{width:100%;max-width:100%;}
 .sgs-drawer{width:min(620px,92vw)}
}
@media(max-width:560px){
 .sgs-drawer{width:100vw}
 .sgs-drawer-content .sgs-grid{grid-template-columns:1fr}
}
@media(prefers-reduced-motion:reduce){.sgs-drawer{transition:none}}


/* Administration's additional drawers. Reuse the same institution drawer styling. */
.admin-extra-drawer .admin-extra-form { margin-top:20px; }
.admin-extra-drawer .drawer-meta { margin-bottom:14px; }
.admin-extra-drawer .admin-extra-form input { max-width:100%; }
.admin-extra-drawer [data-admin-user-actions][hidden] { display:none; }

/* ADMINISTRACION: aspecto identico del boton Abrir en las cinco pestañas. */
.admin-tab-panel .card .scroll table button.edit-institution-button,
.admin-tab-panel .card .scroll table button.admin-extra-open-button,
.card .scroll table button.edit-institution-button,
.card .scroll table button.admin-extra-open-button {
    -webkit-appearance: none !important;
    appearance: none !important;
    display: inline-block !important;
    box-sizing: border-box !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 5px 9px !important;
    border: 0 !important;
    border-radius: 7px !important;
    background: #eaf1f7 !important;
    color: #11639f !important;
    font-family: inherit !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: normal !important;
    text-align: center !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    box-shadow: none !important;
    cursor: pointer !important;
}
.admin-tab-panel .card .scroll table button.edit-institution-button:hover,
.admin-tab-panel .card .scroll table button.admin-extra-open-button:hover,
.card .scroll table button.edit-institution-button:hover,
.card .scroll table button.admin-extra-open-button:hover {
    background: #dceaf5 !important;
    color: #11639f !important;
}
.admin-tab-panel .card .scroll table button.edit-institution-button:focus-visible,
.admin-tab-panel .card .scroll table button.admin-extra-open-button:focus-visible,
.card .scroll table button.edit-institution-button:focus-visible,
.card .scroll table button.admin-extra-open-button:focus-visible {
    outline: 2px solid #11639f !important;
    outline-offset: 2px !important;
}

/* === Support drawer styling: same visual system as Administration drawers === */
/* Existing rules moved out of index.php so structure and styling remain separate. */
 /* Botón Crear ticket: mismo estilo base de los botones de Administración.
    La especificidad evita que los estilos propios de Soporte lo sobrescriban. */
 #openCreateTicketDrawer {
   appearance: none;
   display: inline-block;
   width: auto;
   min-width: 0;
   flex: 0 0 auto;
   margin: 0;
   border: 0;
   border-radius: 9px;
   padding: 11px 17px;
   background: #087ca7;
   color: #fff;
   font: inherit;
   font-weight: 650;
   line-height: normal;
   text-align: center;
   text-decoration: none;
   cursor: pointer;
   box-shadow: none;
 }
 #openCreateTicketDrawer:hover,
 #openCreateTicketDrawer:focus-visible {
   background: #066385;
   color: #fff;
 }
 #openCreateTicketDrawer:focus-visible {
   outline: 2px solid #087ca7;
   outline-offset: 3px;
 }
 /* Solo drawer de creación de tickets; no modifica los demás drawers. */
 #sgsCreateDrawerBackdrop { position:fixed; inset:0; background:rgba(0,0,0,.48); z-index:9990; }
 #sgsCreateDrawerBackdrop[hidden] { display:none !important; }
 #sgsCreateDrawer { position:fixed; z-index:9991; top:0; right:0; height:100dvh; width:min(540px,100vw); max-width:100vw; overflow:hidden; display:flex; flex-direction:column; background:var(--card-bg, #fff); transform:translateX(105%); transition:transform .22s ease; visibility:hidden; }
 #sgsCreateDrawer.open { transform:translateX(0); visibility:visible; }
 #sgsCreateDrawer .sgs-drawer-header { flex:0 0 auto; }
 #sgsCreateDrawer .sgs-drawer-content { flex:1 1 auto; overflow-y:auto; padding-bottom:28px; }
 #sgsCreateDrawer .sgs-grid { grid-template-columns:repeat(auto-fit,minmax(185px,1fr)); }
 #sgsCreateDrawer form button[type="submit"] { width:auto; }

/* The two SGS panels must match Institution/Workspace/Campus administration drawers. */
.sgs #sgsCreateDrawer,
.sgs #sgsDrawer {
    width: min(620px, 94vw) !important;
    max-width: 100vw;
    height: 100dvh;
    background: #fff !important;
    border-left: 1px solid #d6e1eb !important;
    box-shadow: -12px 0 36px #18304a18 !important;
    transition: transform .25s ease;
}
.sgs #sgsCreateDrawerBackdrop,
.sgs #sgsDrawerBackdrop {
    background: #0b2c4d35 !important;
}
.sgs #sgsCreateDrawer .sgs-drawer-header,
.sgs #sgsDrawer .sgs-drawer-header {
    align-items: flex-start;
    gap: 16px;
    padding: 22px;
    border-bottom: 1px solid #e3ebf2;
}
.sgs #sgsCreateDrawer .sgs-drawer-header h2,
.sgs #sgsDrawer .sgs-drawer-header h2 {
    margin: 5px 0 0;
    color: #192c40;
    font-size: 19px;
}
.sgs #sgsCreateDrawer .sgs-drawer-content,
.sgs #sgsDrawer .sgs-drawer-content {
    padding: 22px !important;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    max-width: none;
}
.sgs #sgsCreateDrawer .sgs-grid,
.sgs #sgsDrawer .sgs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px;
}
/* Uniform form fields, labels, checkboxes and text areas. */
.sgs #sgsCreateDrawer label,
.sgs #sgsDrawer label {
    color: #192c40;
    font-size: 13px;
    font-weight: 600;
    margin: 8px 0 5px;
}
.sgs #sgsCreateDrawer input:not([type=hidden]):not([type=checkbox]),
.sgs #sgsCreateDrawer select,
.sgs #sgsCreateDrawer textarea,
.sgs #sgsDrawer input:not([type=hidden]):not([type=checkbox]),
.sgs #sgsDrawer select,
.sgs #sgsDrawer textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    background: #fff;
    border: 2px solid #B5A17B;
    border-radius: 9px;
    padding: 11px;
    font: inherit;
    color: #192c40;
}
.sgs #sgsCreateDrawer textarea,
.sgs #sgsDrawer textarea {
    min-height: 128px;
    resize: vertical;
}
.sgs #sgsCreateDrawer input[type=checkbox],
.sgs #sgsDrawer input[type=checkbox] {
    width: auto;
    accent-color: #087ca7;
}
/* Buttons: match Admin primary and subtle secondary variants. */
.sgs #sgsCreateDrawer button,
.sgs #sgsDrawer button {
    display: inline-block;
    width: auto;
    max-width: 100%;
    border: 0;
    border-radius: 9px;
    background: #087ca7;
    color: #fff;
    padding: 11px 17px;
    font: inherit;
    font-weight: 650;
    line-height: normal;
    text-decoration: none;
    box-shadow: none;
    cursor: pointer;
}
.sgs #sgsCreateDrawer button:hover,
.sgs #sgsDrawer button:hover {
    background: #066385;
    color: #fff;
}
.sgs #sgsCreateDrawer button.subtle,
.sgs #sgsDrawer button.subtle {
    background: #eaf1f7;
    color: #144463;
    white-space: nowrap;
}
.sgs #sgsCreateDrawer button.subtle:hover,
.sgs #sgsDrawer button.subtle:hover {
    background: #dceaf5;
    color: #144463;
}
.sgs #sgsCreateDrawer button:focus-visible,
.sgs #sgsDrawer button:focus-visible,
.sgs #sgsCreateDrawer input:focus-visible,
.sgs #sgsDrawer input:focus-visible,
.sgs #sgsCreateDrawer select:focus-visible,
.sgs #sgsDrawer select:focus-visible,
.sgs #sgsCreateDrawer textarea:focus-visible,
.sgs #sgsDrawer textarea:focus-visible {
    outline: 2px solid #087ca7;
    outline-offset: 2px;
}
/* Existing inner ticket sections still present, with coordinated border and spacing. */
.sgs #sgsDrawer .sgs-card,
.sgs #sgsCreateDrawer .sgs-card {
    background: #fff;
    border: 2px solid #B5A17B;
    border-radius: 15px;
    padding: 21px;
    margin: 0 0 18px;
    box-shadow: 0 3px 14px #18304a09;
}
@media (max-width: 560px) {
    .sgs #sgsCreateDrawer,
    .sgs #sgsDrawer { width: 100vw !important; }
    .sgs #sgsCreateDrawer .sgs-drawer-header,
    .sgs #sgsDrawer .sgs-drawer-header,
    .sgs #sgsCreateDrawer .sgs-drawer-content,
    .sgs #sgsDrawer .sgs-drawer-content { padding: 18px !important; }
    .sgs #sgsCreateDrawer .sgs-grid,
    .sgs #sgsDrawer .sgs-grid { grid-template-columns: 1fr !important; }
}
@media (prefers-reduced-motion: reduce) {
    .sgs #sgsCreateDrawer,
    .sgs #sgsDrawer { transition: none; }
}


/* SGS: listado filtrable y agrupado, sin modificar los drawers */
.sgs .sgs-date-filters {display:grid;grid-template-columns:minmax(155px,220px) minmax(155px,220px) auto;gap:12px;align-items:end;margin:17px 0 20px;}
.sgs .sgs-date-filters > div {min-width:0;}
.sgs .sgs-date-filters label {margin:0 0 6px;}
.sgs .sgs-date-filters input[type="date"] {width:100%;min-width:0;border:2px solid #B5A17B;border-radius:9px;padding:11px;font:inherit;}
.sgs .sgs-date-actions {display:flex;gap:10px;align-items:center;padding-bottom:1px;}
.sgs .sgs-date-actions button {background:#087ca7;color:#fff;border:0;border-radius:9px;padding:11px 17px;font:inherit;font-weight:650;cursor:pointer;}
.sgs .sgs-date-actions button:hover {background:#066385;}
.sgs a.sgs-clear-filter {color:#144463;text-decoration:none;font-weight:600;white-space:nowrap;}
.sgs a.sgs-clear-filter:hover {text-decoration:underline;}
.sgs .sgs-group-heading {font-size:16px;margin:23px 0 9px;padding-bottom:8px;border-bottom:1px solid #e3ebf2;color:#192c40;}
.sgs .sgs-group-count {font-size:12px;color:#667b8f;font-weight:400;margin-left:7px;}
.sgs .sgs-ticket-table td,.sgs .sgs-ticket-table th {color:#172638;font-size:13px;vertical-align:middle;}
.sgs .sgs-ticket-date {white-space:nowrap;}
.sgs .sgs-status {display:inline-flex;align-items:center;gap:8px;color:inherit;font:inherit;background:transparent;border:0;padding:0;border-radius:0;white-space:nowrap;}
.sgs .sgs-status-dot {width:9px;height:9px;min-width:9px;border-radius:50%;background:#7c8795;display:inline-block;}
.sgs .sgs-status-dot.sgs-status-open {background:#2563eb;}
.sgs .sgs-status-dot.sgs-status-in_progress {background:#f59e0b;}
.sgs .sgs-status-dot.sgs-status-waiting_customer {background:#a855f7;}
.sgs .sgs-status-dot.sgs-status-resolved {background:#16a34a;}
.sgs .sgs-status-dot.sgs-status-closed {background:#64748b;}
@media(max-width:690px){.sgs .sgs-date-filters{grid-template-columns:repeat(2,minmax(0,1fr));}.sgs .sgs-date-actions{grid-column:1/-1;}}
@media(max-width:430px){.sgs .sgs-date-filters{grid-template-columns:1fr;}.sgs .sgs-date-actions{grid-column:auto;}}


/* SGS: filtros compactos y controles espaciados, estilo del botón Crear ticket. */
.sgs form.sgs-date-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-start;
    column-gap: 16px;
    row-gap: 14px;
    margin: 17px 0 24px;
}
.sgs form.sgs-date-filters > div:not(.sgs-date-actions) {
    width: 185px;
    max-width: 100%;
    flex: 0 1 185px;
    min-width: 0;
}
.sgs form.sgs-date-filters input[type="date"] {
    display: block;
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
}
.sgs form.sgs-date-filters .sgs-date-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 19px;
    padding-bottom: 0;
}
.sgs form.sgs-date-filters .sgs-date-actions button {
    appearance: none;
    display: inline-block;
    width: auto;
    background: #087ca7;
    color: #fff;
    border: 0;
    border-radius: 9px;
    padding: 11px 17px;
    font: inherit;
    font-weight: 650;
    line-height: normal;
    box-shadow: none;
    cursor: pointer;
}
.sgs form.sgs-date-filters .sgs-date-actions button:hover,
.sgs form.sgs-date-filters .sgs-date-actions button:focus-visible {
    background: #066385;
    color: #fff;
}
.sgs form.sgs-date-filters a.sgs-clear-filter {
    display: inline-block;
    margin: 0;
    padding: 8px 2px;
    white-space: nowrap;
}
@media (max-width: 520px) {
    .sgs form.sgs-date-filters > div:not(.sgs-date-actions) {
        flex: 1 1 140px;
        width: auto;
    }
    .sgs form.sgs-date-filters .sgs-date-actions {
        flex-basis: 100%;
        gap: 20px;
    }
}


/* Soporte: estado y prioridad visibles para usuarios no superadmin.
   Mantener la apariencia de los drawers y evitar que .sgs label aplique a estos textos. */
.sgs-drawer-content .sgs-ticket-readonly-meta,
.sgs .sgs-ticket-readonly-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 0 0 18px;
}
.sgs-drawer-content .sgs-ticket-readonly-item,
.sgs .sgs-ticket-readonly-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    padding: 13px 15px;
    background: #f4f7fa;
    border: 1px solid #d6e1eb;
    border-radius: 9px;
}
.sgs-drawer-content .sgs-ticket-readonly-label,
.sgs .sgs-ticket-readonly-label {
    color: #52677a;
    font-size: 13px;
    font-weight: 650;
}
.sgs-drawer-content .sgs-ticket-readonly-value,
.sgs .sgs-ticket-readonly-value {
    color: #0b2c4d;
    font-size: 19px;
    font-weight: 750;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
@media (max-width: 430px) {
    .sgs-drawer-content .sgs-ticket-readonly-meta,
    .sgs .sgs-ticket-readonly-meta { gap: 9px; }
    .sgs-drawer-content .sgs-ticket-readonly-item,
    .sgs .sgs-ticket-readonly-item { padding: 11px; }
    .sgs-drawer-content .sgs-ticket-readonly-value,
    .sgs .sgs-ticket-readonly-value { font-size: 17px; }
}

/* Conversaciones: paginacion numerada. */
.conversation-pagination{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:8px;margin-top:19px;}
.conversation-page-link{display:inline-flex;align-items:center;justify-content:center;min-width:38px;min-height:37px;padding:8px 12px;background:#eaf1f7;color:#144463;border:1px solid #d6e3ed;border-radius:9px;text-decoration:none;font-size:14px;font-weight:650;}
.conversation-page-link:hover{background:#dceaf5;color:#0b2c4d;text-decoration:none;}
.conversation-page-link.active{background:#0b2c4d;color:#fff;border-color:#0b2c4d;}
.conversation-page-link.disabled{opacity:.45;cursor:default;}
.conversation-page-total{color:#667b8f;font-size:13px;margin-left:4px;}
@media(max-width:560px){.conversation-pagination{gap:5px}.conversation-page-link{padding:7px 9px;min-width:32px}}

/* Conversaciones: centrar toda la paginacion, incluidos saltos de linea. */
.card > nav.conversation-pagination,
nav.conversation-pagination {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    margin: 19px auto 0 !important;
    padding: 0 !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 8px;
}
nav.conversation-pagination > .conversation-page-total {
    text-align: center;
}

/* Lily Knowledge Base: administración de documentos */
.kb-portal .kb-heading{margin-bottom:18px}
.kb-portal .kb-heading h1{margin-bottom:8px}
.kb-workspace-selector{display:flex;align-items:end;gap:14px;flex-wrap:wrap;margin-bottom:16px}
.kb-workspace-selector>div:first-child{flex:1 1 320px}.kb-workspace-selector>div:nth-child(2){flex:1 1 220px}
.kb-workspace-selector button,.kb-panel-actions button{background:#087ca7;color:white;border-radius:9px;padding:11px 17px}
.kb-panel-actions{display:flex;justify-content:space-between;align-items:center;gap:14px;flex-wrap:wrap;margin:22px 0 12px}
.kb-panel-actions h2{margin:0}.kb-documents-table td,.kb-documents-table th{vertical-align:middle}.kb-documents-table .kb-edit{background:#eaf1f7;color:#144463;padding:7px 12px;font-size:14px}
.kb-warning{color:#52677a;background:#f4f7fa;border-left:4px solid #087ca7;padding:13px 15px;border-radius:8px;line-height:1.45;margin-top:20px}
.kb-drawer{z-index:1301}.kb-drawer.open{transform:translateX(0)}#kbDrawerBackdrop{z-index:1300}#kbDrawerBackdrop[hidden]{display:none!important}
.kb-drawer input:not([type=checkbox]),.kb-drawer textarea{width:100%}.kb-drawer textarea{resize:vertical;min-height:160px;font:inherit;padding:12px;border-radius:9px;border:2px solid #B5A17B}
.kb-drawer form{padding-top:14px}.kb-drawer form>button{margin-top:18px}.kb-mode-tabs{display:flex;gap:7px;flex-wrap:wrap;border-bottom:1px solid #d6e1eb;padding-bottom:8px}.kb-mode{background:#eaf1f7;color:#144463}.kb-mode.active{background:#0b2c4d;color:white}
.kb-drawer [hidden]{display:none!important}.kb-drawer label{margin-top:14px}.kb-drawer input[type=checkbox]{width:auto}
@media(max-width:560px){.kb-drawer{width:100vw}.kb-workspace-selector{display:block}.kb-workspace-selector button{margin-top:12px}}

/* Agent Knowledge Base — selector consistente con Administración */
.kb-agent-picker {border:1px solid #d6e1eb;border-radius:10px;margin:16px 0;padding:14px;background:#f7f9fc;min-width:0;}
.kb-agent-picker legend {font-weight:700;color:#192c40;padding:0 6px;}
.kb-agent-picker .kb-agent-options {display:grid;gap:9px;margin-top:10px;}
.kb-agent-picker .kb-agent-options label {display:flex;align-items:center;gap:10px;margin:0;font-weight:500;cursor:pointer;}
.kb-agent-picker input[type="checkbox"] {width:auto;flex:0 0 auto;accent-color:#087ca7;}
.kb-documents-table .kb-link {margin-left:7px;}
#kbLinkPanel[hidden],#kbNewPanels[hidden],#kbEditPanel[hidden] {display:none!important;}

/* KB: títulos y botones corregidos sin modificar la funcionalidad */
.kb-portal .kb-heading { margin-bottom: 14px; }
.kb-portal .kb-heading p { margin: 0; }
.kb-documents-table .kb-row-actions {
  display: flex; align-items: center; justify-content: flex-start;
  flex-wrap: wrap; column-gap: 12px; row-gap: 10px;
}
.kb-documents-table .kb-row-actions .kb-edit,
.kb-documents-table .kb-row-actions .kb-link {
  appearance: none; display: inline-flex; align-items: center; justify-content: center;
  margin: 0; padding: 8px 13px; min-height: 36px;
  background: #eaf1f7; color: #144463; border: 0; border-radius: 8px;
  font: inherit; font-size: 13px; font-weight: 600; line-height: 1.3;
  cursor: pointer; white-space: nowrap;
}
.kb-documents-table .kb-row-actions button:hover { background: #dceaf5; color: #0b2c4d; }
.kb-documents-table th:last-child, .kb-documents-table td:last-child { min-width: 175px; }

/* KB: editor de texto visual. Solo afecta al drawer de edición KB. */
.kb-rich-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:9px;border:1px solid #cbd8e3;border-radius:9px 9px 0 0;background:#f4f7fa;margin-top:8px}
.kb-rich-toolbar button{display:inline-flex;align-items:center;justify-content:center;background:#eaf1f7;color:#144463;border:1px solid #cbd8e3;border-radius:6px;padding:7px 11px;font-size:13px;font-weight:600;cursor:pointer;min-height:34px}
.kb-rich-toolbar button:hover,.kb-rich-toolbar button:focus-visible{background:#dceaf5;color:#0b2c4d}
.kb-rich-editor{background:#fff;border:2px solid #B5A17B;border-top:0;border-radius:0 0 9px 9px;padding:15px;min-height:240px;max-height:48vh;overflow-y:auto;font:inherit;color:#192c40;line-height:1.55;overflow-wrap:anywhere;white-space:normal;outline-offset:2px}
.kb-rich-editor:focus{outline:2px solid #087ca7}
.kb-rich-editor:empty::before{content:attr(data-placeholder);color:#8796a7}
.kb-rich-editor h1,.kb-rich-editor h2,.kb-rich-editor h3{margin:14px 0 8px;line-height:1.25}
.kb-rich-editor p{margin:8px 0}.kb-rich-editor ul,.kb-rich-editor ol{margin:8px 0;padding-left:25px}.kb-rich-editor li{margin:4px 0}
.kb-rich-editor table{border-collapse:collapse;width:100%}.kb-rich-editor td,.kb-rich-editor th{border:1px solid #d6e1eb;padding:7px}
#kbEditContent[hidden]{display:none!important}

/* KB: edicion y vinculacion reunidas en un solo drawer */
.kb-edit-links{border-top:1px solid #d6e1eb;margin-top:26px;padding-top:20px;}
.kb-edit-links h3{margin:0 0 10px;color:#192c40;font-size:17px;}
.kb-edit-links .kb-agent-picker{margin:14px 0 18px;}
.kb-edit-links form > button[type="submit"]{margin-top:4px;}

/* Keep transcript actions aligned with the conversation drawer content. */
.conversation-transcript-mailbar {
    padding: 12px 20px;
    flex-shrink: 0;
}

/* Interactive credit gauge: each arc reveals its own quantity. */
.credit-gauge {
    width: min(100%, 440px);
    margin: 18px auto;
    animation: credit-gauge-enter 450ms ease-out;
}
.credit-gauge svg { display: block; width: 100%; height: auto; overflow: visible; }
.credit-gauge-track, .credit-gauge-segment > path { fill: none; stroke-width: 26; }
.credit-gauge-track { stroke: #edf0f7; }
.credit-gauge-segment { outline: none; }
.credit-gauge-segment > path {
    cursor: help;
    transition: stroke-width 180ms ease, filter 180ms ease;
}
.credit-gauge-available > path { stroke: #89a8ee; }
.credit-gauge-used > path { stroke: #14b8a6; }
.credit-gauge-used.is-medium > path { stroke: #f59e0b; }
.credit-gauge-used.is-high > path { stroke: #f36b66; }
.credit-gauge-segment:hover > path, .credit-gauge-segment:focus > path {
    stroke-width: 32;
    filter: drop-shadow(0 3px 4px #163a6633);
}
.credit-gauge-tooltip { opacity: 0; pointer-events: none; transition: opacity 150ms ease; }
.credit-gauge-segment:hover .credit-gauge-tooltip,
.credit-gauge-segment:focus .credit-gauge-tooltip { opacity: 1; }
.credit-gauge-tooltip rect { fill: #152b49; }
.credit-gauge-tooltip text { fill: #fff; font-size: 19px; font-weight: 700; }
.credit-gauge-needle { stroke: #253555; stroke-width: 4; stroke-linecap: round; pointer-events: none; }
.credit-gauge-pivot { fill: #7c3aed; pointer-events: none; }
.credit-gauge-percent { fill: #253555; font-size: 26px; font-weight: 700; pointer-events: none; }
.credit-gauge-goal line { stroke: #7c3aed; stroke-width: 5; stroke-linecap: round; }
.credit-gauge-goal text { fill: #6d28d9; font-size: 17px; font-weight: 700; }
@keyframes credit-gauge-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
    .credit-gauge { animation: none; }
    .credit-gauge-segment > path, .credit-gauge-tooltip { transition: none; }
}
.lab-date-filter {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin: 22px 0 26px;
    flex-wrap: wrap;
}

.lab-date-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lab-date-field label {
    font-weight: 600;
    font-size: 14px;
}

.lab-date-field input {
    min-width: 190px;
    padding: 10px 12px;
}

#labConsultButton {
    min-height: 42px;
    padding: 9px 24px;
    cursor: pointer;
}

@media (max-width: 600px) {
    .lab-date-filter {
        align-items: stretch;
    }

    .lab-date-field,
    .lab-date-field input {
        width: 100%;
    }
}

/* "Limpiar" shown as a real button next to "Filtrar" (Resumen date filter) */
.conversation-filters .filter-submit { align-items: center; }
.conversation-filters .filter-submit a.btn { white-space: nowrap; text-decoration: none; line-height: normal; }

/* Field with a validation error (Administración drawers) */
input.field-error,
select.field-error {
    border: 3px solid #d44949 !important;
    background: #fff6f6;
    outline: none;
}
.institution-drawer-content .alert.error[data-ajax-error] { margin: 0 0 14px; }

/* Conversation drawer is a push panel: the backdrop must not block the list (click another "Abrir" while it is open). */
.drawer-backdrop {
    pointer-events: none;
    background: transparent;
}

/* Transcript e-mail result: shown below the "Enviar a mi correo" button as a clear status box. */
.conversation-transcript-mailmessage { display: none; }
.conversation-transcript-mailmessage.is-success,
.conversation-transcript-mailmessage.is-error,
.conversation-transcript-mailmessage.is-pending {
    display: block;
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 9px;
    border-left: 6px solid;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
}
.conversation-transcript-mailmessage.is-success { background: #e4f6ea; border-color: #1f9d55; color: #14532d; }
.conversation-transcript-mailmessage.is-success::before { content: "✓ "; color: #1f9d55; font-size: 18px; }
.conversation-transcript-mailmessage.is-error { background: #fde8e8; border-color: #d44949; color: #7f1d1d; }
.conversation-transcript-mailmessage.is-error::before { content: "⚠ "; font-size: 18px; }
.conversation-transcript-mailmessage.is-pending { background: #e8f1fa; border-color: #087ca7; color: #0b2c4d; }

/* Evaluaciones tab (conversation drawer) */
.evaluation-item {
    margin: 12px 0;
    padding: 12px 16px;
    border-radius: 9px;
    border-left: 6px solid #9aa9b8;
    background: #f4f7fa;
}
.evaluation-item p { margin: 8px 0 0; }
.evaluation-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.evaluation-badge {
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    background: #dfe6ee;
    color: #3a4a5c;
}
.evaluation-score { margin-left: auto; font-weight: 700; color: #3a4a5c; }
.evaluation-success { border-color: #1f9d55; background: #eaf7ef; }
.evaluation-success .evaluation-badge { background: #1f9d55; color: #fff; }
.evaluation-failure { border-color: #d44949; background: #fdeeee; }
.evaluation-failure .evaluation-badge { background: #d44949; color: #fff; }

/* Search mode selector next to the text search */
.conversation-filters .search-mode-row {
    display: flex;
    gap: 8px;
}

.conversation-filters .search-mode-row select {
    width: auto;
    flex: 0 0 auto;
}

.conversation-filters .search-mode-row input {
    flex: 1 1 auto;
    min-width: 0;
}

/* Transcript events (tools, workflow, knowledge base) */
.msg-event, .msg-event-row {
    color: #5b6b7c;
    font-size: 13px;
}

.msg-event-row {
    margin: 6px 0 6px 6px;
    padding: 4px 10px;
    border-left: 3px dashed #c3ccd6;
}

.msg-event {
    margin-top: 6px;
    overflow-wrap: anywhere;
}

.msg-event-workflow {
    font-style: italic;
}

.msg-event-detail summary {
    cursor: pointer;
    color: #0b7aa5;
}

.msg-event-detail pre {
    margin: 4px 0 8px;
    padding: 8px;
    background: #f3f6f9;
    border-radius: 6px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 12px;
}

/* KB page: sync + add buttons side by side */
.kb-panel-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.kb-panel-buttons .kb-sync-form {
    margin: 0;
}

/* Informacion adicional de la conversacion: combos y notas */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    padding: 11px;
    background: #f4f7fa;
    border: 1px solid #d6e1ea;
    border-radius: 9px;
}

.info-label {
    font-size: 12px;
    color: #667b8f;
}

.info-notes {
    grid-column: 1 / -1;
}

.info-notes-input {
    width: 100%;
    height: calc(3 * 1.45em + 18px);
    min-height: 0;
    padding: 8px 10px;
    font: inherit;
    font-size: 13px;
    line-height: 1.45;
    color: #192c40;
    background: #fff;
    border: 1px solid #cbd8e3;
    border-radius: 7px;
    resize: none;
    overflow-y: auto;
}

.info-status {
    min-height: 1.4em;
    margin: 8px 0 0;
}

.info-status-error {
    color: #a12b2b;
    font-weight: 600;
}

.combo {
    position: relative;
}

.combo-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #192c40;
    text-align: left;
    background: #fff;
    border: 1px solid #cbd8e3;
    border-radius: 7px;
    cursor: pointer;
}

.combo-toggle:hover {
    border-color: #8fb0c9;
}

.combo-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.combo-placeholder {
    font-weight: 400;
    color: #7a8d9f;
}

.combo-caret {
    flex: 0 0 auto;
    color: #667b8f;
}

.combo-panel {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 200px;
    padding: 6px;
    background: #fff;
    border: 1px solid #cbd8e3;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(11, 44, 77, 0.18);
}

.combo-panel[hidden] {
    display: none;
}

.combo-search {
    width: 100%;
    margin: 0 0 6px;
    padding: 6px 8px;
    font: inherit;
    font-size: 13px;
    border: 1px solid #cbd8e3;
    border-radius: 6px;
}

.combo-list {
    max-height: 200px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.combo-option {
    padding: 7px 8px;
    font-size: 13px;
    color: #192c40;
    border-radius: 6px;
    cursor: pointer;
}

.combo-option-active {
    background: #e4eef6;
}

.combo-option-selected {
    font-weight: 700;
}

.combo-option-create {
    color: #0b4d8a;
    font-weight: 600;
}

@media (max-width: 560px) {
    .info-grid {
        grid-template-columns: 1fr;
    }

    .info-notes {
        grid-column: auto;
    }
}

/* Etiquetas de la conversacion */
.info-tags {
    grid-column: 1 / -1;
}

.tags-count {
    margin-left: 4px;
    color: #7a8d9f;
}

.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-chips:empty {
    display: none;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 4px 6px 4px 10px;
    font-size: 13px;
    line-height: 1.2;
    color: #1f3347;
    border: 1px solid rgba(11, 44, 77, 0.12);
    border-radius: 6px;
}

.tag-chip-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-chip-remove {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    padding: 0;
    font-size: 15px;
    line-height: 16px;
    color: #52677a;
    text-align: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.tag-chip-remove:hover {
    color: #fff;
    background: #52677a;
}

.tag-input {
    width: 100%;
    padding: 7px 10px;
    font: inherit;
    font-size: 13px;
    background: #fff;
    border: 1px solid #cbd8e3;
    border-radius: 7px;
}

.tag-input:disabled {
    color: #7a8d9f;
    background: #eef2f6;
}

.tag-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 8px;
    border: 1px solid rgba(11, 44, 77, 0.2);
    border-radius: 50%;
}

.combo-option-note {
    color: #7a8d9f;
    cursor: default;
}

/* Origin of the credits of a conversation: plan, top-up (recarga) or both */
.balance-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    background: #dfe6ee;
    color: #3a4a5c;
}
.balance-plan { background: #e8f5ed; color: #217044; }
.balance-mixed { background: #fff3d6; color: #8a5a00; }
.balance-topup { background: #fdeeee; color: #b03030; }
.balance-column { white-space: nowrap; }

/* Top bar: user name links to the profile, with the profile photo when there is one */
a.portal-user{display:inline-flex;align-items:center;gap:8px;color:inherit;text-decoration:none}
a.portal-user:hover{text-decoration:underline}
.portal-avatar{width:30px;height:30px;border-radius:50%;object-fit:cover;border:1px solid rgba(255,255,255,.45)}
@media (max-width:520px){a.portal-user{display:none}}

/* Administración > Usuario: avatar in the list and detail drawer */
.user-cell{display:inline-flex;align-items:center;gap:8px}
.user-avatar-sm{width:28px;height:28px;border-radius:50%;object-fit:cover;border:1px solid #cbd8e3;flex:none}
.user-avatar-ph{display:inline-flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;color:#52677a;background:#eef2f6}
.user-detail-head{display:flex;gap:14px;align-items:center;margin:14px 0}
.admin-extra-drawer .profile-avatar-lg{width:72px;height:72px;border-radius:50%;object-fit:cover;border:1px solid #cbd8e3;background:#eef2f6;flex:none}
.admin-extra-drawer .profile-avatar-ph{display:flex;align-items:center;justify-content:center;font-size:24px;font-weight:700;color:#52677a}
.admin-extra-drawer .profile-dl{display:grid;grid-template-columns:max-content 1fr;gap:6px 16px;margin:0 0 14px}
.admin-extra-drawer .profile-dl dt{font-weight:600}
.admin-extra-drawer .profile-dl dd{margin:0}
.admin-extra-drawer [hidden]{display:none!important}

/* Administración > Usuario: pages, history, reason dialog */
.user-pages-grid{display:flex;flex-wrap:wrap;gap:6px 18px;margin:6px 0}
.admin-extra-drawer .check{display:flex;gap:8px;align-items:center;font-weight:400;margin-top:6px}
.admin-extra-drawer .check input{width:auto}
.user-actions-row{display:flex;gap:18px;flex-wrap:wrap;align-items:flex-start;margin:6px 0 10px}
.user-actions-row .admin-extra-form{margin:0}
button.danger{color:#b42318;border-color:#b42318}
.user-history-item{border-top:1px solid #dde6ee;padding:8px 0}
.admin-reason-dialog{border:1px solid #cbd8e3;border-radius:10px;padding:18px 20px;max-width:440px;width:90vw}
.admin-reason-dialog::backdrop{background:rgba(0,0,0,.45)}
.admin-reason-dialog textarea{width:100%;box-sizing:border-box}

/* All drawers behave like the conversation drawer: the page makes room on the right instead of the header covering the drawer. */
body.institution-drawer-open { overflow-x: hidden; overflow-y: auto; }
body.institution-drawer-open header,
body.institution-drawer-open main,
body.institution-drawer-open footer {
    width: calc(100% - min(620px, 50vw));
    margin-left: 0;
    margin-right: auto;
    max-width: none;
}
.institution-drawer { width: min(620px, 50vw); }
.institution-drawer-backdrop { z-index: 1000; background: #0b2c4d20; }
@media (min-width: 921px) {
    body.sgs-create-drawer-open header,
    body.sgs-create-drawer-open main,
    body.sgs-create-drawer-open footer {
        width: calc(100% - min(540px, 100vw));
        margin-left: 0;
        margin-right: auto;
        max-width: none;
    }
}
@media (max-width: 920px) {
    body.institution-drawer-open header,
    body.institution-drawer-open main,
    body.institution-drawer-open footer { width: 100%; max-width: 100%; }
    .institution-drawer { width: min(620px, 92vw); }
}
@media (min-width: 561px) and (max-width: 920px) {
    .institution-drawer, .sgs-drawer { top: var(--portal-header-height); height: calc(100dvh - var(--portal-header-height)); }
}
@media (min-width: 561px) and (max-width: 850px) {
    .conversation-drawer { top: var(--portal-header-height); height: calc(100dvh - var(--portal-header-height)); }
}
@media (max-width: 560px) {
    body.institution-drawer-open header,
    body.institution-drawer-open main,
    body.institution-drawer-open footer { display: none; }
    .institution-drawer { width: 100vw; }
}

/* Desactivar usuario: bold red text + thick red outline; on hover white bold text on red (border unchanged) */
button.danger[data-toggle-label]{background:#fff;color:#b42318;font-weight:700;border:3px solid #b42318;border-radius:10px}
button.danger[data-toggle-label]:hover,button.danger[data-toggle-label]:focus-visible{background:#b42318;color:#fff;font-weight:700;border-color:#b42318}

/* Activar usuario: same look as Desactivar usuario but green */
button.activate[data-toggle-label]{background:#fff;color:#067647;font-weight:700;border:3px solid #067647;border-radius:10px}
button.activate[data-toggle-label]:hover,button.activate[data-toggle-label]:focus-visible{background:#067647;color:#fff;font-weight:700;border-color:#067647}

/* School profile page */
.school-form .card{margin-top:18px}
.school-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px 22px;align-items:start}
.school-image-preview{margin:6px 0;padding:8px;border:1px solid #dde6ee;border-radius:8px;background:#fff;display:inline-block}
.school-image-preview img{display:block;max-height:90px;max-width:240px}
.school-image input[type=file]{margin-top:6px}

.admin-tab-panel a.btn.subtle{text-decoration:none}

/* School list logo + profile header */
.school-logo-sm{width:28px;height:28px;border-radius:6px;object-fit:contain;background:#fff;border:1px solid #cbd8e3;flex:none}
.school-logo-ph{display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;color:#52677a;background:#eef2f6}
.school-head{display:flex;align-items:baseline;gap:14px;flex-wrap:wrap}
.school-head h2{margin:0}

/* School profile: WhatsApp numbers */
.wa-row{display:grid;grid-template-columns:minmax(150px,1fr) minmax(150px,1fr) minmax(200px,1.4fr) 250px;gap:10px;align-items:center;margin:0 0 10px}
.wa-head{font-weight:700;font-size:13px;color:#52677a;margin-bottom:4px}
.wa-actions{display:flex;gap:8px;white-space:nowrap}
@media (max-width:760px){.wa-row{grid-template-columns:1fr}.wa-head{display:none}}

/* WhatsApp numbers: Eliminar button = same look as "Desactivar usuario" */
.wa-actions button.danger{background:#fff;color:#b42318;font-weight:700;border:3px solid #b42318;border-radius:10px}
.wa-actions button.danger:hover,.wa-actions button.danger:focus-visible{background:#b42318;color:#fff;font-weight:700;border-color:#b42318}

/* School profile: outgoing mail account */

/* Copy pill (dark chip with copy icon) */
.copy-pill-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.copy-pill{display:inline-flex;align-items:center;gap:10px;background:#2b2f36;color:#e8ecf0;border-radius:10px;padding:6px 8px 6px 14px;font-size:14px;line-height:1}
.copy-pill-text{letter-spacing:1px}
.copy-pill .copy-pill-btn{background:transparent;border:0;color:#e8ecf0;padding:4px;border-radius:6px;cursor:pointer;display:inline-flex;align-items:center;min-height:0}
.copy-pill .copy-pill-btn:hover,.copy-pill .copy-pill-btn:focus-visible{background:rgba(255,255,255,.16)}

/* Modal dialog (same look as the inactivity warning; below it so that warning always shows on top) */
.modal-overlay{position:fixed;inset:0;background:rgba(11,44,77,.55);display:flex;align-items:center;justify-content:center;z-index:99990;padding:16px}
.modal-overlay[hidden]{display:none}
.modal-box{background:#fff;border-radius:14px;max-width:420px;width:100%;padding:24px;box-shadow:0 10px 40px rgba(0,0,0,.3);color:#102033}
.modal-box h2{margin:0 0 14px;font-size:20px}
.modal-box input{width:100%;box-sizing:border-box}
.modal-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}

/* School profile: staff rows */
.staff-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;align-items:center;padding:12px 0;border-bottom:1px solid #d9cfb8;margin:0}
.staff-row .check{margin:0}
.staff-actions{display:flex;gap:8px;white-space:nowrap}
.staff-new{border-bottom:0}
.staff-actions button.danger{background:#fff;color:#b42318;font-weight:700;border:3px solid #b42318;border-radius:10px}
.staff-actions button.danger:hover,.staff-actions button.danger:focus-visible{background:#b42318;color:#fff;font-weight:700;border-color:#b42318}

.staff-row{align-items:end}
.staff-row .check{padding-bottom:14px}
.staff-actions{padding-bottom:2px}

.staff-org-form select{min-width:260px}
.staff-filter .school-grid{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}

/* Personal: filters like Conversaciones */
.staff-filters{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr)) auto;gap:12px;align-items:end;width:100%}
.staff-filters>div{min-width:0}
.staff-filters label{white-space:nowrap}
.staff-filters input,.staff-filters select{min-width:0;width:100%}
.staff-filters .filter-submit{display:flex;gap:8px;align-self:end}
.staff-filters .filter-submit .btn,.staff-filters .filter-submit button{white-space:nowrap}
.institution-drawer-content .staff-actions{display:flex;gap:10px}
.institution-drawer-content .staff-actions button[hidden]{display:none}


/* "Eliminar" buttons: same look as Desactivar usuario (bold red text, thick red outline; hover = white text on red) */
button.btn-danger,.card button.btn-danger{background:#fff;color:#b42318;font-weight:700;border:3px solid #b42318;border-radius:10px}
button.btn-danger:hover,button.btn-danger:focus-visible,.card button.btn-danger:hover{background:#b42318;color:#fff;font-weight:700;border-color:#b42318}

/* Soporte: "Limpiar" shown as a standard blue button next to "Filtrar" */
.sgs form.sgs-date-filters a.sgs-clear-filter,.sgs a.sgs-clear-filter{display:inline-block;background:#087ca7;color:#fff;border:0;border-radius:9px;padding:11px 17px;font:inherit;font-weight:650;line-height:normal;text-decoration:none;white-space:nowrap;cursor:pointer}
.sgs form.sgs-date-filters a.sgs-clear-filter:hover,.sgs a.sgs-clear-filter:hover,.sgs a.sgs-clear-filter:focus-visible{background:#066385;color:#fff;text-decoration:none}


/* "Abrir" in list rows: same look as "Salir" in the header (light button, dark text; hover = white text on blue) */
.card .scroll table button.edit-institution-button,
.card .scroll table button.admin-extra-open-button,
.admin-tab-panel .card .scroll table button.admin-extra-open-button,
.card .scroll table button[data-admin-drawer-open],
a.open-btn,
a.conversation-open,
a.staff-open,
.kb-documents-table .kb-edit,
.kb-documents-table .kb-row-actions .kb-edit,
.sgs a.sgs-ticket-open,
a[data-log-open] {
    -webkit-appearance: none !important;
    appearance: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 17px !important;
    border: 0 !important;
    border-radius: 9px !important;
    background: #eaf1f7 !important;
    color: #144463 !important;
    font-family: Inter, system-ui, Segoe UI, Arial, sans-serif !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 20px !important;
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    text-align: center !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    box-shadow: none !important;
    cursor: pointer !important;
}
.card .scroll table button.edit-institution-button:hover,
.card .scroll table button.admin-extra-open-button:hover,
.admin-tab-panel .card .scroll table button.admin-extra-open-button:hover,
.card .scroll table button[data-admin-drawer-open]:hover,
a.open-btn:hover,
a.conversation-open:hover,
a.staff-open:hover,
.kb-documents-table .kb-edit:hover,
.kb-documents-table .kb-row-actions .kb-edit:hover,
.sgs a.sgs-ticket-open:hover,
a[data-log-open]:hover,
.card .scroll table button.edit-institution-button:focus-visible,
.card .scroll table button.admin-extra-open-button:focus-visible,
a.open-btn:focus-visible,
a.conversation-open:focus-visible,
a.staff-open:focus-visible,
.kb-documents-table .kb-edit:focus-visible,
.kb-documents-table .kb-row-actions .kb-edit:focus-visible,
.sgs a.sgs-ticket-open:focus-visible,
a[data-log-open]:focus-visible {
    background: #066385 !important;
    color: #fff !important;
    text-decoration: none !important;
}
a.conversation-open.conversation-open-selected,a.conversation-open.conversation-open-selected:hover{background:#0b2c4d !important;color:#fff !important;box-shadow:0 0 0 2px #b9d4e8 !important}

/* Soporte: selected ticket keeps its dark look */
.sgs a.sgs-ticket-open.selected,.sgs a.sgs-ticket-open.selected:hover{background:#0b2c4d !important;color:#fff !important}

/* Live validation message (standard): small red text under the field; same red as the field border. */
.field-msg {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 5px 0 0;
    color: #b42318;
    font-size: 13px;
    line-height: 1.35;
    font-weight: 600;
}
.field-msg::before {
    content: "!";
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #d44949;
    color: #fff;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
    font-weight: 700;
    margin-top: 1px;
}
input[type="checkbox"].field-error { outline: 2px solid #d44949 !important; outline-offset: 2px; }

/* Error alert shown inside any drawer when a button action fails. */
.sgs-drawer-content .alert.error[data-ajax-error],
.kb-drawer .alert.error[data-ajax-error] { margin: 0 0 14px; }

/* Registros list: row cells centred vertically so the "Ver" button lines up with the text. */
tr[id^="logrow-"] td { vertical-align: middle; }

/* Icons of the list rows (tags 🏷️, note 📝, photo 📷): always on one line. */
.log-ico{display:inline-block;margin-right:8px;font-size:1.15em;cursor:default}
.log-tags-cell,.info-icons-cell{white-space:nowrap}
.log-tags-cell .log-ico:last-child,.info-icons-cell .log-ico:last-child{margin-right:0}
