:root {
  --yale-blue: #00356b;
  --yale-navy: #0f1641;
  --yale-sky: #4fa8e0;
  --yale-mist: #dbe9f4;
  --weekend: #e8f2fb;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --ink: #1b2430;
  --ink-2: #4a5566;
  --ink-3: #7b8696;
  --line: #e1e6ed;
  --done: #a3acb8;
  --warn: #9a6400;
  --warn-bg: #fff4dc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 22, 65, .06), 0 4px 16px rgba(15, 22, 65, .06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--yale-blue); }
button { font: inherit; color: inherit; }

/* ---------- Masthead ---------- */
.masthead { background: var(--yale-navy); color: #fff; border-bottom: 4px solid var(--yale-sky); }
.masthead-inner {
  max-width: 1280px; margin: 0 auto; padding: 18px 16px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-yale { font: 600 36px/1 "EB Garamond", Georgia, serif; letter-spacing: .5px; }
.brand-som { font: 500 17px/1 "EB Garamond", Georgia, serif; text-transform: uppercase; letter-spacing: 2px; }
.brand-sub { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.brand-program { font-weight: 700; font-size: 20px; color: var(--yale-sky); letter-spacing: -.2px; }
.brand-cohort { font-size: 13px; opacity: .85; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 16px; }

/* ---------- Summary ---------- */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; border-left: 4px solid var(--yale-blue); }
.stat b { display: block; font-size: 22px; color: var(--yale-blue); }
.stat span { color: var(--ink-2); font-size: 12.5px; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.views { display: inline-flex; background: var(--surface); border-radius: 999px; padding: 3px; box-shadow: var(--shadow); }
.views button { border: 0; background: transparent; padding: 7px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.views button[aria-selected="true"] { background: var(--yale-blue); color: #fff; }
#search { flex: 1 1 220px; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: inherit; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { border: 1px solid var(--yale-blue); background: var(--yale-blue); color: #fff; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn-ghost { background: var(--surface); color: var(--yale-blue); }
.btn:hover { filter: brightness(1.08); }

/* ---------- Filters (dropdown menus) ---------- */
.filters { margin-bottom: 16px; position: relative; z-index: 20; }
.fbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fbar-sep { flex: 1; }
.dd { position: relative; }
.dd-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
}
.dd-btn:hover, .dd.open .dd-btn { border-color: var(--yale-blue); }
.dd-name { font-weight: 600; color: var(--ink); }
.dd-sum { color: var(--ink-3); font-size: 12.5px; }
.dd.filtered .dd-sum { color: var(--yale-blue); font-weight: 700; }
.dd-dots { display: inline-flex; }
.dd-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface); margin-left: -3px; }
.dd-dot:first-child { margin-left: 0; }
.dd-caret { color: var(--ink-3); font-size: 11px; }
.dd-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 340px; max-width: calc(100vw - 32px);
  max-height: min(70vh, 520px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 22, 65, .18); padding: 6px;
}
.dd-menu[hidden] { display: none; }
.dd-quick { display: flex; gap: 6px; padding: 4px 6px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.dd-quick button { border: 1px solid var(--line); background: #f6f8fb; border-radius: 6px; padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--yale-blue); cursor: pointer; }
.dd-quick button:hover { border-color: var(--yale-blue); }
.dd-section { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--ink-3); padding: 8px 8px 3px; }
.dd-opt { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.dd-opt:hover { background: #f3f6fa; }
.dd-opt input { width: 16px; height: 16px; margin: 0; accent-color: var(--yale-blue); flex: none; }
.dd-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.dd-opt.off .dd-swatch { opacity: .3; }
.dd-opt.off .dd-label { color: var(--ink-3); }
.dd-label { flex: 1; min-width: 0; }
.dd-label small { color: var(--ink-3); }
.dd-only { visibility: hidden; border: 0; background: none; color: var(--yale-blue); font-size: 11.5px; font-weight: 600; cursor: pointer; padding: 0 2px; }
.dd-opt:hover .dd-only, .dd-only:focus-visible { visibility: visible; }
.fopt { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.fopt input { width: 16px; height: 16px; margin: 0; accent-color: var(--yale-blue); }
@media (hover: none) { .dd-only { visibility: visible; } }
@media (max-width: 600px) {
  .dd { position: static; }
  .dd-menu { left: 0; right: 0; min-width: 0; }
  .fbar-sep { display: none; }
}

/* ---------- Shared bits ---------- */
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; background: var(--c, var(--yale-blue)); white-space: nowrap; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; background: #eef2f6; color: var(--ink-2); white-space: nowrap; }
.tag.t-assignment { background: #e4eefa; color: #0b4a8f; }
.tag.t-exam { background: #fde7e4; color: #a12a1b; }
.tag.t-case { background: #efe7fb; color: #5b2ca0; }
.tag.t-reading { background: #e6f4ec; color: #1d6b43; }
.tag.t-office { background: #fff1de; color: #8a5300; }
.tag.opt { background: transparent; border: 1px dashed var(--ink-3); color: var(--ink-3); }
.tag.req { background: #eaf0f7; color: var(--yale-blue); }
.tag.grp { background: #fdeef6; color: #9a2463; }
.tag.ind { background: #eef6ff; color: #1e5a9c; }
.tag.unk { background: var(--warn-bg); color: var(--warn); }
.verify { color: var(--warn); font-size: 12px; }
.links a { margin-right: 10px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.links a:hover { text-decoration: underline; }

.chk { width: 18px; height: 18px; accent-color: var(--yale-blue); cursor: pointer; flex: none; margin: 0; }

/* ---------- List view ---------- */
.period { margin-bottom: 18px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.period-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--yale-mist); border-bottom: 1px solid #c6d9ea; }
.period-head h2 { margin: 0; font-size: 17px; color: var(--yale-navy); }
.period-head small { color: var(--ink-2); }
.period.current .period-head { background: var(--yale-blue); }
.period.current .period-head h2, .period.current .period-head small { color: #fff; }

.row {
  display: grid;
  grid-template-columns: 26px 108px 92px 92px minmax(0, 1fr) 64px 88px 76px;
  gap: 10px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); cursor: pointer;
}
.row:first-of-type { border-top: 0; }
.row:hover { background: #f8fafc; }
.row .when b { display: block; font-weight: 600; }
.row .when span { color: var(--ink-3); font-size: 12px; }
.row .title { min-width: 0; }
.row .title .t { font-weight: 600; }
.row .title .sub { color: var(--ink-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .pts { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.row.k-session, .row.k-colloquium, .row.k-event { background: #fbfcfe; }
.row.k-session .title .t, .row.k-colloquium .title .t { font-weight: 500; }
.row.is-done { color: var(--done); }
.row.is-done .title .t { text-decoration: line-through; }
.row.is-done .pill { background: var(--done) !important; }
.row.is-done .tag, .row.is-done .links a, .row.is-done .title .sub { color: var(--done); background: #f1f3f6; border-color: var(--done); }
.today-line { display: flex; align-items: center; gap: 8px; padding: 2px 14px; color: #c0392b; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; }
.today-line::after { content: ""; flex: 1; height: 2px; background: #c0392b; }
.empty { background: var(--surface); border-radius: var(--radius); padding: 40px 20px; text-align: center; color: var(--ink-2); box-shadow: var(--shadow); }

/* ---------- Calendar view ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.cal-head h2 { margin: 0 8px 0 0; font-size: 22px; color: var(--yale-navy); min-width: 190px; }
.cal-legend { margin-left: auto; display: flex; gap: 12px; color: var(--ink-2); font-size: 12px; flex-wrap: wrap; }
.cal-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal-dow { background: var(--yale-blue); color: #fff; text-align: center; font-size: 12px; font-weight: 600; padding: 6px 0; }
.day { background: var(--surface); min-height: 118px; padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.day.out { background: #fafbfc; }
.day.out .dnum { color: #c3c9d2; }
.day.wknd { background: var(--weekend); }
.day .dnum { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 1px 3px; display: flex; justify-content: space-between; }
.day.today .dnum b { background: #c0392b; color: #fff; border-radius: 999px; padding: 0 6px; }
.chip {
  display: flex; align-items: center; gap: 5px; width: 100%; text-align: left;
  border: 0; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 9%, #fff);
  border-radius: 4px; padding: 2px 5px; font-size: 11.5px; line-height: 1.3; cursor: pointer; min-width: 0;
}
.chip:hover, .chip:focus-visible { background: color-mix(in srgb, var(--c) 20%, #fff); outline: none; }
.chip .cc { font-weight: 700; color: var(--c); flex: none; }
.chip .ct { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chip.due { background: var(--c); color: #fff; }
.chip.due .cc { color: #fff; }
.chip.due:hover { filter: brightness(1.1); }
.chip.done { background: #f1f3f6; border-left-color: var(--done); color: var(--done); }
.chip.done .cc { color: var(--done); }
.chip.done .ct { text-decoration: line-through; }
.chip.more { border-left-color: transparent; background: transparent; color: var(--yale-blue); font-weight: 600; }

/* ---------- By-course view ---------- */
.course-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; border-top: 5px solid var(--c); }
.course-head { padding: 12px 14px; display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.course-head h2 { margin: 0; font-size: 19px; }
.course-head h2 small { color: var(--ink-3); font-weight: 600; margin-right: 6px; }
.course-head .meta { color: var(--ink-2); font-size: 13px; }
.grading { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.grading span { font-size: 12px; background: #f1f4f8; border-radius: 4px; padding: 2px 7px; }
.grading b { color: var(--yale-blue); }
.course-progress { min-width: 180px; text-align: right; font-size: 12.5px; color: var(--ink-2); }
.bar { height: 6px; background: #e8ecf1; border-radius: 99px; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: var(--c); }

/* ---------- Tooltip + modal ---------- */
.tooltip {
  position: fixed; z-index: 50; max-width: 300px; pointer-events: none;
  background: var(--yale-navy); color: #fff; border-radius: 8px; padding: 9px 11px; font-size: 12.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.tooltip b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.tooltip .tl { opacity: .85; }
.tooltip .hint { margin-top: 5px; opacity: .6; font-size: 11px; }
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 22, 65, .45); }
.modal-card { position: relative; background: var(--surface); border-radius: 12px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); border-top: 6px solid var(--c, var(--yale-blue)); }
.modal-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--ink-3); }
#modal-body { padding: 18px 20px 20px; }
#modal-body h3 { margin: 6px 30px 12px 0; font-size: 19px; line-height: 1.3; }
.dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0 0 14px; }
.dl dt { color: var(--ink-3); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; padding-top: 2px; }
.dl dd { margin: 0; }
.note { background: #f6f8fb; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; color: var(--ink-2); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.done-toggle { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 600; margin-top: 6px; }
.done-toggle.on { background: #f1f3f6; color: var(--ink-2); }
.mini-list { list-style: none; padding: 0; margin: 0 0 10px; }
.mini-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.mini-list li:first-child { border-top: 0; }
.mini-list li.is-done .mt { text-decoration: line-through; color: var(--done); }
.mini-list .mt { font-weight: 600; }
.mini-list button.linkish { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; font-weight: 600; }
.mini-list button.linkish:hover { color: var(--yale-blue); text-decoration: underline; }

.foot { max-width: 1280px; margin: 0 auto; padding: 8px 16px 32px; color: var(--ink-3); font-size: 12px; }

/* ---------- Responsive tiers ----------
   Laptop / web  >= 1024px : base styles above (full table, labeled calendar)
   Tablet / iPad 601-1023px: compact two-line rows, labeled calendar, side-sheet chat
   Phone         <= 600px  : cards, dot calendar + agenda, bottom-sheet dialogs      */

/* Tablet and phone: rows become two lines (course + tags under the title). */
@media (max-width: 1023px) {
  .row { grid-template-columns: 26px 104px minmax(0, 1fr) auto; grid-template-areas: "chk when title pts" "chk when meta pts"; row-gap: 3px; align-items: start; }
  .row > .chkcell { grid-area: chk; padding-top: 2px; }
  .row > .when { grid-area: when; }
  .row > .title { grid-area: title; }
  .row > .pts { grid-area: pts; padding-top: 1px; }
  .row > .coursecell { grid-area: meta; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
  .row > .typecell, .row > .modecell, .row > .reqcell { display: none; }
  .row .metaflat { display: inline-flex !important; gap: 6px; flex-wrap: wrap; }
  .cal-legend span:last-child { display: none; }
  .day { min-height: 104px; }
  .chip { font-size: 11px; }
}

/* Touch screens (phones and tablets): bigger tap targets, no hover-only affordances. */
@media (pointer: coarse) {
  .btn, .views button, .dd-btn { min-height: 40px; }
  .dd-opt { padding: 10px 8px; }
  .dd-opt input, .chk { width: 22px; height: 22px; }
  .chip { min-height: 24px; }
  .row { padding-top: 11px; padding-bottom: 11px; }
}

/* Phone */
@media (max-width: 600px) {
  body { font-size: 15px; }
  .masthead-inner { padding-top: 12px; padding-bottom: 12px; gap: 4px; flex-direction: column; align-items: flex-start; }
  .brand-yale { font-size: 26px; }
  .brand-som { font-size: 13px; letter-spacing: 1.5px; }
  .brand-sub { text-align: left; flex-direction: row; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .brand-program { font-size: 15px; }
  .brand-cohort { font-size: 12px; }
  .wrap { padding-top: 12px; }

  .summary { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .stat { padding: 9px 11px; }
  .stat b { font-size: 17px; }
  .stat span { font-size: 11.5px; line-height: 1.3; display: block; }

  .toolbar { gap: 8px; }
  .views { width: 100%; }
  .views button { flex: 1; padding: 8px 6px; }
  #search { flex-basis: 100%; }
  .toolbar-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .toolbar-actions .btn { padding: 8px 6px; font-size: 13.5px; }
  .fbar { gap: 6px; }
  .dd-btn { padding: 6px 10px; gap: 6px; }
  .dd-name { font-size: 13.5px; }

  .row { grid-template-columns: 30px 1fr auto; grid-template-areas: "chk when pts" "chk title title" "chk meta meta"; padding-left: 10px; padding-right: 12px; }
  .row > .when { display: flex; gap: 8px; align-items: baseline; }
  .period-head { padding: 9px 12px; }
  .period-head h2 { font-size: 16px; }

  /* Calendar: dot grid + agenda */
  .cal-head h2 { min-width: 0; font-size: 19px; flex: 1 0 100%; }
  .cal-head .btn { flex: 1; }
  .cal-legend { display: none; }
  .cal-phone .day { min-height: 54px; border: 0; padding: 4px 2px; align-items: center; cursor: pointer; font: inherit; color: inherit; }
  .cal-phone .day.sel { box-shadow: inset 0 0 0 2px var(--yale-blue); }
  .cal-phone .dnum { justify-content: center; }
  .pdots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; min-height: 8px; }
  .pdot { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--c) 45%, #fff); }
  .pdot.due { background: var(--c); }
  .pdot.done { background: var(--done); opacity: .5; }
  .pmore { font-style: normal; font-size: 9px; line-height: 7px; color: var(--ink-3); }
  .agenda { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; margin-top: 12px; }
  .agenda h3 { margin: 0 0 8px; font-size: 15px; color: var(--yale-navy); }
  .agenda-item { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 7%, #fff); border-radius: 8px; padding: 10px; margin-bottom: 6px; cursor: pointer; font: inherit; color: inherit; }
  .agenda-item.due { background: color-mix(in srgb, var(--c) 16%, #fff); }
  .agenda-item.done { opacity: .55; }
  .agenda-item.done b { text-decoration: line-through; }
  .ag-time { flex: none; width: 66px; font-size: 12px; color: var(--ink-2); padding-top: 1px; }
  .ag-main b { display: block; font-size: 14px; }
  .ag-main small { display: block; color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }

  /* Dialogs become bottom sheets */
  .modal { place-items: end center; padding: 0; }
  .modal-card { width: 100%; max-height: 88vh; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  #modal-body { padding: 16px 16px 22px; }
  .dl { grid-template-columns: 92px 1fr; }
}
.metaflat { display: none !important; }

/* ---------- Ask the Planner (chat) ---------- */
.meta.faculty { margin-top: 3px; line-height: 1.6; }
.ask-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  border: 0; border-radius: 999px; padding: 12px 18px; cursor: pointer;
  background: var(--yale-blue); color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 53, 107, .35); border: 2px solid var(--yale-sky);
}
.ask-fab:hover { filter: brightness(1.1); }
.ask-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 55;
  width: min(420px, calc(100vw - 32px)); height: min(640px, calc(100vh - 40px));
  display: flex; flex-direction: column; background: var(--surface);
  border-radius: 14px; box-shadow: 0 20px 60px rgba(15, 22, 65, .35); overflow: hidden;
}
.ask-panel[hidden] { display: none; }
.ask-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; background: var(--yale-navy); color: #fff; border-bottom: 3px solid var(--yale-sky); }
.ask-head b { font-size: 15px; }
.ask-mode { margin-left: 8px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .15); }
.ask-mode.is-claude { background: var(--yale-sky); color: var(--yale-navy); }
.ask-head-btns { display: flex; gap: 2px; }
.ask-icon { border: 0; background: none; color: #fff; font-size: 18px; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }
.ask-icon:hover { background: rgba(255, 255, 255, .12); }
.ask-settings { padding: 10px 16px; border-bottom: 1px solid var(--line); background: #f8fafc; font-size: 13px; }
.ask-settings h4 { margin: 6px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-3); }
.ask-settings label { display: block; margin: 3px 0; }
.ask-settings small { color: var(--ink-3); }
.ask-note { color: var(--ink-2); font-size: 12px; margin: 4px 0; }
.ask-note.ok { color: #1d6b43; }
.ask-keyrow { display: flex; gap: 6px; }
.ask-keyrow input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.ask-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ask-msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; }
.ask-msg p { margin: 0 0 6px; }
.ask-msg p:last-child { margin-bottom: 0; }
.ask-msg.me { align-self: flex-end; background: var(--yale-blue); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.ask-msg.bot { align-self: flex-start; background: #f1f4f8; border-bottom-left-radius: 4px; width: 92%; }
.ask-hint { color: var(--ink-3); font-size: 12px; }
.ask-list { margin: 4px 0 6px; padding-left: 18px; }
.ask-list li { margin: 3px 0; }
.ask-items { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.ask-item {
  display: flex; gap: 8px; align-items: flex-start; text-align: left; width: 100%;
  border: 0; border-left: 3px solid var(--c); background: #fff; border-radius: 6px; padding: 5px 8px; cursor: pointer; font-size: 12.5px;
}
.ask-item:hover { background: color-mix(in srgb, var(--c) 8%, #fff); }
.ask-item .ai-c { font-weight: 700; color: var(--c); flex: none; min-width: 28px; }
.ask-item .ai-t { font-weight: 600; min-width: 0; }
.ask-item small { display: block; font-weight: 400; color: var(--ink-2); }
.ask-item.done .ai-t { text-decoration: line-through; color: var(--done); }
.ask-list .ask-item { display: inline-flex; width: auto; margin: 2px 0; }
.ask-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
.ask-suggest button { border: 1px solid #c6d9ea; background: var(--yale-mist); color: var(--yale-navy); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.ask-suggest button:hover { background: #cfe2f3; }
.ask-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.ask-form textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; min-height: 38px; }
.ask-form .btn:disabled { opacity: .5; cursor: wait; }
.ask-typing { display: flex; gap: 4px; }
.ask-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: askdot 1s infinite ease-in-out; }
.ask-typing span:nth-child(2) { animation-delay: .15s; }
.ask-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes askdot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (max-width: 600px) {
  .ask-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; }
  .ask-fab { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); width: 56px; height: 56px; padding: 0; font-size: 0; display: grid; place-items: center; }
  .ask-fab span { font-size: 24px; }
  .wrap { padding-bottom: 84px; }
}
@media (min-width: 601px) and (max-width: 1023px) {
  .ask-panel { height: min(720px, calc(100vh - 40px)); width: 400px; }
}
.ask-ref {
  display: inline-block; vertical-align: 1px; margin: 0 1px; padding: 0 6px; border: 0; border-radius: 999px;
  background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); font: 600 11px/1.6 Inter, sans-serif; cursor: pointer; white-space: nowrap;
}
.ask-ref:hover { background: color-mix(in srgb, var(--c) 26%, #fff); }
.ask-ref.done { color: var(--done); text-decoration: line-through; background: #f1f3f6; }
.dd-sum-strong { color: var(--yale-blue); font-weight: 700; }
.dd-radio .dd-label small { display: block; margin-top: 1px; }
.dd-radio input { accent-color: var(--yale-blue); }

/* ---------- Add to calendar ---------- */
.cal-modal h3 { margin-top: 4px; }
.muted-p { color: var(--ink-2); font-size: 13px; margin: 8px 0; }
.cal-modal hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0 6px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.seg label { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--yale-blue); background: var(--yale-mist); color: var(--yale-navy); font-weight: 600; }
.seg label:has(input:disabled) { opacity: .5; cursor: default; }
.seg input { accent-color: var(--yale-blue); margin: 0; }
.cal-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.cal-btn { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); background: #fff; }
.cal-btn:hover { border-color: var(--yale-blue); background: #f7fafd; }
.cal-btn b { color: var(--yale-blue); }
.cal-btn span { font-size: 12px; color: var(--ink-3); }
.cal-copy { display: flex; gap: 6px; }
.cal-copy input { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font: 12px ui-monospace, Menlo, monospace; color: var(--ink-2); background: #f8fafc; }
@media (max-width: 480px) { .cal-btns { grid-template-columns: 1fr; } }

/* ---------- Installed app (home screen) ---------- */
.install-steps { padding-left: 20px; line-height: 1.7; }
.ios-share { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 12px; }
@media (display-mode: standalone) {
  .masthead { padding-top: env(safe-area-inset-top); }
  .foot { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
  .ask-fab { bottom: calc(20px + env(safe-area-inset-bottom)); }
}
.wrap, .masthead-inner { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }

.stat b small { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.stat-bar { display: block; height: 5px; background: #e8ecf1; border-radius: 99px; overflow: hidden; margin-top: 7px; }
.stat-bar i { display: block; height: 100%; background: #1d6b43; border-radius: 99px; }

.sub-list { display: flex; flex-direction: column; margin: 10px 0; border-top: 1px solid var(--line); }
.sub-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sub-row .dd-swatch { background: var(--c); }
.sub-name { flex: 1 1 200px; min-width: 0; }
.sub-name b { display: block; font-size: 14px; }
.sub-name small { color: var(--ink-3); font-size: 12px; }
.sub-btns { display: flex; gap: 5px; flex-wrap: wrap; }
.sub-btn { border: 1px solid var(--line); background: #fff; color: var(--yale-blue); border-radius: 6px; padding: 4px 9px; font-size: 12.5px; font-weight: 600; text-decoration: none; cursor: pointer; font-family: inherit; }
.sub-btn:hover { border-color: var(--yale-blue); background: #f7fafd; }
details.combined { margin: 6px 0 8px; }
details.combined summary { cursor: pointer; color: var(--yale-blue); font-weight: 600; font-size: 13.5px; }
@media (max-width: 600px) { .sub-row { gap: 6px 10px; } .sub-btns { width: 100%; padding-left: 22px; } .sub-btn { flex: 1; text-align: center; padding: 7px 4px; } }

/* ---------- Sign-in ---------- */
body.signed-out > header, body.signed-out > main, body.signed-out > footer, body.signed-out .ask-fab { display: none !important; }
.signin { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, var(--yale-navy) 0%, var(--yale-blue) 100%); }
.signin-card { width: min(420px, 100%); background: var(--surface); border-radius: 16px; padding: 28px 26px 20px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.signin-brand { display: flex; align-items: baseline; gap: 10px; color: var(--yale-navy); }
.signin-brand .brand-yale { font-size: 30px; }
.signin-brand .brand-som { font-size: 13px; }
.signin h1 { margin: 14px 0 2px; font-size: 24px; color: var(--yale-blue); }
.signin-sub { margin: 0 0 18px; color: var(--ink-2); font-size: 13.5px; }
.signin label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.signin input { font: inherit; font-size: 17px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; }
.signin input[name=code] { letter-spacing: 6px; font-size: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.signin .btn-lg { width: 100%; margin-top: 14px; padding: 12px; font-size: 16px; }
.signin-msg { min-height: 1em; font-size: 13.5px; margin: 10px 0 0; }
.signin-msg.err { color: #b3261e; }
.signin-note { color: var(--ink-2); font-size: 14px; margin: 0 0 12px; }
.signin-dev { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; }
.signin-alt { text-align: center; font-size: 13px; }
.signin-foot { margin: 18px 0 0; text-align: center; color: var(--ink-3); font-size: 12px; }
.linkish { border: 0; background: none; padding: 0; color: var(--yale-blue); font: inherit; font-weight: 600; cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.linkish.danger { color: #b3261e; }

/* ---------- Account menu ---------- */
.acct { position: relative; align-self: center; }
.acct-btn { display: flex; align-items: center; gap: 8px; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); color: #fff; border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font-size: 13px; }
.acct-btn:hover { background: rgba(255, 255, 255, .16); }
.acct-av { width: 30px; height: 30px; border-radius: 50%; background: var(--yale-sky); color: var(--yale-navy); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 45; min-width: 240px; background: var(--surface); color: var(--ink); border-radius: 12px; box-shadow: 0 14px 40px rgba(15, 22, 65, .3); padding: 6px; }
.acct-menu[hidden] { display: none; }
.acct-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acct-who b, .acct-who span { display: block; }
.acct-who span { color: var(--ink-3); font-size: 12.5px; }
.acct-menu button, .acct-menu a { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 8px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; text-decoration: none; }
.acct-menu button:hover, .acct-menu a:hover { background: #f3f6fa; }

/* ---------- Teams ---------- */
.teams-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.teams-head h2 { margin: 0; color: var(--yale-navy); }
.join-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface); border-left: 5px solid var(--c); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 14px; }
.join-banner > div { flex: 1 1 200px; }
.join-banner b, .join-banner span { display: block; }
.join-banner span { color: var(--ink-3); font-size: 12.5px; }
.team-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border-top: 5px solid var(--c); margin-bottom: 16px; }
.team-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.team-top h3 { margin: 0; font-size: 18px; }
.team-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.team-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.team-meetings, .team-people { padding: 10px 14px 14px; }
.team-people { border-left: 1px solid var(--line); }
.team-cols h4 { margin: 6px 0 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--ink-3); }
.meet-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.meet-row:first-of-type { border-top: 0; }
.meet-row b, .meet-row span { display: block; }
.meet-row span { color: var(--ink-2); font-size: 12.5px; }
.meet-btns { display: flex; gap: 10px; flex: none; align-items: flex-start; font-size: 13px; }
.team-people ul { list-style: none; padding: 0; margin: 0 0 8px; }
.team-people li { padding: 4px 0; font-size: 14px; }
.team-owner { margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.cal-modal h4 { margin: 16px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .7px; color: var(--ink-3); display: flex; gap: 10px; align-items: baseline; }
.cal-modal h4 .linkish { text-transform: none; letter-spacing: 0; font-size: 12.5px; }

/* Forms in dialogs */
.meet-form { display: flex; flex-direction: column; gap: 10px; }
.meet-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.meet-form label small { font-weight: 400; color: var(--ink-3); }
.meet-form input, .meet-form select, .meet-form textarea { font: inherit; font-size: 15px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-width: 0; }
.meet-form [hidden] { display: none !important; }
.grid2f { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.days { display: flex; gap: 5px; flex-wrap: wrap; }
.daychk { flex-direction: row !important; }
.daychk input { position: absolute; opacity: 0; pointer-events: none; }
.daychk span { display: inline-block; min-width: 44px; text-align: center; padding: 7px 0; border: 1px solid var(--line); border-radius: 8px; font-weight: 600; cursor: pointer; }
.daychk input:checked + span { background: var(--yale-blue); border-color: var(--yale-blue); color: #fff; }
.daychk input:focus-visible + span { outline: 2px solid var(--yale-sky); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label { flex-direction: row !important; }
.swatches input { position: absolute; opacity: 0; }
.swatches i { width: 28px; height: 28px; border-radius: 50%; display: block; cursor: pointer; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatches input:checked + i { box-shadow: 0 0 0 2px var(--ink); }
.form-msg.err { color: #b3261e; font-size: 13px; }
.courses-pick { max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 80; background: var(--yale-navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1023px) {
  .team-cols { grid-template-columns: 1fr; }
  .team-people { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .masthead-inner { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand-sub { order: 3; flex-basis: 100%; }
  .acct { margin-left: auto; }
  .acct-name { display: none; }
  .acct-btn { padding: 3px 8px 3px 3px; }
  .views button { padding: 8px 2px; font-size: 13.5px; }
  .meet-row { flex-direction: column; gap: 4px; }
  .grid2f { grid-template-columns: 1fr; }
}
.meet-form .seg label { flex-direction: row; align-items: center; font-weight: 600; }

/* ---------- My notes + admin item editing ---------- */
.my-notes { margin: 14px 0 6px; display: flex; flex-direction: column; gap: 4px; }
.my-notes label { font-weight: 700; font-size: 13px; color: var(--ink-2); }
.my-notes label small { font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.my-notes textarea { font: inherit; font-size: 14.5px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; min-height: 64px; background: #fffdf5; }
.my-notes textarea:focus { outline: 2px solid var(--yale-sky); border-color: transparent; }
.note-status { font-size: 12px; color: var(--ink-3); min-height: 1em; }
.has-note, .chip .cn { font-size: 11px; }
.chip .cn { margin-left: auto; flex: none; padding-left: 2px; }
details.admin-edit { margin-top: 14px; border: 1px dashed #c6d9ea; border-radius: 10px; padding: 8px 12px; background: #f7fafd; }
details.admin-edit summary { cursor: pointer; font-weight: 700; color: var(--yale-blue); }
details.admin-edit summary small { font-weight: 400; color: var(--ink-3); }
details.admin-edit form { margin-top: 10px; }
.confirm-row { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 600; }
.confirm-row input { width: 18px; height: 18px; accent-color: var(--yale-blue); }

.credit { display: block; margin-top: 6px; color: var(--ink-2); font-weight: 600; }
.unofficial { display: inline-block; vertical-align: middle; font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--warn); background: var(--warn-bg); border-radius: 999px; padding: 2px 8px; }
