/* ==========================================================================
   FCML Asset Library — design system
   Type: Chivo (display), Noto Sans (body), Red Hat Display (labels / UI)
   ========================================================================== */

:root {
    --ink: #1b1a18;
    --ink-2: #3d3b37;
    --muted: #7a766e;
    --line: #e4dfd6;
    --line-strong: #cfc8bb;
    --stone: #f5f2ec;
    --stone-2: #ece7de;
    --paper: #ffffff;
    --brass: #a07c4a;
    --brass-dark: #7f6138;
    --brass-soft: #f1e8da;
    --header: #3b2a1e;
    --danger: #a3422f;
    --success: #4e6b4a;

    --font-display: "Chivo", "Helvetica Neue", Arial, sans-serif;
    --font-body: "Noto Sans", "Helvetica Neue", Arial, sans-serif;
    --font-ui: "Red Hat Display", "Helvetica Neue", Arial, sans-serif;

    --radius: 2px;
    --shadow-sm: 0 1px 2px rgba(27, 26, 24, .06);
    --shadow: 0 12px 32px -12px rgba(27, 26, 24, .18);
    --ease: cubic-bezier(.2, .7, .2, 1);

    --bs-body-font-family: var(--font-body);
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--stone);
    --bs-border-color: var(--line);
    --bs-link-color: var(--ink);
    --bs-link-hover-color: var(--brass-dark);
    --bs-link-color-rgb: 27, 26, 24;
    --bs-link-hover-color-rgb: 127, 97, 56;
}

html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-body); color: var(--ink); background: var(--stone); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }

h1, h2, h3, h4, h5, .display { font-family: var(--font-display); font-weight: 300; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: clamp(2rem, 3.6vw, 3.1rem); line-height: 1.08; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.3rem; font-weight: 400; }
h4, h5 { font-weight: 400; }

a { color: var(--ink); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--brass-dark); }
::selection { background: var(--brass-soft); }

.eyebrow {
    font-family: var(--font-ui); font-size: .72rem; font-weight: 600;
    letter-spacing: .18em; text-transform: uppercase; color: var(--brass-dark);
}
.text-muted, .muted { color: var(--muted) !important; }
.meta { font-family: var(--font-ui); font-size: .8rem; color: var(--muted); letter-spacing: .02em; }
.rule { height: 1px; background: var(--line); border: 0; opacity: 1; margin: 2rem 0; }

