/* DarsMarket — calm teacher-workspace theme
   Light, readable, restrained. Color is used sparingly: teal for the one
   primary action, blue for links, everything else is ink, muted ink and
   quiet surfaces. No full-bleed dark banners; headers are compact. */

:root {
    /* ground / ink — verified real contrast, not assumed */
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-sunk: #eef2f7;
    --ink: #172b4d;
    --ink-muted: #4f5e78;
    --ink-faint: #7c8aa3;
    --border: #d8e1eb;
    --border-strong: #c3d0de;

    /* one primary action color, used sparingly */
    --accent: #0f766e;
    --accent-dark: #0b5c56;
    --accent-ink: #ffffff;
    --accent-soft: #e1f2f0;
    --accent-soft-line: #bfe3df;

    /* links are a distinct, cooler blue — not the same as the primary action */
    --link: #1d4ed8;
    --link-dark: #1739a6;
    --link-soft: #e6eefc;

    --success: #15663f;
    --success-soft: #e3f5ec;
    --warning: #8a5a0a;
    --warning-soft: #fbf0dc;
    --danger: #b3122a;
    --danger-soft: #fbe8e6;
    --info: var(--link);
    --info-soft: var(--link-soft);

    --radius: 10px;
    --radius-sm: 8px;
    --radius-lg: 14px;

    --shadow-float: 0 10px 24px rgba(23, 43, 77, 0.12), 0 2px 6px rgba(23, 43, 77, 0.06);
    --shadow-card-hover: 0 4px 14px rgba(23, 43, 77, 0.08);

    --content-width: 1280px;
    --wide-width: 1400px;

    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

    /* retune Bootstrap's own utility classes (.text-primary, .bg-primary, …) to this palette */
    --bs-primary: #0f766e;
    --bs-primary-rgb: 15, 118, 110;
    --bs-success: #15663f;
    --bs-success-rgb: 21, 102, 63;
    --bs-danger: #b3122a;
    --bs-danger-rgb: 179, 18, 42;
    --bs-warning: #8a5a0a;
    --bs-warning-rgb: 138, 90, 10;
    --bs-info: #1d4ed8;
    --bs-info-rgb: 29, 78, 216;
    --bs-body-color: #4f5e78;
    --bs-link-color: #1d4ed8;
    --bs-link-hover-color: #1739a6;
    --bs-border-color: #d8e1eb;

    /* fixed-ish scale, tighter ratio (Operate mode), capped well below display size */
    --step-small: 13px;
    --step-body: 16px;
    --step-lead: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
    --step-h3: clamp(1.25rem, 1.1rem + 0.7vw, 1.55rem);
    --step-h2: clamp(1.5rem, 1.3rem + 1vw, 1.9rem);
    --step-h1: clamp(1.8rem, 1.5rem + 1.6vw, 2.4rem);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body.site-body {
    font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: var(--step-body);
    color: var(--ink-muted);
    background: var(--bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--accent-soft);
    color: var(--ink);
}

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--surface-sunk);
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
    border: 3px solid var(--surface-sunk);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ink-faint);
}

a,
button {
    transition: color 140ms var(--ease-out), background-color 140ms var(--ease-out), border-color 140ms var(--ease-out), transform 140ms var(--ease-out);
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--link-dark);
}

/* plain inline text links (not nav/buttons/cards) keep a visible underline */
p a,
.muted-copy a,
.section-copy a,
.footer_widget a {
    text-decoration: underline;
    text-decoration-color: rgba(29, 78, 216, 0.35);
    text-underline-offset: 2px;
}

img {
    max-width: 100%;
    height: auto;
}

