/* AtVITE module apps — shared design system (Talent & Jobs / Research /
 * Learning). Loaded by jobs/index.html, research/index.html and
 * learning/index.html, which frame these pages inside the SPA shell at their
 * routes. Visual language mirrors the frozen SPA bundles (dark slate theme)
 * so the embedded page reads as one product. Per-app accent via --acc.
 *
 * CSP: this file is 'self'-loaded; no inline styles beyond what the clients
 * set explicitly for data-driven widths/colors.
 */

:root {
  --bg: #020617;          /* slate-950 */
  --panel: #0f172a;       /* slate-900 */
  --panel-2: #111c31;
  --line: #1e293b;        /* slate-800 */
  --line-2: #293548;
  --txt: #e2e8f0;         /* slate-200 */
  --muted: #94a3b8;       /* slate-400 */
  --dim: #7d8ca4;         /* slate-500 lightened — AA on slate-950/900 */
  --acc: #818cf8;         /* indigo-400 (per app overrides) — AA on dark panels */
  --acc-soft: rgba(99, 102, 241, .14);
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #f43f5e;
  --radius: 12px;
}

/* Light mode: the section pages follow the system color scheme, same as the
 * marketplace and the SPA shell. Slate palette inverted; per-app --acc from
 * the app stylesheet (loaded after this file) still wins, so research keeps
 * violet, learning sky and jobs amber in both modes. */
html.light {

    --bg: #f8fafc;        /* slate-50 */
    --panel: #ffffff;     /* white cards */
    --panel-2: #f1f5f9;   /* slate-100 */
    --line: #e2e8f0;      /* slate-200 */
    --line-2: #cbd5e1;    /* slate-300 */
    --txt: #0f172a;       /* slate-900 */
    --muted: #475569;     /* slate-600 */
    --dim: #5b6b83;       /* slate-500 darkened — AA on light surfaces */
    --acc: #4f46e5;       /* indigo-600 links/accents on light surfaces */
    --ok: #047857;        /* emerald-700 */
    --warn: #92400e;      /* amber-800 */
    --bad: #be123c;       /* rose-700 */
  
}

* { box-sizing: border-box; }
/* The blanket override matters: several components set display via class
 * (.authbanner uses flex, .pill uses inline-flex), and a class display value
 * beats the UA's [hidden]{display:none} — the exact Tailwind flex-vs-hidden
 * trap apps-menu.js documents. Without this, "hidden" banners/pills stay
 * visible. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 8px; font-weight: 700; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 10px; }
img { max-width: 100%; }

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 0; flex-wrap: wrap;
  padding: 10px 16px;
  background: rgba(2, 6, 23, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; letter-spacing: .02em; color: var(--txt);
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 10px; height: 10px; border-radius: 3px;
  background: var(--acc); display: inline-block;
}
.brand small { color: var(--dim); font-weight: 600; }
.topbar .spacer { flex: 1; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button {
  appearance: none; border: 1px solid transparent; background: none;
  color: var(--muted); font: inherit; font-weight: 600;
  padding: 7px 12px; border-radius: 8px; cursor: pointer;
}
.tabs button:hover { color: var(--txt); background: var(--panel); }
.tabs button.on {
  color: var(--txt); background: var(--acc-soft);
  border-color: var(--acc);
}
/* Light mode for the sticky bar — MUST come after the base .topbar rule:
 * equal specificity means source order decides, and an earlier override
 * loses to the dark background below (that bug kept the bar dark while
 * the rest of the page went light). */
html.light .topbar {
 background: rgba(248, 250, 252, .92); 
}

/* ------------------------------------------------------------------ layout */
.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 14px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.card.tight { padding: 10px 12px; }
.card h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card h2 .spacer, .row .spacer { flex: 1; }
.section-title { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin: 18px 0 8px; }

/* ------------------------------------------------------------------ cards */
.jobcard, .papercard, .coursecard {
  display: block; width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
  color: var(--txt); font: inherit; cursor: pointer;
  transition: border-color .12s ease, transform .12s ease;
}
.jobcard:hover, .papercard:hover, .coursecard:hover {
  border-color: var(--acc); text-decoration: none;
}
.jobcard { margin-bottom: 10px; }
.jobcard .jc-top { display: flex; gap: 12px; align-items: flex-start; }
.jobcard .logo {
  width: 44px; height: 44px; border-radius: 10px; flex: none;
  background: var(--panel-2); border: 1px solid var(--line);
  object-fit: cover;
}
.jobcard .jc-main { flex: 1; min-width: 0; }
.jobcard .jc-title { font-size: 15px; font-weight: 700; color: var(--txt); }
.jobcard .jc-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.jobcard .jc-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.jobcard .jc-side { text-align: right; flex: none; color: var(--dim); font-size: 12px; }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.pill.acc { color: var(--acc); border-color: var(--acc); background: var(--acc-soft); }
.pill.ok { color: var(--ok); border-color: rgba(16,185,129,.4); }
.pill.warn { color: var(--warn); border-color: rgba(245,158,11,.4); }
.pill.bad { color: var(--bad); border-color: rgba(244,63,94,.4); }

/* course cards grid */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.coursecard { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.coursecard .cover { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.coursecard .cc-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.coursecard .cc-title { font-weight: 700; font-size: 14px; color: var(--txt); }

/* ---------------------------------------------------------------- buttons */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel-2); color: var(--txt);
  border: 1px solid var(--line-2); border-radius: 8px;
  font: inherit; font-weight: 600; font-size: 13px;
  padding: 7px 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--dim); }
