/* Slot Suggester: every rule is sg- prefixed. Tokens come from index.php :root. */

/* ---------- CTA under the search pill ---------- */
.sg-cta-wrap { width: 100%; max-width: 520px; margin: -6px auto 14px; padding: 0 4px; }
.sg-cta {
  position: relative; overflow: hidden; width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 10px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(234,179,8,.10), rgba(56,189,248,.06));
  border: 1px solid rgba(234,179,8,.28);
  color: var(--text-main, #f4f4f5); font-family: inherit; text-align: left; cursor: pointer;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.sg-cta::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(253,224,71,.10) 50%, transparent 65%);
  transform: translateX(-100%); transition: transform .8s ease;
}
.sg-cta:hover { border-color: var(--brand, #eab308); transform: translateY(-1px); box-shadow: 0 8px 26px rgba(234,179,8,.12); }
.sg-cta:hover::after { transform: translateX(100%); }
.sg-cta:active { transform: scale(.99); }
.sg-cta:focus-visible { outline: 2px solid var(--brand, #eab308); outline-offset: 2px; }
.sg-cta-ic {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; font-size: 15px; color: #000;
  background: var(--brand-grad, linear-gradient(135deg,#fde047,#ca8a04));
  box-shadow: 0 4px 14px rgba(234,179,8,.28);
}
.sg-cta-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sg-cta-txt b { font-size: 13px; font-weight: 800; color: #fff; letter-spacing: .2px; }
.sg-cta-txt small { font-size: 11px; line-height: 1.3; color: var(--text-muted, #a1a1aa); }
.sg-cta-go {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 11px; font-weight: 700;
  color: var(--brand, #eab308); background: rgba(234,179,8,.08); border: 1px solid rgba(234,179,8,.3);
  transition: background .2s ease, color .2s ease;
}
.sg-cta-go i { font-size: 10px; transition: transform .2s ease; }
.sg-cta:hover .sg-cta-go { background: var(--brand, #eab308); color: #000; }
.sg-cta:hover .sg-cta-go i { transform: translateX(2px); }

/* ---------- sheet + panel ---------- */
html.sg-lock, html.sg-lock body { overflow: hidden !important; }

.sg-sheet {
  position: fixed; inset: 0; z-index: 1500; display: none;
  align-items: center; justify-content: center; padding: 16px;
  background: rgba(0,0,0,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: var(--text-main, #f4f4f5); font-size: 13px; line-height: 1.4;
}
.sg-sheet.is-open { display: flex; animation: sgFade .2s ease-out; }
.sg-sheet button, .sg-sheet input, .sg-sheet select { font-family: inherit; }
.sg-sheet :focus-visible { outline: 2px solid var(--brand, #eab308); outline-offset: 2px; }
.sg-sheet [hidden] { display: none !important; }

.sg-panel {
  width: min(1120px, 100%); height: min(92vh, 880px);
  display: flex; flex-direction: column; overflow: hidden;
  background: rgba(12,12,12,.96); border: 1px solid rgba(255,255,255,.1); border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.06);
  animation: sgUp .34s cubic-bezier(.2,.9,.3,1.08);
}

.sg-head {
  flex: none; display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--glass-border, rgba(255,255,255,.08));
}
.sg-head-ic {
  flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand-grad, linear-gradient(135deg,#fde047,#ca8a04)); color: #000; font-size: 13px;
  box-shadow: 0 4px 12px rgba(234,179,8,.25);
}
.sg-head-txt { flex: 1; min-width: 0; }
.sg-head-txt h2 { margin: 0; font-size: 14.5px; font-weight: 800; color: #fff; letter-spacing: .3px; outline: none; }
.sg-head-txt p { margin: 1px 0 0; font-size: 11px; color: var(--text-muted, #a1a1aa); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-icon-btn {
  flex: none; width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 10px;
  background: rgba(255,255,255,.04); border: 1px solid var(--glass-border, rgba(255,255,255,.08));
  color: var(--text-muted, #a1a1aa); font-size: 15px;
}
.sg-icon-btn:hover { color: #fff; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); }

.sg-tabs { display: none; }

.sg-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 360px minmax(0, 1fr); }

/* ---------- left column: subjects ---------- */
.sg-left {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  border-right: 1px solid var(--glass-border, rgba(255,255,255,.08)); background: rgba(255,255,255,.012);
}
.sg-search { position: relative; z-index: 5; flex: none; padding: 14px 14px 10px; }
.sg-inbox { position: relative; display: flex; align-items: center; }
.sg-inbox-ic { position: absolute; left: 13px; color: var(--brand, #eab308); font-size: 12.5px; pointer-events: none; }
.sg-inbox input {
  width: 100%; height: 42px; padding: 0 38px 0 36px; border-radius: 11px;
  background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.14); color: #fff;
  font-size: 13px; outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.sg-inbox input::placeholder { color: #71717a; }
.sg-inbox input:focus { border-color: var(--brand, #eab308); background: #000; box-shadow: 0 0 0 3px rgba(234,179,8,.14); }
.sg-inbox input::-webkit-search-cancel-button, .sg-inbox input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.sg-inbox-x {
  position: absolute; right: 6px; width: 30px; height: 30px; padding: 0; justify-content: center;
  border-radius: 8px; background: none; border: none; color: var(--text-muted, #a1a1aa); font-size: 13px;
}
.sg-inbox-x:hover { color: #fff; background: rgba(255,255,255,.06); }

.sg-drop {
  position: absolute; left: 14px; right: 14px; top: calc(100% - 4px);
  max-height: min(300px, 50vh); overflow-y: auto; overscroll-behavior: contain;
  padding: 6px; border-radius: 12px;
  background: rgba(12,12,12,.98); border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 18px 44px rgba(0,0,0,.85); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  scrollbar-width: none; animation: sgDrop .14s ease-out;
}
.sg-drop::-webkit-scrollbar { display: none; }
.sg-opt {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px;
  cursor: pointer; color: #e4e4e7; transition: background .15s ease;
}
.sg-opt + .sg-opt { margin-top: 1px; }
.sg-opt:hover, .sg-opt.is-active { background: rgba(56,189,248,.12); }
.sg-opt-code {
  flex: none; min-width: 64px; text-align: center; padding: 1px 5px; border-radius: 5px;
  font-family: Consolas, monospace; font-size: 11px; font-weight: 700; line-height: 1.4;
  color: var(--brand, #eab308); background: rgba(234,179,8,.06); border: 1px solid rgba(234,179,8,.18);
}
.sg-opt-title { flex: 1; min-width: 0; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-opt-kind {
  flex: none; font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; white-space: nowrap;
  color: var(--accent, #38bdf8); background: rgba(56,189,248,.05); border: 1px solid rgba(56,189,248,.15);
}
.sg-opt.is-picked { opacity: .7; }
.sg-opt.is-picked .sg-opt-kind { color: #4ade80; background: rgba(74,222,128,.06); border-color: rgba(74,222,128,.2); }
.sg-drop-empty { padding: 14px; text-align: center; font-size: 12px; color: var(--text-muted, #a1a1aa); }

.sg-left-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 14px 18px; }
.sg-sec-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 8px; min-height: 22px; }
.sg-sec-t { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--brand, #eab308); }
.sg-sec-t b { margin-left: 4px; color: #fff; font-size: 11px; }
.sg-sec-t small { color: #71717a; font-size: 10px; font-weight: 600; }

.sg-link {
  display: inline-flex; padding: 2px 0; border: none; background: none; border-radius: 0;
  color: var(--brand, #eab308); font-size: 11.5px; font-weight: 700; cursor: pointer;
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
  transition: text-decoration-color .15s ease;
}
.sg-link:hover { text-decoration-color: currentColor; }

/* chips */
.sg-chips { display: flex; flex-direction: column; gap: 6px; }
.sg-chip {
  display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 5px 5px 5px 11px;
  border-radius: 10px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08);
  transition: border-color .15s ease, background .15s ease, opacity .2s ease;
}
.sg-chip:hover { border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.045); }
.sg-chip.is-new { animation: sgChipIn .3s ease-out; }
.sg-chip.sg-pulse { animation: sgPulse .75s ease-out; }
.sg-chip.is-off { opacity: .6; }
.sg-chip-code { flex: none; font-family: Consolas, monospace; font-size: 12px; font-weight: 700; color: var(--brand, #eab308); }
.sg-chip-title { flex: 1; min-width: 0; font-size: 11.5px; color: #d4d4d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-need {
  flex: none; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border-radius: 7px;
  font-size: 10.5px; font-weight: 700; white-space: nowrap;
  color: var(--accent, #38bdf8); background: rgba(56,189,248,.08); border: 1px solid rgba(56,189,248,.25);
}
button.sg-need { cursor: pointer; }
button.sg-need:hover { background: rgba(56,189,248,.16); border-color: rgba(56,189,248,.5); }
.sg-need i { font-size: 8.5px; opacity: .75; }
.sg-need-s { display: none; }
.sg-need.is-fixed { color: #d4d4d8; background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.1); }
.sg-need.is-p { color: #c4b5fd; background: rgba(147,51,234,.08); border-color: rgba(147,51,234,.3); }
.sg-need.is-kept { color: #4ade80; background: rgba(74,222,128,.08); border-color: rgba(74,222,128,.25); }
.sg-need.is-part { color: #fde68a; background: rgba(234,179,8,.07); border-color: rgba(234,179,8,.25); }
.sg-chip-x {
  flex: none; width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: 8px;
  background: none; border: 1px solid transparent; color: rgba(248,113,113,.6); font-size: 12px;
}
.sg-chip-x:hover { color: #f87171; background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.25); }

/* preferred slots: control on the chip + chooser expanding under it */
.sg-chip-wrap { min-width: 0; }
.sg-chip-wrap.is-open .sg-chip { border-radius: 10px 10px 0 0; border-color: rgba(234,179,8,.35); background: rgba(234,179,8,.04); }
.sg-chip-sl {
  flex: none; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 7px; border-radius: 7px;
  font-size: 10.5px; font-weight: 700; white-space: nowrap; color: var(--text-muted, #a1a1aa);
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.1); transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.sg-chip-sl > i:first-child { font-size: 9px; }
.sg-chip-sl .sg-acc-chev { margin: 0; font-size: 9px; }
.sg-chip-sl em { display: none; font-style: normal; font-size: 10px; font-weight: 800; color: #000; background: var(--brand, #eab308); padding: 0 5px; border-radius: 999px; }
.sg-chip-sl:hover { color: #fff; border-color: rgba(234,179,8,.4); }
.sg-chip-sl.is-on { color: #fde68a; background: rgba(234,179,8,.08); border-color: rgba(234,179,8,.35); }
.sg-chip-sl.is-on > i:first-child { color: var(--brand, #eab308); }
.sg-chip-sl.is-open .sg-acc-chev { transform: rotate(180deg); }
.sg-sl { padding: 10px 11px 8px; border: 1px solid rgba(234,179,8,.3); border-top: none; border-radius: 0 0 10px 10px; background: rgba(234,179,8,.03); animation: sgFade .18s ease-out; }
.sg-sl-hint { margin: 0 0 9px; font-size: 10.5px; line-height: 1.4; color: var(--text-muted, #a1a1aa); }
.sg-sl-hint i { color: var(--brand, #eab308); margin-right: 2px; }
.sg-sl-g + .sg-sl-g { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.06); }
.sg-sl-gh { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sg-sl-k { font-size: 9.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--brand, #eab308); }
.sg-sl-k.is-l { color: var(--accent, #38bdf8); }
.sg-sl-n { flex: 1; min-width: 0; font-size: 10.5px; color: #71717a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-sl-any { height: 24px; padding: 0 10px; border-radius: 999px; font-size: 10.5px; font-weight: 700; color: var(--text-main, #f4f4f5); background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.12); }
.sg-sl-any:hover { border-color: rgba(234,179,8,.4); }
.sg-sl-any.is-on { color: #000; background: var(--brand, #eab308); border-color: var(--brand, #eab308); }
.sg-sl-list { display: flex; flex-direction: column; gap: 4px; }
.sg-sl-p {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 5px 9px; border-radius: 8px; text-align: left;
  color: var(--text-main, #f4f4f5); background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.08); transition: border-color .15s ease, background .15s ease;
}
.sg-sl-p:hover { border-color: rgba(234,179,8,.45); }
.sg-sl-p.is-l:hover { border-color: rgba(56,189,248,.5); }
.sg-sl-p:active { transform: none; }
.sg-sl-ck { flex: none; width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid rgba(255,255,255,.3); display: grid; place-items: center; }
.sg-sl-p.is-on { background: rgba(234,179,8,.1); border-color: rgba(234,179,8,.5); }
.sg-sl-p.is-l.is-on { background: rgba(56,189,248,.1); border-color: rgba(56,189,248,.5); }
.sg-sl-p.is-on .sg-sl-ck { background: var(--brand, #eab308); border-color: var(--brand, #eab308); }
.sg-sl-p.is-l.is-on .sg-sl-ck { background: var(--accent, #38bdf8); border-color: var(--accent, #38bdf8); }
.sg-sl-p.is-on .sg-sl-ck::after { content: ''; width: 4px; height: 8px; border: solid #000; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.sg-sl-p b { flex: none; min-width: 74px; font-family: Consolas, monospace; font-size: 11.5px; font-weight: 700; color: var(--brand, #eab308); }
.sg-sl-p.is-l b { color: var(--accent, #38bdf8); }
.sg-sl-p small { flex: 1; min-width: 0; font-size: 10.5px; line-height: 1.3; color: var(--text-muted, #a1a1aa); font-variant-numeric: tabular-nums; }
.sg-sl-foot { display: flex; justify-content: flex-end; margin-top: 8px; }

.sg-chips-empty {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 18px 16px; border-radius: 12px; border: 1px dashed rgba(255,255,255,.09); background: rgba(255,255,255,.012);
}
.sg-chips-empty-ic {
  width: 32px; height: 32px; margin-bottom: 4px; border-radius: 50%; display: grid; place-items: center;
  color: var(--brand, #eab308); font-size: 13px; background: rgba(234,179,8,.05); border: 1px solid rgba(234,179,8,.15);
}
.sg-chips-empty b { font-size: 12.5px; color: #fff; }
.sg-chips-empty span { font-size: 11px; line-height: 1.45; color: var(--text-muted, #a1a1aa); max-width: 280px; }

/* switch rows (keep picks + bool prefs) */
.sg-switch-row {
  width: 100%; display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 12px;
  border-radius: 10px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.08);
  color: inherit; text-align: left; font-size: 12px; font-weight: 400;
}
.sg-switch-row:hover:not(:disabled) { border-color: var(--glass-border-hover, rgba(234,179,8,.4)); }
.sg-switch-row:disabled { opacity: .55; cursor: default; }
.sg-switch-row:active { transform: none; }
.sg-sw-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sg-sw-txt b { font-size: 12.5px; font-weight: 700; color: #fff; }
.sg-sw-txt b em { font-style: normal; color: var(--brand, #eab308); }
.sg-sw-txt small { font-size: 10.5px; line-height: 1.4; color: var(--text-muted, #a1a1aa); }
.sg-switch { flex: none; position: relative; width: 36px; height: 20px; border-radius: 999px; background: rgba(255,255,255,.12); transition: background .2s ease; }
.sg-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #a1a1aa; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .2s ease, background .2s ease;
}
[aria-checked="true"] > .sg-switch { background: rgba(234,179,8,.35); }
[aria-checked="true"] > .sg-switch::after { transform: translateX(16px); background: var(--brand, #eab308); }
.sg-switch-row.is-flat { margin: 0; padding: 10px 0; background: none; border: none; border-radius: 0; }
.sg-switch-row.is-flat + .sg-switch-row.is-flat { border-top: 1px solid rgba(255,255,255,.05); }

/* preferences accordion */
.sg-acc {
  width: 100%; display: flex; align-items: center; gap: 9px; margin-top: 12px; padding: 0 12px; height: 44px;
  border-radius: 10px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.08);
  color: #fff; font-size: 12.5px; font-weight: 700;
}
.sg-acc:hover { border-color: var(--glass-border-hover, rgba(234,179,8,.4)); }
.sg-acc:active { transform: none; }
.sg-acc > i:first-child { color: var(--brand, #eab308); font-size: 12px; }
.sg-acc em { font-style: normal; font-size: 10px; font-weight: 800; color: #000; background: var(--brand, #eab308); padding: 1px 7px; border-radius: 999px; }
.sg-acc-chev { margin-left: auto; font-size: 11px; color: var(--text-muted, #a1a1aa); transition: transform .2s ease; }
.sg-acc[aria-expanded="true"] { border-radius: 10px 10px 0 0; border-bottom-color: rgba(255,255,255,.04); }
.sg-acc[aria-expanded="true"] .sg-acc-chev { transform: rotate(180deg); }
.sg-pref-body {
  padding: 2px 12px 6px; border: 1px solid rgba(255,255,255,.08); border-top: none;
  border-radius: 0 0 10px 10px; background: rgba(255,255,255,.015); animation: sgFade .18s ease-out;
}
.sg-field { padding: 10px 0; }
.sg-field + .sg-field { border-top: 1px solid rgba(255,255,255,.05); }
.sg-field-sw { padding: 0; }
.sg-label { display: block; margin-bottom: 7px; font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--text-muted, #a1a1aa); }
.sg-seg { display: flex; padding: 3px; border-radius: 10px; background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.06); }
.sg-seg button {
  flex: 1; height: 30px; padding: 0 6px; justify-content: center; border-radius: 7px;
  background: none; border: none; color: var(--text-main, #f4f4f5); font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.sg-seg button:hover { background: rgba(255,255,255,.05); }
/* two-line segments: strict theory half */
.sg-seg.is-2l button { flex-direction: column; gap: 0; height: 42px; padding: 0 3px; min-width: 0; }
.sg-seg.is-2l b { font-size: 11.5px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.sg-seg.is-2l small { font-size: 9.5px; font-weight: 600; line-height: 1.2; color: var(--text-muted, #a1a1aa); font-family: Consolas, monospace; white-space: nowrap; }
.sg-seg.is-2l button[aria-pressed="true"] small { color: rgba(0,0,0,.7); }
.sg-label-tag { font-style: normal; margin-left: 5px; padding: 1px 6px; border-radius: 999px; font-size: 9px; letter-spacing: .4px; color: #000; background: var(--brand, #eab308); }
.sg-label-tag.is-soft { color: var(--accent, #38bdf8); background: rgba(56,189,248,.1); border: 1px solid rgba(56,189,248,.3); }
.sg-seg button[aria-pressed="true"] { background: var(--brand-grad, linear-gradient(135deg,#fde047,#ca8a04)); color: #000; font-weight: 700; }
.sg-days { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.sg-day {
  height: 32px; padding: 0; justify-content: center; border-radius: 8px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.1);
  color: var(--text-main, #f4f4f5); font-size: 11px; font-weight: 700;
}
.sg-day:hover { border-color: var(--glass-border-hover, rgba(234,179,8,.4)); }
.sg-day[aria-pressed="true"] { color: #4ade80; background: rgba(74,222,128,.12); border-color: rgba(74,222,128,.5); }
.sg-day[data-v="-1"][aria-pressed="true"] { color: var(--text-main, #f4f4f5); background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.25); }
.sg-note { display: block; margin-top: 7px; font-size: 10.5px; line-height: 1.4; color: #71717a; }

.sg-left-foot {
  flex: none; padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--glass-border, rgba(255,255,255,.08)); background: rgba(10,10,10,.92);
}
.sg-foot-hint { margin: 7px 0 0; font-size: 10.5px; text-align: center; color: var(--text-muted, #a1a1aa); }

/* ---------- buttons ---------- */
.sg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 9px; font-size: 12px; font-weight: 700; white-space: nowrap; cursor: pointer;
  transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease, filter .2s ease;
}
.sg-btn-brand { background: var(--brand-grad, linear-gradient(135deg,#fde047,#ca8a04)); color: #000; border: 1px solid transparent; box-shadow: 0 4px 14px rgba(234,179,8,.18); }
.sg-btn-brand:hover:not(:disabled) { filter: brightness(1.07); box-shadow: 0 6px 20px rgba(234,179,8,.32); }
.sg-btn-ghost { background: rgba(255,255,255,.04); color: var(--text-main, #f4f4f5); border: 1px solid rgba(255,255,255,.12); }
.sg-btn-ghost:hover:not(:disabled) { color: #fff; background: rgba(234,179,8,.06); border-color: var(--glass-border-hover, rgba(234,179,8,.4)); }
.sg-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
.sg-btn-sm { height: 32px; padding: 0 12px; font-size: 11.5px; }
.sg-find { width: 100%; height: 46px; border-radius: 12px; font-size: 13.5px; font-weight: 800; letter-spacing: .2px; }
.sg-l-short { display: none; }
.sg-only-m { display: none; }

/* ---------- right column: results ---------- */
.sg-right { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.sg-res-head {
  flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--glass-border, rgba(255,255,255,.08));
}
.sg-res-sum { flex: 1; min-width: 0; font-size: 12px; color: var(--text-muted, #a1a1aa); }
.sg-res-sum b { color: #e4e4e7; font-weight: 700; }
.sg-res-big { font-size: 19px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.sg-dot-sep { margin: 0 2px; color: #52525b; }
.sg-sort { position: relative; display: inline-flex; align-items: center; flex: none; }
.sg-sort i { position: absolute; left: 11px; font-size: 11px; color: var(--brand, #eab308); pointer-events: none; }
.sg-sort select {
  height: 34px; padding: 0 30px 0 30px; border-radius: 9px; cursor: pointer;
  -webkit-appearance: none; appearance: none; color: #fff; font-size: 12px; font-weight: 600;
  background: rgba(0,0,0,.5) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a1a1aa' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 11px center;
  border: 1px solid rgba(255,255,255,.14); transition: border-color .2s ease;
}
.sg-sort select:hover, .sg-sort select:focus { border-color: var(--glass-border-hover, rgba(234,179,8,.4)); outline: none; }
.sg-sort select option { background: #111; color: #fff; }

.sg-res-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; width: 100%; }
/* quick filters + pins */
.sg-filt { display: flex; flex-wrap: wrap; gap: 5px; width: 100%; margin-top: 2px; }
.sg-fc {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border-radius: 999px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.12); color: var(--text-main, #f4f4f5);
  font-size: 11px; font-weight: 700; white-space: nowrap; transition: border-color .15s ease, background .15s ease, opacity .15s ease;
}
.sg-fc small { font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 999px; color: var(--text-muted, #a1a1aa); background: rgba(255,255,255,.07); font-variant-numeric: tabular-nums; }
.sg-fc:hover { border-color: var(--glass-border-hover, rgba(234,179,8,.4)); }
.sg-fc.is-on { color: #000; background: var(--brand, #eab308); border-color: var(--brand, #eab308); }
.sg-fc.is-on small { color: #000; background: rgba(0,0,0,.14); }
.sg-fc.is-zero { opacity: .45; }
.sg-fc.is-pin { color: #fde68a; background: rgba(234,179,8,.1); border-color: rgba(234,179,8,.45); }
.sg-fc.is-pin b { font-family: Consolas, monospace; color: #fff; }
.sg-fc.is-pin > i:first-child { font-size: 9.5px; color: var(--brand, #eab308); }
.sg-fc-x { font-size: 10px; color: var(--text-muted, #a1a1aa); }
.sg-fc.is-pin:hover { border-color: #f87171; }
.sg-fc.is-pin:hover .sg-fc-x { color: #f87171; }

.sg-res-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 22px; }
.sg-notes { display: flex; flex-direction: column; gap: 6px; }
.sg-notes:not(:empty) { margin-bottom: 12px; }
#sgStale:empty { display: none; }
.sg-nb {
  display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: 9px;
  font-size: 11.5px; line-height: 1.4; color: var(--text-muted, #a1a1aa);
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.07);
}
.sg-nb > i { flex: none; color: var(--accent, #38bdf8); font-size: 12px; }
.sg-nb > span { flex: 1; min-width: 0; }
.sg-nb .sg-link { flex: none; }
.sg-nb.is-warn { color: #fde68a; background: rgba(234,179,8,.06); border-color: rgba(234,179,8,.28); }
.sg-nb.is-warn > i { color: var(--brand, #eab308); }
.sg-nb.is-bad { color: #fca5a5; background: rgba(239,68,68,.07); border-color: rgba(239,68,68,.3); }
.sg-nb.is-bad > i { color: #f87171; }
.sg-left .sg-nb { margin-top: 8px; }

.sg-cards { display: flex; flex-direction: column; gap: 12px; }

/* ---------- result card ---------- */
.sg-card {
  min-width: 0; padding: 14px; border-radius: 14px;
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.08);
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
  animation: sgIn .34s ease-out both; animation-delay: calc(var(--i, 0) * 35ms);
}
.sg-card.no-anim { animation: none; }
.sg-card:hover { border-color: var(--glass-border-hover, rgba(234,179,8,.4)); background: rgba(255,255,255,.035); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.sg-card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.sg-rank {
  font-family: Consolas, monospace; font-size: 12.5px; font-weight: 800; color: #fff;
  padding: 2px 8px; border-radius: 7px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
}
.sg-rank.is-top { color: #000; background: var(--brand-grad, linear-gradient(135deg,#fde047,#ca8a04)); border-color: transparent; }
.sg-fit { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-muted, #a1a1aa); }
.sg-fit b { font-size: 14px; font-weight: 800; color: var(--brand, #eab308); font-variant-numeric: tabular-nums; }
.sg-fit-ring {
  width: 16px; height: 16px; border-radius: 50%;
  background: conic-gradient(var(--brand, #eab308) calc(var(--p, 0) * 1%), rgba(255,255,255,.12) 0);
  -webkit-mask: radial-gradient(circle, transparent 4px, #000 4.5px); mask: radial-gradient(circle, transparent 4px, #000 4.5px);
}
.sg-meta { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-muted, #a1a1aa); white-space: nowrap; }
.sg-meta i { font-size: 10.5px; color: #71717a; }
.sg-when { margin-left: auto; }
.sg-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.sg-tag {
  font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  color: var(--accent, #38bdf8); background: rgba(56,189,248,.08); border: 1px solid rgba(56,189,248,.22);
}
.sg-tag.is-free { color: #4ade80; background: rgba(74,222,128,.08); border-color: rgba(74,222,128,.25); }


/* subject colours: same palette as the page's chip classes c0..c7, as a token so any element can use it */
.sg-c0 { --sw: #2563eb; } .sg-c1 { --sw: #059669; } .sg-c2 { --sw: #db2777; } .sg-c3 { --sw: #9333ea; }
.sg-c4 { --sw: #ea580c; } .sg-c5 { --sw: #0891b2; } .sg-c6 { --sw: #475569; } .sg-c7 { --sw: #4f46e5; }
.sg-ck { --sw: #71717a; }   /* already in the timetable */
.sg-cp { --sw: #a78bfa; }   /* project, no slot */
.sg-sw { flex: none; width: 9px; height: 9px; border-radius: 3px; background: var(--sw, #71717a); }
.sg-sw.sg-ck { background: repeating-linear-gradient(135deg, rgba(161,161,170,.6) 0 2px, rgba(161,161,170,.15) 2px 4px); }
.sg-sw.sg-cp { background: transparent; border: 1.5px solid #a78bfa; }
.sg-s {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 5px; white-space: nowrap;
  font-family: Consolas, monospace; font-size: 11px; font-weight: 700; line-height: 1.45;
  color: var(--brand, #eab308); background: rgba(234,179,8,.08); border: 1px solid rgba(234,179,8,.2);
}
.sg-s-l { color: var(--accent, #38bdf8); background: rgba(56,189,248,.08); border-color: rgba(56,189,248,.22); }
.sg-s-k { color: var(--text-muted, #a1a1aa); background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.1); }
.sg-s-k i { font-size: 8px; }
/* a slot pill that pins */
button.sg-s { cursor: pointer; min-height: 24px; padding: 1px 7px; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease; }
button.sg-s:hover { background: rgba(234,179,8,.18); border-color: rgba(234,179,8,.6); }
button.sg-s.sg-s-l:hover { background: rgba(56,189,248,.18); border-color: rgba(56,189,248,.6); }
button.sg-s:active { transform: none; }
button.sg-s.is-pin { color: #000; background: var(--brand, #eab308); border-color: var(--brand, #eab308); box-shadow: 0 0 0 2px rgba(234,179,8,.25); }
button.sg-s.is-pin.sg-s-l { background: var(--accent, #38bdf8); border-color: var(--accent, #38bdf8); box-shadow: 0 0 0 2px rgba(56,189,248,.25); }
button.sg-s.is-pin i { font-size: 8.5px; }

/* lab variants */
.sg-vars { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed rgba(255,255,255,.08); }
.sg-vars-lbl { font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-muted, #a1a1aa); }
.sg-vars-lbl i { color: var(--accent, #38bdf8); margin-right: 2px; }
.sg-vars-lbl small { font-size: 10px; letter-spacing: .3px; text-transform: none; font-weight: 600; color: #71717a; }
.sg-vars-list { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.sg-var {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  min-height: 32px; max-width: 100%; padding: 6px 11px; border-radius: 10px; text-align: left;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.12); color: var(--text-main, #f4f4f5);
}
.sg-var:hover { border-color: rgba(56,189,248,.5); background: rgba(56,189,248,.05); }
.sg-var.is-on { background: rgba(56,189,248,.13); border-color: var(--accent, #38bdf8); box-shadow: 0 0 0 1px rgba(56,189,248,.25) inset; }
.sg-var-l { display: flex; align-items: baseline; gap: 6px; max-width: 100%; font-family: Consolas, monospace; font-size: 11.5px; line-height: 1.3; white-space: nowrap; }
.sg-var-l em { font-style: normal; font-weight: 600; color: var(--text-muted, #a1a1aa); }
.sg-var-l b { font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; }
.sg-var.is-on .sg-var-l b { color: var(--accent, #38bdf8); }
.sg-var-l.is-same { opacity: .45; }
.sg-var small { font-size: 11px; font-weight: 600; color: var(--text-muted, #a1a1aa); white-space: nowrap; }
.sg-var.is-on small { color: #bae6fd; }

.sg-card-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.sg-more { display: flex; margin: 14px auto 0; }
.sg-more-n { font-weight: 600; color: var(--text-muted, #a1a1aa); font-size: 11px; }
.sg-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: 16px 2px 0; font-size: 10.5px; color: #71717a; }
.sg-legend > i { margin-right: -8px; }
.sg-legend-k { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- progress / empty / diagnosis ---------- */
.sg-progress { max-width: 420px; margin: 36px auto 26px; text-align: center; }
.sg-prog-ic {
  width: 50px; height: 50px; margin: 0 auto 14px; border-radius: 15px; display: grid; place-items: center;
  font-size: 18px; color: var(--brand, #eab308); background: rgba(234,179,8,.1); border: 1px solid rgba(234,179,8,.3);
  animation: sgBreath 1.6s ease-in-out infinite;
}
.sg-prog-title { font-size: 14px; font-weight: 700; color: #fff; }
.sg-prog-bar { position: relative; height: 4px; margin: 14px 0 8px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.08); }
.sg-prog-bar span {
  position: absolute; top: 0; bottom: 0; left: 0; width: 4%; border-radius: inherit;
  background: linear-gradient(90deg, #ca8a04, #fde047, #38bdf8, #fde047, #ca8a04); background-size: 200% 100%;
  animation: sgShimmer 1.2s linear infinite; transition: width .2s linear;
}
.sg-prog-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted, #a1a1aa); font-variant-numeric: tabular-nums; }
.sg-progress .sg-btn { margin: 18px auto 0; }
/* slim strip above early results while the worker is still going */
.sg-progress.is-slim {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; max-width: none; margin: 0 0 12px; padding: 8px 12px; border-radius: 9px;
  text-align: left; font-size: 11.5px; color: #fde68a; background: rgba(234,179,8,.06); border: 1px solid rgba(234,179,8,.28);
}
.sg-progress.is-slim > i { color: var(--brand, #eab308); }
.sg-progress.is-slim .sg-prog-title { font-size: 12px; }
.sg-progress.is-slim > span { color: var(--text-muted, #a1a1aa); font-variant-numeric: tabular-nums; }
.sg-progress.is-slim .sg-link { margin-left: auto; }
.sg-skels { display: flex; flex-direction: column; gap: 12px; }
.sg-skel {
  height: 128px; border-radius: 14px; border: 1px solid rgba(255,255,255,.05);
  background: linear-gradient(90deg, rgba(255,255,255,.02), rgba(255,255,255,.05), rgba(255,255,255,.02)); background-size: 200% 100%;
  animation: sgShimmer 1.5s linear infinite;
}
.sg-skel + .sg-skel { opacity: .6; }

.sg-empty { max-width: 460px; margin: 34px auto 20px; padding: 0 4px; text-align: center; animation: sgIn .3s ease-out both; }
.sg-empty-ic {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; font-size: 20px;
  color: var(--brand, #eab308); background: rgba(234,179,8,.08); border: 1px solid rgba(234,179,8,.22);
}
.sg-empty-ic.is-warn { color: #f87171; background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.25); }
.sg-empty h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; color: #fff; }
.sg-empty p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--text-muted, #a1a1aa); }
.sg-steps { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.sg-steps li {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  font-size: 12px; color: var(--text-main, #f4f4f5); background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.06);
}
.sg-steps b { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: var(--brand, #eab308); background: rgba(234,179,8,.12); }
.sg-idle .sg-btn { margin: 16px auto 0; }
.sg-empty-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.sg-fb {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; padding: 12px; border-radius: 12px; text-align: left;
  font-size: 12px; color: var(--text-main, #f4f4f5); background: rgba(234,179,8,.06); border: 1px solid rgba(234,179,8,.28);
}
.sg-fb > i { color: var(--brand, #eab308); font-size: 14px; }
.sg-fb > span { flex: 1; min-width: 160px; line-height: 1.45; }
.sg-fb b { color: #fff; }
.sg-pairs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 14px; }
.sg-pair {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-family: Consolas, monospace; font-size: 11.5px; color: #fff; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1);
}
.sg-pair i { font-style: normal; color: #f87171; font-weight: 700; }
.sg-diag-chips { margin-top: 18px; }
.sg-diag-chips .sg-label { margin-bottom: 9px; }
.sg-dchips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.sg-dchip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 32px; padding: 0 11px; border-radius: 999px;
  background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; font-size: 11.5px;
}
.sg-dchip b { font-family: Consolas, monospace; font-weight: 700; }
.sg-dchip span { min-width: 0; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: #d4d4d8; }
.sg-dchip i { font-size: 10px; }
.sg-dchip:hover { color: #fff; background: rgba(239,68,68,.18); border-color: #ef4444; }
.sg-nomatch { margin-top: 24px; }

/* ---------- slim themed scrollbars ---------- */
.sg-left-scroll, .sg-res-scroll, .sg-mm-body, .sg-dt-wrap, .sg-cf { scrollbar-width: thin; scrollbar-color: rgba(234,179,8,.28) transparent; }
.sg-left-scroll::-webkit-scrollbar, .sg-res-scroll::-webkit-scrollbar, .sg-mm-body::-webkit-scrollbar,
.sg-dt-wrap::-webkit-scrollbar, .sg-cf::-webkit-scrollbar { width: 6px; height: 6px; }
.sg-left-scroll::-webkit-scrollbar-track, .sg-res-scroll::-webkit-scrollbar-track, .sg-mm-body::-webkit-scrollbar-track,
.sg-dt-wrap::-webkit-scrollbar-track, .sg-cf::-webkit-scrollbar-track { background: transparent; }
.sg-left-scroll::-webkit-scrollbar-thumb, .sg-res-scroll::-webkit-scrollbar-thumb, .sg-mm-body::-webkit-scrollbar-thumb,
.sg-dt-wrap::-webkit-scrollbar-thumb, .sg-cf::-webkit-scrollbar-thumb { background: rgba(234,179,8,.22); border-radius: 999px; }
.sg-left-scroll:hover::-webkit-scrollbar-thumb, .sg-res-scroll:hover::-webkit-scrollbar-thumb, .sg-mm-body:hover::-webkit-scrollbar-thumb,
.sg-dt-wrap:hover::-webkit-scrollbar-thumb { background: rgba(234,179,8,.45); }

/* ---------- detail view (Visualise timetable) ---------- */
.sg-dv-nav { width: 32px; height: 32px; font-size: 12px; }
.sg-dv-nav:disabled { opacity: .3; cursor: default; }
.sg-dv-ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: center; }
.sg-dv-ttl b { font-size: 14px; font-weight: 800; color: #fff; }
.sg-dv-ttl b small { font-size: 11px; font-weight: 600; color: var(--text-muted, #a1a1aa); }
.sg-dv-ttl > small { font-size: 11px; color: var(--text-muted, #a1a1aa); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-mm-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 14px 16px 26px; }
.sg-dv-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 12px; }
.sg-dv-head .sg-tags { margin-top: 0; }
.sg-dv-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sg-dv-tile { min-width: 0; padding: 10px 12px; border-radius: 11px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.07); }
.sg-dv-tile b { display: block; font-size: 16px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-dv-tile span { display: block; margin-top: 2px; font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-muted, #a1a1aa); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-dv-tile.is-free { background: rgba(74,222,128,.06); border-color: rgba(74,222,128,.25); }
.sg-dv-tile.is-free b { color: #4ade80; }
.sg-dv-sec { margin-top: 20px; min-width: 0; }
.sg-dv-sec h4 {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; margin: 0 0 9px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--brand, #eab308);
}
.sg-dv-sec h4 small { font-size: 10.5px; font-weight: 600; letter-spacing: .2px; text-transform: none; color: #71717a; }

/* lab options inside the detail */
.sg-dvv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.sg-dvv {
  display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 10px 12px; border-radius: 11px; text-align: left;
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.1); color: inherit; font-size: 12px; font-weight: 400;
}
.sg-dvv:hover { border-color: rgba(56,189,248,.5); background: rgba(56,189,248,.04); }
.sg-dvv:active { transform: none; }
.sg-dvv.is-on { background: rgba(56,189,248,.1); border-color: var(--accent, #38bdf8); box-shadow: 0 0 0 1px rgba(56,189,248,.3) inset; }
.sg-dvv-n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; background: rgba(255,255,255,.08); }
.sg-dvv.is-on .sg-dvv-n { color: #000; background: var(--accent, #38bdf8); }
.sg-dvv-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.sg-dvv-l { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 8px; min-width: 0; }
.sg-dvv-l > b { min-width: 60px; font-family: Consolas, monospace; font-size: 11.5px; font-weight: 700; color: #fff; }
.sg-dvv-l small { font-size: 11px; color: var(--text-muted, #a1a1aa); font-variant-numeric: tabular-nums; }
.sg-dvv-l.is-same { opacity: .5; }
.sg-dvv-l.is-diff > b { color: var(--brand, #eab308); }

/* colour legend */
.sg-lg { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-bottom: 9px; }
.sg-lg-i { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.sg-lg-i b { font-family: Consolas, monospace; font-weight: 700; color: #fff; }
.sg-lg-i small { font-size: 10px; color: var(--text-muted, #a1a1aa); }

/* big week grid (desktop): theory + lab hour rows, lunch band, sticky day column */
.sg-dt-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; border-radius: 12px; border: 1px solid rgba(255,255,255,.08); background: rgba(0,0,0,.4); }
.sg-dt-wrap:focus-visible { outline: 2px solid var(--brand, #eab308); outline-offset: 2px; }
.sg-dt { width: 100%; min-width: 760px; table-layout: fixed; border-collapse: separate; border-spacing: 2px; }
.sg-dt th, .sg-dt td { padding: 0; }
.sg-dt-k, .sg-dt-day {
  position: sticky; left: 0; z-index: 2; width: 50px; border-radius: 6px; text-align: center;
  background: #0e0e0e; box-shadow: 2px 0 0 #0e0e0e; font-size: 10px; font-weight: 800; letter-spacing: .6px;
}
.sg-dt-k { font-size: 9px; text-transform: uppercase; color: var(--text-muted, #a1a1aa); }
.sg-dt-h.is-lab .sg-dt-k { color: var(--accent, #38bdf8); }
.sg-dt-day { height: 50px; color: #fff; font-size: 11px; }
.sg-dt-day small { display: block; margin-top: 1px; font-size: 8.5px; font-weight: 700; letter-spacing: .4px; color: #4ade80; }
.sg-dt tr.is-free .sg-dt-c:not(.is-on) { background: rgba(74,222,128,.05); }
.sg-dt-t { padding: 4px 2px; border-radius: 6px; text-align: center; line-height: 1.25; background: rgba(255,255,255,.04); font-variant-numeric: tabular-nums; }
.sg-dt-t b { display: block; font-size: 10px; font-weight: 800; color: #e4e4e7; }
.sg-dt-t span { display: block; font-size: 9px; font-weight: 600; color: #71717a; }
.sg-dt-h.is-lab .sg-dt-t { background: rgba(56,189,248,.06); }
.sg-dt-h.is-lab .sg-dt-t b { color: #bae6fd; }
.sg-dt-lunch { width: 22px; border-radius: 6px; text-align: center; vertical-align: middle; background: rgba(234,179,8,.07); }
.sg-dt-lunch span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); font-size: 9.5px; font-weight: 800; letter-spacing: 3px; color: var(--brand, #eab308); }
.sg-dt-c { position: relative; height: 50px; border-radius: 6px; overflow: hidden; text-align: center; vertical-align: middle; background: rgba(255,255,255,.035); }
.sg-dt-c b, .sg-dt-c small { display: block; padding: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-dt-c b { font-family: Consolas, monospace; font-size: 10.5px; font-weight: 700; color: #fff; }
.sg-dt-c small { font-size: 9px; font-weight: 600; color: rgba(255,255,255,.8); }
.sg-dt-c small.sg-dt-n { font-family: Consolas, monospace; color: #52525b; }
.sg-dt-c.is-on { background: var(--sw, #475569); box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.sg-dt-c.is-on.is-l::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(135deg, rgba(255,255,255,.14) 0 3px, transparent 3px 9px); }
.sg-dt-c.is-on.sg-ck { background: repeating-linear-gradient(135deg, rgba(161,161,170,.35) 0 4px, rgba(161,161,170,.12) 4px 8px); }
.sg-dt-c.is-on.sg-ck b { color: #e4e4e7; }

/* week map (phones): one block per period, nothing to scroll */
.sg-wk { display: none; flex-direction: column; gap: 4px; }
.sg-wk-row {
  display: flex; align-items: center; gap: 2px; width: 100%; height: 34px; padding: 0 6px 0 0; border-radius: 9px;
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.07); color: inherit;
}
.sg-wk-row:active { transform: none; }
.sg-wk-row.is-on { border-color: var(--brand, #eab308); background: rgba(234,179,8,.07); }
.sg-wk-row.is-free { background: rgba(74,222,128,.045); border-color: rgba(74,222,128,.22); }
.sg-wk-d { flex: none; width: 38px; font-size: 10px; font-weight: 800; letter-spacing: .5px; color: #fff; text-align: center; }
.sg-wk-row.is-free .sg-wk-d { color: #4ade80; }
.sg-wk-c { flex: 1; min-width: 0; height: 20px; border-radius: 3px; background: rgba(255,255,255,.06); }
.sg-wk-c.is-lunch { margin-right: 5px; }
.sg-wk-c.is-on { background: var(--sw, #475569); }
.sg-wk-c.is-on.is-l { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.22) 0 2px, transparent 2px 6px); }
.sg-wk-c.is-on.sg-ck { background: repeating-linear-gradient(135deg, rgba(161,161,170,.45) 0 3px, rgba(161,161,170,.15) 3px 6px); }
.sg-wk-free { flex: none; margin-left: 4px; font-size: 9.5px; font-weight: 700; color: #4ade80; }

/* day tabs (phones) */
.sg-ag-tabs { display: none; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-bottom: 8px; }
.sg-ag-tab {
  display: flex; flex-direction: column; align-items: center; gap: 1px; height: 44px; padding: 0 2px; border-radius: 9px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.1); color: var(--text-main, #f4f4f5);
}
.sg-ag-tab:active { transform: none; }
.sg-ag-tab b { font-size: 11px; font-weight: 800; letter-spacing: .4px; }
.sg-ag-tab small { font-size: 9px; font-weight: 600; color: var(--text-muted, #a1a1aa); white-space: nowrap; }
.sg-ag-tab.is-free small { color: #4ade80; }
.sg-ag-tab.is-on { color: #000; background: var(--brand-grad, linear-gradient(135deg,#fde047,#ca8a04)); border-color: transparent; }
.sg-ag-tab.is-on small { color: rgba(0,0,0,.7); }

/* day-by-day agenda */
.sg-ag { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.sg-ag-day { min-width: 0; padding: 10px 12px; border-radius: 11px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.07); }
.sg-ag-day.is-free { background: rgba(74,222,128,.045); border-color: rgba(74,222,128,.2); }
.sg-ag-dh { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sg-ag-day.is-free .sg-ag-dh { margin-bottom: 2px; }
.sg-ag-dh b { font-size: 12px; font-weight: 800; letter-spacing: .6px; color: #fff; }
.sg-ag-dh span { font-size: 11px; color: var(--text-muted, #a1a1aa); font-variant-numeric: tabular-nums; text-align: right; }
.sg-ag-dh .sg-ag-free { color: #4ade80; font-weight: 700; }
.sg-ag-none { margin: 0; font-size: 11px; color: var(--text-muted, #a1a1aa); }
.sg-ag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.sg-ag-s { display: flex; align-items: stretch; gap: 9px; min-width: 0; min-height: 36px; font-size: 11.5px; line-height: 1.35; }
.sg-ag-t { flex: none; width: 44px; display: flex; flex-direction: column; justify-content: center; font-family: Consolas, monospace; font-variant-numeric: tabular-nums; }
.sg-ag-t b { font-size: 11.5px; font-weight: 700; color: #fff; }
.sg-ag-t span { font-size: 10px; color: #71717a; }
.sg-ag-rail { flex: none; width: 3px; border-radius: 2px; background: var(--sw, #71717a); }
.sg-ag-s.is-k .sg-ag-rail { background: repeating-linear-gradient(180deg, rgba(161,161,170,.6) 0 3px, rgba(161,161,170,.15) 3px 6px); }
.sg-ag-m { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.sg-ag-m b { font-family: Consolas, monospace; font-size: 12px; font-weight: 700; color: #fff; }
.sg-ag-ttl { font-size: 11px; color: #d4d4d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-ag-k {
  flex: none; align-self: center; font-size: 10px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; padding: 2px 7px; border-radius: 5px;
  color: var(--brand, #eab308); background: rgba(234,179,8,.1); white-space: nowrap;
}
.sg-ag-k em { font-style: normal; font-family: Consolas, monospace; font-weight: 700; text-transform: none; color: #fff; }
.sg-ag-k.is-l { color: var(--accent, #38bdf8); background: rgba(56,189,248,.1); }
.sg-ag-k i { font-size: 8.5px; color: var(--text-muted, #a1a1aa); }
.sg-ag-gap { padding-left: 56px; font-size: 10.5px; font-style: italic; color: #71717a; }
.sg-ag-gap span { display: inline-block; padding: 1px 0 1px 8px; border-left: 2px dotted rgba(255,255,255,.14); }
.sg-ag-gap i { font-size: 9px; margin-right: 2px; }

/* per-subject summary */
.sg-sub { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.sg-sub-row { min-width: 0; padding: 10px 12px; border-radius: 11px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.07); }
.sg-sub-h { display: flex; align-items: center; gap: 8px; min-width: 0; margin-bottom: 7px; }
.sg-sub-h b { flex: none; font-family: Consolas, monospace; font-size: 12.5px; font-weight: 700; color: #fff; }
.sg-sub-h span { flex: 1; min-width: 0; font-size: 11.5px; color: #d4d4d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-sub-h em { flex: none; font-style: normal; font-size: 11px; font-weight: 700; color: var(--brand, #eab308); }
.sg-sub-c { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; padding: 5px 0 0; }
.sg-sub-c + .sg-sub-c { margin-top: 2px; }
.sg-sub-c.is-none { opacity: .5; }
.sg-sub-k { flex: none; width: 46px; font-size: 9.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--brand, #eab308); }
.sg-sub-c.is-l .sg-sub-k { color: var(--accent, #38bdf8); }
.sg-sub-k.is-p { color: #c4b5fd; }
.sg-sub-c small { flex: 1 1 140px; min-width: 0; font-size: 11px; line-height: 1.35; color: var(--text-muted, #a1a1aa); font-variant-numeric: tabular-nums; }
.sg-sub-type { flex: none; font-style: normal; font-size: 10px; font-weight: 600; color: #71717a; }

/* ---------- combination table on the card ---------- */
.sg-cb { margin-top: 12px; overflow: hidden; border-radius: 12px; border: 1px solid rgba(255,255,255,.07); background: rgba(0,0,0,.28); }
.sg-cb-row { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.45fr) minmax(0, 1fr); gap: 12px; align-items: center; padding: 9px 12px; }
.sg-cb-row + .sg-cb-row { border-top: 1px solid rgba(255,255,255,.05); }
.sg-cb-hd { padding-top: 7px; padding-bottom: 7px; background: rgba(255,255,255,.025); }
.sg-cb-hd span { font-size: 9.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: #71717a; }
.sg-cb-subj { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sg-cb-subj b { flex: none; font-family: Consolas, monospace; font-size: 12px; font-weight: 700; color: #fff; }
.sg-cb-subj span { min-width: 0; font-size: 11.5px; color: #d4d4d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-cb-kept { flex: none; font-style: normal; font-size: 10px; font-weight: 600; color: var(--text-muted, #a1a1aa); }
.sg-cb-kept i { font-size: 8.5px; }
.sg-cb-row.is-kept .sg-cb-subj b { color: #d4d4d8; }
.sg-cb-c { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.sg-cb-k { display: none; }
.sg-cb-time { flex: 1 1 150px; min-width: 0; font-size: 11px; line-height: 1.35; color: var(--text-muted, #a1a1aa); font-variant-numeric: tabular-nums; }
.sg-cb-c.is-k .sg-cb-time { opacity: .75; }
.sg-cb-dash { color: #52525b; }
.sg-cb-proj { grid-column: 2 / span 2; }
.sg-cb-proj em { font-style: normal; font-size: 11px; color: #c4b5fd; }
/* narrow card on a small desktop window: stack like the phone layout */
.sg-cb { container-type: inline-size; }
@container (max-width: 520px) {
  .sg-cb-hd { display: none; }
  .sg-cb-row { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 10px 11px; }
  .sg-cb-c { padding-left: 17px; }
  .sg-cb-c.is-none { display: none; }
  .sg-cb-k { display: inline-block; flex: none; width: 46px; font-size: 9.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--brand, #eab308); }
  .sg-cb-c.is-l .sg-cb-k { color: var(--accent, #38bdf8); }
  .sg-cb-proj { grid-column: auto; }
}

/* ---------- Visualise timetable modal (above the sheet, below showConfirm) ---------- */
.sg-modal {
  position: fixed; inset: 0; z-index: 1700; display: flex; align-items: center; justify-content: center; padding: 3vh 16px;
  background: rgba(0,0,0,.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.sg-modal[hidden], .sg-modal [hidden] { display: none !important; }
.sg-modal.is-open { animation: sgFade .18s ease-out; }
.sg-modal button { font-family: inherit; }
.sg-modal :focus-visible { outline: 2px solid var(--brand, #eab308); outline-offset: 2px; }
.sg-modal-box {
  width: min(1040px, 94vw); max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
  background: rgba(14,14,14,.98); border: 1px solid rgba(255,255,255,.12); border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0,0,0,.85), inset 0 1px 0 rgba(255,255,255,.06);
  color: var(--text-main, #f4f4f5); font-size: 13px; line-height: 1.4;
  animation: sgUp .28s cubic-bezier(.2,.9,.3,1.08);
}
.sg-mm-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--glass-border, rgba(255,255,255,.08)); }
.sg-mm-foot {
  flex: none; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--glass-border, rgba(255,255,255,.08)); background: rgba(10,10,10,.95);
}
.sg-mm-foot .sg-btn { height: 40px; padding: 0 16px; }

/* ---------- minimised preview bar ---------- */
.sg-sheet.sg-min { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; animation: none; }
.sg-sheet.sg-min .sg-panel { display: none; }
.sg-bar {
  display: none; position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 560px; min-height: 56px; margin: 0 auto; padding: 8px 8px 8px 12px; gap: 10px; align-items: center;
  border-radius: 14px; background: rgba(12,12,12,.95); border: 1px solid rgba(234,179,8,.45);
  box-shadow: 0 16px 44px rgba(0,0,0,.75), 0 0 0 4px rgba(234,179,8,.06);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); pointer-events: auto;
}
.sg-sheet.sg-min .sg-bar { display: flex; animation: sgBarIn .3s cubic-bezier(.2,.9,.3,1.1); }
.sg-bar-ic { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--brand, #eab308); background: rgba(234,179,8,.12); }
.sg-bar-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sg-bar-txt b { font-size: 12.5px; color: #fff; white-space: nowrap; }
.sg-bar-txt small { font-size: 10.5px; color: var(--text-muted, #a1a1aa); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-bar .sg-btn { height: 38px; }

/* banner + outline on the page timetable while previewing */
.sg-pv-banner {
  display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 8px 12px; border-radius: 9px;
  font-size: 11.5px; line-height: 1.4; color: #fde68a; background: rgba(234,179,8,.1); border: 1px solid rgba(234,179,8,.4);
  animation: sgFade .25s ease-out;
}
.sg-pv-banner i { color: var(--brand, #eab308); }
.sg-pv-banner b { color: #fff; }
.sg-pv-on .tt-wrap { box-shadow: 0 0 0 2px rgba(234,179,8,.6), 0 4px 15px rgba(0,0,0,.3) !important; }

/* slot list inside the showConfirm() dialog */
.sg-cf {
  display: flex; flex-direction: column; gap: 3px; margin: 12px auto 0; padding: 10px 12px; max-height: 180px; overflow-y: auto;
  border-radius: 10px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.06); text-align: left;
  font-family: Consolas, monospace; font-size: 11.5px; color: var(--text-muted, #a1a1aa);
}
.sg-cf b { color: var(--brand, #eab308); margin-right: 6px; }

.sg-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- animations ---------- */
@keyframes sgFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sgUp { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes sgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sgDrop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes sgBarIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes sgChipIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@keyframes sgPulse {
  0% { box-shadow: 0 0 0 0 rgba(234,179,8,.55); border-color: var(--brand, #eab308); }
  60% { box-shadow: 0 0 0 7px rgba(234,179,8,0); border-color: var(--brand, #eab308); }
  100% { box-shadow: 0 0 0 0 rgba(234,179,8,0); }
}
@keyframes sgShimmer { from { background-position: 200% 0; } to { background-position: 0 0; } }
@keyframes sgBreath { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(234,179,8,.25); } 50% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(234,179,8,0); } }

/* ---------- tablet & phone: full screen, tabs ---------- */
@media (max-width: 768px) {
  .sg-sheet { padding: 0; align-items: stretch; }
  .sg-panel {
    width: 100%; height: 100%; height: 100dvh; border: none; border-radius: 0;
    animation: sgUpM .3s cubic-bezier(.2,.9,.3,1.04);
  }
  .sg-head { min-height: 52px; padding: calc(6px + env(safe-area-inset-top)) 10px 6px 14px; }
  .sg-tabs { display: flex; flex: none; gap: 4px; padding: 6px 10px; border-bottom: 1px solid var(--glass-border, rgba(255,255,255,.08)); }
  .sg-tab {
    flex: 1; height: 38px; justify-content: center; gap: 7px; border-radius: 10px;
    background: none; border: 1px solid transparent; color: var(--text-muted, #a1a1aa); font-size: 12.5px; font-weight: 700;
  }
  .sg-tab[aria-selected="true"] { color: var(--brand, #eab308); background: rgba(234,179,8,.1); border-color: rgba(234,179,8,.3); }
  .sg-tab-n { min-width: 18px; padding: 1px 6px; border-radius: 999px; font-size: 10px; color: #fff; background: rgba(255,255,255,.1); }
  .sg-tab-n:empty { display: none; }
  .sg-tab-n i { font-size: 9px; }
  .sg-body { display: flex; flex-direction: column; }
  .sg-left, .sg-right { flex: 1; }
  .sg-left { border-right: none; background: none; }
  .sg-panel[data-tab="subjects"] .sg-right, .sg-panel[data-tab="results"] .sg-left { display: none; }
  .sg-inbox input, .sg-sort select { font-size: 16px; } /* no iOS zoom */
  .sg-inbox input { height: 46px; }
  .sg-sort select { height: 38px; font-size: 16px; }
  .sg-left-foot { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .sg-find { height: 48px; }
  .sg-res-head { padding: 10px 12px; }
  .sg-res-scroll { padding: 12px 12px calc(22px + env(safe-area-inset-bottom)); }
  .sg-card-foot .sg-btn { flex: 1; height: 40px; }
  .sg-only-m { display: inline-flex; }
  .sg-card:hover { box-shadow: none; }
  .sg-drop { max-height: min(300px, 42vh); }
  /* combination: each subject becomes a stacked block */
  .sg-cb-hd { display: none; }
  .sg-cb-row { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 10px 11px; }
  .sg-cb-c { padding-left: 17px; }
  .sg-cb-c.is-none { display: none; }
  .sg-cb-k { display: inline-block; flex: none; width: 46px; font-size: 9.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--brand, #eab308); }
  .sg-cb-c.is-l .sg-cb-k { color: var(--accent, #38bdf8); }
  .sg-cb-proj { grid-column: auto; }
  /* modal: full-screen sheet */
  .sg-modal { padding: 0; align-items: stretch; }
  .sg-modal-box { width: 100%; max-height: none; height: 100%; height: 100dvh; border: none; border-radius: 0; animation: sgUpM .28s cubic-bezier(.2,.9,.3,1.04); }
  .sg-mm-head { padding: calc(8px + env(safe-area-inset-top)) 10px 8px 14px; }
  .sg-mm-body { padding: 12px 12px 18px; }
  .sg-mm-foot { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .sg-mm-foot .sg-btn { flex: 1; height: 44px; padding: 0 10px; }
  .sg-dv-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sg-ag, .sg-sub, .sg-dvv-list { grid-template-columns: minmax(0, 1fr); }
  .sg-dv-ttl { text-align: left; }
  .sg-filt { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 2px -12px 0; padding: 0 12px 2px; width: auto; }
  .sg-filt::-webkit-scrollbar { display: none; }
}

/* phone modal: 12 periods cannot fit, so the week becomes a map and the agenda gets day tabs */
@media (max-width: 600px) {
  .sg-dt-wrap { display: none; }
  .sg-wk { display: flex; }
  .sg-ag-tabs { display: grid; }
  .sg-ag-day:not(.is-act) { display: none; }
  .sg-ag-day.is-act { animation: sgFade .18s ease-out; }
  .sg-lg { margin-bottom: 8px; }
}
@keyframes sgUpM { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }

@media (max-width: 420px) {
  .sg-need-l { display: none; }
  .sg-need-s { display: inline; }
  .sg-when { margin-left: 0; }
  .sg-res-head { gap: 8px; }
  .sg-sort, .sg-sort select { width: 100%; }
}

@media (max-width: 360px) {
  .sg-cta { gap: 10px; padding: 9px; }
  .sg-cta-ic { width: 32px; height: 32px; font-size: 13px; }
  .sg-cta-txt b { font-size: 12.5px; }
  .sg-cta-txt small { font-size: 10.5px; }
  .sg-cta-go { font-size: 0; gap: 0; width: 30px; height: 30px; padding: 0; justify-content: center; }
  .sg-cta-go i { font-size: 11px; }

  .sg-head-txt p { display: none; }
  .sg-head-ic { width: 28px; height: 28px; font-size: 12px; }
  .sg-tabs { padding: 6px 8px; }
  .sg-search { padding: 10px 10px 8px; }
  .sg-drop { left: 10px; right: 10px; }
  .sg-left-scroll { padding: 4px 10px 14px; }
  .sg-left-foot { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .sg-res-head { padding: 10px; }
  .sg-res-scroll { padding: 10px 10px calc(20px + env(safe-area-inset-bottom)); }
  .sg-res-big { font-size: 17px; }
  .sg-card { padding: 11px; }
  .sg-l-long { display: none; }
  .sg-l-short { display: inline; }
  .sg-days { gap: 4px; }
  .sg-day { font-size: 10.5px; }
  .sg-seg button { font-size: 11px; padding: 0 4px; }
  .sg-seg.is-2l b { font-size: 10.5px; }
  .sg-seg.is-2l small { font-size: 9px; }
  .sg-bar { left: 8px; right: 8px; padding: 7px 7px 7px 10px; gap: 8px; }
  .sg-bar-ic { display: none; }
  .sg-bar .sg-btn { padding: 0 11px; }
  .sg-empty { margin-top: 24px; }
  .sg-card-foot { gap: 6px; }
  .sg-card-foot .sg-btn { padding: 0 8px; gap: 5px; }
  .sg-mm-body { padding: 10px 10px 16px; }
  .sg-mm-foot { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
  .sg-mm-head .sg-head-ic { display: none; }
  .sg-cb-row { padding: 9px 10px; }
  .sg-dv-tile { padding: 9px 10px; }
  .sg-dv-tile b { font-size: 14.5px; }
  .sg-ag-day, .sg-sub-row { padding: 10px; }
  .sg-dv-strip { gap: 6px; }
  .sg-wk-d { width: 34px; font-size: 9.5px; }
  .sg-wk-c { height: 18px; }
  .sg-ag-k { padding: 2px 5px; }
  .sg-fc { height: 26px; padding: 0 8px; font-size: 10.5px; }
  .sg-filt { margin: 2px -10px 0; padding: 0 10px 2px; }
  .sg-chip-sl { padding: 0 6px; gap: 4px; }
  .sg-chip-sl span { display: none; }
  .sg-chip-sl em { display: inline-block; }
  .sg-sl { padding: 9px 9px 7px; }
  .sg-sl-p { padding: 5px 7px; gap: 7px; }
  .sg-sl-p b { min-width: 66px; font-size: 11px; }
  .sg-var { padding: 5px 9px; }
}

@media (max-width: 330px) {
  .sg-chip { gap: 5px; padding-left: 9px; }
  .sg-seg.is-2l button { padding: 0 2px; }
  .sg-seg.is-2l b { font-size: 10px; }
  .sg-seg.is-2l small { font-size: 8.5px; }
  .sg-sl-p { flex-wrap: wrap; row-gap: 2px; }
  .sg-sl-p small { flex-basis: 100%; padding-left: 23px; }
  .sg-chip-code, .sg-chip-title { font-size: 11px; }
  .sg-need { padding: 0 6px; font-size: 10px; }
  .sg-card-foot .sg-btn { height: 36px; }
  .sg-s { font-size: 10.5px; padding: 1px 5px; }
  .sg-tab { font-size: 12px; gap: 5px; }
  .sg-bar-txt small { display: none; }
  .sg-card-foot .sg-btn i { display: none; }
  .sg-ag-s { gap: 7px; }
  .sg-ag-k em { display: none; }
  .sg-ag-gap { padding-left: 0; }
  .sg-sub-type { display: none; }
  .sg-wk-row { padding-right: 4px; }
  .sg-wk-c { height: 16px; border-radius: 2px; }
  .sg-wk-free { display: none; }
  .sg-dv-nav { width: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .sg-sheet, .sg-sheet *, .sg-modal, .sg-modal *, .sg-cta, .sg-cta *, .sg-pv-banner { animation: none !important; transition: none !important; }
}
