/* Studentgator brand tokens, copied from SG Manager Analyst (which copies the CRM). Light only,
   like the CRM. Layout: one top bar, one column of cards. */
:root {
  --Prim-500: #701CBF; --Prim-500-rgb: 112, 28, 191; --Prim-50: #F3E9FC; --Prim-100: #EAD7FA; --Prim-200: #E6D3F8;
  --Prim-600: #5C17A0; --Prim-700: #4E1485; --primary-color: #7E61D5; --blue-600: #3282D2;
  --gradient-primary-dark: linear-gradient(90deg, #5F46B5 0%, #1C1335 100%);
  --Shadowed-Card: linear-gradient(180deg, rgba(254, 254, 255, 0.90) 79.33%, rgba(244, 239, 241, 0.90) 100%);
  --Greyscale-900: #212121; --Detail-ink: #1A1A1A; --Detail-muted: #66666B; --Detail-border: #E5E5EB; --sg-bg: #F7F4FB;
  --sg-positive: #2E9E2E; --sg-negative: #D94A4A; --sg-warning: #B7791F;
  --inter: "Inter", system-ui, sans-serif; --sora: "Sora", "Inter", system-ui, sans-serif;
  /* roles used by the pages */
  --accent: var(--Prim-500); --second: var(--blue-600); --grid: #EEE7F7;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--sg-bg); color: var(--Detail-ink); font: 14px/1.45 var(--inter); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--sora); }
h1 { font-size: 22px; font-weight: 600; text-wrap: balance; }
h2 { font-size: 15px; font-weight: 600; text-wrap: balance; }
a { color: var(--Prim-500); }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
select { background: #fff; border: 1px solid var(--Detail-border); border-radius: 10px; padding: 7px 10px; }
:focus-visible { outline: 2px solid var(--Prim-500); outline-offset: 2px; }
.logo-row, .mobile-logo { display: flex; align-items: center; gap: 12px; }
.wordmark { display: block; height: 26px; width: auto; }
.pill { padding: 4px 10px; border-radius: 999px; font: 600 13px/1.2 var(--sora); background: var(--Prim-50); color: var(--Prim-700); }

/* ---------- sign-in (same screen as SG Manager Analyst) ---------- */
.login-page { display: grid; grid-template-columns: minmax(360px, 46%) 1fr; min-height: 100dvh; }
.brand { position: relative; overflow: hidden; color: #fff; background: var(--gradient-primary-dark); display: flex; align-items: center; padding: 56px; }
.brand::before, .brand::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.brand::before { width: 420px; height: 420px; right: -140px; top: -120px; }
.brand::after { width: 300px; height: 300px; left: -100px; bottom: -110px; }
.brand-inner { position: relative; max-width: 440px; }
.brand .wordmark { height: 34px; }
.brand .pill { background: rgba(255, 255, 255, .16); color: #fff; }
.brand h1 { font: 600 36px/1.2 var(--sora); margin: 40px 0 14px; letter-spacing: -.01em; }
.brand .lead { font-size: 16px; line-height: 1.5; opacity: .88; margin: 0 0 28px; }
.brand ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.brand li { display: flex; align-items: center; gap: 12px; }
.brand li::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 3px; background: rgba(255, 255, 255, .5); }
.panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--Detail-border); border-radius: 20px;
  padding: 36px 32px; box-shadow: 0 12px 40px rgba(var(--Prim-500-rgb), .10); }
.mobile-logo { display: none; margin-bottom: 24px; }
.login-card h2 { font: 600 24px/1.25 var(--sora); color: var(--Greyscale-900); margin: 0 0 6px; }
.login-card .sub { color: var(--Detail-muted); margin: 0 0 22px; }
.login-card .sub strong { color: var(--Detail-ink); font-weight: 600; }
.login-card form { display: flex; flex-direction: column; }
.login-card label { font-weight: 500; margin: 0 0 6px; }
.field { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 6px 0 14px; margin-bottom: 16px;
  border: 1px solid var(--Detail-border); border-radius: 12px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.field:focus-within { border-color: var(--Prim-500); box-shadow: 0 0 0 3px rgba(var(--Prim-500-rgb), .12); }
.field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; height: 100%; }
.field.code input { letter-spacing: .3em; font-weight: 600; }
.eye { border: 0; background: none; padding: 8px 10px; border-radius: 8px; color: var(--Detail-muted); font-size: 13px; }
.eye:hover { background: var(--Prim-50); color: var(--Prim-500); }
.submit { height: 48px; border: 0; border-radius: 12px; margin-top: 4px; background: var(--Prim-500); color: #fff; font-weight: 500; font-size: 15px; }
.submit:hover { background: var(--Prim-600); }
.submit:disabled { opacity: .7; cursor: progress; }
.form-error { padding: 10px 12px; margin: -4px 0 14px; border-radius: 10px; background: #FDECEC; color: #B3261E; }
.note { padding: 10px 12px; margin: 0 0 18px; border-radius: 10px; background: var(--Prim-50); color: var(--Prim-700); }
.back { border: 0; background: none; padding: 0; margin: -6px 0 18px; color: var(--Prim-500); font-weight: 500; align-self: flex-start; }
.hint { font-size: 12px; color: var(--Detail-muted); text-align: center; margin: 14px 0 0; }
.foot { font-size: 12px; color: var(--Detail-muted); margin-top: 20px; }
@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .brand { display: none; }
  .mobile-logo { display: flex; }
  .login-card { padding: 28px 22px; border-radius: 18px; }
}

/* ---------- app ---------- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px max(16px, calc((100vw - 1180px) / 2)); background: #fff; border-bottom: 1px solid var(--Detail-border); }
.top nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.top nav a { padding: 7px 14px; border-radius: 999px; color: var(--Detail-muted); text-decoration: none; font-weight: 500; }
.top nav a:hover { background: var(--Prim-50); }
.top nav a[aria-current="page"] { background: var(--Prim-50); color: var(--Prim-700); }
.who { color: var(--Detail-muted); font-size: 13px; }
button.quiet { background: #fff; color: var(--Prim-500); border: 1px solid var(--Detail-border); border-radius: 10px; padding: 7px 14px; font-weight: 500; }
button.quiet:hover { background: var(--Prim-50); }
.count { background: var(--sg-negative); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 12px; }

#page { max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; display: flex; flex-direction: column; gap: 16px; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sub { color: var(--Detail-muted); font-size: 13px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; color: var(--Detail-muted); font-size: 13px; }
.banner { background: #FDECEC; color: #B3261E; border-radius: 10px; padding: 10px 12px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile, .card { border: 1px solid var(--Detail-border); border-radius: 16px; background: var(--Shadowed-Card); min-width: 0;
  box-shadow: 0 1px 2px rgba(var(--Prim-500-rgb), .04), 0 4px 16px rgba(var(--Prim-500-rgb), .05); }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; }
.tile .label { color: var(--Detail-muted); font-size: 13px; }
.tile .num { font: 600 26px/1.2 var(--sora); color: var(--Greyscale-900); font-variant-numeric: tabular-nums; }
.tile .note { background: none; padding: 0; margin: 0; color: var(--Detail-muted); font-size: 12px; }
.tile.attention .num { color: var(--sg-negative); }
.meter { height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; margin-top: 6px; }
.meter > i { display: block; height: 100%; background: var(--Prim-500); }
.meter.warn > i { background: var(--sg-warning); } .meter.bad > i { background: var(--sg-negative); }

.card { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.legend { display: flex; gap: 14px; color: var(--Detail-muted); font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
svg.chart { display: block; width: 100%; height: auto; }
svg.chart text { fill: var(--Detail-muted); font-size: 11px; font-variant-numeric: tabular-nums; }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .value { color: var(--Detail-muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-row .track { grid-column: 1 / -1; height: 8px; display: flex; gap: 2px; }
.bar-row .track i { display: block; height: 100%; border-radius: 3px; background: var(--accent); min-width: 2px; }
.bar-row .track i.second { background: var(--second); }

.scroll { overflow-x: auto; max-height: 560px; overflow-y: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--Detail-border); text-align: right; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--Prim-50); color: var(--Prim-700); font-weight: 600; }
th:first-child, td:first-child { text-align: left; white-space: normal; min-width: 200px; }
td.left, th.left { text-align: left; }
.status { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; border: 1px solid var(--Detail-border); color: var(--Detail-muted); background: #fff; }
.status.on { color: var(--sg-positive); border-color: var(--sg-positive); }
.status.open { color: var(--sg-negative); border-color: var(--sg-negative); }
.empty { color: var(--Detail-muted); padding: 8px 0; }

.alert-list { display: flex; flex-direction: column; }
.alert { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--Detail-border); align-items: baseline; }
.alert:last-child { border-bottom: 0; }
.alert time { color: var(--Detail-muted); font-size: 12px; white-space: nowrap; }

.reviews { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .reviews { grid-template-columns: 1fr; } }
.review-list { gap: 2px; }
.review-list button { border: 0; background: none; text-align: left; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.review-list button:hover, .review-list button[aria-current="true"] { background: var(--Prim-50); }
.review-list small { color: var(--Detail-muted); }
/* Rendered agent markdown: same look as the analyst's answers. */
.report { line-height: 1.6; overflow-wrap: anywhere; font-size: 15px; }
.report h1, .report h2, .report h3, .report h4 { font: 600 16px/1.3 var(--sora); margin: 16px 0 6px; }
.report > :first-child { margin-top: 0; }
.report p, .report ul, .report ol { margin: 0 0 10px; max-width: 75ch; }
.report ul, .report ol { padding-left: 22px; }
.report li::marker { color: var(--Prim-500); }
.report strong { color: var(--Greyscale-900); font-weight: 600; }
.report code { font-size: .9em; padding: 1px 5px; border-radius: 4px; background: var(--Prim-50); color: var(--Prim-700); }
.report table { display: block; max-width: 100%; overflow-x: auto; margin: 0 0 12px; width: auto; }
.report th, .report td { border: 1px solid var(--Detail-border); text-align: left; position: static; }
.report th:first-child, .report td:first-child { min-width: 0; }

.tip { position: fixed; pointer-events: none; z-index: 20; background: #fff; border: 1px solid var(--Detail-border); border-radius: 10px;
  padding: 6px 9px; font-size: 12px; box-shadow: 0 4px 16px rgba(var(--Prim-500-rgb), .12); white-space: pre; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; }
.chat-log { display: flex; flex-direction: column; gap: 10px; min-height: 240px; }
.msg { max-width: min(760px, 92%); padding: 10px 14px; border-radius: 16px; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--Prim-500); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--Detail-border); border-bottom-left-radius: 4px; }
.msg.step { align-self: flex-start; padding: 0 4px; color: var(--Detail-muted); font-size: 12px; }
.msg.step::before { content: "✓ "; color: var(--sg-positive); }
.msg.working { align-self: flex-start; padding: 0 4px; color: var(--Prim-700); font-size: 13px; }
.msg.working::after { content: "…"; animation: dots 1.2s steps(3, end) infinite; display: inline-block; overflow: hidden; vertical-align: bottom; width: 1.2em; }
@keyframes dots { from { width: 0; } to { width: 1.2em; } }
@media (prefers-reduced-motion: reduce) { .msg.working::after { animation: none; } }
.chat-form { display: flex; gap: 10px; align-items: flex-end; position: sticky; bottom: 12px; background: #fff; padding: 10px;
  border: 1px solid var(--Detail-border); border-radius: 16px; box-shadow: 0 4px 16px rgba(var(--Prim-500-rgb), .08); }
.chat-form:focus-within { border-color: var(--Prim-500); }
.chat-form textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: transparent; font: inherit; font-size: 15px; max-height: 160px; }
.primary { border: 0; border-radius: 12px; background: var(--Prim-500); color: #fff; font-weight: 500; padding: 9px 16px; }
.primary:hover { background: var(--Prim-600); }
.primary:disabled { opacity: .55; cursor: not-allowed; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestions button { border: 1px solid var(--Prim-200); background: var(--Prim-50); color: var(--Prim-700); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.confirm { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--Prim-50); color: var(--Prim-700); border-radius: 12px; padding: 10px 12px; }
.confirm p { flex: 1; min-width: 220px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
