:root {
  --bg: var(--tg-theme-bg-color, #fff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f3f5);
  --text: var(--tg-theme-text-color, #111);
  --hint: var(--tg-theme-hint-color, #8a8f98);
  --link: var(--tg-theme-link-color, #2a7de1);
  --btn: var(--tg-theme-button-color, #2a7de1);
  --btn-text: var(--tg-theme-button-text-color, #fff);
  --section: var(--tg-theme-section-bg-color, var(--bg));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg2); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 640px; margin: 0 auto; padding: 12px 12px 32px; }
h1 { font-size: 20px; margin: 2px 0 0; }
.muted { color: var(--hint); }
.small { font-size: 12px; }
.center { text-align: center; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.chip { border: 0; background: var(--section); color: var(--link); padding: 7px 12px; border-radius: 16px; font-size: 13px; cursor: pointer; }
input[type=search] { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid transparent;
  background: var(--section); color: var(--text); font-size: 16px; outline: none; }
input[type=search]:focus { border-color: var(--btn); }
.list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.list button { text-align: left; border: 0; background: var(--section); color: var(--text); padding: 12px 14px; border-radius: 12px; cursor: pointer; }
.list button b { display: block; font-size: 16px; }
.list button span { color: var(--hint); font-size: 12px; }
.tabs { display: flex; background: var(--section); border-radius: 12px; padding: 3px; gap: 3px; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--text); padding: 8px; border-radius: 9px; font-size: 14px; cursor: pointer; }
.tabs button.active { background: var(--btn); color: var(--btn-text); }
.weekbar { display: flex; align-items: center; gap: 4px; margin: 10px 0; }
.arrow { border: 0; background: transparent; color: var(--link); font-size: 26px; width: 30px; cursor: pointer; }
.days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.days button { border: 0; background: var(--section); color: var(--text); border-radius: 10px; padding: 6px 0; cursor: pointer; font-size: 12px; }
.days button b { display: block; font-size: 16px; }
.days button.today b { color: var(--link); }
.days button.sel { background: var(--btn); color: var(--btn-text); }
.days button.sel b { color: var(--btn-text); }
.days button.has::after { content: "•"; display: block; line-height: 6px; color: var(--hint); }
.days button.sel.has::after { color: var(--btn-text); }
.dayhead { margin: 16px 4px 6px; font-weight: 600; text-transform: capitalize; }
.dayhead .muted { font-weight: 400; text-transform: none; }
.card { display: flex; gap: 12px; background: var(--section); border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.time { min-width: 48px; font-variant-numeric: tabular-nums; }
.time b { display: block; }
.time span { color: var(--hint); font-size: 13px; }
.body { flex: 1; min-width: 0; }
.subj { font-weight: 600; margin-bottom: 4px; }
.meta { color: var(--hint); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 8px; margin-bottom: 4px; background: var(--bg2); }
.badge.lec { background: #2e7d3222; color: #2e7d32; }
.badge.pr { background: #1565c022; color: #1565c0; }
.badge.lab { background: #8e24aa22; color: #8e24aa; }
.badge.kr { background: #ef6c0022; color: #ef6c00; }
.badge.sub { background: var(--bg2); color: var(--hint); }
.note { font-size: 12px; color: var(--hint); margin-top: 4px; }
.empty { background: var(--section); border-radius: 14px; padding: 18px; text-align: center; color: var(--hint); margin-bottom: 8px; }
.err { color: #d32f2f; }
