/* Colecroft site styles: docs. Loaded after colecroft.css (tokens, base,
   layout and shared components live there). */

.docs { max-width: 68rem; margin-inline: auto; }
.docs h1, .doc-info h1 { font-size: var(--fs-2xl); }
.docs-upload h2, .doc-info .card h2 { font-size: var(--fs-lg); }
.doc-info .eyebrow { font-size: var(--fs-xs); }

/* ── Filters ───────────────────────────────────────────────── */
.docs-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; }
.docs-controls .input-icon { flex: 1 1 16rem; }
.docs-controls .select { width: auto; flex: none; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0; padding: 0; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 0.4rem;
    min-height: 2.1rem;
    padding: 0.3rem 0.85rem;
    font: 600 var(--fs-xs) / 1.4 var(--font-body);
    color: var(--ink-2);
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 999px;
    cursor: pointer;
}
.filter-chip:hover { border-color: var(--rule-strong); color: var(--ink); }
.filter-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.filter-chip .n { font-weight: 500; opacity: 0.75; font-variant-numeric: tabular-nums; }

.docs-selectrow { display: flex; align-items: center; gap: 0.75rem; font-size: var(--fs-sm); }
.docs-select-all-sm { display: none; }
.docs-message:empty { display: none; }
.docs-message .alert { margin: 0; align-items: center; }
.docs-alert-body { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.docs-failed { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.docs-alert-close { flex: none; width: 1.9rem; min-height: 1.9rem; margin: -0.25rem -0.4rem -0.25rem 0; }
.docs.is-busy .docs-table { opacity: 0.6; }

/* ── The table ─────────────────────────────────────────────── */
.docs-table th .bi { font-size: 0.8em; color: var(--blossom-deep); }
.docs-sort {
    all: unset;
    box-sizing: border-box;
    display: inline-flex; align-items: center; gap: 0.3rem;
    cursor: pointer;
}
.docs-sort:hover { color: var(--ink); text-decoration: underline; }
.docs-sort:focus-visible, .docs-link-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 3px; }
.doc-row { cursor: pointer; }
.doc-title-wrap { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.doc-icon {
    display: inline-grid; place-items: center; flex: none;
    width: 2.1rem; height: 2.5rem;
    border-radius: 4px 9px 4px 4px;
    background: var(--surface-2);
    color: var(--brick);
    border: 1px solid var(--rule);
    font-size: 1.1rem;
}
.doc-title { overflow-wrap: anywhere; }
span.doc-title { color: var(--ink); font-weight: 600; }
.doc-row.is-locked .doc-title { color: var(--ink-2); }
/* Icon-only control: a 24px target at least (WCAG 2.5.8). */
.doc-info-link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.5rem; min-height: 1.5rem;
    flex: none;
    color: var(--ink-3);
}
.doc-info-link:hover { color: var(--ink); }
.docs-locked-note { font-size: var(--fs-xs); color: var(--warn); }
.docs-locked-note a { color: inherit; font-weight: 600; }
.docs-placeholder td { padding: 1.75rem 1rem; text-align: center; color: var(--ink-2); cursor: default; }
.docs-col-date, .docs-col-access, .docs-col-status, .docs-col-size { white-space: nowrap; }
.docs-col-size { color: var(--ink-2); }
/* A tag's label (up to 60 characters) wraps rather than widen the table. */
.docs-col-tag { min-width: 8rem; overflow-wrap: anywhere; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }
.docs-signed-out { display: flex; gap: 0.6rem; align-items: flex-start; }
.docs-signed-out .bi { margin-top: 0.15rem; }

/* Phones and tablets: each document is a stacked item (a manager's
   columns leave a tablet's titles a few letters wide). The row is flex, with
   every line after the first starting under the title, and the checkbox
   drawn into the indent. */
@media (max-width: 991.98px) {
    .docs-select-all-sm { display: inline-flex; }
    .docs-table thead { display: none; }
    .docs-table, .docs-table tbody { display: block; }
    .docs-table tr.doc-row {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        padding: 0.85rem 1rem 0.85rem 3.1rem;
        border-bottom: 1px solid var(--rule);
    }
    .docs-table tbody tr.doc-row:last-child { border-bottom: 0; }
    .docs-table tr.doc-row > td { display: block; padding: 0; border: 0; background: none; }
    .docs-table tr.doc-row:hover > td { background: none; }
    .docs-table tr.doc-row.is-selected { background: color-mix(in srgb, var(--sign-soft) 70%, transparent); }
    .docs-table .docs-col-select { flex: 0 0 2rem; width: auto; margin-left: -2.1rem; padding-top: 0.55rem; }
    .docs-table .docs-col-title { flex: 1 1 100%; min-width: 0; }
    /* Tag, date and size or access and status: small print, set apart by
       space alone (a separator would start a line the print wraps onto). */
    .docs-table tr.doc-row > td:nth-child(n+3) {
        flex: 0 0 auto;
        margin: 0.3rem 1rem 0 0;
        font-size: var(--fs-xs);
        color: var(--ink-2);
        white-space: nowrap;
    }
    .docs-table tr.doc-row > td.is-empty { display: none; }
    .docs-table tr.doc-row > td.docs-col-tag { white-space: normal; min-width: 0; flex-shrink: 1; }
    .docs-placeholder, .docs-placeholder td { display: block; }
}

/* ── The selection bar ─────────────────────────────────────── */
.docs-bar .docs-bar-count { font-weight: 700; margin-right: 0.35rem; font-variant-numeric: tabular-nums; }
.docs-bar .btn:disabled { opacity: 0.45; }
.menu { position: relative; }
.menu-list {
    position: absolute; bottom: calc(100% + 0.5rem); left: 0; z-index: 10;
    display: grid;
    min-width: 13rem; padding: 0.35rem;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-2);
}
.menu-list .menu-head { padding: 0.35rem 0.6rem; font-size: var(--fs-xs); color: var(--ink-3); font-weight: 600; }
.menu-list button {
    all: unset; box-sizing: border-box; cursor: pointer;
    display: flex; align-items: center; gap: 0.5rem; width: 100%;
    padding: 0.5rem 0.6rem; border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
}
.menu-list button:hover, .menu-list button:focus-visible { background: var(--surface-2); }
.menu-list button:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

