:root {
  --lh-primary: #1e3a5f;
  --lh-accent: #2f9e44;
  --lh-light: #f4f7f9;
}
body { background-color: var(--lh-light); }
.navbar-brand { font-weight: 700; letter-spacing: .5px; }
.lh-navbar { background-color: var(--lh-primary) !important; }
.btn-primary { background-color: var(--lh-primary); border-color: var(--lh-primary); }
.btn-primary:hover { background-color: #16283f; border-color: #16283f; }
.btn-accent { background-color: var(--lh-accent); border-color: var(--lh-accent); color: #fff; }
.card { border: none; box-shadow: 0 1px 4px rgba(0,0,0,.08); border-radius: 10px; }
.badge-pending { background-color: #f0ad4e; }
.badge-approved { background-color: var(--lh-accent); }
.badge-rejected { background-color: #c0392b; }
.chat-bubble-user { background-color: var(--lh-primary); color: #fff; border-radius: 14px 14px 2px 14px; padding: .6rem 1rem; max-width: 75%; margin-left: auto; }
.chat-bubble-ai { background-color: #fff; border: 1px solid #e2e6ea; border-radius: 14px 14px 14px 2px; padding: .6rem 1rem; max-width: 75%; }
#chatWindow { height: 60vh; overflow-y: auto; }
.subject-card:hover { transform: translateY(-2px); transition: .15s; cursor: pointer; }

/* ============================================================
   Dashboard shell (sidebar + topbar) — learner / teacher / admin
   Warm cream + orange theme
   ============================================================ */
:root {
  --lh-ink: #2b2117;
  --lh-muted: #a39a8f;
  --lh-line: #f0e9e0;
  --lh-surface: #ffffff;
  --lh-canvas: #fbf6f0;
  --lh-orange: #ff5a1f;
  --lh-orange-dark: #e8480f;
  --lh-orange-soft: #fff0e6;
  --lh-orange-soft-ink: #d1490f;
  --lh-yellow: #fff3d6;   --lh-yellow-ink: #b3791a;
  --lh-lavender: #efe9fb; --lh-lavender-ink: #7c5ce0;
  --lh-pink: #fdeaf0;     --lh-pink-ink: #d6437e;
  --lh-blue: #e9f2fb;     --lh-blue-ink: #2b7fc4;
}
body.dash-body { background: var(--lh-canvas); font-family: 'Inter', sans-serif; padding: 0; min-height: 100vh; }
.dash-h, h1.dash-h, h2.dash-h, h3.dash-h, h4.dash-h, h5.dash-h, h6.dash-h { font-family: 'Poppins', sans-serif; color: var(--lh-ink); }

.dash-shell { display: flex; align-items: flex-start; max-width: 100%; margin: 0; background: var(--lh-surface); border-radius: 0; overflow: hidden; box-shadow: none; }

.dash-sidebar {
  width: 240px; flex-shrink: 0; background: var(--lh-surface);
  border-right: 1px solid var(--lh-line); min-height: 100vh;
  position: sticky; top: 0; padding: 1.5rem 1.1rem; display: flex; flex-direction: column;
}
.dash-brand-row { display: flex; align-items: center; justify-content: space-between; gap: .4rem; padding: .4rem .2rem 1.4rem; }
.dash-brand { display: flex; align-items: center; gap: .55rem; font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--lh-ink); overflow: hidden; }
.dash-brand i { color: var(--lh-orange); font-size: 1.25rem; flex-shrink: 0; }
.dash-brand .brand-text { white-space: nowrap; }
.dash-sidebar-toggle {
  border: 1px solid var(--lh-line); background: #fff; color: var(--lh-muted);
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; transition: .15s;
}
.dash-sidebar-toggle:hover { background: var(--lh-canvas); color: var(--lh-ink); }
.dash-sidebar-toggle i { transition: transform .18s ease; }
.dash-navlink-text { white-space: nowrap; }
.dash-nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--lh-muted); font-weight: 700; margin: 0 .5rem .5rem; }
.dash-nav { list-style: none; padding: 0; margin: 0; flex: 1; }
.dash-nav li { margin-bottom: .2rem; }
.dash-navlink {
  display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; border-radius: 11px;
  color: #7d7369; text-decoration: none; font-weight: 500; font-size: .9rem; transition: .15s;
}
.dash-navlink i { font-size: 1.05rem; width: 1.1rem; text-align: center; }
.dash-navlink:hover { background: var(--lh-canvas); color: var(--lh-ink); }
.dash-navlink.active { background: var(--lh-orange); color: #fff; font-weight: 600; box-shadow: 0 6px 14px rgba(255,90,31,.35); }
.dash-nav-divider { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--lh-muted); font-weight: 700; margin: 1rem .8rem .35rem; }
.dash-upgrade { background: linear-gradient(160deg, #ff8a4c, var(--lh-orange-dark)); border-radius: 16px; padding: 1.1rem; color: #fff; margin-top: .5rem; position: relative; overflow: hidden; }
.dash-upgrade h6 { font-family: 'Poppins', sans-serif; font-weight: 600; margin-bottom: .3rem; }
.dash-upgrade p { font-size: .78rem; color: #ffe4d2; margin-bottom: .8rem; }
.dash-upgrade a { display: inline-block; font-size: .8rem; font-weight: 600; background: #fff; color: var(--lh-orange-dark); padding: .4rem .9rem; border-radius: 8px; text-decoration: none; }

.dash-main { flex: 1; min-width: 0; padding: 1.5rem 1.8rem 2.5rem; background: var(--lh-canvas); }
.dash-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.dash-topbar h3 { font-family: 'Poppins', sans-serif; font-weight: 600; margin: 0; color: var(--lh-ink); }
.dash-topbar .sub { color: var(--lh-muted); font-size: .86rem; margin-top: .1rem; }
.dash-search { display: flex; align-items: center; gap: .5rem; background: #fff; border: 1px solid var(--lh-line); border-radius: 999px; padding: .55rem 1rem; flex: 1; max-width: 340px; }
.dash-search input { border: none; outline: none; background: transparent; font-size: .85rem; flex: 1; color: var(--lh-ink); }
.dash-search i { color: var(--lh-muted); }
.dash-icon-btn { width: 38px; height: 38px; border-radius: 50%; background: #fff; border: 1px solid var(--lh-line); display: flex; align-items: center; justify-content: center; color: var(--lh-ink); text-decoration: none; flex-shrink: 0; }
.dash-icon-btn:hover { background: var(--lh-orange-soft); color: var(--lh-orange-dark); }
.dash-user-chip { display: flex; align-items: center; gap: .55rem; }
.dash-user-chip .avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--lh-orange); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8rem; }
.dash-user-chip .name { font-size: .85rem; font-weight: 600; color: var(--lh-ink); line-height: 1.1; }
.dash-user-chip .role { font-size: .72rem; color: var(--lh-muted); text-transform: capitalize; }

.stat-card { border-radius: 18px; padding: 1.2rem 1.3rem; border: none; height: 100%; }
.stat-card .stat-icon { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.55); font-size: 1.1rem; margin-bottom: .9rem; }
.stat-card .stat-value { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.65rem; color: var(--lh-ink); line-height: 1; }
.stat-card .stat-label { font-size: .82rem; color: rgba(43,33,23,.6); margin-top: .35rem; font-weight: 500; }
.stat-card.stat-yellow { background: var(--lh-yellow); } .stat-card.stat-yellow .stat-icon { color: var(--lh-yellow-ink); }
.stat-card.stat-lavender { background: var(--lh-lavender); } .stat-card.stat-lavender .stat-icon { color: var(--lh-lavender-ink); }
.stat-card.stat-pink { background: var(--lh-pink); } .stat-card.stat-pink .stat-icon { color: var(--lh-pink-ink); }
.stat-card.stat-blue { background: var(--lh-blue); } .stat-card.stat-blue .stat-icon { color: var(--lh-blue-ink); }
.stat-card.stat-orange { background: var(--lh-orange-soft); } .stat-card.stat-orange .stat-icon { color: var(--lh-orange-dark); }

.dash-panel { background: #fff; border-radius: 18px; padding: 1.3rem 1.4rem; border: 1px solid var(--lh-line); }
.dash-panel-title { font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 1rem; color: var(--lh-ink); }
.dash-panel-link { font-size: .8rem; color: var(--lh-muted); text-decoration: none; font-weight: 500; }
.dash-panel-link:hover { color: var(--lh-orange); }

.item-row { display: flex; align-items: center; gap: .9rem; padding: .75rem .6rem; border-radius: 12px; text-decoration: none; color: inherit; }
.item-row:hover { background: var(--lh-canvas); }
.item-row .item-icon { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0; }
.item-row .item-title { font-weight: 600; font-size: .9rem; color: var(--lh-ink); }
.item-row .item-meta { font-size: .78rem; color: var(--lh-muted); }
.progress-thin { height: 6px; border-radius: 999px; background: #f1ece5; overflow: hidden; margin-top: .35rem; }
.progress-thin > span { display: block; height: 100%; border-radius: 999px; background: var(--lh-orange); }

.badge-soft { font-size: .7rem; font-weight: 600; padding: .28rem .6rem; border-radius: 999px; }
.badge-soft.pending { background: #fdf0d9; color: #a8791a; }
.badge-soft.approved { background: #e2f5e8; color: #1f8a4c; }
.badge-soft.rejected { background: #fde5e5; color: #c0392b; }

.quick-tile { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; border-radius: 14px; background: #fff; border: 1px solid var(--lh-line); text-decoration: none; color: inherit; transition: .15s; height: 100%; }
.quick-tile:hover { border-color: var(--lh-orange); transform: translateY(-2px); }
.quick-tile .quick-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; flex-shrink: 0; }
.quick-tile .quick-title { font-weight: 600; font-size: .88rem; color: var(--lh-ink); }
.quick-tile .quick-sub { font-size: .76rem; color: var(--lh-muted); }

/* Course / resource cards (Continue Learning + Explore Resources) */
.course-card { background: var(--lh-canvas); border-radius: 16px; padding: 1.1rem 1.2rem; height: 100%; }
.course-card .course-icon { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; margin-bottom: .7rem; }
.course-card .course-cat { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--lh-muted); font-weight: 700; }
.course-card .course-title { font-family: 'Poppins', sans-serif; font-weight: 600; font-size: .96rem; color: var(--lh-ink); margin: .2rem 0 .7rem; }
.course-card .course-meta { display: flex; justify-content: space-between; font-size: .76rem; color: var(--lh-muted); margin-top: .5rem; }
.course-card .course-cta { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; font-weight: 600; color: var(--lh-orange); text-decoration: none; margin-top: .7rem; }
.course-card .course-cta:hover { color: var(--lh-orange-dark); }

.resource-card { border: 1px solid var(--lh-line); border-radius: 16px; overflow: hidden; background: #fff; height: 100%; text-decoration: none; color: inherit; display: block; transition: .15s; }
.resource-card:hover { border-color: var(--lh-orange); transform: translateY(-2px); }
.resource-card .resource-thumb { height: 96px; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; color: #fff; }
.resource-card .resource-body { padding: .8rem .9rem 1rem; }
.resource-card .resource-title { font-weight: 600; font-size: .88rem; color: var(--lh-ink); margin-bottom: .2rem; }
.resource-card .resource-sub { font-size: .76rem; color: var(--lh-muted); }

/* Profile card + stat chips (right column) */
.profile-card { text-align: center; padding: 1.2rem 1rem; }
.profile-card .avatar-lg { width: 64px; height: 64px; border-radius: 50%; background: var(--lh-orange); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.3rem; margin: 0 auto .7rem; }
.profile-card .p-name { font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 1rem; color: var(--lh-ink); }
.profile-card .p-role { font-size: .78rem; color: var(--lh-muted); text-transform: capitalize; margin-bottom: .9rem; }
.stat-chip-row { display: flex; gap: .6rem; }
.stat-chip { flex: 1; background: var(--lh-canvas); border-radius: 12px; padding: .65rem .3rem; text-align: center; }
.stat-chip .chip-value { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--lh-ink); }
.stat-chip .chip-label { font-size: .66rem; color: var(--lh-muted); text-transform: uppercase; letter-spacing: .03em; margin-top: .1rem; }

.mini-bar-row { display: flex; align-items: center; gap: .7rem; margin-bottom: .6rem; }
.mini-bar-row .mini-bar-label { font-size: .78rem; color: var(--lh-muted); width: 76px; flex-shrink: 0; }
.mini-bar-track { flex: 1; height: 8px; border-radius: 999px; background: #f1ece5; overflow: hidden; }
.mini-bar-track > span { display: block; height: 100%; border-radius: 999px; }
.mini-bar-row .mini-bar-value { font-size: .78rem; font-weight: 600; color: var(--lh-ink); width: 26px; text-align: right; flex-shrink: 0; }

.dash-sidebar { transition: width .18s ease, padding .18s ease; }

@media (min-width: 901px) {
  .dash-sidebar.collapsed { width: 78px; padding-left: .6rem; padding-right: .6rem; }
  .dash-sidebar.collapsed .brand-text,
  .dash-sidebar.collapsed .dash-nav-label,
  .dash-sidebar.collapsed .dash-nav-divider,
  .dash-sidebar.collapsed .dash-navlink-text,
  .dash-sidebar.collapsed .dash-upgrade { display: none; }
  .dash-sidebar.collapsed .dash-brand-row { justify-content: center; }
  .dash-sidebar.collapsed .dash-sidebar-toggle i { transform: rotate(180deg); }
  .dash-sidebar.collapsed .dash-navlink { justify-content: center; padding: .65rem; }
}

/* Document viewer "focus mode" — the sidebar disappears entirely so the
   reading area gets the full width. A tap on the (now always-visible)
   topbar menu button slides it back in as a temporary overlay. */
.doc-focus-mode .dash-shell { max-width: 1600px; }
.doc-focus-mode .dash-sidebar { display: none; }
.doc-focus-mode .dash-mobile-toggle { display: inline-flex !important; }
.doc-focus-mode .dash-sidebar.open {
  display: flex; position: fixed; top: 0; left: 0; height: 100vh; z-index: 1050;
  width: 240px; padding: 1.5rem 1.1rem; transform: translateX(0);
  box-shadow: 10px 0 30px rgba(0,0,0,.15);
}
.doc-focus-mode .dash-sidebar.open.collapsed .brand-text,
.doc-focus-mode .dash-sidebar.open.collapsed .dash-nav-label,
.doc-focus-mode .dash-sidebar.open.collapsed .dash-nav-divider,
.doc-focus-mode .dash-sidebar.open.collapsed .dash-navlink-text,
.doc-focus-mode .dash-sidebar.open.collapsed .dash-upgrade { display: block; }
.doc-focus-mode .dash-sidebar.open.collapsed .dash-brand-row { justify-content: space-between; }
.doc-focus-mode .dash-sidebar.open.collapsed .dash-navlink { justify-content: flex-start; padding: .6rem .8rem; }

@media (max-width: 900px) {
  body.dash-body { padding: 0; }
  .dash-shell { border-radius: 0; }
  .dash-sidebar { position: fixed; z-index: 1050; transform: translateX(-100%); transition: .2s; box-shadow: 0 0 0 100vmax rgba(0,0,0,0); }
  .dash-sidebar.open { transform: translateX(0); box-shadow: 10px 0 30px rgba(0,0,0,.15); }
  .dash-main { padding: 1.2rem 1rem 3rem; }
  .dash-mobile-toggle { display: inline-flex !important; }
  .dash-search { display: none; }
}
.dash-mobile-toggle { display: none; border: 1px solid var(--lh-line); background: #fff; border-radius: 10px; width: 38px; height: 38px; align-items: center; justify-content: center; }

/* ============================================================
   AI Resource Shelf
   ============================================================ */
.ai-banner { background: linear-gradient(120deg, #fff, var(--lh-orange-soft)); border: 1px solid var(--lh-line); border-radius: 18px; padding: 1.1rem 1.3rem; display: flex; align-items: center; gap: 1rem; margin-bottom: 1.4rem; }
.ai-banner .ai-banner-icon { width: 46px; height: 46px; border-radius: 13px; background: var(--lh-orange); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.ai-banner .ai-banner-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--lh-orange-dark); font-weight: 700; }
.ai-banner .ai-banner-msg { font-size: .92rem; color: var(--lh-ink); font-weight: 500; }
.ai-banner .ai-banner-cta { margin-left: auto; flex-shrink: 0; }

.shelf-controls { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.term-pill { border: 1px solid var(--lh-line); background: #fff; color: var(--lh-muted); font-size: .82rem; font-weight: 600; padding: .45rem 1rem; border-radius: 999px; cursor: pointer; transition: .15s; }
.term-pill:hover { border-color: var(--lh-orange); color: var(--lh-orange-dark); }
.term-pill.active { background: var(--lh-orange); border-color: var(--lh-orange); color: #fff; }
.year-select { border: 1px solid var(--lh-line); background: #fff; border-radius: 999px; padding: .43rem .9rem; font-size: .82rem; font-weight: 600; color: var(--lh-ink); }

.shelf-section { background: #fff; border: 1px solid var(--lh-line); border-radius: 18px; margin-bottom: 1rem; overflow: hidden; }
.shelf-header { display: flex; align-items: center; gap: .9rem; padding: 1.1rem 1.3rem; cursor: pointer; user-select: none; }
.shelf-header .shelf-tile { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; color: #fff; flex-shrink: 0; }
.shelf-header .shelf-title { font-family: 'Poppins', sans-serif; font-weight: 600; font-size: .98rem; color: var(--lh-ink); }
.shelf-header .shelf-sub { font-size: .78rem; color: var(--lh-muted); }
.shelf-header .shelf-chevron { margin-left: auto; color: var(--lh-muted); transition: .2s; flex-shrink: 0; }
.shelf-section.open .shelf-chevron { transform: rotate(180deg); }
.shelf-body { display: none; padding: 0 1.3rem 1.3rem; }
.shelf-section.open .shelf-body { display: block; }
.shelf-subhead { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--lh-muted); font-weight: 700; margin: .8rem 0 .6rem; }

.shelf-card { background: var(--lh-canvas); border-radius: 14px; overflow: hidden; height: 100%; display: block; text-decoration: none; color: inherit; transition: .15s; }
.shelf-card:hover { transform: translateY(-2px); }
.shelf-thumb { height: 74px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; position: relative; }
.shelf-thumb .shelf-thumb-badge { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.28); color: #fff; font-size: .62rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; }
.shelf-card-body { padding: .7rem .8rem .85rem; }
.shelf-card-title { font-weight: 600; font-size: .84rem; color: var(--lh-ink); margin-bottom: .15rem; line-height: 1.25; }
.shelf-card-meta { font-size: .72rem; color: var(--lh-muted); }
.shelf-card-cta { display: inline-flex; align-items: center; gap: .25rem; font-size: .76rem; font-weight: 600; color: var(--lh-orange); margin-top: .4rem; }

/* ============================================================
   Resource viewer (PDF / DOCX reader + AI summary)
   ============================================================ */
.viewer-frame-wrap { background: #e9e4dc; border-radius: 16px; overflow: hidden; height: 78vh; min-height: 420px; display: flex; align-items: center; justify-content: center; }
.viewer-frame-wrap iframe, .viewer-frame-wrap img { width: 100%; height: 100%; border: none; object-fit: contain; }
.doc-reader { background: #fff; border-radius: 16px; padding: 2.2rem 2.6rem; max-height: 78vh; overflow-y: auto; font-family: Georgia, 'Times New Roman', serif; font-size: .96rem; line-height: 1.7; color: #2b2117; white-space: pre-wrap; }
.viewer-unsupported { background: var(--lh-canvas); border-radius: 16px; padding: 3rem 2rem; text-align: center; }
.viewer-unsupported .viewer-unsupported-icon { width: 60px; height: 60px; border-radius: 16px; background: var(--lh-orange-soft); color: var(--lh-orange-dark); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; margin: 0 auto 1rem; }

.ai-summary-panel { background: linear-gradient(160deg, #fff, var(--lh-orange-soft)); border: 1px solid var(--lh-line); border-radius: 16px; padding: 1.2rem 1.3rem; }
.ai-summary-panel .ai-summary-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.ai-summary-panel .ai-summary-head i { color: var(--lh-orange); }
.ai-summary-body { font-size: .86rem; color: var(--lh-ink); line-height: 1.6; white-space: pre-wrap; }
.ai-summary-loading { display: flex; align-items: center; gap: .5rem; color: var(--lh-muted); font-size: .85rem; }
.ai-summary-tag { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .18rem .5rem; border-radius: 999px; }
.ai-summary-tag.real { background: #e2f5e8; color: #1f8a4c; }
.ai-summary-tag.fallback { background: #fdf0d9; color: #a8791a; }