:focus-visible {
    outline: 2.5px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5,
.section-heading,
.display-heading,
.resource-title,
.store-title,
.footer_title {
    color: var(--ink);
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-weight: 650;
    letter-spacing: -0.015em;
    line-height: 1.22;
    text-wrap: balance;
    overflow-wrap: break-word;
    word-break: break-word;
}

p, .text-muted, .small, small {
    color: var(--ink-muted);
}

.container,
.site-container {
    max-width: var(--content-width);
}

.site-topbar .container-fluid,
.site-navbar .container-fluid {
    max-width: none;
    padding-left: 32px;
    padding-right: 32px;
}

/* ---------- header / nav — one quiet bar, no duplicated links ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1040;
}

.site-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.site-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 40px;
}

.site-topbar-meta,
.site-topbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.site-topbar-meta {
    min-width: 0;
}

.site-topbar-badge {
    display: inline-flex;
    align-items: center;
    padding: 0;
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
}

.site-topbar-badge::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 8px;
    background: var(--accent);
    border-radius: 999px;
}

.site-topbar-meta p {
    margin: 0;
    color: var(--ink-faint);
    font-size: 12.5px;
    line-height: 1.6;
}

.site-topbar-link,
.site-user-pill {
    transition: color 140ms var(--ease-out), background-color 140ms var(--ease-out);
}

.site-topbar-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 2px;
    color: var(--ink-muted);
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid transparent;
}

.site-topbar-link:hover,
.site-topbar-link.is-current {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

.site-topbar-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.site-user-pill {
    display: grid;
    gap: 1px;
    min-width: 170px;
    padding: 6px 2px 6px 14px;
    border-left: 1px solid var(--border);
    color: var(--ink);
    text-align: left;
}

.site-user-pill:hover,
.site-user-pill.is-current {
    color: var(--accent-dark);
}

.site-user-pill-name {
    display: block;
    color: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.site-user-pill small {
    color: var(--ink-faint);
    font-size: 11px;
    font-weight: 500;
}

.site-navbar {
    padding: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.site-navbar-shell {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 18px;
    padding: 12px 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 0;
    margin-right: 6px;
}

.site-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.site-brand-copy {
    display: flex;
    flex-direction: column;
}

.site-brand-title {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--ink);
    line-height: 1;
}

.site-brand-subtitle {
    color: var(--ink-faint);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.02em;
    margin-top: 4px;
}

.site-toggler {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    background: var(--surface);
    box-shadow: none;
    margin-left: auto;
}

.site-toggler:focus {
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.site-toggler-line {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--ink);
}

.site-toggler-line + .site-toggler-line {
    margin-top: 5px;
}

#mainNav {
    flex: 1 1 auto;
}

.site-nav-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    margin-right: auto;
}

.site-nav .nav-link {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    color: var(--ink-muted);
    font-size: 14px;
    font-weight: 500;
}

.site-nav .nav-link:hover,
.site-nav .nav-link.active,
.site-nav-dropdown.show .nav-link,
.site-utility-link:hover,
.site-utility-link.is-current {
    background: var(--surface-sunk);
    color: var(--ink);
}

.site-nav-dropdown .dropdown-toggle::after {
    margin-left: 7px;
    border-top-width: 0.32em;
}

.site-nav-dropdown-menu {
    margin-top: 8px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-float);
    transform-origin: top left;
    animation: menuIn 140ms var(--ease-out);
}

@keyframes menuIn {
    from { opacity: 0; transform: scale(0.98) translateY(-3px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.site-nav-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 500;
}

.site-nav-dropdown-menu .dropdown-item:hover,
.site-nav-dropdown-menu .dropdown-item.active,
.site-nav-dropdown-menu .dropdown-item:active {
    background: var(--surface-sunk);
    color: var(--ink);
}

.site-nav-dropdown-menu .dropdown-divider {
    margin: 6px 2px;
    border-top-color: var(--border);
}

.site-utility {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}

.site-utility-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-muted);
    font-size: 13px;
    font-weight: 500;
}

.site-logout-link:hover {
    background: var(--surface-sunk);
    color: var(--ink);
}

.site-utility-button {
    min-width: 108px;
}

.site-header.is-scrolled .site-navbar {
    border-bottom-color: var(--border-strong);
}

.site-main {
    position: relative;
}

.site-container {
    padding-top: 24px;
    padding-bottom: 64px;
}

/* ---------- labels — quiet, no pill chrome ---------- */

.eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 0;
    margin-bottom: 8px !important;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
}

