/* CiteUEH design tokens */
:root {
    /* UEH identity (ueh.edu.vn): teal #005f69, orange #f26f33 */
    --brand: #005f69;
    --brand-dark: #00474f;
    --brand-soft: #e5f1f2;
    --accent: #f26f33;
    --accent-dark: #a84e14;
    --accent-soft: #fdeee6;
    --ink: #121719;
    --muted: #46535e;
    --line: #c4d0d7;
    --surface: #ffffff;
    --canvas: #e9eef1;
    --supporting: #167a42;
    --mentioning: #6b7885;
    --contrasting: #c4440f;
    --radius: 14px;

    --bs-body-font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--canvas);
    --bs-border-color: var(--line);
    --bs-link-color-rgb: 0, 95, 105;
    --bs-link-hover-color-rgb: 0, 71, 79;
    --bs-secondary-color: var(--muted);
}
body { background: var(--canvas); font-size: .95rem; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .h1, .h2, .h3, .h4, .h5 { font-weight: 700; letter-spacing: -.01em; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
.text-muted { color: var(--muted) !important; }
.text-brand { color: var(--brand) !important; }
.bg-brand { background: var(--brand) !important; }

/* ---------- top bar ---------- */
.app-nav { background: var(--surface); border-bottom: 1px solid var(--line); }
.app-nav .navbar-brand { font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: .55rem; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 1.05rem;
    background: var(--brand); box-shadow: 0 4px 10px rgba(0, 95, 105, .25); position: relative; font-weight: 800; font-size: .72rem; letter-spacing: .02em; }
.brand-mark::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; }
.brand-name { line-height: 1.05; }
.brand-name small { display: block; font-size: .68rem; font-weight: 600; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; }
.app-nav .nav-link { color: var(--muted); font-weight: 500; border-radius: 10px; padding: .45rem .8rem !important; }
.app-nav .nav-link:hover { color: var(--ink); background: var(--canvas); }
.app-nav .nav-link.active { color: var(--brand); background: var(--brand-soft); }
.user-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: 999px; background: var(--canvas);
    color: var(--ink); font-size: .85rem; }
