/* =====================================================================
   Academic Recovery Agent  -  university dashboard theme
   Light backgrounds, subtle shadows, green accent, no heavy gradients.
   ===================================================================== */

:root {
  --bg:         #f5f8f7;
  --surface:    #ffffff;
  --surface-2:  #f8faf9;
  --ink:        #16211c;
  --ink-soft:   #66786e;
  --ink-faint:  #93a49b;
  --line:       #e3eae6;
  --line-2:     #eff4f2;

  --brand:      #177950;
  --brand-dk:   #0f5b3c;
  --brand-lt:   #e8f4ee;

  --low:        #177950;  --low-bg:      #e8f4ee;  --low-br:      #bfe0cf;
  --medium:     #9a7008;  --medium-bg:   #fdf4dc;  --medium-br:   #f0dfae;
  --high:       #bd6118;  --high-bg:     #fdeee2;  --high-br:     #f2d3b7;
  --critical:   #b92d3a;  --critical-bg: #fdebed;  --critical-br: #f1c4c9;

  --radius:   12px;
  --radius-lg:16px;
  --shadow:   0 1px 2px rgba(18,52,38,.05), 0 4px 14px rgba(18,52,38,.05);
  --shadow-md:0 2px 6px rgba(18,52,38,.06), 0 12px 28px rgba(18,52,38,.08);

  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
p { margin: 0; }
a { color: inherit; }

.muted   { color: var(--ink-soft); }
.faint   { color: var(--ink-faint); }
.center  { text-align: center; }

/* =====================================================================
   BUTTONS / FIELDS
   ===================================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: .92rem;
  padding: 10px 18px; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .06s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dk); }

.btn-ghost { background: var(--surface); color: var(--brand-dk); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--brand-lt); border-color: var(--low-br); }

.btn-quiet { background: transparent; color: var(--ink-soft); border-color: var(--line); padding: 8px 14px; font-size: .86rem; }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }

.btn-danger { background: transparent; color: var(--critical); border-color: var(--critical-br); }
.btn-danger:hover { background: var(--critical-bg); }

.btn-block { width: 100%; padding: 12px 18px; }
.btn-lg    { padding: 13px 26px; font-size: 1rem; }
.btn-sm    { padding: 6px 12px; font-size: .82rem; border-radius: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  font: inherit; font-size: .94rem; width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--ink-faint); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23,121,80,.14);
}
.field .hint { font-size: .76rem; color: var(--ink-faint); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.form-msg {
  padding: 11px 14px; border-radius: 10px; font-size: .87rem;
  background: var(--brand-lt); color: var(--brand-dk); border: 1px solid var(--low-br);
}
.form-msg.error { background: var(--critical-bg); color: var(--critical); border-color: var(--critical-br); }
.form-msg.warn  { background: var(--medium-bg);   color: var(--medium);   border-color: var(--medium-br); }

/* password */
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { padding-right: 66px; }
.pw-toggle {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font: inherit; font-size: .79rem; font-weight: 600;
  color: var(--brand-dk); padding: 6px 9px; border-radius: 7px;
}
.pw-toggle:hover { background: var(--brand-lt); }

.pw-checks { list-style: none; margin: 9px 0 0; padding: 0; display: grid; gap: 5px; }
.pw-checks li { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--ink-soft); }
.pw-checks .tick {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 1.5px solid #cfdfd7; background: #fff;
  display: grid; place-items: center;
}
.pw-checks li.ok { color: var(--brand-dk); }
.pw-checks li.ok .tick { background: var(--brand); border-color: var(--brand); }
.pw-checks li.ok .tick::after { content: "\2713"; color: #fff; font-size: .58rem; }

/* =====================================================================
   LANDING PAGE
   ===================================================================== */

.site-head {
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.site-head-in {
  max-width: 1100px; margin: 0 auto; padding: 0 22px;
  height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.site-head .actions { display: flex; gap: 10px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: .78rem; letter-spacing: .5px;
}
.brand-text { font-size: .98rem; }

.hero { max-width: 760px; margin: 0 auto; padding: 84px 22px 48px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); margin-bottom: 18px; }
.hero p  { font-size: 1.08rem; color: var(--ink-soft); max-width: 620px; margin: 0 auto 30px; }
.hero .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.features { max-width: 1040px; margin: 0 auto; padding: 20px 22px 90px; }
.features h2 { text-align: center; font-size: 1.3rem; margin-bottom: 26px; }
.feature-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.feature {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.feature .ficon {
  width: 36px; height: 36px; border-radius: 9px; margin-bottom: 13px;
  background: var(--brand-lt); color: var(--brand);
  display: grid; place-items: center;
}
.feature .ficon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.feature h3 { font-size: .96rem; margin-bottom: 6px; }
.feature p  { font-size: .87rem; color: var(--ink-soft); }

.site-foot {
  border-top: 1px solid var(--line); background: var(--surface);
  padding: 22px; text-align: center; font-size: .83rem; color: var(--ink-soft);
}

/* =====================================================================
   AUTH PAGES
   ===================================================================== */

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; }
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  padding: 34px;
}
.auth-card.wide { max-width: 560px; }
.auth-card .brand { justify-content: center; margin-bottom: 22px; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 6px; text-align: center; }
.auth-card .sub { text-align: center; color: var(--ink-soft); font-size: .92rem; margin-bottom: 24px; }
.auth-card form { display: grid; gap: 15px; }
.auth-switch { margin-top: 20px; text-align: center; font-size: .88rem; color: var(--ink-soft); }
.auth-switch a { color: var(--brand-dk); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-note {
  margin-top: 18px; padding: 10px 12px; border-radius: 9px;
  background: var(--surface-2); font-size: .75rem; color: var(--ink-soft); line-height: 1.5;
}

/* =====================================================================
   APP SHELL
   ===================================================================== */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px; flex: none;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 18px 14px;
}
.sidebar .brand { padding: 4px 8px 20px; text-decoration: none; }

.nav { display: grid; gap: 3px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 9px;
  font-size: .9rem; font-weight: 550; color: var(--ink-soft); text-decoration: none;
  transition: background .13s, color .13s;
}
.nav-link svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nav-link:hover  { background: var(--surface-2); color: var(--ink); }
.nav-link.active { background: var(--brand-lt); color: var(--brand-dk); font-weight: 650; }

.sidebar-foot {
  margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--brand-lt); color: var(--brand-dk);
  display: grid; place-items: center; font-size: .76rem; font-weight: 700;
}
.who { min-width: 0; }
.who-name { font-size: .84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-sub  { font-size: .74rem; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px; flex: none;
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 22px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-weight: 650; font-size: .95rem; flex: 1; }
.icon-btn {
  display: none; background: none; border: 1px solid var(--line);
  border-radius: 9px; padding: 7px; cursor: pointer; color: var(--ink-soft);
}
.icon-btn svg { width: 18px; height: 18px; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.page { padding: 28px 22px 70px; max-width: 1140px; width: 100%; }

.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 1.6rem; margin-bottom: 5px; }
.page-head p  { color: var(--ink-soft); font-size: .93rem; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin: 30px 0 14px; flex-wrap: wrap;
}
.section-head h2 { font-size: 1.14rem; }

/* =====================================================================
   CARDS / STATS / PILLS
   ===================================================================== */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}