/* ---------- compact page head — replaces the old full-bleed banner ---------- */

.page-hero,
.hero {
    position: relative;
    overflow: hidden;
    padding: 22px 26px;
    margin-bottom: 24px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--ink);
}

.page-home .page-hero {
    min-height: 0;
    background: var(--surface);
}

.page-hero::before {
    content: none;
}

.page-hero > *,
.hero > * {
    position: relative;
    z-index: 1;
}

.page-hero h1,
.hero h1 {
    color: var(--ink);
    font-size: var(--step-h1);
    line-height: 1.14;
    margin-bottom: 8px;
    max-width: 24ch;
}

.page-hero .lead,
.hero .lead {
    max-width: 640px;
    color: var(--ink-muted);
    font-size: var(--step-lead);
    line-height: 1.55;
    margin-bottom: 16px;
}

.page-hero .eyebrow,
.hero .eyebrow {
    color: var(--accent);
}

.page-hero .card,
.hero .card {
    background: var(--surface);
}

.auth-aside .soft-panel {
    background: var(--surface-sunk);
    border-color: var(--border);
    color: var(--ink-muted);
    padding: 16px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.6;
}

.stat-stack {
    display: grid;
    gap: 14px;
    margin-top: 24px;
}

.page-hero .card-kicker,
.hero .card-kicker {
    background: var(--accent-soft);
}

.page-hero .resource-meta,
.hero .resource-meta {
    max-width: 760px;
}

.page-hero .meta-badge,
.hero .meta-badge {
    background: var(--surface-sunk);
    color: var(--ink-muted);
    border-color: var(--border);
}

.page-hero .btn-outline-primary,
.hero .btn-outline-primary {
    border-color: var(--border-strong);
    color: var(--ink);
}

/* a compact, single-row header used on catalog/dashboard/admin-style pages */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding-bottom: 18px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.page-head h1 {
    font-size: var(--step-h1);
    margin-bottom: 4px;
    max-width: 32ch;
}

.page-head p {
    margin: 0;
    max-width: 56ch;
    color: var(--ink-muted);
}

.page-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.resource-hero {
    padding: 20px 24px;
    margin-bottom: 20px;
}

.resource-hero .eyebrow {
    margin-bottom: 8px !important;
}

.resource-hero h1 {
    max-width: 28ch;
    font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem);
    line-height: 1.16;
    margin-bottom: 8px !important;
}

.resource-hero .lead {
    max-width: 720px;
    font-size: var(--step-body);
    line-height: 1.55;
    margin-bottom: 14px !important;
}

.resource-hero .resource-meta {
    max-width: 980px;
    gap: 10px;
    margin-bottom: 0 !important;
}

.resource-hero .meta-badge {
    padding: 7px 12px;
    font-size: 12px;
}

.resource-hero-strip {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-sunk);
    margin-top: 14px;
}

.resource-hero-kicker {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
}

.resource-hero-stats {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
}

.resource-metric-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    padding: 2px 18px;
    border-left: 1px solid var(--border);
}

.resource-metric-inline:first-child {
    padding-left: 0;
    border-left: none;
}

.resource-metric-inline:last-child {
    padding-right: 0;
}

