/* /features/documents/ only: the body of the hero's live instrument (a job's folders beside a
   Details-view file list; js/pages/documents.js). The instrument's shell (stage, board header,
   activity footer) is .site-instrument in css/public-site.css. */

.doc-board {
    /* The shell sets tabular figures for money; here they space out drawing numbers ("A - 101"). */
    font-variant-numeric: normal;
    /* File-type tags, and the reason-for-issue colours on controlled documents. */
    --doc-pdf: #B42318;
    --doc-dwg: #4338CA;
    --doc-jpg: #15803D;
    --doc-xlsx: #0E7490;
    --doc-docx: #2563EB;
}

.doc-board__body { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 14px; height: 352px; }

/* ---------- Folder tree ---------- */
.doc-tree { padding: 10px 8px; border: 1px solid var(--site-line); border-radius: 10px; background: var(--site-paper); overflow: hidden; }
.doc-tree__label { padding: 2px 8px 10px; font-family: var(--site-font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--site-subtle); }
.doc-folder {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    padding: 0 8px;
    border-radius: 7px;
    font-size: 13px;
    color: var(--site-text-2);
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}
.doc-folder:hover { background: #fff; }
.doc-folder.is-open { background: #fff; color: var(--site-text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--site-line); }
.doc-folder__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-folder__count { font-family: var(--site-font-mono); font-size: 11px; font-weight: 400; color: var(--site-subtle); }
/* A folder drawn in CSS: a body with a tab on its top-left. */
.doc-folder__icon { position: relative; flex: none; width: 16px; height: 12px; margin-top: 2px; border-radius: 2px; background: #C9C2DA; }
.doc-folder__icon::before { content: ''; position: absolute; left: 0; top: -3px; width: 7px; height: 4px; border-radius: 2px 2px 0 0; background: inherit; }
.doc-folder.is-open .doc-folder__icon { background: var(--site-accent); }

/* ---------- File pane ---------- */
.doc-pane { display: flex; flex-direction: column; min-height: 0; overflow: hidden; border: 1px solid var(--site-line); border-radius: 10px; background: #fff; }
.doc-pane__head {
    flex: none;
    height: 46px;
    padding: 0 10px 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--site-line);
}
.doc-crumbs { min-width: 0; display: flex; align-items: baseline; gap: 8px; font-size: 13px; white-space: nowrap; overflow: hidden; }
.doc-crumbs__job { color: var(--site-subtle); }
.doc-crumbs__sep { color: var(--site-line); }
.doc-crumbs__here { font-weight: 600; color: var(--site-text); }
.doc-search {
    flex: none;
    width: 190px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--site-line);
    border-radius: 7px;
    background: #FAFAFC;
    font: 400 12.5px/1 var(--site-font-body);
    color: var(--site-text);
    outline: none;
}
.doc-search::placeholder { color: var(--site-subtle); }
.doc-search:focus, .doc-search.is-filtering { border-color: var(--site-accent); background: #fff; }

.doc-list { flex: 1; min-height: 0; overflow: hidden; }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table th {
    padding: 7px 12px;
    background: var(--site-paper);
    font-family: var(--site-font-mono);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-align: left;
    color: var(--site-subtle);
    white-space: nowrap;
}
.doc-table td { height: 38px; padding: 0 12px; border-top: 1px solid #ECEAF1; font-size: 12.5px; color: var(--site-text-2); white-space: nowrap; }
.doc-table td:first-child { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; color: var(--site-text); }
.doc-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.doc-board .site-instrument__value { font-variant-numeric: tabular-nums; }
.doc-table tbody tr { cursor: pointer; transition: background-color .2s ease; }
.doc-table tbody tr:hover td { background: #F7F5FC; }
.doc-table tbody tr.is-selected td { background: var(--site-panel); }
/* opacity only, and backwards, never both: a transform left on a <tr> stops Chrome hit-testing it. */
.doc-table tbody tr.is-new { animation: doc-row-in .4s ease backwards; }
@keyframes doc-row-in { from { opacity: 0; } }
.doc-table__empty td { font-style: italic; color: var(--site-subtle); cursor: default; }

.doc-type {
    display: inline-block;
    width: 34px;
    margin-right: 10px;
    padding: 2px 0;
    border-radius: 3px;
    background: currentColor;
    font-family: var(--site-font-mono);
    font-size: 9px;
    letter-spacing: .04em;
    text-align: center;
    vertical-align: 1px;
}
.doc-type span { color: #fff; }
.doc-rev { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 4px; background: var(--site-panel); font-family: var(--site-font-mono); font-size: 11px; text-align: center; color: var(--site-text); }
.doc-table tbody tr.is-selected .doc-rev { background: #fff; box-shadow: inset 0 0 0 1px var(--site-line); }
.doc-rev.is-flash { animation: doc-rev-flash 1s ease; }
@keyframes doc-rev-flash { from { background: #FFF1C2; } }
.doc-status { font-size: 12px; color: var(--site-text-2); }
.doc-status::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--doc-dot, var(--site-line)); vertical-align: 1px; }
.doc-status--for_construction { --doc-dot: #16A34A; }
.doc-status--for_approval { --doc-dot: #D97706; }
.doc-status--for_tender { --doc-dot: #2563EB; }
.doc-muted { color: var(--site-subtle); }

/* An upload in progress: the bar runs along the bottom of its row's name cell. */
.doc-upload { position: relative; }
.doc-upload__bar { position: absolute; left: 12px; right: 12px; bottom: 5px; height: 3px; border-radius: 2px; background: var(--site-panel); overflow: hidden; }
.doc-upload__bar span { display: block; width: 0; height: 100%; background: var(--site-accent); transition: width .12s linear; }

.doc-pane__foot {
    flex: none;
    height: 36px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--site-line);
    background: #FAFAFC;
}
.doc-pane__count { flex: none; font-family: var(--site-font-mono); font-size: 11px; color: var(--site-subtle); }
.doc-notice {
    min-width: 0;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--site-ink-2);
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity .3s ease;
}
.doc-notice.is-shown { opacity: 1; }

/* ---------- Tablet: a narrower tree, and the names keep the room Size had ---------- */
@media (max-width: 1000px) {
    .doc-board__body { grid-template-columns: 180px minmax(0, 1fr); }
    .doc-col-size { display: none; }
}

/* ---------- Narrow: folders as a row of tabs above the list ---------- */
@media (max-width: 760px) {
    .doc-board__body { grid-template-columns: minmax(0, 1fr); height: auto; }
    .doc-tree { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; }
    .doc-tree__label, .doc-folder__count { display: none; }
    .doc-folder { height: 30px; gap: 7px; padding: 0 10px; font-size: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--site-line); }
    .doc-folder.is-open { box-shadow: inset 0 0 0 1px var(--site-accent); }
    .doc-pane { height: 360px; }
    .doc-search { width: 120px; }
    .doc-crumbs__job, .doc-crumbs__sep { display: none; }
    .doc-col-status, .doc-col-size { display: none; }
    .doc-pane__count { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .doc-folder, .doc-table tbody tr, .doc-notice, .doc-upload__bar span { transition: none; }
}