.summary { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.summary .card { display: flex; flex-direction: column; gap: 4px; }
.summary .k { font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); }
.summary .v { font-size: 1.7rem; font-weight: 680; line-height: 1.15; }
.summary .v small { font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.summary .s { font-size: .82rem; color: var(--ink-soft); }

.status-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 1.02rem; font-weight: 680; line-height: 1.2;
}
.status-chip::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.status-ON_TRACK          { color: var(--low); }
.status-AT_RISK           { color: var(--high); }
.status-RECOVERY_REQUIRED { color: var(--critical); }

.pill {
  font-size: .67rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent;
}
.pill.risk-LOW      { color: var(--low);      background: var(--low-bg);      border-color: var(--low-br); }
.pill.risk-MEDIUM   { color: var(--medium);   background: var(--medium-bg);   border-color: var(--medium-br); }
.pill.risk-HIGH     { color: var(--high);     background: var(--high-bg);     border-color: var(--high-br); }
.pill.risk-CRITICAL { color: var(--critical); background: var(--critical-bg); border-color: var(--critical-br); }
.pill.risk-NOT_ANALYZED {
  color: var(--ink-soft); background: var(--line-2); border-color: var(--line);
  text-transform: none; letter-spacing: .01em; font-weight: 600;
}

.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(296px, 1fr)); }