.btn-ghost { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.btn-ghost:hover { border-color: #cfd8de; background: var(--canvas); }

/* ---------- buttons & forms ---------- */
.btn { border-radius: 10px; font-weight: 500; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover, .btn-brand:focus, .btn-brand:active { background: var(--brand-dark) !important; border-color: var(--brand-dark) !important; color: #fff !important; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover, .btn-accent:focus, .btn-accent:active { background: var(--accent-dark) !important; border-color: var(--accent-dark) !important; color: #fff !important; }
.btn-outline-secondary { border-color: var(--line); color: var(--ink); }
.btn-outline-secondary:hover { background: var(--canvas); border-color: #cfd8de; color: var(--ink); }
.form-control, .form-select { border-radius: 10px; border-color: #9fb0ba; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(0, 99, 110, .12); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.input-group-text { background: var(--canvas); border-color: #9fb0ba; color: var(--muted); }
.form-label { font-weight: 500; }

/* ---------- surfaces ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(16, 32, 48, .10); }
.card.shadow-sm { box-shadow: 0 1px 2px rgba(16, 32, 48, .04) !important; }
.card-title-sm { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; font-size: 1.6rem; }
.page-head h1::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 4px; background: var(--accent); margin-bottom: .55rem; }
.page-head p { margin: .25rem 0 0; color: var(--muted); }
.alert { border-radius: var(--radius); }
.alert-info { background: #eef6fb; border-color: #d6e9f5; color: #1c4e6b; }

/* stat cards */
.stat-card .card-body { display: flex; align-items: center; gap: .85rem; padding: 1rem 1.1rem; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; flex: none;
    background: var(--brand-soft); color: var(--brand); }
.stat-icon.danger { background: #fdecec; color: #c0392b; }
.stat-icon.warning { background: #fff4e0; color: #b7791f; }
.stat-icon.contrast { background: #fdeee6; color: var(--contrasting); }
.stat-label { font-size: .8rem; color: var(--muted); line-height: 1.2; }
.stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.15; }

/* badges: soft pills */
.badge { font-weight: 600; border-radius: 999px; padding: .32em .7em; letter-spacing: .01em; }
.text-bg-success { background: #d3efdd !important; color: #0e5c2e !important; }
.text-bg-danger { background: #fbd5d5 !important; color: #8f1a10 !important; }
.text-bg-warning { background: #ffe9b3 !important; color: #6b4300 !important; }
.text-bg-info { background: #cde6f7 !important; color: #0f4668 !important; }
.text-bg-secondary { background: #dde4e9 !important; color: #2c3740 !important; }
.text-bg-light { background: #eef2f5 !important; color: #2c3740 !important; }
.badge.bg-contrasting { background: #fbdcca !important; color: #8f3208 !important; }

/* Smart Citation colours */
.bg-supporting { background: var(--supporting) !important; }
.bg-mentioning { background: var(--mentioning) !important; }
.bg-contrasting { background: var(--contrasting) !important; color: #fff; }
.text-supporting { color: var(--supporting); }
.text-contrasting { color: var(--contrasting); }
.border-supporting { border-color: var(--supporting) !important; }
.border-contrasting { border-color: var(--contrasting) !important; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; vertical-align: baseline; }
.progress { background: #d3dde3; border-radius: 999px; }

/* ---------- tables ---------- */
.table { --bs-table-bg: transparent; margin: 0; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600;
    background: #e3eaee !important; color: var(--ink); border-bottom: 2px solid var(--line); padding-top: .75rem; padding-bottom: .75rem; white-space: nowrap; }
.table > tbody td { border-color: #d3dde3; padding-top: .8rem; padding-bottom: .8rem; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f7fafb; }
.table-responsive.card, .card > .table-responsive { border-radius: var(--radius); overflow: hidden; }
.ref-table td { vertical-align: top; }
.ref-table .detail-row > td { border-top: 0; background: #f9fbfc !important; }
.ref-table tr.table-danger > * { --bs-table-bg: #fff5f5; }
.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link:hover, .sort-link.active { color: var(--brand); }
.sort-chips { text-transform: none; letter-spacing: 0; }
.sort-chips .sort-link { font-weight: 500; }

/* ---------- upload ---------- */
.dropzone { display: block; text-align: center; padding: 2.25rem 1rem; cursor: pointer; border-radius: var(--radius);
    border: 2px dashed #c3d3d8; background: linear-gradient(180deg, #fbfdfd, #f3f8f9); transition: all .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.drop-icon { width: 56px; height: 56px; border-radius: 16px; display: inline-grid; place-items: center; font-size: 1.6rem;
    color: var(--brand); background: #fff; box-shadow: 0 4px 14px rgba(0, 99, 110, .12); }

/* ---------- statement check ---------- */
.statement-check { border-bottom: 1px dashed #d5dee2; padding-bottom: .9rem; }
.statement-check .stmt { border-left: 3px solid #cfdde2; padding-left: .65rem; }
.statement-check .abstract { max-height: 18rem; overflow-y: auto; line-height: 1.55; background: #fff; border: 1px solid var(--line);
    border-radius: 10px; padding: .6rem .75rem; }
.statement-check mark { background: #fff0b3; padding: 0 .1em; border-radius: 3px; }
.quick-guide summary { cursor: pointer; list-style: none; }
.quick-guide summary::-webkit-details-marker { display: none; }

/* ---------- auth ---------- */
.auth-wrap { min-height: calc(100vh - 160px); display: grid; align-items: center; }
.auth-card { overflow: hidden; }
.auth-hero { background: linear-gradient(155deg, var(--brand) 0%, #00515a 70%, #003f46 100%); color: #fff; padding: 2.5rem; position: relative; overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; width: 170px; height: 170px; border-radius: 50%; right: -85px; bottom: -85px; background: var(--accent); opacity: .85; }
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero h2 { font-size: 1.6rem; }
.auth-hero .feature { display: flex; gap: .75rem; margin-top: 1.1rem; }
.auth-hero .feature i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(242, 111, 51, .9); flex: none; }
.auth-hero .feature small { color: rgba(255, 255, 255, .82); }

/* ---------- admin ---------- */
.admin-tabs .nav-link { color: var(--muted); font-weight: 500; border-radius: 10px; }
.admin-tabs .nav-link.active { background: var(--brand); color: #fff; }
.provider-card { border: 2px solid var(--line); border-radius: var(--radius); padding: 1rem; cursor: pointer; height: 100%;
    transition: border-color .15s, background .15s; display: block; }
.provider-card:hover { border-color: #c3d3d8; }
.btn-check:checked + .provider-card { border-color: var(--brand); background: var(--brand-soft); }
.provider-logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; }

/* ---------- help ---------- */
.help-toc { top: 5rem; }
.help-toc a { display: block; padding: .3rem .6rem; text-decoration: none; color: var(--muted); border-radius: 8px; }
.help-toc a:hover { background: #fff; color: var(--brand); }
.help section { scroll-margin-top: 5rem; margin-bottom: 1.25rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; }
.help h2 { font-size: 1.2rem; margin-top: 0; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }

footer.app-footer { color: var(--muted); }

/* ---------- literature search ---------- */
.search-hero { border-top: 4px solid var(--accent); }
.filter-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .7rem; border-radius: 999px; background: #fff; border: 1px solid var(--line);
    color: var(--ink); text-decoration: none; font-size: .82rem; }
.filter-chip:hover { border-color: var(--accent); color: var(--accent-dark); }
.filter-chip.clear { background: transparent; border-style: dashed; color: var(--muted); }
.facet-row { display: flex; justify-content: space-between; gap: .5rem; padding: .28rem .4rem; margin: 0 -.4rem; border-radius: 8px; color: var(--ink);
    text-decoration: none; font-size: .86rem; }
a.facet-row:hover { background: var(--canvas); }
.facet-row.on { color: var(--brand); font-weight: 600; }
.facet-row .count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .8rem; }
.year-chart { display: flex; align-items: flex-end; gap: 2px; height: 70px; }
.year-chart a { flex: 1; position: relative; height: 100%; min-width: 3px; }
.year-chart a i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 3px 3px 0 0; }
.year-chart a .ghost { background: #d3e3e6; }
.year-chart a .bar { background: #5f9ba2; }
.year-chart a:hover .bar { background: var(--accent); }
.hit { transition: border-color .15s; }
.hit:hover { border-color: var(--brand); }
.hit.retracted { border-left: 4px solid #d64545; }
.hit-no { width: 1.8rem; text-align: right; padding-top: .15rem; flex: none; }
.hit-title { font-size: 1.02rem; font-weight: 600; margin-bottom: .25rem; line-height: 1.35; }
.hit-title a { color: var(--ink); text-decoration: none; }
.hit-title a:hover { color: var(--brand); }
.hit mark, .hit-abstract mark { background: #ffe7d9; color: inherit; padding: 0 .1em; border-radius: 3px; }
.hit-abstract { color: #4a5763; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hit-abstract.open { display: block; }
.pagination .page-link { color: var(--brand); border-color: var(--line); }
.pagination .active > .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }

/* journal ranking badges: best tier = UEH teal, then lighter, orange, grey */
.rank-badge { border: 1px solid transparent; font-weight: 500; }
.rank-badge strong { font-weight: 800; }
.rank-badge.rank-0 { background: #005f69 !important; color: #fff !important; }
.rank-badge.rank-1 { background: #d7ecee !important; color: #00474f !important; border-color: #b3d8dc; }
.rank-badge.rank-2 { background: #fdeee6 !important; color: #a94f1e !important; border-color: #f8d3bf; }
.rank-badge.rank-3 { background: #f1f3f5 !important; color: #5b6772 !important; border-color: #e1e5e9; }

.border-dashed { border-style: dashed !important; border-width: 2px !important; }

/* exclusion list warnings */
.excl-badge { background: #fff1e6 !important; color: #b4470f !important; border: 1px solid #f6b98f; font-weight: 600; }
.pub-badge { color: #fff !important; font-weight: 600; text-shadow: 0 0 1px rgba(0, 0, 0, .35); }
.hit.flagged { border-left: 4px solid var(--accent); background: #fffaf6; }
.excl-note { background: #fff1e6; border: 1px solid #f8cfb2; color: #8d3a0d; border-radius: 8px; padding: .35rem .6rem; }
.year-chart a.on .bar { background: var(--brand-dark); }
.year-chart a.on .ghost { background: #aacdd2; }

/* higher contrast */
body { color: var(--ink); }
.small, small { color: inherit; }
.form-control::placeholder { color: #5d6b76; opacity: 1; }
.hit-title a { color: var(--brand-dark); }
.btn-ghost, .btn-outline-secondary { border-color: #9fb0ba; }
.facet-row .count { color: var(--muted); }

/* folders, history, toast */
.folder-icon { color: var(--accent); }
.folder-card:hover { border-color: var(--brand); }
.folder-pick .form-select { max-width: 12rem; }
.toast-lite { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 2000; background: var(--brand-dark); color: #fff;
    padding: .6rem 1rem; border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); max-width: calc(100vw - 2rem); font-size: .92rem; }
.toast-lite.err { background: #8f1a10; }
.js-fold { white-space: nowrap; }

/* responsive */
@media (max-width: 991.98px) {
    #g-sidebar-box { margin-bottom: 1rem; }
    .navbar .navbar-collapse { padding-bottom: .5rem; }
    .app-nav .nav-link { padding: .6rem .8rem !important; }
}
@media (max-width: 767.98px) {
    main.container-xl { padding-top: 1rem !important; padding-bottom: 1rem !important; }
    .page-head { flex-direction: column; align-items: stretch !important; gap: .75rem; }
    .page-head h1 { font-size: 1.45rem; }
    .admin-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem; -webkit-overflow-scrolling: touch; }
    .admin-tabs .nav-link { white-space: nowrap; }
    .card-body { padding: .9rem; }
    .search-hero .card-body { padding: .9rem !important; }
    .help section { padding: 1rem; }
    .help table, .help .table { display: block; overflow-x: auto; }
    .help-toc { position: static !important; }
    .app-footer { flex-direction: column; text-align: center; }
    .table-responsive > .table { min-width: 36rem; }
}
@media (max-width: 575.98px) {
    .hit-no { display: none; }
    .hit-title { font-size: 1rem; }
    #search-results .card-body > .ms-auto, #search-results .card-body > .ms-auto > * { width: 100%; }
    #search-results .card-body > .ms-auto .form-select.w-auto, #search-results .folder-pick { width: 100% !important; flex: 1 1 100%; }
    .folder-pick .form-select { max-width: none; }
    #search-results .card-body > .ms-auto .dropdown, #search-results .card-body > .ms-auto .dropdown .btn { width: 100%; }
    .pagination { flex-wrap: wrap; justify-content: center; }
    .year-chart { height: 56px; }
    .toast-lite { bottom: .75rem; }
}

@media (min-width: 992px) { .app-nav .nav-link { white-space: nowrap; padding: .45rem .6rem !important; } }
@media (min-width: 768px) and (max-width: 1199.98px) { .brand-name small { display: none; } }

/* writing from a folder */
.article-pick { max-height: 18rem; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: .35rem .65rem; background: #fff; }
.article-pick label { cursor: pointer; border-bottom: 1px solid #e3eaee; }
.article-pick label:last-child { border-bottom: 0; }
.flex-none { flex: none; margin-top: .2rem; }
.engine-card { padding: .6rem .75rem; }
.engine-card.disabled { opacity: .55; cursor: not-allowed; }
.written-text { font-size: 1.02rem; line-height: 1.7; }
.written-text p { margin-bottom: .9rem; }
.ref-list.apa li { padding-left: 2em; text-indent: -2em; }

/* admin: publication lists */
.pub-row { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.pub-row.on { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(0, 95, 105, .15); }
.pub-row.inactive { opacity: .6; }

.pub-table summary { cursor: pointer; list-style-position: outside; }
.pub-table summary::marker { color: var(--muted); }
.pub-detail { margin-top: .4rem; padding: .5rem .65rem; background: var(--canvas); border-radius: 8px; line-height: 1.5; }

.pub-table th.sortable a { color: inherit; text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: .25rem; }
.pub-table th.sortable a:hover { color: var(--brand); }
.pub-table th.sortable i { font-size: .7rem; opacity: .45; }
.pub-table th.sorted a { color: var(--brand-dark); }
.pub-table th.sorted i { opacity: 1; }
.pub-table .pub-authors { min-width: 10rem; max-width: 16rem; }

/* admin tab bar scrolls inside itself on narrow screens instead of widening the page */
.page-head > * { min-width: 0; max-width: 100%; }
@media (max-width: 767.98px) { .admin-tabs { width: 100%; } }

/* AI writing: verifiable citations */
.written-text .cite { color: var(--brand-dark); border-bottom: 1px dashed var(--brand); cursor: help; white-space: nowrap; }
.written-text .cite:hover, .written-text .cite:focus { background: var(--brand-soft); outline: none; }
.written-text .cite.cite-warn { border-bottom-color: #c4440f; }
.ev-popover { max-width: min(30rem, calc(100vw - 2rem)); }
.ev-popover .popover-body { font-size: .85rem; max-height: 22rem; overflow-y: auto; }
.ev-src + .ev-src { border-top: 1px solid var(--line); margin-top: .5rem; padding-top: .5rem; }
.ev-quote { margin: .3rem 0; padding: .3rem .55rem; border-left: 3px solid var(--brand); background: var(--canvas); font-style: italic; }
.ev-reason { color: var(--muted); }
.ev-more { margin-top: .4rem; font-size: .75rem; color: var(--muted); }
.ev-check { font-weight: 600; }
.ev-exact { background: #d3efdd !important; color: #0e5c2e !important; }
.ev-close { background: #cde6f7 !important; color: #0f4668 !important; }
.ev-not_found { background: #fbd5d5 !important; color: #8f1a10 !important; }
.ev-none { background: #ffe9b3 !important; color: #6b4300 !important; }
.ev-table td { vertical-align: top; }
.ev-table td:nth-child(2) { min-width: 12rem; }
.ev-table td.ev-q { min-width: 16rem; font-style: italic; }
.ev-table td.ev-q .badge { font-style: normal; }
.ev-table tr:target, .ev-table tr.flash { background: var(--brand-soft); }

/* branding */
.brand-logo { height: 38px; width: auto; max-width: 140px; object-fit: contain; }
.logo-preview { width: 84px; height: 56px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 10px; background: #fff; }
.logo-preview img { max-width: 76px; max-height: 48px; object-fit: contain; }
.favicon-preview { width: 84px; height: 56px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 10px; background: #fff; }
.favicon-preview img { width: 32px; height: 32px; object-fit: contain; }

/* credits */
.credit-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .7rem; border-radius: 999px; background: var(--accent-soft);
    color: #8f3208; font-weight: 600; font-size: .85rem; text-decoration: none; border: 1px solid #f6c4a8; white-space: nowrap; font-variant-numeric: tabular-nums; }
.credit-chip:hover { background: #fbdcca; color: #6e2606; }
.credit-chip.bump { animation: credit-bump .9s ease; }
@keyframes credit-bump { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(242, 111, 51, .55); } 30% { transform: scale(1.08); } 100% { transform: scale(1); box-shadow: 0 0 0 10px rgba(242, 111, 51, 0); } }
.usage-chart { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.usage-chart .bar { flex: 1; background: #5f9ba2; border-radius: 3px 3px 0 0; min-width: 4px; }
.usage-chart .bar:hover { background: var(--accent); }
.bg-brand { background-color: var(--brand) !important; }
.text-brand { color: var(--brand) !important; }

/* medium screens: secondary menu items as icons (label in the tooltip) */
@media (min-width: 992px) and (max-width: 1399.98px) { .app-nav .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }

.brand-preview { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.footer-preview { padding: .6rem .8rem; border: 1px dashed var(--line); border-radius: 10px; background: var(--canvas); min-height: 2.5rem; }

/* rich-text footer */
.footer-content { flex: 1 1 auto; min-width: 0; }
.footer-content p, .footer-preview p { margin: 0 0 .25rem; }
.footer-content p:last-child, .footer-preview p:last-child { margin-bottom: 0; }
.footer-content img, .footer-preview img { max-height: 48px; max-width: 100%; vertical-align: middle; }
.footer-content ul, .footer-content ol { margin: 0 0 .25rem; padding-left: 1.2rem; }
.ql-align-center { text-align: center; } .ql-align-right { text-align: right; } .ql-align-justify { text-align: justify; }
.footer-editor { background: #fff; min-height: 7rem; border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; }
.footer-editor .ql-editor { min-height: 7rem; font-size: .9rem; }
.ql-toolbar.ql-snow { border-top-left-radius: 10px; border-top-right-radius: 10px; background: var(--canvas); }

/* local search in the fetched results */
.local-search { border-top: 3px solid var(--brand); }
.hit mark.lq, .hit-abstract mark.lq { background: #fff3a3; color: inherit; padding: 0 .12em; border-radius: 3px; box-shadow: inset 0 -2px 0 #e0b400; }
.lq-badge { background: #fff3a3 !important; color: #5c4700 !important; border: 1px solid #ecd36a; font-weight: 600; }
#g-qhelp code { background: var(--canvas); padding: 0 .25em; border-radius: 4px; color: var(--ink); }

/* find mainstream */
.text-accent { color: var(--accent) !important; }
.ms-list { padding-left: 1.4rem; max-height: 22rem; overflow-y: auto; }
.ms-list li { padding: .3rem 0; border-bottom: 1px solid #e3eaee; }
.ms-list .ms-count { display: inline-block; min-width: 3.2rem; text-align: center; font-weight: 700; color: #8f3208; background: var(--accent-soft);
    border-radius: 999px; padding: 0 .45rem; margin-right: .35rem; font-variant-numeric: tabular-nums; }
.ms-list .ms-t { font-weight: 600; }

.filter-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* AI writing: full screen reading view, list of saved texts */
#w-result.w-fullscreen { position: fixed; inset: 0; z-index: 1045; margin: 0 !important; border-radius: 0; overflow-y: auto; }
#w-result.w-fullscreen > .card-body { max-width: 62rem; margin: 0 auto; padding: 1.5rem 2rem 3rem; }
#w-result.w-fullscreen .written-text { font-size: 1.12rem; line-height: 1.8; }
body.w-fullscreen-open { overflow: hidden; }
.writing-card:hover { border-color: var(--brand); }
@media (max-width: 575.98px) { #w-result.w-fullscreen > .card-body { padding: 1rem; } }

/* header menu a little smaller */
.app-nav .nav-link { font-size: .9rem; }
.app-nav .btn-sm, .app-nav .credit-chip { font-size: .82rem; }
.brand-name { font-size: 1.05rem; }
.ref-labels .badge { margin: 0 .2rem .2rem 0; }

/* reference check: statement appendix */
.appx-table th { white-space: nowrap; }
.appx-table td:nth-child(2) { min-width: 15rem; }
.appx-table td:nth-child(3) { min-width: 12rem; }
.appx-table td:nth-child(5) { min-width: 16rem; }
.appx-table td.appx-rel { min-width: 11rem; }
.appx-quote { font-style: italic; }
.appx-table mark { background: #fff3a3; padding: 0 .1em; border-radius: 3px; }

/* account pages: captcha, notices */
.captcha-img { border: 1px solid var(--line); border-radius: 8px; background: #f5f8f9; }
.auth-notice-icon { width: 64px; height: 64px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 1.8rem; background: var(--brand-soft); color: var(--brand); }
.auth-notice-icon.warn { background: #ffe9b3; color: #6b4300; }

/* admin users */
.users-table tr.table-suspended > * { background: #fff5f5; }
.stat-link:hover { border-color: var(--brand); }

/* user guide */
.help-step { display: flex; gap: .7rem; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; height: 100%; background: var(--canvas); }
.help-step > i { font-size: 1.4rem; color: var(--accent); flex: none; }
@media (max-width: 991.98px) { .help-toc { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .6rem; } }

/* phones: header on one row, search button on one line */
@media (max-width: 575.98px) {
    .app-nav .navbar-brand { gap: .45rem; margin-right: .25rem; min-width: 0; }
    .app-nav .brand-name small { display: none; }
    .app-nav .brand-name { font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
    .app-nav .brand-logo { height: 30px; max-width: 70px; }
    .app-nav .credit-chip { padding: .22rem .5rem; }
    .app-nav .navbar-toggler { padding: .25rem .5rem; }
    .search-hero .btn-lg, .search-hero .form-select-lg { font-size: 1rem; padding-top: .55rem; padding-bottom: .55rem; }
    #search-btn { white-space: nowrap; padding-left: .75rem !important; padding-right: .75rem !important; }
}
@media (max-width: 359.98px) { .app-nav .brand-name { display: none; } }
@media (max-width: 575.98px) { .help .lead { font-size: 1.02rem; } .help h1 { font-size: 1.35rem; } }
.credit-chip .credit-limit { opacity: .65; font-weight: 400; margin-left: 1px; }
.btn-outline-brand { color: var(--brand); border-color: var(--brand); background: #fff; }
.btn-outline-brand:hover, .btn-outline-brand:focus, .btn-outline-brand.show { background: var(--brand); border-color: var(--brand); color: #fff; }
.dropdown-item .small { white-space: normal; max-width: 20rem; }
/* literature review matrix */
.matrix-wrap { max-height: 75vh; }
.matrix-table { min-width: 1500px; }
.matrix-table thead th { position: sticky; top: 0; background: var(--bs-light, #f4f7f8); z-index: 1; white-space: nowrap; }
.matrix-table td { vertical-align: top; }
.matrix-table .mx-study { min-width: 15rem; position: sticky; left: 0; background: #fff; z-index: 0; }
.matrix-table thead .mx-study { z-index: 2; background: var(--bs-light, #f4f7f8); }
.matrix-table .mx-findings { min-width: 16rem; }
.matrix-table .mx-quote { min-width: 14rem; }
/* citation map */
.citemap-graph { height: 560px; background: #fbfdfd; border-radius: 8px; }
@media (max-width: 575px) { .citemap-graph { height: 420px; } }
.citemap-legend { position: absolute; left: 12px; bottom: 8px; background: rgba(255,255,255,.9); padding: 2px 8px; border-radius: 6px; }
.lg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.lg-folder { background: #005f69; }
.lg-ext { background: #f26f33; transform: rotate(45deg); border-radius: 1px; }
.sj-fit { color: #f2a33a; font-size: 1.05rem; letter-spacing: 1px; white-space: nowrap; }
