/* Received documents: a card per file with its clean cover, and the viewer that opens them inside the portal. */
.wm-doc-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.wm-doc-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #EAEEF3;
    border-radius: 12px;
    background: #FFFFFF;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.wm-doc-card:hover,
.wm-doc-card:focus-within {
    border-color: #D5DCE5;
    box-shadow: 0 6px 18px rgba(45, 51, 78, .08);
    transform: translateY(-1px);
}

.wm-doc-card__open {
    display: grid;
    grid-template-rows: 168px auto;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.wm-doc-card__open:focus-visible { outline: 2px solid var(--wm-rojo, #CC2D3B); outline-offset: -2px; border-radius: 12px; }

.wm-doc-card__preview {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    padding: 14px 18px 0;
    border-bottom: 1px solid #EAEEF3;
    background: #F3F5F8;
}

/* The cover is the first page as an image: no browser viewer, scroll bars or toolbars. */
.wm-doc-card__cover {
    display: block;
    width: 100%;
    max-width: 150px;
    box-shadow: 0 1px 3px rgba(45, 51, 78, .14);
    background: #FFFFFF;
}

.wm-doc-card__cover[hidden],
.wm-viewer__thumb-preview img[hidden] { display: none; }

.wm-doc-card__cover--image {
    max-width: none;
    height: calc(100% - 14px);
    object-fit: cover;
    object-position: top;
    border-radius: 6px 6px 0 0;
}

.wm-doc-card__loading {
    width: 110px;
    height: 140px;
    border-radius: 2px;
    background: linear-gradient(100deg, #FFFFFF 40%, #F3F5F8 50%, #FFFFFF 60%) 0 0 / 200% 100%;
    animation: wm-doc-shimmer 1.4s linear infinite;
}

.wm-doc-card__loading.is-failed { animation: none; background: #FFFFFF; }

@keyframes wm-doc-shimmer { to { background-position: -200% 0; } }

.wm-doc-card__glyph { align-self: center; width: 44px; height: auto; }

.wm-doc-card__origin,
.wm-doc-card__pages {
    position: absolute;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
}

.wm-doc-card__origin { top: 10px; left: 10px; color: #4A5168; background: #FFFFFF; border: 1px solid #D5DCE5; }
.wm-doc-card__origin--sacmed { color: #1D5C96; background: #E8F1FA; border-color: #BFD7EE; }
.wm-doc-card__pages { right: 10px; bottom: 10px; color: #4A5168; background: rgba(255, 255, 255, .92); }

.wm-doc-card__body {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 12px 14px;
}

.wm-doc-card__text { display: grid; gap: 2px; min-width: 0; }

.wm-doc-card__type {
    flex: none;
    padding: 4px 7px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    color: #FFFFFF;
    background: #7A8197;
}

.wm-doc-card__type--pdf { background: var(--wm-rojo, #CC2D3B); }
.wm-doc-card__type--png,
.wm-doc-card__type--jpg { background: #3B82C4; }

.wm-doc-card__name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: #2D334E;
    overflow-wrap: break-word;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.wm-doc-card__meta { font-size: 11.5px; color: #7A8197; }

.wm-doc-card__download {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid #D5DCE5;
    border-radius: 8px;
    background: #FFFFFF;
    color: #4A5168;
}

.wm-doc-card__download:hover,
.wm-doc-card__download:focus-visible { color: #2D334E; background: #F3F5F8; outline: none; }

/* Viewer */
.wm-viewer {
    width: min(1180px, calc(100vw - 32px));
    max-width: none;
    height: calc(100vh - 32px);
    max-height: none;
    margin: auto;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 14px;
    background: #FFFFFF;
    color: #2D334E;
    box-shadow: 0 24px 60px rgba(20, 24, 40, .28);
}

.wm-viewer[open] { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.wm-viewer::backdrop { background: rgba(20, 24, 40, .55); }

.wm-viewer__bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #EAEEF3;
}

.wm-viewer__title { flex: 1; min-width: 0; }
.wm-viewer__name { margin: 0; overflow: hidden; font-size: 14.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.wm-viewer__meta { margin: 2px 0 0; font-size: 12px; color: #7A8197; }
.wm-viewer__actions { display: flex; flex: none; align-items: center; gap: 8px; }

.wm-viewer__button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid #D5DCE5;
    border-radius: 9px;
    background: #FFFFFF;
    font: inherit;
    font-size: 12.5px;
    font-weight: 500;
    color: #2D334E;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.wm-viewer__button:hover { border-color: #2D334E; }
.wm-viewer__button--icon { padding: 7px; }

.wm-viewer__icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.wm-viewer__body { display: flex; min-height: 0; }

.wm-viewer__side {
    display: flex;
    flex: none;
    flex-direction: column;
    gap: 10px;
    width: 148px;
    padding: 12px;
    overflow-y: auto;
    border-right: 1px solid #EAEEF3;
    background: #F8F9FB;
}

.wm-viewer__thumb {
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid #EAEEF3;
    border-radius: 10px;
    background: #FFFFFF;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.wm-viewer__thumb[aria-current="true"] { border-color: var(--wm-rojo, #CC2D3B); box-shadow: 0 0 0 1px var(--wm-rojo, #CC2D3B); }
.wm-viewer__thumb-preview { display: grid; place-items: start center; height: 96px; overflow: hidden; background: #F3F5F8; border-radius: 6px; }
.wm-viewer__thumb-preview img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.wm-viewer__thumb-name { overflow: hidden; font-size: 11.5px; color: #4A5168; text-overflow: ellipsis; white-space: nowrap; }

.wm-viewer__main { display: grid; flex: 1; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); min-width: 0; }

.wm-viewer__tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 18px;
    padding: 8px 12px;
    border-bottom: 1px solid #EAEEF3;
}

.wm-viewer__tools[hidden] { display: none; }
.wm-viewer__group { display: inline-flex; align-items: center; gap: 4px; }
.wm-viewer__group[hidden] { display: none; }

.wm-viewer__tool {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: #4A5168;
    cursor: pointer;
}

.wm-viewer__tool:hover { background: #F3F5F8; color: #2D334E; }
.wm-viewer__label { min-width: 92px; font-size: 12.5px; text-align: center; color: #4A5168; font-variant-numeric: tabular-nums; }
.wm-viewer__label--zoom { min-width: 48px; }

.wm-viewer__stage {
    display: flex;
    align-items: flex-start;
    padding: 24px;
    overflow: auto;
    scrollbar-gutter: stable both-edges;
    background: #E9EDF2;
}

.wm-viewer__stage:focus-visible { outline: none; }
.wm-viewer__page { flex: none; margin-inline: auto; background: #FFFFFF; box-shadow: 0 2px 10px rgba(20, 24, 40, .16); }
.wm-viewer__image { flex: none; margin-inline: auto; max-width: none; background: #FFFFFF; box-shadow: 0 2px 10px rgba(20, 24, 40, .16); transition: transform .15s ease; }
.wm-viewer__print { position: fixed; width: 0; height: 0; border: 0; visibility: hidden; }

@media (max-width: 720px) {
    .wm-viewer { width: 100vw; height: 100vh; border-radius: 0; }
    .wm-viewer__side { display: none; }
    .wm-viewer__button span { display: none; }
    .wm-viewer__button { padding: 7px; }
    .wm-viewer__bar { gap: 8px; padding: 10px 12px; }
    .wm-viewer__actions { gap: 4px; }
    .wm-viewer__stage { padding: 12px; }
}