.course-card { border-left: 4px solid var(--line); display: flex; flex-direction: column; }
.course-card.risk-LOW      { border-left-color: var(--low); }
.course-card.risk-MEDIUM   { border-left-color: var(--medium); }
.course-card.risk-HIGH     { border-left-color: var(--high); }
.course-card.risk-CRITICAL { border-left-color: var(--critical); }
.course-card.risk-NOT_ANALYZED { border-left-color: var(--line); }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-head h3 { font-size: 1.02rem; }
.code { font-size: .78rem; color: var(--ink-faint); font-weight: 600; margin-top: 2px; }

.stat-row { display: flex; gap: 20px; margin: 15px 0 3px; }
.stat { display: flex; flex-direction: column; }
.stat .k { font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); }
.stat .v { font-size: 1.32rem; font-weight: 680; line-height: 1.2; }
.stat .v small { font-size: .72rem; font-weight: 600; color: var(--ink-soft); }

.verdict {
  margin-top: 13px; padding: 9px 11px; border-radius: 8px;
  font-size: .83rem; font-weight: 600;
  background: var(--low-bg); color: var(--low); border: 1px solid var(--low-br);
}
.verdict.bad { background: var(--critical-bg); color: var(--critical); border-color: var(--critical-br); }

.card-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line-2);
  font-size: .84rem;
}
.card-row .k { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); }
.course-card .btn-block { margin-top: 14px; }

.reason-box {
  background: var(--brand-lt); border: 1px solid var(--low-br);
  border-radius: var(--radius); padding: 15px 17px;
}
.reason-box .k {
  font-size: .71rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brand-dk); margin-bottom: 6px;
}
.reason-box p { font-size: .9rem; color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.chip {
  font-size: .77rem; font-weight: 600; padding: 4px 10px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--low-br); color: var(--brand-dk);
}

/* =====================================================================
   TABLES
   ===================================================================== */

.table-wrap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; min-width: 560px; }
thead th {
  text-align: left; font-size: .72rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint);
  padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); font-size: .89rem; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.done td { background: #fbfdfc; }
td.num, th.num { text-align: right; }

.state {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
}
.state.Completed { background: var(--low-bg);     color: var(--low); }
.state.Upcoming  { background: var(--surface-2);  color: var(--ink-soft); border: 1px solid var(--line); }

table input {
  font: inherit; font-size: .88rem; width: 100%;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
table input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(23,121,80,.13); }
table input.w { max-width: 92px; }

/* =====================================================================
   STUDY PLAN
   ===================================================================== */

.plan-days { display: grid; gap: 14px; }
.plan-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.plan-day-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 13px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.plan-day-head h3 { font-size: .97rem; }
.plan-day-head span { font-size: .8rem; }
.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-2);
}
.plan-item:last-child { border-bottom: none; }
.plan-course { font-weight: 650; font-size: .91rem; }
.plan-task   { font-size: .88rem; color: var(--ink-soft); margin-top: 2px; }
.plan-reason { font-size: .79rem; color: var(--ink-faint); margin-top: 4px; font-style: italic; }
.plan-side { text-align: right; flex: none; }
.plan-hours { display: block; font-weight: 700; font-size: .95rem; color: var(--brand-dk); }
.plan-priority { display: block; font-size: .74rem; color: var(--ink-faint); margin-top: 2px; }

/* =====================================================================
   FEEDBACK STATES
   ===================================================================== */

