/* Dark mode inverts the whole page, then flips pictures back so they keep their real colours.
   The flip-back applies the two steps in the opposite order, which is the exact inverse. */
   This covers every page without restyling each one by hand. */
html.lt-pending { visibility: hidden; }

html[data-theme="dark"]:not([data-native="dark"]),
html[data-theme="light"][data-native="dark"] {
    filter: invert(1) hue-rotate(180deg);
    background: #ffffff;
}

html[data-theme="dark"]:not([data-native="dark"]) img,
html[data-theme="dark"]:not([data-native="dark"]) video,
html[data-theme="dark"]:not([data-native="dark"]) canvas,
html[data-theme="dark"]:not([data-native="dark"]) picture,
html[data-theme="dark"]:not([data-native="dark"]) iframe,
html[data-theme="dark"]:not([data-native="dark"]) embed,
html[data-theme="dark"]:not([data-native="dark"]) object,
html[data-theme="dark"]:not([data-native="dark"]) .theme-keep,
html[data-theme="dark"]:not([data-native="dark"]) [style*="url("],
html[data-theme="dark"]:not([data-native="dark"]) .lt-swatch,
html[data-theme="light"][data-native="dark"] img,
html[data-theme="light"][data-native="dark"] video,
html[data-theme="light"][data-native="dark"] canvas,
html[data-theme="light"][data-native="dark"] picture,
html[data-theme="light"][data-native="dark"] iframe,
html[data-theme="light"][data-native="dark"] embed,
html[data-theme="light"][data-native="dark"] object,
html[data-theme="light"][data-native="dark"] .theme-keep,
html[data-theme="light"][data-native="dark"] [style*="url("],
html[data-theme="light"][data-native="dark"] .lt-swatch {
    filter: hue-rotate(180deg) invert(1);
}

/* Appearance panel */
.lt-overlay {
    position: fixed; inset: 0; z-index: 100000;
    display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(15, 23, 42, 0.45);
}
.lt-overlay[hidden] { display: none; }
html[data-theme="dark"]:not([data-native="dark"]) .lt-overlay,
html[data-theme="light"][data-native="dark"] .lt-overlay { background: rgba(226, 232, 240, 0.5); }
.lt-panel {
    width: 100%; max-width: 380px; background: #ffffff; color: #1e293b;
    border-radius: 20px; padding: 20px; font-family: 'Inter', system-ui, sans-serif;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}