/* Solid indigo-600 regardless of --acc: keeps the white label ≥4.5:1 in
 * both schemes (modules that theme their own primary override this rule). */
.btn.primary { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { background: none; border-color: rgba(244, 63, 94, .5); color: var(--bad); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--txt); border-color: var(--line-2); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------------ forms */
label.fld { display: block; margin-bottom: 10px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
label.fld > input, label.fld > select, label.fld > textarea, .fld-full {
  display: block; width: 100%; margin-top: 4px;
  background: var(--bg); color: var(--txt);
  border: 1px solid var(--line-2); border-radius: 8px;
  font: inherit; padding: 8px 10px;
}
label.fld > textarea { min-height: 90px; resize: vertical; }
label.fld > input:focus, label.fld > select:focus, label.fld > textarea:focus, .fld-full:focus {
  outline: none; border-color: var(--acc);
}
.frow { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .frow { grid-template-columns: 1fr; } }
.chk { display: flex; gap: 8px; align-items: center; color: var(--txt); font-weight: 500; font-size: 13px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0 10px; }

/* filters sidebar */
.filters .fgroup { margin-bottom: 14px; }
.filters .fgroup > .ft { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); margin-bottom: 6px; }
.filters select, .filters input[type="text"], .filters input[type="number"] {
  width: 100%; background: var(--bg); color: var(--txt);
  border: 1px solid var(--line-2); border-radius: 8px; font: inherit; padding: 6px 8px;
}

/* inline selects used by filters/chip bars in every app */
.stage-sel {
  background: var(--bg); color: var(--txt);
  border: 1px solid var(--line-2); border-radius: 8px;
  font: inherit; font-size: 12.5px; padding: 5px 8px;
}

/* search bar */
.searchbar { display: flex; gap: 8px; }
.searchbar input {
  flex: 1; background: var(--bg); color: var(--txt);
  border: 1px solid var(--line-2); border-radius: 10px;
  font: inherit; padding: 10px 14px;
}
.searchbar input:focus { outline: none; border-color: var(--acc); }

/* chips (categories / fields / skills) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  appearance: none; font: inherit; font-size: 12.5px; font-weight: 600;
  background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; cursor: pointer;
}
.chip:hover { color: var(--txt); border-color: var(--dim); }
.chip.on { color: var(--acc); border-color: var(--acc); background: var(--acc-soft); }
.chip .n { color: var(--dim); font-weight: 500; margin-left: 4px; }

/* avatars */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); object-fit: cover; flex: none; }
.avatar.lg { width: 64px; height: 64px; }
.avatar.sm { width: 24px; height: 24px; }

/* misc */
.muted { color: var(--muted); }
.dim { color: var(--dim); font-size: 12.5px; }
.small { font-size: 12.5px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin: 6px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.bignum { font-size: 22px; font-weight: 800; color: var(--txt); }
.statgrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.statgrid .stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.statgrid .stat .l { color: var(--dim); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

.progress { height: 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--acc); border-radius: 999px; }

/* list rows (applications, lessons, comments…) */
.rows { display: flex; flex-direction: column; gap: 8px; }
.rowitem {
  display: flex; gap: 12px; align-items: center;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
}
.rowitem .ri-main { flex: 1; min-width: 0; }
.rowitem .ri-title { font-weight: 600; font-size: 13.5px; }
.rowitem .ri-sub { color: var(--dim); font-size: 12px; margin-top: 1px; }

/* comment thread */
.comment { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.comment:first-of-type { border-top: 0; }
.comment .c-body { flex: 1; min-width: 0; }
.comment .c-head { display: flex; align-items: baseline; gap: 8px; }
.comment .c-head b { font-size: 13px; }
.comment .c-text { margin-top: 2px; white-space: pre-wrap; word-wrap: break-word; }

/* stars */
.stars { color: var(--warn); letter-spacing: 2px; font-size: 13px; }

/* --------------------------------------------------------------- overlays */
.drawer {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(2, 6, 23, .7);
  display: none; align-items: flex-start; justify-content: center;
  padding: 5vh 16px 16px; overflow-y: auto;
}
.drawer.on { display: flex; }
.sheet {
  width: 100%; max-width: 640px;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 16px; padding: 18px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.sheet h3 { font-size: 16px; margin-bottom: 10px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--panel); color: var(--txt);
  border: 1px solid var(--acc); border-radius: 10px;
  padding: 10px 16px; font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all .2s ease; z-index: 100;
  max-width: 90vw;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* sign-in banner */
.authbanner {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--acc-soft); border: 1px solid var(--acc);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px;
}

/* skeletons */
.skel { position: relative; overflow: hidden; background: var(--panel-2); border-radius: 8px; min-height: 60px; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, .08), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.empty {
  text-align: center; color: var(--dim); padding: 26px 10px;
  border: 1px dashed var(--line-2); border-radius: var(--radius);
}
.empty b { color: var(--muted); display: block; margin-bottom: 4px; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 14px; }

/* lesson viewer / paper body prose */
.prose { line-height: 1.7; word-wrap: break-word; }
.prose p { margin: 0 0 12px; }
.prose h1, .prose h2, .prose h3 { margin: 18px 0 8px; }
.prose ul, .prose ol { margin: 0 0 12px 22px; }

/* print (certificate) */
@media print {
  body * { visibility: hidden; }
  .printzone, .printzone * { visibility: visible; }
  .printzone { position: fixed; inset: 0; background: #fff; color: #000; padding: 40px; }
}