/* ---------- Top bar ---------- */
/* Dark brown bar so the white logo reads. */
.topbar {
    position: sticky; top: 0; z-index: 1030;
    background: var(--header);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.topbar .inner { display: flex; align-items: center; gap: 2.5rem; height: 68px; }
.brand { display: flex; align-items: center; gap: .9rem; color: #fff; }
.brand:hover { color: #fff; }
.brand-logo { height: 36px; width: auto; display: block; }
.auth-visual .brand-logo { height: 44px; }
.brand-mark { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: .14em; }
.brand-sub { font-family: var(--font-ui); font-size: .7rem; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; color: rgba(255, 255, 255, .65); padding-left: .9rem; border-left: 1px solid rgba(255, 255, 255, .25); }
.topnav { display: flex; gap: 2rem; margin: 0; padding: 0; list-style: none; }
.topnav a {
    font-family: var(--font-ui); font-size: .78rem; font-weight: 600; letter-spacing: .14em;
    text-transform: uppercase; color: rgba(255, 255, 255, .7); padding: 24px 0; position: relative;
}
.topnav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 18px; height: 1px; background: var(--brass); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease); }
.topnav a:hover, .topnav a.active { color: #fff; }
.topnav a:hover::after, .topnav a.active::after { transform: scaleX(1); }
.user-chip { display: flex; align-items: center; gap: .6rem; font-family: var(--font-ui); font-size: .85rem; color: rgba(255, 255, 255, .85); background: none; border: 0; padding: 0; }
.topbar .avatar { background: var(--brass); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-grid; place-items: center; font-family: var(--font-ui); font-weight: 600; font-size: .78rem; letter-spacing: .05em; }
.dropdown-menu { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); font-family: var(--font-ui); font-size: .88rem; padding: .4rem; }
.dropdown-item { border-radius: var(--radius); padding: .5rem .8rem; }
.dropdown-item:active { background: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
    font-family: var(--font-ui); font-weight: 600; font-size: .76rem; letter-spacing: .14em; text-transform: uppercase;
    border-radius: var(--radius); padding: .78rem 1.5rem; transition: all .25s var(--ease);
}
.btn-sm { padding: .5rem .95rem; font-size: .7rem; }
.btn-dark, .btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover, .btn-primary:hover { background: var(--brass-dark); border-color: var(--brass-dark); color: #fff; }
.btn-outline-dark { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn-outline-dark:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-brass { background: var(--brass); border-color: var(--brass); color: #fff; }
.btn-brass:hover { background: var(--brass-dark); border-color: var(--brass-dark); color: #fff; }
.btn-link-ui { font-family: var(--font-ui); font-size: .76rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); border: 0; background: none; padding: 0; border-bottom: 1px solid var(--ink); }
.btn-link-ui:hover { color: var(--brass-dark); border-color: var(--brass-dark); }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--ink-2); }
.btn-icon:hover { border-color: var(--ink); color: var(--ink); }
.btn-icon.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- Forms ---------- */
.form-label { font-family: var(--font-ui); font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin-bottom: .45rem; }
.form-control, .form-select {
    border-radius: var(--radius); border: 1px solid var(--line-strong); background-color: var(--paper);
    padding: .72rem .9rem; font-size: .95rem; color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(160, 124, 74, .15); }
.form-control::placeholder { color: #aaa49a; }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(160, 124, 74, .2); border-color: var(--ink); }
.form-text { color: var(--muted); font-size: .82rem; }
.field-validation-error, .text-danger { color: var(--danger) !important; font-size: .84rem; }
.validation-summary-valid { display: none; }
.validation-summary-errors ul { list-style: none; padding: .9rem 1.1rem; margin: 0 0 1.5rem; background: #f8ece8; border-left: 2px solid var(--danger); color: var(--danger); font-size: .9rem; }
.input-search { position: relative; }
.input-search .bi { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-search .form-control { padding-left: 2.6rem; }

/* ---------- Surfaces ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-pad { padding: 2rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 1.1rem; }

/* ---------- Library hero ---------- */
.lib-hero { padding: 4.5rem 0 2.5rem; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--paper) 0%, var(--stone) 100%); }
.lib-hero h1 { max-width: 16ch; margin: .8rem 0 1.6rem; }
.lib-search { display: flex; max-width: 720px; border: 1px solid var(--line-strong); background: var(--paper); }
.lib-search .form-control { border: 0; padding: 1rem 1.1rem 1rem 3rem; font-size: 1.02rem; }
.lib-search .form-control:focus { box-shadow: none; }
.lib-search .btn { border-radius: 0; }
.lib-search .input-search { flex: 1; }
.lib-search .input-search .bi { left: 1.2rem; font-size: 1.05rem; }

/* ---------- Filters ---------- */
/* Equal-width grid columns keep every row of filters aligned; labels sit above their box. */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem 1.25rem; align-items: end; padding: 1.4rem 0; border-bottom: 1px solid var(--line); }
.filter-group { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.filter-group .form-select, .filter-group .form-control { width: 100%; padding: .55rem .8rem; font-size: .88rem; font-family: var(--font-ui); }
.filter-group .form-select { padding-right: 2.2rem; }
.filter-group.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: .8rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1.4rem 0 0; }
.chip {
    font-family: var(--font-ui); font-size: .78rem; font-weight: 500; letter-spacing: .04em;
    padding: .45rem 1rem; border: 1px solid var(--line-strong); border-radius: 100px; color: var(--ink-2); background: transparent;
    transition: all .2s var(--ease); white-space: nowrap;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .count { opacity: .55; margin-left: .3rem; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); }
.seg a { font-family: var(--font-ui); font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; padding: .55rem .9rem; color: var(--muted); }
.seg a + a { border-left: 1px solid var(--line-strong); }
.seg a.active { background: var(--ink); color: #fff; }
.seg a:not(.active):hover { color: var(--ink); }

/* ---------- Asset cards ---------- */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2.5rem 1.75rem; }
.asset-card { display: block; color: var(--ink); }
.asset-card .thumb { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--stone-2); }
.asset-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s var(--ease), filter .6s; }
.asset-card:hover .thumb img { transform: scale(1.045); }
.asset-card .thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.28)); opacity: 0; transition: opacity .4s; }
.asset-card:hover .thumb::after { opacity: 1; }
.asset-card .badges { position: absolute; left: .9rem; top: .9rem; display: flex; gap: .4rem; z-index: 2; }
.tag { font-family: var(--font-ui); font-size: .64rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; padding: .32rem .6rem; background: rgba(255,255,255,.94); color: var(--ink); }
.tag.dark { background: rgba(27,26,24,.85); color: #fff; }
.asset-card .play { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; }
.asset-card .play span { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.92); color: var(--ink); font-size: 1.4rem; transition: transform .4s var(--ease); }
.asset-card:hover .play span { transform: scale(1.08); }
.asset-card .body { padding: 1.1rem 0 0; }
.asset-card h3 { font-size: 1.15rem; margin: .35rem 0 .45rem; line-height: 1.3; }
.asset-card:hover h3 { color: var(--brass-dark); }
.asset-card .meta span + span::before { content: "·"; margin: 0 .5rem; color: var(--line-strong); }