.lt-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-size: 1.05rem; }
.lt-close { border: 0; background: transparent; font-size: 1.6rem; line-height: 1; color: #64748b; cursor: pointer; padding: 0 4px; }
.lt-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: #64748b; margin: 14px 0 8px; }
.lt-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lt-mode, .lt-accent {
    border: 1.5px solid #e2e8f0; background: #f8fafc; color: #334155; border-radius: 14px;
    cursor: pointer; font-weight: 600; font-size: 0.85rem; transition: border-color .15s, background .15s;
}
.lt-mode { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; }
.lt-mode i { font-size: 1.2rem; }
.lt-accents { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.lt-accent { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 2px; font-size: 0.7rem; }
.lt-swatch { width: 26px; height: 26px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6); }
.lt-mode[aria-pressed="true"], .lt-accent[aria-pressed="true"] { border-color: #10b981; background: #ecfdf5; color: #065f46; }
.lt-mode:focus-visible, .lt-accent:focus-visible, .lt-close:focus-visible { outline: 2px solid #10b981; outline-offset: 2px; }
.lt-note { margin: 14px 0 0; font-size: 0.78rem; color: #64748b; }
@media (max-width: 400px) {
    .lt-accents { grid-template-columns: repeat(3, 1fr); }
}

/* Floating appearance button for pages that have no button in their navbar */
.lt-fab {
    position: fixed; left: 14px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 1040;
    width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(100, 116, 139, 0.25);
    background: rgba(255, 255, 255, 0.92); color: #475569; font-size: 1.05rem;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.lt-fab[hidden] { display: none; }
.lt-fab.lt-fab-raised { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
.lt-fab:focus-visible { outline: 2px solid #10b981; outline-offset: 2px; }
@media print { .lt-fab, .lt-overlay { display: none !important; } }

/* ==========================================================================
   Typography: one steady scale for every page.
   global-premium.css used to force h1..h6 to 2rem..1rem on phones (the h2 was 24px, the h3 21px), which
   crowded the cards. These sizes replace that scale; rules with a class selector (such as .card h2) still win.
   ========================================================================== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
p, li, dd { line-height: 1.6; }
h1, h2, h3, h4, h5, h6 { line-height: 1.2; text-wrap: balance; }
p { text-wrap: pretty; }

@media (max-width: 768px) {
    html h1 { font-size: clamp(1.75rem, 7.5vw, 2.1rem) !important; }
    html h2 { font-size: clamp(1.35rem, 5.8vw, 1.65rem) !important; }
    html h3 { font-size: 1.2rem !important; }
    html h4 { font-size: 1.1rem !important; }
    html h5 { font-size: 1rem !important; }
    html h6 { font-size: .95rem !important; }
}

/* Long names wrap on two lines instead of being cut off with "..." */
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* ---- Responsive safety net: nothing may be wider than the screen, on a phone or a desktop ---- */
html { overflow-x: clip; }
body { max-width: 100%; }
img, video, canvas, iframe { max-width: 100%; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
/* A table wider than the screen scrolls inside its own box (see theme.js) instead of pushing the page sideways */
.lz-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
/* Long names, e-mails and titles wrap instead of running off the edge */
/* 'break-word' only breaks a word that is longer than its box. 'anywhere' also shrinks the box's minimum width to one
   letter, which squeezed table columns and flex items until names ran down the page one letter per line. */
h1, h2, h3, h4, h5, h6, p, li, label, .card, .modal-body { overflow-wrap: break-word; }
/* Table cells only break a word that is longer than the cell. 'anywhere' let the browser squeeze columns to one letter, so names ran down the page. */
table, td, th { overflow-wrap: break-word; word-break: normal; }
/* A footer that ended up beside the content on a wide page goes below it */
@media (min-width: 992px) {
    .page-layout { flex-wrap: wrap; }
    .page-layout > footer { flex: 0 0 100%; max-width: 100%; }
}
/* Toolbars of buttons wrap onto a second line on a narrow screen */
@media (max-width: 575.98px) {
    /* Not inside a top bar, and not a row that holds an avatar, a picture or something to type in (comment boxes, avatar + text):
       those must stay on one line, so only rows of buttons and chips wrap */
    .d-flex.gap-2:not(.flex-nowrap):not(.flex-column):not(.flex-column-reverse):not(nav *):not(header *):not(.navbar *):not(form):not(:has(> input)):not(:has(> textarea)):not(:has(> select)):not(:has(> img)):not(:has(> .rounded-circle)) { flex-wrap: wrap; }
}

/* The guest header: below a wide desktop the tagline pill under the logo goes, and the bar wraps instead of overflowing */
@media (max-width: 1199.98px) {
    .navbar-custom a > div.d-none.d-md-flex { display: none !important; }
}
@media (max-width: 991.98px) {
    .navbar-custom > .container-fluid { flex-wrap: wrap !important; row-gap: .25rem; }
}
/* The dark strip of links under the header wraps on a tablet instead of running off the edge */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .secondary-nav-strip > .container-fluid { flex-wrap: wrap; justify-content: center; }
    .secondary-nav-strip a { padding: 8px 12px !important; }
}
/* Very small phones: tighter header icons so the whole bar fits */
@media (max-width: 359.98px) {
    .top-actions-row { gap: .3rem !important; }
    .top-actions-row .top-action-btn { width: 36px !important; height: 36px !important; }
    .navbar .navbar-brand { margin-right: .25rem !important; }
    .navbar > .container-fluid { padding-left: .4rem !important; padding-right: .4rem !important; }
}
/* A row with a name/title on the left and a badge on the right: the left side shrinks and wraps instead of pushing the badge off the screen */
.d-flex.justify-content-between > .d-flex.align-items-center,
.d-flex.justify-content-between > .d-flex.align-items-center > div,
.list-item-row .d-flex > div { min-width: 0; }
.list-item-row, .list-item-row * { overflow-wrap: break-word; }
/* Footer links are easy to tap on a phone */
@media (max-width: 767.98px) {
    footer a, .footer-premium-link { display: inline-flex; align-items: center; min-height: 32px; }
}

/* Yellow accent, dark mode: a page whose body is filled with the accent would invert to muddy mustard.
   A cool near-white inverts to a warm near-black instead, and the yellow details stay bright on it. */
html.lt-ybody[data-theme="dark"]:not([data-native="dark"]) body { background: #e9ecf3 !important; }

/* Typography polish. Outfit carries headings and Inter carries text on every page. */
@media (max-width: 768px) {
    /* global-premium.css shrinks rem to 14px on phones, which turned 0.8rem labels into 11px.
       15px keeps pages compact but brings small text back to a readable size. */
    html:root { font-size: 15px; }
}
body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-family: 'Outfit', 'Inter', system-ui, sans-serif; letter-spacing: -0.015em; }
h1, h2 { font-weight: 800; }
h3, h4 { font-weight: 700; }
h5, h6 { font-weight: 600; }
p, li, dd, td, th, label { font-family: 'Inter', system-ui, sans-serif; }
p, li { max-width: 72ch; }
.card p, .card li, td, th, .modal-body p, .modal-body li, footer p, footer li, [class*="col-"] > p { max-width: none; }
table, .stat, .badge, .counter { font-variant-numeric: tabular-nums; }
/* Small uppercase labels read better with a little air between the letters. */
.text-uppercase, th, .badge { letter-spacing: 0.04em; }
::selection { background: rgba(16, 185, 129, 0.28); }

/* Phones use the native system font (San Francisco on iPhone, Roboto on Android): it is the modern
   standard on mobile, loads instantly and matches the other apps on the phone. Icons, code and the
   exam paper layouts keep their own fonts. Wider screens keep Outfit and Inter. */
@media (max-width: 768px) {
    html body,
    html body :not(:is(.bi, [class^="bi-"], [class*=" bi-"], .fa, .fas, .far, .fab, [class*="fa-"], code, pre, kbd, samp, svg, svg *,
                       [id*="pdf"], [id*="pdf"] *, [class*="pdf"], [class*="pdf"] *, [id*="paper"], [id*="paper"] *, [class*="paper"], [class*="paper"] *)) {
        font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif !important;
    }
}

/* Guest header on phones: menu button, logo, Story and Login stay on one row (down to 320px). */
@media (max-width: 575px) {
    .navbar-custom > .container-fluid.public-nav-row { flex-wrap: nowrap !important; padding-left: 8px !important; padding-right: 8px !important; }
    .public-nav-row > div:first-child { gap: 0.3rem !important; min-width: 0; }
    .public-nav-row button[data-bs-toggle="offcanvas"] { width: 38px !important; height: 38px !important; }
    .public-nav-row .public-logo-box { padding: 4px 8px !important; border-width: 2px !important; }
    .public-nav-row .public-logo-text { font-size: 1.02rem !important; letter-spacing: 1px !important; }
    .public-nav-row > div:last-child { gap: 0.35rem !important; flex-shrink: 0; }
    .public-nav-row .magic-auth-btn { padding: 5px 9px !important; font-size: 0.74rem !important; min-height: 0 !important; }
}

/* Side menu header: logo, "Smart in brain" and the close button sit on one row. */
#mobileSidebar > .offcanvas-header { flex-wrap: nowrap !important; align-items: center; gap: 8px; padding: 16px 14px 12px !important; }
#mobileSidebar .offcanvas-title { flex: 1 1 auto; min-width: 0; margin: 0; }
#mobileSidebar .offcanvas-title > a { display: block !important; }
#mobileSidebar .offcanvas-title > a > div { display: flex; flex-wrap: nowrap !important; align-items: center; gap: 6px !important; }
#mobileSidebar .offcanvas-title > a > div > div:first-child { flex: none; padding: 4px 8px !important; border-width: 2px !important; }
#mobileSidebar .offcanvas-title > a > div > div:first-child span { font-size: 1.08rem !important; letter-spacing: 1.5px !important; }
#mobileSidebar .offcanvas-title > a > div > div:nth-child(2) { flex: 0 1 auto; min-width: 0; padding: 3px 8px !important; white-space: nowrap; }
#mobileSidebar .offcanvas-title > a > div > div:nth-child(2) span { font-size: 0.56rem !important; white-space: nowrap; }
#mobileSidebar > .offcanvas-header > button[data-bs-dismiss="offcanvas"] { flex: none; width: 38px !important; height: 38px !important; min-width: 38px !important; min-height: 38px !important; margin: 0 !important; }

/* Note rows in the course tree: Read and Download share one row and have the same size. */
.np-actions { display: flex !important; flex-wrap: nowrap !important; align-items: center; gap: 6px !important; width: 100% !important; margin-top: 8px !important; }
.np-actions > .btn { flex: 1 1 0 !important; min-width: 0 !important; min-height: 34px !important; margin: 0 !important; white-space: nowrap; justify-content: center; font-size: 0.72rem !important; }
.np-actions > .np-report { flex: none !important; min-height: 0 !important; }
@media (min-width: 576px) {
    .np-actions { width: auto !important; margin-top: 0 !important; }
    .np-actions > .btn { flex: none !important; min-width: 84px !important; }
}

/* Course tree on phones: every nested level used to add its own indent, which left note rows about 160px wide. */
@media (max-width: 575px) {
    .custom-category-accordion { --np-ml: 2px; --np-pl: 8px; padding-left: 4px !important; padding-right: 4px !important; }
    .custom-category-accordion .accordion-body.p-3 { padding: 6px 4px !important; padding-top: 0 !important; }
    .custom-category-accordion .accordion.ms-2 { margin-left: 0 !important; padding-left: 8px !important; }
    .custom-category-accordion .accordion-collapse > .px-2 { padding-right: 0 !important; }
    .np-item { padding-left: 10px !important; padding-right: 8px !important; align-items: stretch !important; }
    .np-item > .d-flex { padding-right: 0 !important; }
}
@media (max-width: 359px) {
    .np-actions { gap: 4px !important; }
    .np-actions > .btn { font-size: 0.68rem !important; gap: 2px !important; }
}

/* Dashboard note cards on phones: four actions do not fit one row, and the row used to push Read off the card.
   Read and Download sit on top, Share and Save below, all the same size. */
@media (max-width: 575px) {
    .lz-actions-grid { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; width: 100% !important; margin-left: 0 !important; }
    .lz-actions-grid.lz-actions-grid > * { margin: 0 !important; min-width: 0 !important; width: 100% !important; box-sizing: border-box; min-height: 36px !important; justify-content: center; white-space: nowrap; }
    .lz-actions-grid > .apple-btn-read { order: 1; }
    .lz-actions-grid > a.apple-btn-dl { order: 2; }
    .lz-actions-grid > button.apple-btn-dl { order: 3; }
    .lz-actions-grid > .save-note-btn { order: 4; height: auto !important; border-radius: 100px !important; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.5px; display: inline-flex; align-items: center; }
    .lz-actions-grid > .save-note-btn::after { content: "SAVE"; margin-left: 4px; }
    .lz-actions-grid > .save-note-btn.saved::after { content: "SAVED"; }
}

/* Student notes list on phones: info line on top, then Read and Download, then Share and Save, all the same size.
   Before this the five items sat in one row and were squeezed or cut off. */
@media (max-width: 575px) {
    .np-body.np-body { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; padding: 12px !important; align-items: stretch !important; }
    .np-body.np-body > .text-muted { grid-column: 1 / -1; margin-bottom: 2px; }
    .np-body.np-body > .paper-action-btn,
    .np-body.np-body > .save-note-btn { margin: 0 !important; min-width: 0; width: 100% !important; box-sizing: border-box; min-height: 38px; justify-content: center; white-space: nowrap; padding: 8px 6px !important; font-size: 0.8rem !important; border-radius: 12px !important; }
    .np-body.np-body > .btn-read { order: 1; }
    .np-body.np-body > .btn-download { order: 2; }
    .np-body.np-body > .paper-action-btn:not(.btn-read):not(.btn-download) { order: 3; }
    .np-body.np-body > .save-note-btn { order: 4; height: auto !important; display: inline-flex; align-items: center; font-weight: 600; }
    .np-body.np-body > .save-note-btn::after { content: "Save"; margin-left: 6px; }
    .np-body.np-body > .save-note-btn.saved::after { content: "Saved"; }
}

/* Admin top bar on phones: the shield + logo + "Admin" cluster and four round buttons did not fit, so the buttons
   were squeezed to 21-27px. The shield goes, the logo gets a little smaller and the buttons keep their size. */
@media (max-width: 575px) {
    nav.navbar:has(.navbar-brand .bi-shield-check) > .container { padding-left: 10px !important; padding-right: 10px !important; }
    nav.navbar:has(.navbar-brand .bi-shield-check) .navbar-brand { margin-right: 6px !important; min-width: 0; }
    nav.navbar:has(.navbar-brand .bi-shield-check) .navbar-brand > div:first-child { display: none !important; }
    nav.navbar:has(.navbar-brand .bi-shield-check) .navbar-brand div[style*="border: 3px solid"] { padding: 4px 8px !important; border-width: 2px !important; }
    nav.navbar:has(.navbar-brand .bi-shield-check) .navbar-brand span[style*="1.25rem"] { font-size: 1.02rem !important; letter-spacing: 1px !important; }
    nav.navbar:has(.navbar-brand .bi-shield-check) .navbar-brand > div:last-child > span:last-child { font-size: 0.8rem !important; }
    nav.navbar:has(.navbar-brand .bi-shield-check) .top-actions-row { gap: 0.3rem !important; flex-shrink: 0 !important; }
    nav.navbar:has(.navbar-brand .bi-shield-check) .top-actions-row > * { flex-shrink: 0 !important; margin-right: 0 !important; }
    nav.navbar:has(.navbar-brand .bi-shield-check) .top-actions-row .top-action-btn,
    nav.navbar:has(.navbar-brand .bi-shield-check) .top-actions-row .search-toggle-btn { width: 38px !important; height: 38px !important; min-width: 38px !important; min-height: 38px !important; margin: 0 !important; padding: 0 !important; }
}
@media (max-width: 379px) {
    nav.navbar:has(.navbar-brand .bi-shield-check) .navbar-brand span[style*="1.25rem"] { letter-spacing: 0.5px !important; }
    nav.navbar:has(.navbar-brand .bi-shield-check) .navbar-brand div[style*="border: 3px solid"] { padding: 4px 6px !important; }
    nav.navbar:has(.navbar-brand .bi-shield-check) .navbar-brand > div:last-child > span:last-child { font-size: 0.72rem !important; margin-left: 2px !important; }
    nav.navbar:has(.navbar-brand .bi-shield-check) .top-actions-row { gap: 0.2rem !important; }
    nav.navbar:has(.navbar-brand .bi-shield-check) .top-actions-row .top-action-btn,
    nav.navbar:has(.navbar-brand .bi-shield-check) .top-actions-row .search-toggle-btn { width: 36px !important; height: 36px !important; min-width: 36px !important; min-height: 36px !important; }
}
@media (max-width: 349px) {
    nav.navbar:has(.navbar-brand .bi-shield-check) .navbar-brand > div:last-child > span:last-child { display: none !important; }
}

/* Every page that uses the shared top actions (search, messages, bell, profile): the round buttons stay round on
   phones. From 360px up they keep a fixed size; on smaller phones they may shrink, but always as circles. */
@media (max-width: 575px) {
    .top-actions-row { gap: 0.3rem !important; }
    .top-actions-row .top-action-btn,
    .top-actions-row .search-toggle-btn { margin: 0 !important; padding: 0 !important; aspect-ratio: 1 / 1; }
}
@media (min-width: 360px) and (max-width: 575px) {
    .top-actions-row > * { flex-shrink: 0 !important; }
    .top-actions-row .top-action-btn,
    .top-actions-row .search-toggle-btn { width: 38px !important; height: 38px !important; min-width: 38px !important; min-height: 38px !important; }
}
@media (max-width: 359px) {
    .top-actions-row { gap: 0.2rem !important; }
    .top-actions-row .top-action-btn,
    .top-actions-row .search-toggle-btn { width: 36px !important; height: auto !important; min-width: 0 !important; min-height: 0 !important; flex-shrink: 1 !important; }
}

/* Very small phones: the logo box gives up a little width in every header so the buttons next to it are not touched. */
@media (max-width: 359px) {
    .navbar-brand div[style*="border: 3px solid"] { padding: 4px 8px !important; border-width: 2px !important; }
    .navbar-brand span[style*="font-size: 1.25rem"] { font-size: 1.08rem !important; letter-spacing: 1px !important; }
}

/* Forum top bar (feed and folder pages): menu, logo, then search, messages, bell and profile. The icons used to wrap onto
   two rows on a phone; now everything stays on one row and the buttons keep a round shape. */
@media (max-width: 575.98px) {
    #top-nav > .container-fluid { flex-wrap: nowrap !important; padding-left: 8px !important; padding-right: 8px !important; }
    #top-nav > .container-fluid > div { flex-wrap: nowrap !important; flex-shrink: 0; }
    #top-nav > .container-fluid > div:first-child { gap: 0.4rem !important; min-width: 0; flex-shrink: 1; }
    #top-nav > .container-fluid > div:last-child { gap: 0.35rem !important; }
    #top-nav .btn-link i.bi-list { font-size: 1.5rem; }
    #top-nav .nav-logo-box { padding: 3px 10px !important; border-width: 2px !important; }
    #top-nav .nav-logo-text { font-size: 1.05rem !important; letter-spacing: 1px !important; }
    #top-nav #navSearchToggle,
    #top-nav #msgDropdown,
    #top-nav #notiDropdown { width: 38px !important; height: 38px !important; min-width: 38px !important; min-height: 38px !important; padding: 0 !important; margin: 0 !important; }
    #top-nav #forumProfileDropdown { width: 40px !important; height: 40px !important; min-width: 40px !important; min-height: 40px !important; }
    #top-nav .dropdown-toggle::after { display: none !important; }
}
@media (max-width: 359px) {
    #top-nav > .container-fluid > div:last-child { gap: 0.25rem !important; }
    #top-nav #navSearchToggle, #top-nav #msgDropdown, #top-nav #notiDropdown { width: 34px !important; height: 34px !important; min-width: 34px !important; min-height: 34px !important; }
    #top-nav #forumProfileDropdown { width: 36px !important; height: 36px !important; min-width: 36px !important; min-height: 36px !important; }
    #top-nav .nav-logo-text { font-size: .88rem !important; letter-spacing: .5px !important; }
    #top-nav .nav-logo-box { padding: 3px 7px !important; }
    #top-nav > .container-fluid > div:first-child { gap: 0.3rem !important; }
}

/* Forum pages on phones */
@media (max-width: 575.98px) {
    /* The appearance button floated over the cards and over the comment "Post" button. */
    body:has(#top-nav) .lt-fab { display: none !important; }
    /* Read and Download on a note card: the same size, side by side, filling the card width */
    div:has(> .note-action-btn) { width: 100%; gap: 0.5rem !important; }
    .note-action-btn { flex: 1 1 0 !important; min-width: 0 !important; min-height: 40px !important; display: inline-flex !important; align-items: center; justify-content: center; font-size: 0.85rem !important; padding: 6px 10px !important; margin: 0 !important; }
}

/* Past-paper result cards (CAT 1, CAT 2, UE, projects, assignments).
   Colours match the rest of the app: Read is the filled green action, Download the outlined one. */
.pp-actions > a[href^="/view/"] { background: linear-gradient(135deg, #10b981, #059669) !important; color: #ffffff !important; box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25) !important; border: none !important; }
.pp-actions > a[href^="/download/"] { background: #ffffff !important; color: #047857 !important; border: 1.5px solid #a7f3d0 !important; box-shadow: none !important; }
.pp-actions > button[data-title] { background: rgba(14, 165, 233, 0.1) !important; color: #0284c7 !important; }
@media (max-width: 575.98px) {
    /* The card title may use two lines instead of being cut at 200px */
    .premium-result-card h6.text-truncate { white-space: normal !important; max-width: none !important; overflow: visible !important; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
    /* Counters on top, then Read and Download side by side, then Share and Save: four buttons do not fit one row on a phone */
    .pp-foot { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; margin-left: 0 !important; margin-top: 6px !important; }
    .pp-actions { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; width: 100%; }
    .pp-actions > * { margin: 0 !important; min-width: 0 !important; width: 100% !important; box-sizing: border-box; min-height: 40px !important; display: inline-flex !important; align-items: center; justify-content: center; white-space: nowrap; font-size: 0.8rem !important; padding: 6px 8px !important; border-radius: 10px !important; transform: none !important; }
    .pp-actions > a[href^="/view/"] { order: 1; }
    .pp-actions > a[href^="/download/"] { order: 2; }
    .pp-actions > button[data-title] { order: 3; }
    .pp-actions > .save-note-btn { order: 4; height: auto !important; border-radius: 10px !important; font-weight: 700; }
    .pp-actions > button[data-title]::after { content: "Share"; margin-left: 6px; font-weight: 700; }
    .pp-actions > .save-note-btn::after { content: "Save"; margin-left: 6px; }
    .pp-actions > .save-note-btn.saved::after { content: "Saved"; }
}

/* Module list on small phones: the name keeps the room, the status stays beside it on the same row */
@media (max-width: 430px) {
    #accordionModules > .accordion-item > .accordion-header .accordion-button { gap: 0; }
    #accordionModules .module-title { font-size: 0.78rem !important; letter-spacing: 0.2px !important; }
    #accordionModules .module-status { font-size: 0.58rem !important; padding: 4px 7px !important; letter-spacing: 0.2px !important; }
    #accordionModules .module-status i { font-size: 0.7rem; }
    #accordionModules .accordion-button > div > div:first-child > div:first-child { width: 30px !important; height: 30px !important; min-width: 30px !important; margin-right: 8px !important; }
}