.loading {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: .92rem; color: var(--ink-soft);
}
.spinner {
  width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 40px 24px; text-align: center;
}
.empty h3 { font-size: 1.02rem; margin-bottom: 6px; }
.empty p  { color: var(--ink-soft); font-size: .89rem; margin-bottom: 16px; }

.alert {
  border-radius: var(--radius); padding: 16px 18px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.alert.update { border-color: var(--high-br); background: var(--high-bg); }
.alert h3 { font-size: 1rem; margin-bottom: 6px; color: var(--high); }
.alert p  { font-size: .89rem; color: var(--ink); }
.alert .actions { margin-top: 13px; display: flex; gap: 10px; flex-wrap: wrap; }

/* upload */
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--surface-2); padding: 34px 22px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-lt); }
.drop svg { width: 30px; height: 30px; color: var(--brand); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 10px; }
.drop p { font-size: .92rem; font-weight: 600; }
.drop span { font-size: .8rem; color: var(--ink-soft); }
.file-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 15px; border-radius: 10px;
  background: var(--brand-lt); border: 1px solid var(--low-br); font-size: .88rem;
}

.total-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 17px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); font-size: .9rem; font-weight: 600;
}
.total-bar.ok  { background: var(--low-bg);    border-color: var(--low-br);    color: var(--low); }
.total-bar.bad { background: var(--medium-bg); border-color: var(--medium-br); color: var(--medium); }