.resource-metric-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.resource-metric-label {
    display: block;
    color: var(--ink-faint);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.resource-metric-note {
    display: block;
    color: var(--ink-muted);
    font-size: 12px;
    line-height: 1.25;
}

.resource-metric-value {
    flex: 0 0 auto;
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 1.4rem;
    line-height: 1;
}

.hero-search,
.search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.hero-search .form-control,
.search-row .form-control {
    flex: 1 1 280px;
}

.hero-visual {
    position: relative;
    min-height: 220px;
}

/* compact "today's resource" card beside the home hero — plain frame, no fold */
.hero-doc-frame {
    position: relative;
    height: 100%;
    min-height: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.hero-doc-frame img {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.hero-doc-frame img.is-page-preview {
    object-fit: contain;
    background: var(--surface-sunk);
    padding: 6px;
}

.hero-doc-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 auto;
}

.hero-doc-body strong {
    display: block;
    color: var(--ink);
    font-size: 15.5px;
    line-height: 1.3;
}

.hero-doc-meta {
    color: var(--ink-faint);
    font-size: 12.5px;
}

.hero-visual img {
    position: absolute;
    inset: 0 0 0 auto;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: right bottom;
}

.hero-floating-card {
    position: absolute;
    left: 0;
    bottom: 16px;
    max-width: 320px;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-float);
}

.hero-floating-card .card-kicker {
    margin-bottom: 10px;
}

.hero-floating-card strong {
    display: block;
    color: var(--ink);
    margin-bottom: 8px;
}

.page-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.section-heading {
    font-size: var(--step-h2);
    line-height: 1.22;
    margin-bottom: 6px;
    max-width: 24ch;
}

.display-heading {
    font-size: var(--step-h2);
}

.section-copy,
.muted-copy {
    color: var(--ink-muted);
    line-height: 1.6;
}

/* ---------- surfaces — flat cards, light border, no shadow at rest ---------- */

.card,
.surface-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: none;
    overflow: hidden;
}

.card .card-body {
    padding: 22px 22px;
}

.resource-card,
.store-card,
.info-card,
.table-card,
.form-card,
.list-card {
    height: 100%;
    transition: border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.resource-card:hover,
.store-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card-hover);
}

.resource-card .card-body,
.store-card .card-body,
.info-card .card-body {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface);
}

.resource-card .card-body::after,
.store-card .card-body::after,
.info-card .card-body::after {
    content: none;
}

.resource-thumb,
.store-visual,
.media-frame {
    position: relative;
    overflow: hidden;
    background: var(--surface-sunk);
}

.resource-thumb img,
.store-visual img,
.media-frame img {
    display: block;
    width: 100%;
    height: 168px;
    object-fit: cover;
    transition: transform 300ms var(--ease-out);
}

/* an auto-generated document page: show the whole page, not a cropped sliver */
.resource-thumb img.is-page-preview,
.mini-resource-thumb img.is-page-preview {
    object-fit: contain;
    background: var(--surface);
    padding: 6px;
}

.resource-card:hover .resource-thumb img,
.store-card:hover .store-visual img {
    transform: scale(1.02);
}

.store-visual img {
    height: 180px;
}

/* a real preview image still gets a small format tag in the corner */
.thumb-format-badge {
    position: absolute;
    left: 10px;
    top: 10px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(23, 43, 77, 0.78);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

/* no real preview image: a plain, calm tile that still says what it is —
   instead of a random lookalike classroom photo */
.resource-thumb-placeholder,
.store-visual-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 168px;
    background: var(--accent-soft);
}

.store-visual-placeholder {
    height: 180px;
}

.resource-thumb-placeholder .thumb-placeholder-label,
.store-visual-placeholder .thumb-placeholder-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.preview-lock-note {
    margin-bottom: 12px;
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 600;
}

.preview-gallery {
    display: grid;
    gap: 14px;
    max-height: 760px;
    overflow-y: auto;
    padding-right: 4px;
}

.preview-page-card {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.preview-page-label {
    margin-bottom: 10px;
    color: var(--ink-faint);
    font-size: 12px;
    font-weight: 600;
}

.preview-media-frame {
    border-radius: var(--radius-sm);
}

.preview-media-frame img {
    height: auto;
    max-height: none;
    object-fit: contain;
    background: #fff;
    user-select: none;
    -webkit-user-drag: none;
}

.card-kicker,
.label-chip {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 11.5px;
    font-weight: 600;
}

.share-panel {
    display: grid;
    gap: 14px;
}

.share-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.share-note {
    margin: 0;
    color: var(--ink-muted);
    font-size: 13px;
    line-height: 1.6;
}

.pill-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.btn-outline-success .pill-counter {
    background: var(--success-soft);
    color: var(--success);
}

.btn-success .pill-counter {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.resource-title,
.store-title {
    font-size: 18px;
    line-height: 1.3;
    margin: 0;
}

.resource-meta,
.inline-meta,
.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 10px;
    color: var(--ink-faint);
    font-size: 13px;
}

.rating-note {
    color: var(--ink-faint);
}

.meta-badge,
.subject-chip,
.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 6px 11px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-sunk);
    color: var(--ink-muted);
    font-size: 12px;
    font-weight: 500;
    overflow-wrap: break-word;
}