@media (max-width: 560px) {
    .docs-bar { gap: 0.35rem; padding: 0.5rem 0.6rem 0.5rem 0.9rem; border-radius: var(--radius-lg); }
    .docs-bar .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .docs-bar .btn-sm { min-width: 2.4rem; min-height: 2.4rem; padding-inline: 0.55rem; }
    .docs-bar .sep { display: none; }
    /* The lists open across the bar, not from the button (which may sit at its edge). */
    .docs-bar .menu { position: static; }
    .menu-list { left: 0; right: 0; }
}

/* ── Upload ────────────────────────────────────────────────── */
.docs-upload { display: grid; gap: 1.1rem; }
.docs-dropzone {
    display: grid; justify-items: center; gap: 0.35rem;
    padding: 2rem 1.25rem;
    text-align: center;
    border: 2px dashed var(--rule-strong);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface-2) 50%, transparent);
    transition: border-color 0.15s, background 0.15s;
}
.docs-dropzone.is-over { border-color: var(--sign-deep); background: var(--sign-soft); }
.docs-dropzone-icon { font-size: 2rem; color: var(--sign-deep); }
.docs-dropzone p { max-width: 34em; }
.docs-link-btn {
    all: unset; cursor: pointer;
    color: var(--sign-deep); font-weight: 600;
    text-decoration: underline; text-underline-offset: 0.18em;
}
.docs-upload-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.docs-upload-item {
    display: grid; gap: 0.25rem;
    padding: 0.6rem 0.8rem;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
}
.docs-upload-head { display: flex; align-items: baseline; gap: 0.5rem; min-width: 0; }
.docs-upload-name { font-weight: 600; overflow-wrap: anywhere; }
.docs-upload-size { margin-left: auto; color: var(--ink-2); white-space: nowrap; font-size: var(--fs-xs); }
.docs-upload-item progress { width: 100%; height: 0.3rem; accent-color: var(--sign-deep); }
.docs-upload-status { color: var(--ink-2); }
.docs-upload-status a { font-weight: 600; }
.docs-upload-item.is-done .bi { color: var(--ok); }
.docs-upload-item.is-error { border-color: color-mix(in srgb, var(--danger) 45%, var(--rule)); }
.docs-upload-item.is-error .bi, .docs-upload-item.is-error .docs-upload-status { color: var(--danger); }
.docs-upload-item.is-sending .bi { color: var(--sign-deep); }

/* ── A document's page ─────────────────────────────────────── */
.doc-info-title { overflow-wrap: anywhere; }
.doc-info-title .bi { color: var(--ink-3); }
.doc-info-grid { display: grid; gap: 1.5rem; align-items: start; }
.doc-info-grid > * { min-width: 0; }
.doc-details { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.25rem; align-items: baseline; margin: 0; }
.doc-details dt { font-weight: 600; font-size: var(--fs-sm); }
.doc-details dd { margin: 0; overflow-wrap: anywhere; }
.docs-fieldset { margin: 0; border: 0; min-width: 0; }
.docs-fieldset:disabled { opacity: 0.6; }
.docs-transfer { display: flex; flex-wrap: wrap; align-items: end; gap: 0.5rem 0.75rem; padding: 0; }
.docs-transfer .field { flex: 0 1 18rem; }
.docs-status-error { color: var(--danger); }
@media (min-width: 992px) {
    .doc-info-grid:has(#doc-edit) { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}