.actions-row { display: flex; gap: 11px; flex-wrap: wrap; margin-top: 20px; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */

@media (max-width: 900px) {
  .icon-btn { display: block; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }
  .page { padding: 20px 16px 60px; }
}

@media (max-width: 600px) {
  .grid-2 { grid-template-columns: 1fr; }
  .hero { padding: 54px 20px 36px; }
  .auth-card { padding: 26px 20px; }
  .stat-row { gap: 15px; }
  .plan-item { flex-direction: column; gap: 8px; }
  .plan-side { text-align: left; display: flex; gap: 12px; align-items: baseline; }
  .plan-priority { margin-top: 0; }
  .summary .v { font-size: 1.5rem; }
}

/* =====================================================================
   HERO CARD  -  the achievability statement, the point of the product
   ===================================================================== */

.hero-card {
  background: #0f3d29;
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 26px 30px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  border-left: 5px solid var(--brand-mid, #34a06a);
}
.hero-card.status-AT_RISK           { border-left-color: var(--high); }
.hero-card.status-RECOVERY_REQUIRED { border-left-color: var(--critical); }

.hero-eyebrow {
  font-size: .72rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; opacity: .62; margin-bottom: 10px;
}
.hero-card h2 {
  margin: 0; font-weight: 650;
  font-size: clamp(1.15rem, 2.5vw, 1.6rem);
  line-height: 1.38; letter-spacing: -.01em;
}
.hero-sub { margin: 12px 0 0; font-size: .88rem; opacity: .72; }

/* =====================================================================
   RECOVERY BAR  -  banked / lost / still winnable, out of 100 points
   ===================================================================== */

.bar {
  position: relative;
  display: flex;
  height: 9px;
  margin: 15px 0 9px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line-2);
}
.bar-seg { display: block; height: 100%; }
.bar-seg.earned { background: var(--brand); }
.bar-seg.lost   { background: #e6cdd0; }
.bar-seg.open   { background: #cfe4d8; }

.bar-target {
  position: absolute; top: -3px; bottom: -3px;
  width: 2px; background: var(--ink);
  transform: translateX(-1px);
}
.bar-target::after {
  content: ""; position: absolute; top: -3px; left: -2px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink);
}

.bar-key {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  font-size: .73rem; color: var(--ink-soft);
}
.bar-key span { display: inline-flex; align-items: center; gap: 5px; }
.bar-key .sw { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.bar-key .sw.earned { background: var(--brand); }
.bar-key .sw.lost   { background: #e6cdd0; }
.bar-key .sw.open   { background: #cfe4d8; }

@media (max-width: 600px) {
  .hero-card { padding: 20px 20px; }
  .bar-key { font-size: .7rem; gap: 3px 10px; }
}

/* =====================================================================
   COURSE TONES  -  each course keeps the same colour across the week
   ===================================================================== */

.plan-item { border-left: 3px solid transparent; }
.plan-item.tone-0 { border-left-color: #2f7d5b; }
.plan-item.tone-1 { border-left-color: #3d6fa8; }
.plan-item.tone-2 { border-left-color: #a2682a; }
.plan-item.tone-3 { border-left-color: #7a5aa6; }
.plan-item.tone-4 { border-left-color: #b0503f; }
.plan-item.tone-5 { border-left-color: #2b7f86; }

.plan-item.tone-0 .plan-course { color: #2f7d5b; }
.plan-item.tone-1 .plan-course { color: #3d6fa8; }
.plan-item.tone-2 .plan-course { color: #a2682a; }
.plan-item.tone-3 .plan-course { color: #7a5aa6; }
.plan-item.tone-4 .plan-course { color: #b0503f; }
.plan-item.tone-5 .plan-course { color: #2b7f86; }

/* a deadline inside a week gets flagged */
.due-soon {
  color: var(--critical);
  font-weight: 650;
}

/* =====================================================================
   HIGH / CRITICAL RISK ALERTS
   ===================================================================== */

.risk-alert-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.risk-alert {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex; flex-direction: column;
}
.risk-alert.risk-HIGH     { border-left-color: var(--high);     background: #fffdfb; }
.risk-alert.risk-CRITICAL { border-left-color: var(--critical); background: #fffcfc; }

.risk-alert-head { margin-bottom: 14px; }
.risk-alert-head .pill { display: inline-block; margin-bottom: 8px; }
.risk-alert-head h3 { font-size: 1.08rem; }
.risk-alert-head .code { font-size: .78rem; color: var(--ink-faint); font-weight: 600; margin-top: 2px; }

.risk-facts {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  padding: 14px 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
}
.risk-fact { display: flex; flex-direction: column; gap: 2px; }
.risk-fact .k {
  font-size: .7rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-faint);
}
.risk-fact .v { font-size: .95rem; font-weight: 600; line-height: 1.35; }
.risk-fact .v .muted { font-weight: 500; font-size: .82rem; }

.risk-part { margin-top: 14px; }
.risk-part .k {
  font-size: .7rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 5px;
}
.risk-part p  { font-size: .88rem; color: var(--ink-soft); }
.risk-part ul { margin: 0; padding-left: 18px; font-size: .88rem; color: var(--ink-soft); }
.risk-part li { margin-bottom: 3px; }

.risk-alert .btn { margin-top: 16px; align-self: flex-start; }

/* =====================================================================
   AI CHAPTER SUMMARIZER
   ===================================================================== */

#chapterSummary { display: block; margin-top: 4px; }
#chapterSummary input[type="file"] { padding: 9px 11px; font-size: .88rem; }
#chapterSummary select { cursor: pointer; }

.summary-out {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 26px;
}
.summary-out-head { padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.summary-out-head .k {
  font-size: .7rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 5px;
}
.summary-out-head h3 { font-size: 1.15rem; }

.summary-part { margin-bottom: 22px; }
.summary-part:last-child { margin-bottom: 0; }
.summary-part h4 {
  font-size: .74rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 9px;
}
.summary-part p  { font-size: .93rem; line-height: 1.65; }
.summary-part ul { margin: 0; padding-left: 20px; }
.summary-part li { font-size: .92rem; line-height: 1.6; margin-bottom: 6px; }

.defs { margin: 0; }
.defs dt {
  font-size: .92rem; font-weight: 650; color: var(--brand-dk); margin-top: 12px;
}
.defs dt:first-child { margin-top: 0; }
.defs dd {
  margin: 3px 0 0; padding-left: 13px;
  border-left: 2px solid var(--low-br);
  font-size: .9rem; color: var(--ink-soft); line-height: 1.6;
}

@media (max-width: 600px) {
  .risk-facts { grid-template-columns: 1fr 1fr; }
  .summary-out { padding: 18px 18px; }
}