.subject-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.subject-chip {
    background: var(--surface);
    border-color: var(--border);
    color: var(--ink);
}

.subject-chip:hover {
    border-color: var(--accent);
    color: var(--accent-dark);
    background: var(--accent-soft);
}

/* active-filter chips, removable */
.filter-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 7px 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--accent-soft-line);
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 12.5px;
    font-weight: 500;
}

.filter-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.14);
    color: var(--accent-dark);
    font-size: 13px;
    line-height: 1;
}

.filter-chip-remove:hover {
    background: var(--accent);
    color: #fff;
}

.filter-chip-clear {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    color: var(--ink-faint);
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: var(--border-strong);
}

/* quick filter row on the catalog */
.quick-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.quick-filter-row .form-select,
.quick-filter-row .form-control {
    max-width: 220px;
}

.filters-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.filters-toggle::-webkit-details-marker {
    display: none;
}

.filters-toggle::marker {
    content: "";
}

.filters-details[open] .filters-toggle {
    background: var(--surface-sunk);
}

/* ---------- stats — plain bordered grid, no decorative accents ---------- */

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.metric-tile {
    padding: 18px 20px;
    border: none;
    border-radius: 0;
    background: var(--surface);
    box-shadow: none;
}

.metric-label {
    display: block;
    color: var(--ink-faint);
    font-size: 12.5px;
    font-weight: 500;
    margin-bottom: 8px;
}

.metric-value {
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 26px;
    line-height: 1.1;
}

.soft-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    background: var(--surface-sunk);
}

.cart-item-stack {
    display: grid;
    gap: 14px;
}

.mini-resource {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.mini-resource-thumb {
    background: var(--surface-sunk);
}

.mini-resource-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 160px;
    object-fit: cover;
}

.mini-resource-thumb .resource-thumb-placeholder {
    height: 100%;
    min-height: 160px;
}

.mini-resource-body {
    padding: 18px 20px;
}

.mini-resource-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.mini-resource-price {
    min-width: 140px;
    text-align: right;
}

.mini-resource-price strong {
    display: block;
    margin-top: 8px;
    color: var(--ink);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.1;
}

.summary-stack {
    display: grid;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.summary-stack.compact {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--ink-faint);
}

.summary-row strong {
    color: var(--ink);
}