.doc-tile { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: .9rem; padding: 1.6rem; background: linear-gradient(135deg, #efeae1 0%, #e2dbcf 100%); }
.doc-tile .ext { font-family: var(--font-display); font-weight: 300; font-size: 3.2rem; letter-spacing: -.02em; color: var(--ink); line-height: 1; }
.doc-tile .bi { font-size: 1.8rem; color: var(--brass-dark); }
.doc-tile.ppt { background: linear-gradient(135deg, #f1e6dc 0%, #e4cfbc 100%); }
.doc-tile.pdf { background: linear-gradient(135deg, #ece8e2 0%, #d9d2c6 100%); }
.doc-tile.video { background: linear-gradient(135deg, #2a2926 0%, #45423c 100%); }
.doc-tile.video .ext, .doc-tile.video .bi { color: #fff; }

.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 3.5rem 0 1.6rem; padding-bottom: .9rem; border-bottom: 1px solid var(--ink); }
.group-head:first-child { margin-top: 2.5rem; }
.group-head h2 { margin: 0; font-size: 1.6rem; }

/* ---------- Asset details ---------- */
.crumbs { font-family: var(--font-ui); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { margin: 0 .6rem; color: var(--line-strong); }
.detail-head { padding: 2.5rem 0 2rem; }
.detail-head h1 { margin: 1rem 0 .8rem; max-width: 22ch; }
.gallery-main { position: relative; aspect-ratio: 16 / 10; background: var(--stone-2); overflow: hidden; cursor: zoom-in; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-main .count { position: absolute; right: 1rem; bottom: 1rem; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; margin-top: .75rem; }
.gallery-grid a { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--stone-2); display: block; cursor: zoom-in; }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease), opacity .3s; }
.gallery-grid a:hover img { transform: scale(1.06); }
.video-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video-frame iframe, .video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.pdf-frame { width: 100%; height: 78vh; border: 1px solid var(--line); background: var(--paper); }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; }
.viewer-bar .file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-frame:fullscreen, .pdf-frame:fullscreen { height: 100%; aspect-ratio: auto; border: 0; }
.lightbox .lb-full { top: 1rem; right: 4.5rem; font-size: 1.4rem; }
.lightbox:fullscreen img { max-width: 100vw; max-height: 100vh; box-shadow: none; }
.spec { margin: 0; }
.spec dt { font-family: var(--font-ui); font-size: .68rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: .3rem; }
.spec dd { margin: 0 0 1.4rem; font-size: .98rem; color: var(--ink); }
.spec dd:last-child { margin-bottom: 0; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: flex; align-items: center; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.file-list li:last-child { border-bottom: 0; }
.file-ico { width: 44px; height: 44px; flex: none; display: grid; place-items: center; background: var(--stone); font-family: var(--font-ui); font-weight: 700; font-size: .62rem; letter-spacing: .08em; color: var(--brass-dark); }
.file-name { font-size: .92rem; word-break: break-word; line-height: 1.35; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 3rem 0 1.2rem; }
.section-title h2 { font-size: 1.35rem; margin: 0; }
.sticky-side { position: sticky; top: 92px; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 2000; background: rgba(17, 16, 15, .96); display: none; align-items: center; justify-content: center; }
.lightbox.open { display: flex; animation: fade .25s var(--ease); }
.lightbox img { max-width: 88vw; max-height: 84vh; object-fit: contain; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.lightbox button { position: absolute; background: none; border: 0; color: rgba(255,255,255,.75); font-size: 1.8rem; padding: 1rem; transition: color .2s; }
.lightbox button:hover { color: #fff; }
.lightbox .lb-close { top: 1rem; right: 1.5rem; }
.lightbox .lb-prev { left: 1.5rem; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 1.5rem; top: 50%; transform: translateY(-50%); }
.lightbox .lb-caption { position: absolute; left: 0; right: 0; bottom: 1.5rem; text-align: center; color: rgba(255,255,255,.7); font-family: var(--font-ui); font-size: .8rem; letter-spacing: .08em; }
.lightbox .lb-caption a { color: #fff; border-bottom: 1px solid rgba(255,255,255,.4); margin-left: 1rem; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Empty state / pagination ---------- */
.empty { text-align: center; padding: 6rem 1rem; }
.empty .bi { font-size: 2.4rem; color: var(--line-strong); }
.empty h3 { margin: 1.2rem 0 .5rem; }
.pager { display: flex; justify-content: center; gap: .4rem; margin: 4rem 0 1rem; }
.pager a, .pager span { min-width: 40px; height: 40px; display: grid; place-items: center; font-family: var(--font-ui); font-size: .85rem; border: 1px solid var(--line-strong); color: var(--ink-2); padding: 0 .8rem; }
.pager a:hover { border-color: var(--ink); color: var(--ink); }
.pager .current { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 2rem 0; margin-top: 5rem; font-family: var(--font-ui); font-size: .76rem; letter-spacing: .08em; color: var(--muted); }

/* ---------- Admin shell ---------- */
.admin-shell { display: grid; grid-template-columns: 248px 1fr; min-height: calc(100vh - 68px); }
.admin-side { background: var(--ink); color: #d9d4ca; padding: 2rem 1.25rem; position: sticky; top: 68px; height: calc(100vh - 68px); overflow-y: auto; }
.admin-side .eyebrow { color: #8f887b; padding: 0 .9rem; margin: 1.6rem 0 .6rem; display: block; }
.admin-side .eyebrow:first-child { margin-top: 0; }
.admin-side a { display: flex; align-items: center; gap: .85rem; padding: .7rem .9rem; color: #d9d4ca; font-family: var(--font-ui); font-size: .9rem; border-radius: var(--radius); transition: background .2s, color .2s; }
.admin-side a .bi { font-size: 1.05rem; opacity: .75; }
.admin-side a:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-side a.active { background: rgba(160,124,74,.22); color: #fff; }
.admin-side a.active .bi { color: #d6b98c; opacity: 1; }
.admin-side .cta { margin: 1.2rem .2rem 0; justify-content: center; background: var(--brass); color: #fff; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; font-size: .72rem; padding: .85rem; }
.admin-side .cta:hover { background: #b38d58; }
.admin-main { padding: 2.5rem 3rem 4rem; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.page-head h1 { font-size: 2.2rem; margin: .45rem 0 0; }

.stat { padding: 1.5rem 1.6rem; background: var(--paper); border: 1px solid var(--line); height: 100%; }
.stat .value { font-family: var(--font-display); font-weight: 300; font-size: 2.4rem; line-height: 1; margin-top: .8rem; }
.stat .bi { color: var(--brass); font-size: 1.15rem; }

.table-clean { width: 100%; margin: 0; font-size: .92rem; }
.table-clean th { font-family: var(--font-ui); font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: .9rem 1.5rem; border-bottom: 1px solid var(--line); background: #fbfaf7; white-space: nowrap; }
.table-clean td { padding: 1rem 1.5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-clean tr:last-child td { border-bottom: 0; }
.table-clean tbody tr { transition: background .15s; }
.table-clean tbody tr:hover { background: #fcfbf8; }
.mini-thumb { width: 56px; height: 42px; object-fit: cover; background: var(--stone-2); display: grid; place-items: center; font-family: var(--font-ui); font-size: .6rem; font-weight: 700; color: var(--brass-dark); flex: none; }
.status { display: inline-flex; align-items: center; gap: .45rem; font-family: var(--font-ui); font-size: .78rem; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.status.off::before { background: var(--line-strong); }
.status.off { color: var(--muted); }
.role-pill { font-family: var(--font-ui); font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; padding: .3rem .65rem; border: 1px solid var(--line-strong); color: var(--ink-2); white-space: nowrap; }
.role-pill.admin { background: var(--ink); border-color: var(--ink); color: #fff; }
.role-pill.supervisor { background: var(--brass-soft); border-color: #e2d2b8; color: var(--brass-dark); }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 1rem; padding: .95rem 1.5rem; border-bottom: 1px solid var(--line); font-size: .9rem; }
.activity li:last-child { border-bottom: 0; }
.activity .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brass); margin-top: .45rem; flex: none; }

/* Upload dropzone */
.dropzone { border: 1.5px dashed var(--line-strong); background: #fcfbf8; padding: 2.6rem 1.5rem; text-align: center; cursor: pointer; transition: all .2s var(--ease); }
.dropzone:hover, .dropzone.drag { border-color: var(--brass); background: var(--brass-soft); }
.dropzone .bi { font-size: 2rem; color: var(--brass); }
.dropzone input[type=file] { display: none; }
.upload-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; margin-top: 1rem; }
.upload-item { position: relative; border: 1px solid var(--line); background: var(--paper); }
.upload-item .preview { aspect-ratio: 4/3; background: var(--stone-2); display: grid; place-items: center; overflow: hidden; font-family: var(--font-display); font-size: 1.4rem; font-weight: 300; color: var(--brass-dark); }
.upload-item .preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-item .info { padding: .55rem .7rem; font-size: .76rem; line-height: 1.3; }
.upload-item .info .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-item .remove { position: absolute; top: .4rem; right: .4rem; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255,255,255,.95); color: var(--ink); display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.upload-item .remove:hover { color: var(--danger); }
.upload-item .fields { display: grid; gap: .4rem; padding: 0 .7rem .7rem; }
.upload-item .fields .form-control { font-size: .78rem; }
.upload-item.removed { opacity: .35; }
.upload-item.removed .remove { color: var(--danger); }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .5rem; }
.check-card { display: flex; align-items: center; gap: .7rem; padding: .75rem .9rem; border: 1px solid var(--line); cursor: pointer; transition: all .15s; font-size: .9rem; margin: 0; }
.check-card:hover { border-color: var(--line-strong); }
.check-card:has(input:checked) { border-color: var(--ink); background: #fbfaf7; }
.check-card input { margin: 0; }
.check-card small { color: var(--muted); display: block; font-size: .76rem; }

/* ---------- Toast ---------- */
.toast-fcml { position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 1100; background: var(--ink); color: #fff; padding: 1rem 1.3rem; font-family: var(--font-ui); font-size: .88rem; display: flex; gap: .8rem; align-items: center; box-shadow: var(--shadow); animation: toastIn .4s var(--ease); max-width: 420px; }
.toast-fcml .bi { color: #d6b98c; }
.toast-fcml.hide { opacity: 0; transform: translateY(10px); transition: all .4s var(--ease); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Auth ---------- */
.auth { display: grid; grid-template-columns: 1.15fr 1fr; min-height: 100vh; }
.auth-visual {
    position: relative;
    background:
        linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px) 0 0 / 88px 88px,
        linear-gradient(0deg, rgba(255,255,255,.045) 1px, transparent 1px) 0 0 / 88px 88px,
        radial-gradient(120% 90% at 85% 10%, #5a4a34 0%, #2a2825 55%, #1b1a18 100%); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-visual::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(20,19,17,.55) 100%); }
.auth-visual > * { position: relative; }
.auth-visual .brand-mark, .auth-visual h2 { color: #fff; }
.auth-visual h2 { font-size: clamp(2rem, 3.2vw, 3rem); font-weight: 300; max-width: 14ch; line-height: 1.1; }
.auth-visual .eyebrow { color: #d6b98c; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 3rem 2rem; background: var(--paper); }
.auth-form .box { width: 100%; max-width: 380px; }
.auth-form h1 { font-size: 2.2rem; margin: .8rem 0 .5rem; }

/* ---------- Utilities / responsive ---------- */
.fade-up { animation: fadeUp .7s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 991.98px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-side { position: static; height: auto; display: flex; gap: .3rem; overflow-x: auto; padding: .8rem 1rem; }
    .admin-side .eyebrow { display: none; }
    .admin-side a { white-space: nowrap; }
    .admin-side .cta { margin: 0; }
    .admin-main { padding: 1.8rem 1.25rem 3rem; }
    .auth { grid-template-columns: 1fr; }
    .auth-visual { min-height: 260px; }
    .topnav { gap: 1.2rem; }
    .brand-sub { display: none; }
    .sticky-side { position: static; }
}
@media (max-width: 575.98px) {
    .topbar .inner { gap: 1rem; }
    .topnav a { font-size: .7rem; letter-spacing: .1em; }
    .lib-hero { padding: 2.8rem 0 2rem; }
    .filter-bar { grid-template-columns: 1fr 1fr; }
    .filter-group.wide { flex-direction: column; align-items: stretch; }
    .seg { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Mini thumbnails reuse the card thumbnail partial */
.mini-thumb { position: relative; overflow: hidden; }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-thumb .doc-tile { padding: .3rem; align-items: center; justify-content: center; }
.mini-thumb .doc-tile .ext { font-size: .72rem; font-family: var(--font-ui); font-weight: 700; letter-spacing: .06em; }
.mini-thumb .doc-tile .bi { display: none; }
.min-w-0 { min-width: 0; }

/* Profile */
.profile-nav a { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; font-family: var(--font-ui); font-size: .9rem; color: var(--ink-2); border-radius: var(--radius); }
.profile-nav a .bi { color: var(--muted); }
.profile-nav a:hover { background: var(--stone); color: var(--ink); }
.profile-nav a.active { background: var(--ink); color: #fff; }
.profile-nav a.active .bi { color: #d6b98c; }
.status-banner { display: flex; align-items: center; gap: .7rem; padding: .9rem 1.1rem; background: #eef2ec; border-left: 2px solid var(--success); color: var(--success); font-size: .92rem; }
.form-control:disabled { background: var(--stone); color: var(--muted); }

.file-text { padding: .9rem 1rem 0; color: var(--ink-2); line-height: 1.65; }
.file-text p { white-space: pre-line; }