.summary-row.is-total {
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.summary-row.is-total strong {
    font-size: 18px;
    color: var(--accent-dark);
}

.detail-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.detail-stat {
    padding: 14px 16px;
    border: none;
    border-radius: 0;
    background: var(--surface);
}

.detail-stat small {
    display: block;
    margin-bottom: 6px;
    color: var(--ink-faint);
    font-size: 11px;
    font-weight: 600;
}

.detail-stat strong {
    color: var(--ink);
    font-weight: 600;
}

.card-actions,
.action-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.quick-link-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.quick-link {
    display: block;
    padding: 14px 16px;
    border: none;
    border-radius: 0;
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
}

.quick-link:hover {
    background: var(--surface-sunk);
    color: var(--accent-dark);
}

.empty-state {
    padding: 32px 26px;
    border-radius: var(--radius);
    border: 1px dashed var(--border-strong);
    background: var(--surface-sunk);
    text-align: center;
}

.sticky-panel {
    position: sticky;
    top: 92px;
}

/* ---------- buttons — rounded, one teal action, quiet press feedback ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border-width: 1px;
    transition: transform 120ms var(--ease-out), background-color 140ms var(--ease-out), border-color 140ms var(--ease-out), color 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}

.btn:active {
    transform: scale(0.98);
}

.btn-sm {
    min-height: 36px;
    padding: 7px 14px;
    font-size: 13px;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: var(--accent-ink);
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--ink);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: var(--surface-sunk);
    border-color: var(--ink-faint);
    color: var(--ink);
}

.btn-outline-secondary,
.btn-secondary {
    border-color: var(--border);
    color: var(--ink-muted);
}

.btn-success,
.btn-outline-success {
    border-color: var(--success);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-outline-success {
    color: var(--success);
    background: transparent;
}

.btn-outline-success:hover {
    background: var(--success);
    color: #fff;
}

.btn-warning,
.btn-outline-warning {
    border-color: var(--warning);
}

.btn-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.btn-outline-warning {
    color: var(--warning);
}

.btn-warning:hover,
.btn-outline-warning:hover {
    background: var(--warning);
    color: #fff;
}

.btn-outline-danger {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger);
    color: #fff;
}

/* ---------- forms ---------- */

.form-control,
.form-select {
    min-height: 44px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    color: var(--ink);
    background: var(--surface);
    box-shadow: none;
    font-size: var(--step-body);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3.5px var(--accent-soft);
}

textarea.form-control {
    min-height: 140px;
}

.form-label {
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 600;
}

.form-text {
    color: var(--ink-faint);
}

.form-check-input {
    border-color: var(--border-strong);
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3.5px var(--accent-soft);
}

/* ---------- tables, lists, pagination ---------- */

.table-responsive {
    border-radius: var(--radius);
}

.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 13px 14px;
    border-bottom-color: var(--border);
    color: var(--ink-muted);
}

.table thead th {
    color: var(--ink);
    font-size: 12.5px;
    font-weight: 600;
}

.list-group {
    gap: 10px;
}

.list-group-item {
    border: 1px solid var(--border);
    border-radius: var(--radius) !important;
    background: var(--surface);
}

.list-group-item.active {
    border-color: var(--accent);
    background: var(--accent);
}

.pagination {
    gap: 8px;
    flex-wrap: wrap;
}

.pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border);
    color: var(--ink);
    transition: background-color 120ms var(--ease-out), border-color 120ms var(--ease-out);
}

.pagination .page-link:hover {
    background: var(--surface-sunk);
}

.pagination .page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.badge {
    border-radius: var(--radius-sm);
    padding: 0.5em 0.75em;
    font-weight: 600;
}

.alert {
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: none;
}

.alert-info {
    background: var(--info-soft);
    border-color: rgba(29, 78, 216, 0.16);
    color: var(--link-dark);
}

.alert-success {
    background: var(--success-soft);
    border-color: rgba(21, 102, 63, 0.18);
    color: var(--success);
}

.alert-warning {
    background: var(--warning-soft);
    border-color: rgba(138, 90, 10, 0.18);
    color: var(--warning);
}

.alert-danger {
    background: var(--danger-soft);
    border-color: rgba(179, 18, 42, 0.18);
    color: var(--danger);
}

.modal-content {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-float);
}

/* ---------- auth — form first, quiet aside (reorders on mobile) ---------- */

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 480px) 1fr;
    gap: 1px;
    align-items: stretch;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.auth-shell > * {
    background: var(--surface);
}

.auth-shell .auth-card {
    order: 1;
}

.auth-shell .auth-aside {
    order: 2;
}

.auth-aside {
    min-height: 100%;
    background: var(--surface-sunk);
    position: relative;
    padding: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-card .card-body {
    padding: 40px 36px;
}

.password-field {
    position: relative;
}

.password-field .form-control {
    padding-right: 76px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    padding: 6px 8px;
    color: var(--link);
    font-size: 12.5px;
    font-weight: 600;
}

.password-toggle:hover {
    color: var(--link-dark);
}

.divider-line {
    height: 1px;
    margin: 24px 0;
    background: var(--border);
}

/* ---------- footer — one quiet, deliberate dark close ---------- */

.site-footer {
    margin-top: auto;
    background: var(--ink);
    color: #e4e9f2;
}

.site-footer .container {
    max-width: var(--content-width);
}

.footer_top {
    padding: 56px 0 36px;
}

.footer_cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 32px;
    margin-bottom: 44px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.footer_cta .footer_title {
    color: #fff;
    font-size: var(--step-h2);
    margin-bottom: 6px;
    max-width: 20ch;
}

.footer_copy {
    color: rgba(228, 233, 242, 0.68);
    line-height: 1.7;
    margin-bottom: 0;
}

.footer-search {
    display: flex;
    align-items: stretch;
    min-width: min(100%, 420px);
}

.footer-search input {
    flex: 1;
    min-width: 0;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    padding: 0 16px;
    color: var(--ink);
    background: var(--surface);
}

.footer-search button {
    border: none;
    min-width: 120px;
    height: 48px;
    padding: 0 18px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.footer-search button:hover {
    background: var(--accent-dark);
}

.footer_widget {
    height: 100%;
}

.footer_widget .footer_title {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin-bottom: 14px;
}

.footer_widget p,
.footer_widget li a {
    color: rgba(228, 233, 242, 0.64);
    font-size: 14px;
}

.footer_widget ul {
    display: grid;
    gap: 10px;
    list-style: none;
    padding: 0;
}

.footer_widget li a:hover {
    color: #fff;
}

.footer_widget_action {
    padding: 20px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-wordmark {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 36px;
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-size: 20px;
    line-height: 1;
}

.footer-wordmark::before {
    content: "";
    display: inline-block;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: var(--accent);
}

.copy-right_text {
    padding: 0 0 30px;
}

.footer_border {
    height: 1px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.12);
}

.copy-right_text small {
    color: rgba(228, 233, 242, 0.52);
}

.table-card .card-body,
.form-card .card-body,
.list-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.program-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.program-tabs .program-tab {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    color: var(--ink);
    background: var(--surface);
    font-size: 13px;
    font-weight: 500;
}

.program-tabs .program-tab.is-active,
.program-tabs .program-tab:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.feature-split {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--surface-sunk);
    border: 1px solid var(--border);
    box-shadow: none;
}

.feature-split .feature-copy {
    padding: 32px;
    color: var(--ink);
}

.feature-split .feature-copy .section-heading,
.feature-split .feature-copy p {
    color: var(--ink);
}

.feature-split .feature-copy .section-copy {
    color: var(--ink-muted);
}

.feature-list {
    display: grid;
    gap: 12px;
}

.feature-split .soft-panel {
    background: var(--surface);
    border-color: var(--border);
    color: var(--ink);
}

.feature-split .soft-panel strong,
.feature-split .soft-panel p {
    color: var(--ink);
}

.feature-list .soft-panel {
    background: var(--surface);
    border-color: var(--border);
}

.ranking-list {
    display: grid;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.ranking-row {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    overflow: hidden;
    border: none;
    border-radius: 0;
    background: var(--surface);
    box-shadow: none;
}

.ranking-index {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: var(--surface-sunk);
    color: var(--ink);
}

.ranking-index strong {
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 24px;
    line-height: 1;
}

.ranking-index span {
    font-size: 10px;
    font-weight: 600;
    color: var(--ink-faint);
    margin-top: 4px;
}

.ranking-row:first-child .ranking-index {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.ranking-body {
    padding: 18px 20px;
}

.ranking-body h3 {
    margin-bottom: 8px;
}

/* ---------- motion — restrained: short distances, no bounce ---------- */

.reveal {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 360ms var(--ease-out), transform 360ms var(--ease-out);
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* ---------- responsive ---------- */

@media (max-width: 1199.98px) {
    .site-navbar-shell {
        flex-wrap: wrap;
        padding: 14px 0;
    }

    .site-navbar .navbar-collapse {
        width: 100%;
        margin-top: 12px;
        margin-bottom: 0;
        padding: 14px;
        background: var(--surface-sunk);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: none;
    }

    .site-nav-shell {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding-bottom: 0;
    }

    .site-nav {
        flex-direction: column;
        align-items: stretch;
    }

    .site-nav .nav-link {
        justify-content: space-between;
        padding: 11px 14px;
    }

    .site-nav-dropdown-menu {
        position: static !important;
        transform: none !important;
        width: 100%;
        margin-top: 8px;
        box-shadow: none;
    }

    .site-utility {
        justify-content: flex-start;
        width: 100%;
        padding-top: 12px;
        border-top: 1px solid var(--border);
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .auth-shell {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991.98px) {
    .site-container {
        padding-top: 18px;
        padding-bottom: 52px;
    }

    .page-hero,
    .hero {
        padding: 20px;
    }

    .resource-hero {
        padding: 18px;
    }

    .resource-hero-strip {
        flex-direction: column;
        align-items: stretch;
        padding: 14px 16px;
    }

    .hero-visual {
        min-height: 200px;
    }

    .hero-floating-card {
        position: static;
        margin-top: 16px;
        max-width: none;
    }

    .mini-resource {
        grid-template-columns: 1fr;
    }

    .mini-resource-thumb img {
        min-height: 180px;
        height: 180px;
    }

    .detail-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sticky-panel {
        position: static;
    }

    .footer_cta {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 767.98px) {
    .site-topbar-inner,
    .site-topbar-meta,
    .site-topbar-actions,
    .page-intro,
    .hero-search,
    .search-row,
    .card-actions,
    .action-cluster,
    .copy-right_text .d-flex {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-topbar .container-fluid,
    .site-navbar .container-fluid {
        padding-left: 16px;
        padding-right: 16px;
    }

    .site-topbar-meta,
    .site-topbar-actions {
        width: 100%;
    }

    .hero-search .form-control,
    .search-row .form-control {
        flex-basis: auto;
        width: 100%;
    }

    .quick-filter-row .form-select,
    .quick-filter-row .form-control {
        max-width: none;
        width: 100%;
    }

    .site-user-pill {
        min-width: 0;
        border-left: none;
        padding-left: 0;
    }

    .site-brand-title {
        font-size: 18px;
    }

    .page-hero h1,
    .hero h1,
    .section-heading {
        font-size: clamp(1.5rem, 1.2rem + 3vw, 1.9rem);
    }

    .resource-hero .lead {
        font-size: 14px;
        line-height: 1.55;
    }

    .resource-hero .meta-badge {
        width: 100%;
    }

    .resource-hero-stats {
        grid-template-columns: 1fr;
    }

    .resource-metric-inline {
        padding: 10px 0;
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .resource-metric-inline:first-child {
        padding-top: 0;
        border-top: none;
    }

    .resource-metric-inline:last-child {
        padding-bottom: 0;
    }

    .metric-grid,
    .quick-link-grid,
    .detail-stat-grid,
    .share-action-grid {
        grid-template-columns: 1fr;
    }

    .card .card-body,
    .auth-card .card-body {
        padding: 20px 18px;
    }

    .footer-search {
        flex-direction: column;
    }

    .footer-search input,
    .footer-search button {
        width: 100%;
        border-radius: var(--radius-sm);
    }

    .footer-search input {
        border-right: 1px solid rgba(255, 255, 255, 0.14);
    }

    .footer-search button {
        margin-top: 10px;
    }

    .ranking-row {
        grid-template-columns: 1fr;
    }

    .ranking-index {
        flex-direction: row;
        gap: 8px;
        padding: 12px 16px;
    }

    .mini-resource-body,
    .mini-resource-price {
        text-align: left;
    }

    .mini-resource-head,
    .summary-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 575.98px) {
    .page-hero,
    .hero {
        padding: 18px;
    }

    .metric-tile,
    .soft-panel {
        padding: 16px;
    }

    .mini-resource-body {
        padding: 18px;
    }

    .btn,
    .btn-sm,
    .site-utility-button {
        width: 100%;
    }

    .form-control,
    .form-select {
        min-height: 46px;
    }
}
