  :root {
    --bg:        #0f1115;
    --bg-card:   #181b22;
    --bg-raised: #21242e;
    --text:      #f2f3f7;
    --hint:      #9aa0ac;
    --accent:    #7c7ff5;
    --accent-2:  #43c6ac;
    --danger:    #ff6363;
    --warn:      #ffb238;
    --ok:        #3ddc84;
    --border:    #2a2e3a;
    --radius:    18px;
    --radius-sm: 12px;
    --shadow:    0 8px 24px rgba(0,0,0,0.35);
    /* цвета для текста: в тёмной теме — те же, в светлой — темнее (ниже) */
    --ok-text: var(--ok); --warn-text: var(--warn); --accent-2-text: var(--accent-2); --danger-text: var(--danger);
  }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body { height: 100%; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    overscroll-behavior-y: contain;
  }
  ::-webkit-scrollbar { display: none; }

  header.top {
    padding: 18px 18px 10px;
    background: var(--bg);
  }
  /* полный экран Telegram (core.js): шапка ниже «чёлки» и кнопок Telegram, вкладки — выше полоски */
  html.fullscreen header.top { padding-top: calc(max(var(--safe-top, 0px), env(safe-area-inset-top), 44px) + 8px); }
  /* в полном экране под часами и кнопками Telegram — полоса фона, чтобы
     прокрученный контент не просвечивал под ними (живой тест) */
  html.fullscreen body::before {
    content: ""; position: fixed; top: 0; left: 0; right: 0; z-index: 50; pointer-events: none;
    height: calc(max(var(--safe-top, 0px), env(safe-area-inset-top)) + 4px);
    background: linear-gradient(var(--bg) 75%, transparent);
  }
  html.fullscreen nav.tabs { padding-bottom: calc(8px + var(--safe-bottom, 0px)); }
  header.top h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.3px;
  }
  header.top p {
    margin: 2px 0 0;
    color: var(--hint);
    font-size: 13px;
  }

  /* Отступ снизу под фиксированную панель вкладок. На body он не работал:
     у body height: 100%, и его padding-bottom не добавлялся после контента —
     последняя пара/карточка оставалась под панелью (живой тест с телефона). */
  main { padding: 6px 14px calc(var(--nav-h, 64px) + 28px); }

  .view { display: none; animation: fadein .18s ease; }
  .view.active { display: block; }
  @keyframes fadein { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none; } }

  .bento {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
  }
  .bento .wide { grid-column: 1 / -1; }

  .card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
  }
  .card.tap { cursor: pointer; transition: transform .12s ease, background .12s ease; }
  .card.tap:active { transform: scale(0.97); background: var(--bg-raised); }

  .card .eyebrow {
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--accent-2-text);
    margin: 0 0 6px;
  }
  .card .big { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
  .card .sub { color: var(--hint); font-size: 13px; margin: 0; }

  .schedule-html { font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; }

  /* Главная: погода, «следующая пара», пары карточками, выбор дня */
  .opt-card {
    margin: 0 0 12px; padding: 12px 14px; background: var(--bg-card); border: 1px solid var(--accent);
    border-radius: var(--radius-sm); animation: fadein .3s ease-out;
  }
  .opt-card .txt { font-size: 13px; color: var(--hint); line-height: 1.35; }
  .opt-card .txt b { display: block; font-size: 15px; color: var(--text); margin-bottom: 2px; }
  .opt-card .btns { display: flex; gap: 8px; margin-top: 10px; }
  .opt-card button { flex: 1; border: none; border-radius: 999px; padding: 9px 0; font-size: 14px; font-weight: 700;
                     background: var(--accent); color: #fff; }
  .opt-card button.no { background: none; border: 1px solid var(--border); color: var(--text); }
  .home-add {
    display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 10px 10px 12px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    animation: fadein .3s ease-out;
  }
  .home-add .ic { font-size: 22px; }
  .home-add .txt { flex: 1; min-width: 0; font-size: 12.5px; color: var(--hint); line-height: 1.3; }
  .home-add .txt b { display: block; font-size: 14px; color: var(--text); }
  .home-add button { flex: none; background: var(--accent); color: #fff; border: none; border-radius: 999px;
                     padding: 7px 13px; font-size: 13px; font-weight: 700; white-space: nowrap; }
  .home-add button.x { background: none; color: var(--hint); padding: 4px; font-size: 14px; font-weight: 400; }
  .home-link { display: block; margin: 18px auto 4px; color: var(--hint); font-weight: 600; }
  .weather-pill {
    display: inline-block; margin: 0 0 10px; padding: 7px 12px; border-radius: 999px;
    background: var(--bg-card); border: 1px solid var(--border); color: var(--hint); font-size: 13px;
  }
  .hero {
    border-radius: var(--radius); padding: 16px 18px; margin-bottom: 4px; color: #fff;
    background: linear-gradient(135deg, var(--accent) 0%, #5a5fe0 55%, var(--accent-2) 130%);
    box-shadow: 0 10px 28px rgba(92, 96, 230, .35);
  }
  .hero .h-eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; opacity: .85; }
  .hero .h-big { font-size: 28px; font-weight: 900; letter-spacing: -.5px; margin: 4px 0 2px; }
  .hero .h-title { font-size: 16px; font-weight: 700; margin: 2px 0; }
  .hero .h-meta { font-size: 13px; opacity: .9; }
  .hero .h-bar { height: 6px; background: rgba(255,255,255,.25); border-radius: 99px; margin-top: 12px; overflow: hidden; }
  .hero .h-bar i { display: block; height: 100%; background: #fff; border-radius: 99px; transition: width .6s ease; }
  .hero.calm { background: linear-gradient(135deg, #2f9e7e 0%, var(--accent-2) 100%); box-shadow: 0 10px 28px rgba(67,198,172,.3); }
  /* расписание не загрузилось — серая карточка с «Повторить», не «отдыхай» */
  .hero.err { background: linear-gradient(135deg, #5b6170 0%, #7a8090 100%); box-shadow: none; }
  .hero .h-retry { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 7px 14px; border: none;
                   border-radius: 999px; background: rgba(255,255,255,.2); color: #fff; font-size: 13px; font-weight: 700; }
  .lessons { display: flex; flex-direction: column; gap: 8px; }
  .lesson {
    display: flex; gap: 12px; align-items: stretch;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 11px 13px; position: relative;
  }
  .lesson.now { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
  .lesson.past { opacity: .5; }
  .lesson .l-time { min-width: 46px; display: flex; flex-direction: column; font-size: 13px; color: var(--hint); }
  .lesson .l-time b { color: var(--text); font-size: 15px; }
  .lesson .l-body { flex: 1; min-width: 0; }
  .lesson .l-title { font-weight: 700; line-height: 1.3; }
  .lesson .l-meta { color: var(--hint); font-size: 12.5px; margin-top: 3px; }
  .lesson .l-num {
    align-self: flex-start; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 8px;
    background: var(--bg-raised); color: var(--hint); font-size: 12px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
  }
  .lesson.now .l-num { background: var(--accent); color: #fff; }
  .lesson .l-now { color: var(--ok-text); font-weight: 800; font-size: 12px; }
  .note-card { margin-top: 8px; padding: 10px 13px; border-radius: var(--radius-sm);
               background: rgba(255,178,56,.1); border: 1px solid rgba(255,178,56,.3); font-size: 13.5px; }
  .daychips { display: flex; gap: 6px; margin-bottom: 10px; }
  .week-nav { display: flex; gap: 6px; }
  .week-nav button {
    width: 34px; height: 30px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text); font-size: 18px; font-weight: 800; line-height: 1;
  }
  .week-nav button:disabled { opacity: .3; }
  .daychips button {
    flex: 1; background: var(--bg-card); border: 1px solid var(--border); color: var(--hint);
    border-radius: 12px; padding: 7px 0; font-size: 11.5px; font-weight: 700; line-height: 1.2;
  }
  .daychips button b { display: block; font-size: 16px; color: var(--text); }
  .daychips button.today b { color: var(--accent-2-text); }
  .daychips button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
  .daychips button.active b { color: #fff; }
  .daychips .dots { display: flex; justify-content: center; gap: 2px; height: 5px; margin-top: 4px; }
  .daychips .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--hint); }
  .daychips button.active .dots i { background: rgba(255,255,255,.9) !important; }
  .daychips.swipe-l { animation: swipel .25s ease-out; }
  .daychips.swipe-r { animation: swiper .25s ease-out; }
  @keyframes swipel { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
  @keyframes swiper { from { transform: translateX(-24px); opacity: .4; } to { transform: none; opacity: 1; } }
  button.sending { animation: pulse .8s ease-in-out infinite; }
  button.sent { background: var(--ok, #34c759) !important; color: #fff !important; transform: scale(1.04); transition: transform .15s, background .2s; }
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
  .kd { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
  #wk-num, #tw-num { margin-left: 6px; }
  .skel {
    border-radius: var(--radius-sm); margin-bottom: 8px;
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-raised) 50%, var(--bg-card) 75%);
    background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
  }
  @keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
  .schedule-html s { color: var(--hint); }
  .schedule-html b { color: var(--accent-2-text); }

  .chip {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    background: var(--bg-raised);
    color: var(--hint);
    border: 1px solid var(--border);
  }
  .chip.ok      { background: rgba(61,220,132,.14); color: var(--ok-text); border-color: rgba(61,220,132,.3); }
  .chip.warn    { background: rgba(255,178,56,.14); color: var(--warn-text); border-color: rgba(255,178,56,.3); }
  .chip.danger  { background: rgba(255,99,99,.14);  color: var(--danger-text); border-color: rgba(255,99,99,.3); }

  nav.tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    display: flex;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  }
  nav.tabs button {
    flex: 1;
    background: none; border: none; color: var(--hint);
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: 11px; font-weight: 600;
    padding: 6px 2px;
    border-radius: var(--radius-sm);
    transition: color .15s ease, background .15s ease;
  }
  nav.tabs button .ic { font-size: 20px; line-height: 1; }
  nav.tabs button.active { color: var(--accent); background: rgba(124,127,245,.12); }

  h2.section {
    font-size: 15px;
    font-weight: 800;
    margin: 18px 2px 10px;
    display: flex; align-items: center; justify-content: space-between;
  }
  h2.section .stat { font-size: 12px; color: var(--hint); font-weight: 600; }

  .list { display: flex; flex-direction: column; gap: 8px; }

  .seg { display: flex; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 3px; margin: 4px 0 4px; }
  .seg button { flex: 1; background: none; border: none; color: var(--hint); font-weight: 700; font-size: 13.5px; padding: 8px 0; border-radius: 9px; }
  .seg button.active { background: var(--accent); color: #fff; }
  .group-title { color: var(--hint); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; margin: 14px 2px 8px; }
  .group-title.danger { color: var(--danger-text); }
  details.done-group summary { cursor: pointer; list-style: none; }
  details.done-group summary::-webkit-details-marker { display: none; }
  .dl-actions { display: flex; gap: 12px; margin-top: 6px; }
  .dl-actions button, .dl-actions a { background: none; border: none; color: var(--accent); font-size: 12.5px; font-weight: 700; padding: 0; text-decoration: none; }
  .dl-actions button.del { color: var(--danger-text); }
  .fab {
    position: fixed; right: 18px; bottom: calc(var(--nav-h, 64px) + 16px); z-index: 8;
    width: 54px; height: 54px; border-radius: 50%; border: none;
    background: var(--accent); color: #fff; font-size: 28px; line-height: 1;
    box-shadow: 0 8px 22px rgba(92, 96, 230, .45);
  }
  #view-deadlines { padding-bottom: 80px; }
  .sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.5); display: none; align-items: flex-end; }
  .sheet-backdrop.open { display: flex; animation: fadein .15s ease; }
  .sheet {
    width: 100%; background: var(--bg); border-radius: 20px 20px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border); animation: slideup .2s ease;
    max-height: 88vh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  }
  @keyframes slideup { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
  .sheet-grip { width: 38px; height: 4px; border-radius: 4px; background: var(--border); margin: 0 auto 10px; }
  .sheet h3 { margin: 0 0 12px; font-size: 17px; }
  .sheet .row2 { display: flex; gap: 8px; }
  .sheet textarea { resize: none; font-family: inherit; font-size: 15px; }
  .sheet input { font-size: 16px; }
  .sheet-hint { color: var(--hint); font-size: 12.5px; margin: 0 0 12px; }
  button.primary { width: 100%; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); padding: 13px; font-size: 15px; font-weight: 800; }
  button.primary:disabled { opacity: .5; }
  .toast {
    position: fixed; left: 14px; right: 14px; bottom: calc(var(--nav-h, 64px) + 12px); z-index: 40;
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
    background: #23262f; color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.4);
    font-size: 14px; transform: translateY(20px); opacity: 0; pointer-events: none;
    transition: transform .2s ease, opacity .2s ease;
  }
  .toast.show { transform: none; opacity: 1; pointer-events: auto; }
  .toast span { flex: 1; }
  .toast button { background: none; border: none; color: #9ea2ff; font-weight: 800; font-size: 14px; padding: 0; }
  .toast button:empty { display: none; }
  .hw-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
  .hw-card .hw-subj { font-weight: 800; margin-bottom: 4px; }
  .hw-card .hw-text { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
  .hw-card .dl-meta { margin-top: 8px; }
  .file-card .fbody { min-width: 0; }
  .file-card .fbody.tap { cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .file-card .fbody.tap:active { opacity: .6; }

  /* ── Конспект лекции ── */
  .sum-body { background: var(--bg-raised); border: 1px solid var(--border); border-radius: 16px; padding: 14px 15px;
    font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
  .sum-body b { font-weight: 800; }
  .sum-foot { margin: 10px 2px 0; }
  .sum-empty { text-align: center; padding: 14px 8px 18px; }
  .sum-empty .sum-ic { display: inline-flex; width: 52px; height: 52px; border-radius: 16px; align-items: center; justify-content: center;
    background: linear-gradient(145deg, #9b7cf6, #4a8ff7); color: #fff; font-size: 26px; margin-bottom: 10px; }
  .sum-empty b { display: block; font-size: 16px; }
  .sum-empty p { color: var(--hint); font-size: 13.5px; margin: 6px auto 0; max-width: 300px; }
  .sum-wait { text-align: center; margin: 10px 0 0; }
  .chat-files { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
  .file-card button.dl { background: none; padding: 6px 4px; font-size: 18px; }
  .file-card.hl { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); transition: box-shadow .3s; }
  .file-card button.edit { margin-left: -4px; background: none; color: var(--hint); padding: 6px 2px; font-size: 15px; }
  .folder-card {
    display: flex; align-items: center; gap: 12px; cursor: pointer;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 14px;
    transition: transform .12s ease;
  }
  .folder-card:active { transform: scale(0.985); background: var(--bg-raised); }
  .folder-card .ic { font-size: 24px; }
  .folder-card .ft { font-weight: 800; word-break: break-word; }
  .folder-card .fs { color: var(--hint); font-size: 12.5px; margin-top: 2px; }
  .folder-card .go { margin-left: auto; color: var(--hint); font-size: 18px; }
  .file-back { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 14px; padding: 0; margin: 0 0 6px; }
  .file-del { display: block; width: 100%; margin-top: 10px; background: none; border: none;
              color: var(--danger-text); font-size: 14px; font-weight: 700; padding: 8px; }
  .file-del.inline { display: inline; width: auto; margin: 0 0 10px; padding: 0; font-size: 13px; }
  .file-subj-title { font-size: 19px; font-weight: 800; margin: 0 2px 10px; word-break: break-word; }
  #file-list > .group-title:first-child { margin-top: 2px; }

  .deadline-card {
    display: flex; align-items: flex-start; gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    transition: opacity .2s ease, transform .12s ease;
  }
  .deadline-card:active { transform: scale(0.985); }
  .deadline-card.done { opacity: .45; }
  .deadline-card.done .dl-title { text-decoration: line-through; }

  .checkbox {
    width: 24px; height: 24px; min-width: 24px;
    border-radius: 8px;
    border: 2px solid var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 900;
    margin-top: 1px;
  }
  .checkbox.checked { background: var(--accent); color: #fff; }

  .dl-body { flex: 1; min-width: 0; }
  .dl-title { font-weight: 700; margin: 0 0 3px; word-break: break-word; }
  .dl-desc { color: var(--hint); font-size: 13px; margin: 0 0 6px; word-break: break-word; }
  .dl-meta { display: flex; gap: 6px; flex-wrap: wrap; }

  .file-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
  }
  .file-card .ic { font-size: 22px; }
  .file-card .ft { font-weight: 700; }
  .file-card .fs { color: var(--hint); font-size: 12.5px; }
  .file-card button {
    margin-left: auto;
    flex: none; white-space: nowrap;   /* «В чат» в одну строку — сжимается название, а не кнопка */
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 7px 13px;
    font-size: 12.5px;
    font-weight: 700;
  }

  input.searchbox, select.filter, textarea.searchbox {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-size: 14px;
    margin-bottom: 10px;
  }
  input.searchbox::placeholder { color: var(--hint); }

  /* Поиск расписания */
  .chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 12px; }
  /* фильтры поиска — одной строкой с прокруткой вбок: «Аудитории» на узком
     iPhone уезжали на вторую строку (дизайн-ревью, п. 5) */
  #target-types { flex-wrap: nowrap; overflow-x: auto; margin-right: -18px; padding-right: 18px; }
  .chips-row button {
    flex: none; background: var(--bg-card); color: var(--hint);
    border: 1px solid var(--border); border-radius: 999px;
    padding: 6px 12px; font-size: 12.5px; font-weight: 700;
  }
  .chips-row button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
  .target-item {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer;
  }
  .target-item:active { transform: scale(0.985); background: var(--bg-raised); }
  .target-item .ic { font-size: 20px; }
  .target-item .tt { font-weight: 700; }
  .target-item .ts { color: var(--hint); font-size: 12px; }
  .target-item .go { margin-left: auto; color: var(--hint); font-size: 18px; }
  .target-head {
    display: flex; align-items: center; gap: 12px; margin: 4px 0 2px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
  }
  .target-head .ic { font-size: 30px; }
  .target-head .eyebrow { margin: 0; }
  .target-head .t-title { font-size: 19px; font-weight: 800; margin: 3px 0 0; word-break: break-word; }
  .pin-btn {
    margin-left: auto; flex: none; width: 42px; height: 42px; border-radius: 50%;
    background: var(--bg-raised); border: 1px solid var(--border); font-size: 19px; line-height: 1; padding: 0;
  }
  .pin-btn span { display: inline-block; filter: grayscale(1); opacity: .55; transition: transform .15s ease; }
  .pin-btn.on { background: var(--accent); border-color: var(--accent); }
  .pin-btn.on span { filter: none; opacity: 1; transform: rotate(-20deg); }
  .l-groups { color: var(--hint); font-size: 12.5px; margin-top: 3px; word-break: break-word; }
  .recent-title { color: var(--hint); font-size: 12px; font-weight: 700; text-transform: uppercase;
                  letter-spacing: .05em; margin: 4px 2px 8px; }
  button.back {
    background: none; border: none; color: var(--accent);
    font-size: 14px; font-weight: 700; padding: 4px 2px 10px;
  }

  .empty {
    text-align: center;
    color: var(--hint);
    padding: 30px 10px;
    font-size: 13.5px;
  }

  /* Чат */
  /* Поле ввода закреплено над панелью вкладок, как в мессенджерах. Раньше
     чат был высотой calc(100vh - 180px): внутри Telegram 100vh не равен
     видимой высоте окна, и поле ввода уезжало под панель вкладок — писать
     было нельзя (живой тест). --nav-h выставляет JS по реальной высоте панели. */
  .chat-wrap { padding-bottom: var(--dock-h, 60px); }  /* под панель вкладок отступ уже даёт main */
  .chat-log { display: flex; flex-direction: column; gap: 10px; }
  .msg { max-width: 88%; padding: 10px 13px; border-radius: 16px; font-size: 14px; word-wrap: break-word; white-space: pre-wrap; }
  .msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
  .msg.bot  { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
  .msg.bot.pending { color: var(--hint); }

  .think {
    margin-top: 8px;
    border-top: 1px dashed var(--border);
    padding-top: 8px;
  }
  .think summary {
    cursor: pointer;
    color: var(--accent-2-text);
    font-size: 12px;
    font-weight: 700;
    list-style: none;
  }
  .think summary::-webkit-details-marker { display: none; }
  .think summary::before { content: "🧠 "; }
  .think[open] summary::after { content: " ▲"; }
  .think:not([open]) summary::after { content: " ▼"; }
  .think .think-body {
    margin-top: 6px;
    color: var(--hint);
    font-size: 12.5px;
    white-space: pre-wrap;
    border-left: 2px solid var(--border);
    padding-left: 10px;
  }

  .chat-dock {
    position: fixed; left: 0; right: 0; z-index: 9;
    bottom: var(--nav-h, 64px);
    padding: 8px 14px;
    background: var(--bg);
    border-top: 1px solid var(--border);
  }
  .chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
  body.typing nav.tabs { display: none; }
  body.typing .chat-dock { bottom: 0; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .chat-input-row button.attach {
    background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
    padding: 0 12px; font-size: 18px; min-height: 42px;
  }
  #attach-preview:empty { display: none; }
  #attach-preview { margin-bottom: 8px; }
  .attach-chip {
    display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 6px 8px 6px 6px; font-size: 13px;
  }
  .attach-chip img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
  .attach-chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 210px; }
  .attach-chip button { background: none; border: none; color: var(--hint); font-size: 16px; padding: 0 2px; }
  .msg img.att { display: block; max-width: 220px; max-height: 220px; border-radius: 12px; margin-bottom: 6px; }
  .msg .file-att { display: inline-block; background: rgba(255,255,255,.18); border-radius: 10px;
                   padding: 4px 9px; margin-bottom: 6px; font-size: 13px; }
  .msg .msg-tools { margin-top: 6px; display: flex; gap: 10px; }
  .msg .msg-tools button { background: none; border: none; color: var(--hint); font-size: 12px; font-weight: 700; padding: 0; }
  /* «По какому предмету?» — как подсказки пустого чата: те же карточки, текст 14px, длинное название переносится */
  .msg .subject-choice { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; white-space: normal; }
  .msg .subject-choice button {
    display: flex; align-items: center; gap: 10px; text-align: left;
    background: var(--bg); border: 1px solid var(--border); color: var(--text);
    border-radius: 14px; padding: 10px 12px; font-size: 14px; line-height: 1.3;
    transition: background .15s, border-color .15s;
  }
  .msg .subject-choice button::after { content: "›"; margin-left: auto; color: var(--hint); font-size: 18px; }
  .msg .subject-choice button:active { background: var(--accent); border-color: var(--accent); color: #fff; }
  .chat-head-btns { display: inline-flex; gap: 14px; }
  .msg .msg-src { margin-top: 8px; font-size: 12px; color: var(--hint); line-height: 1.5; }
  .msg .msg-src button { background: none; border: none; padding: 0; color: var(--accent); font-size: 12px; font-weight: 600; }
  .msg .msg-src.pages { display: flex; flex-wrap: wrap; gap: 6px; }
  .msg .msg-src.pages button { background: rgba(124,127,245,.14); color: var(--accent); border-radius: 8px; padding: 4px 8px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
  .msg .msg-src.pages span { align-self: center; }
  .msg .cite { background: rgba(124,127,245,.18); color: var(--accent); border: none; border-radius: 6px; padding: 0 5px; margin: 0 1px;
               font-size: 11px; font-weight: 800; line-height: 16px; vertical-align: 2px; }
  .page-img { display: block; width: 100%; border-radius: 12px; margin: 10px 0; background: #fff; }
  .page-text { white-space: pre-wrap; font-size: 14px; line-height: 1.45; max-height: 46vh; overflow: auto; margin: 10px 0;
               background: var(--bg-raised); border-radius: 12px; padding: 12px; }
  .page-text.small { font-size: 12.5px; max-height: 18vh; color: var(--hint); }
  .page-nav { display: flex; gap: 8px; align-items: stretch; }
  .page-nav .ghost { flex: 0 0 52px; font-size: 22px; }
  .page-nav .primary { flex: 1; margin: 0; }
  .quick-replies { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: -2px 0 4px; padding: 0 2px;
                   animation: fadein .25s ease-out; }
  .quick-replies::-webkit-scrollbar { display: none; }
  .quick-replies button { flex: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 999px;
                          padding: 5px 11px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
  .quick-replies button:active { background: var(--accent); border-color: var(--accent); color: #fff; }
  .chat-item { display: flex; align-items: center; gap: 10px; background: var(--bg-card); border: 1px solid var(--border);
               border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 6px; cursor: pointer; }
  .chat-item.cur { border-color: var(--accent); }
  .chat-item .ft { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-item .fs { font-size: 12px; color: var(--hint); margin-top: 2px; }
  .chat-item .del { background: none; border: none; color: var(--hint); font-size: 15px; padding: 4px; }
  .msg .chat-retry { display: block; margin-top: 8px; background: none; border: none; padding: 0;
                     color: var(--accent); font-size: 13px; font-weight: 800; }
  .msg.typing-dots { display: inline-flex; gap: 4px; padding: 14px 16px; }
  .msg.typing-dots span {
    width: 7px; height: 7px; border-radius: 50%; background: var(--hint);
    animation: blink 1.2s infinite ease-in-out;
  }
  .msg.typing-dots span:nth-child(2) { animation-delay: .2s; }
  .msg.typing-dots span:nth-child(3) { animation-delay: .4s; }
  @keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
  .chat-empty { text-align: center; color: var(--hint); padding: 22px 8px 6px; }
  .chat-avatar {
    width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 22px;
    display: flex; align-items: center; justify-content: center; font-size: 30px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 120%);
    box-shadow: 0 10px 26px rgba(92, 96, 230, .35);
  }
  .chat-empty p { margin: 6px 0 14px; font-size: 14px; }
  .suggest { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
  .suggest button {
    background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
    border-radius: 14px; padding: 10px 12px; font-size: 14px; text-align: left;
  }
  .link-btn { background: none; border: none; color: var(--accent); font-size: 13px; font-weight: 700; padding: 0; }
  .chat-input-row textarea {
    flex: 1;
    resize: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-family: inherit;
    min-height: 42px; line-height: 1.3;
    font-size: 16px; /* меньше 16px — iOS при фокусе приближает страницу */
    max-height: 100px;
  }
  .chat-input-row button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0 18px;
    font-weight: 800;
    font-size: 16px;
    min-height: 42px;
  }
  .chat-input-row button:disabled { opacity: .5; }

  /* ── Меню «Ещё» (☰): плитки над нижней панелью ── */
  .more-backdrop { position: fixed; left: 0; right: 0; top: 0; bottom: var(--nav-h, 64px); z-index: 25;
    background: rgba(0,0,0,.45); display: none; align-items: flex-end; justify-content: center; padding: 0 12px 10px; }
  .more-backdrop.open { display: flex; animation: fadein .15s ease; }
  .more-pop { width: 100%; max-width: 360px; background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: 22px; padding: 14px; box-shadow: 0 20px 55px rgba(0,0,0,.5);
    transform-origin: 90% 100%; animation: popup .18s ease; }
  @keyframes popup { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
  .more-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 6px; }
  .more-grid button { background: none; border: none; color: var(--text); font-size: 11px; font-weight: 600;
    padding: 0; text-align: center; min-width: 0; }
  .more-grid .sq { position: relative; display: flex; align-items: center; justify-content: center; width: 100%;
    aspect-ratio: 1; border-radius: 17px; background: rgba(127,127,127,.18); font-size: 26px; margin-bottom: 6px; }
  .more-grid button:active .sq { transform: scale(.94); }
  .more-grid .sq.sdo { background: linear-gradient(145deg, #2aa39a, #2366b0); }
  .more-grid .sq.badge::after { content: ""; position: absolute; top: 6px; right: 6px; width: 9px; height: 9px;
    border-radius: 50%; background: var(--ok); border: 2px solid var(--bg-raised); }
  .more-grid .sq.badge.bad::after { background: var(--danger); }
  nav.tabs button.open { color: var(--accent); }

  /* ── СДО: статус, подключение, сдача ── */
  .st-card { display: flex; align-items: center; gap: 12px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; }
  .st-card.bad { border-color: rgba(255,99,99,.4); }
  .st-card b { display: block; font-size: 15px; }
  .st-card .s, .sub-task .s, .fpick .s { color: var(--hint); font-size: 12.5px; }
  .st-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--hint); }
  .st-dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
  .st-dot.bad { background: var(--danger); }
  .lock { background: rgba(124,127,245,.09); border: 1px solid rgba(124,127,245,.25); border-radius: 12px;
    padding: 10px 12px; font-size: 12.5px; line-height: 1.4; margin: 0 0 12px; }
  .steps { list-style: none; counter-reset: s; margin: 0 0 12px; padding: 0; }
  .steps li { counter-increment: s; display: flex; gap: 10px; font-size: 14px; margin-bottom: 10px; line-height: 1.4; }
  .steps li::before { content: counter(s); flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent);
    color: #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
  #sdo-cookie { margin-bottom: 12px; font-family: ui-monospace, Menlo, monospace; }
  button.ghost { width: 100%; background: none; border: none; color: var(--hint); font-size: 14px; font-weight: 600; padding: 12px; margin-top: 2px; }
  button.ghost.danger { color: var(--danger-text); }
  .sub-task { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 12px; }
  .fpick { display: flex; align-items: center; gap: 12px; background: var(--bg-card); border: 1px dashed var(--border);
    border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; }
  .fpick.chosen { border-style: solid; border-color: var(--accent); }
  .fpick > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .fpick .ic { font-size: 26px; }
  .fpick .go { color: var(--accent); font-weight: 700; }
  .fpick .x { background: none; border: none; color: var(--danger-text); font-size: 16px; padding: 4px; }
  .sub-done { text-align: center; padding: 6px 0 2px; }
  .sub-done .big { font-size: 52px; }
  .dl-actions button.submit { color: var(--ok-text); }

  /* ── СДО → Баллы (js/sdo.js): цвета категорий БРС ── */
  :root { --s-tk: #a78bfa; --s-pos: #34d399; --s-sk: #60a5fa; --s-td: #f472b6; --s-dost: #fbbf24; --s-dop: #2dd4bf; }
  .sdo-head-btns { display: flex; align-items: center; gap: 10px; }
  .sdo-empty { text-align: center; padding: 22px 16px; }
  .sdo-empty .big { font-size: 40px; margin-bottom: 6px; }
  .sdo-empty b { display: block; margin-bottom: 6px; }
  .sbar { position: relative; flex: 1; height: 8px; border-radius: 8px; background: var(--bg-raised); display: flex; margin: 14px 0 8px; }
  .sbar i { height: 100%; }
  .sbar i:first-child { border-radius: 8px 0 0 8px; }
  .sbar .tk { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 2px; background: #48484a; }
  .sc-sum { border-radius: 22px; padding: 18px; margin-bottom: 14px; color: #fff; background: linear-gradient(135deg, #3e88f7 0%, #7c5cf0 100%); box-shadow: 0 12px 30px rgba(62,136,247,.3); }
  .sc-sum .e { font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; opacity: .85; }
  .sc-sum .b { font-size: 28px; font-weight: 900; letter-spacing: -.5px; margin: 4px 0 2px; }
  .sc-sum .m { font-size: 13px; opacity: .9; }
  .sc-sum .pips { display: flex; gap: 6px; margin-top: 12px; }
  .sc-sum .pips i { flex: 1; height: 6px; border-radius: 6px; background: rgba(255,255,255,.25); }
  .sc-sum .pips i.on { background: #fff; }
  .legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 2px 4px 12px; font-size: 12px; color: var(--hint); }
  .legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
  .sc-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px; padding: 14px; margin-bottom: 10px; }
  .sc-card.tap:active { transform: scale(.985); }
  .sc-top { display: flex; align-items: flex-start; gap: 10px; }
  .sc-top .t { flex: 1; min-width: 0; font-weight: 700; line-height: 1.3; }
  .sc-top .n { font-size: 24px; font-weight: 900; letter-spacing: -.5px; line-height: 1; white-space: nowrap; }
  .sc-top .n .of { font-size: 14px; color: var(--hint); font-weight: 700; }
  .sc-kind { display: inline-block; font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 6px; margin-bottom: 5px; }
  .sc-kind.ex { background: rgba(96,165,250,.16); color: #93c5fd; }
  .sc-kind.za { background: rgba(52,211,153,.14); color: #6ee7b7; }
  .sc-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--hint); }
  .sc-foot b { color: var(--text); }
  .zach { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--hint); }
  .zach b { color: var(--text); }
  .zach > b { color: var(--warn-text); min-width: 34px; text-align: right; }
  .zach.ok > b { color: var(--ok-text); }
  .zach .zb { position: relative; flex: 1; height: 5px; border-radius: 5px; background: var(--bg-raised); }
  .zach .zb i { display: block; height: 100%; border-radius: 5px; background: var(--warn); }
  .zach.ok .zb i { background: var(--ok); }
  .zach .zb em { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--hint); border-radius: 2px; }
  .sd-head { display: flex; align-items: flex-end; gap: 12px; }
  .sd-head .n { font-size: 44px; font-weight: 900; letter-spacing: -1.5px; line-height: 1; }
  .sd-head .of { color: var(--hint); font-weight: 700; padding-bottom: 5px; }
  .sd-head .st { margin-left: auto; text-align: right; font-size: 12px; color: var(--hint); }
  .sd-head .st b { display: block; font-size: 15px; color: var(--warn-text); }
  .sd-head .st b.ok { color: var(--ok-text); }
  .gbar { position: relative; margin: 22px 0 26px; }
  .gtrack { height: 10px; border-radius: 10px; background: var(--bg-raised); display: flex; overflow: hidden; }
  .gtrack i { height: 100%; }
  .gm { position: absolute; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; }
  .gm b { width: 24px; height: 24px; border-radius: 50%; background: var(--bg-card); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; color: var(--hint); }
  .gm em { position: absolute; top: 28px; font-style: normal; font-size: 10.5px; color: var(--hint); font-weight: 600; white-space: nowrap; }
  .gm.got b { background: var(--ok); border-color: var(--ok); color: #000; }
  .cat-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px; }
  .cat-row:first-child { border-top: none; }
  .cat-row .d { width: 10px; height: 10px; border-radius: 3px; flex: none; }
  .cat-row .nm { flex: 1; min-width: 0; }
  .cat-row .mb { width: 70px; height: 5px; border-radius: 5px; background: var(--bg-raised); overflow: hidden; flex: none; }
  .cat-row .mb i { display: block; height: 100%; }
  .cat-row .v { width: 56px; text-align: right; font-weight: 800; }
  .cat-row .v small { color: var(--hint); font-weight: 600; }
  .cat-row .chev { width: 12px; text-align: center; color: var(--accent); font-size: 20px; font-weight: 700; }
  .cat-row.go:active { opacity: .6; }
  .tkbar { display: flex; gap: 4px; margin: 16px 0 8px; }
  .tkbar i, .tklegend i { background: var(--bg-raised); }
  .tkbar i { flex: 1; height: 10px; border-radius: 4px; }
  .tkbar i.g, .tklegend i.g { background: var(--ok); }
  .tkbar i.r, .tklegend i.r { background: var(--danger); }
  .tkbar i.b, .tklegend i.b { background: var(--accent); }
  .tkbar i.y, .tklegend i.y { background: var(--warn); }
  .tkbar i.q, .tklegend i.q { background: repeating-linear-gradient(45deg, var(--hint) 0 2px, transparent 2px 4px); opacity: .55; }
  .pos-lines { display: grid; gap: 6px; margin-top: 12px; font-size: 13px; line-height: 1.35; }
  .pos-lines .ico { color: var(--hint); }
  .wrow.excused .wi { background: rgba(255,178,56,.16); color: var(--warn-text); }
  .wrow.future { opacity: .5; }
  .wrow.before .wi { border: 1.5px dashed var(--hint); background: none; }
  .wrow.ok .wi, .wrow.miss .wi, .wrow.excused .wi, .wrow.before .wi { font-size: 15px; }
  .wrow:not(.edit):active { opacity: 1; }
  .wrow.edit { cursor: pointer; }
  .tklegend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--hint); }
  .tklegend i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 4px; }
  .tk-chips { margin-top: 12px; }
  .card.pad { padding: 4px 14px; }
  .wrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
  .wrow:first-child { border-top: none; }
  .wrow:active { opacity: .6; }
  .wrow .wi { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 900; flex: none; background: var(--bg-raised); color: var(--hint); }
  .wrow.ok .wi { background: rgba(61,220,132,.16); color: var(--ok-text); }
  .wrow.low .wi, .wrow.miss .wi { background: rgba(255,99,99,.16); color: var(--danger-text); }
  .wrow.wait .wi { background: rgba(124,127,245,.18); }
  .wrow.todo .wi { background: var(--accent); }
  .wrow.soon { opacity: .55; }
  .wrow .wn { flex: 1; min-width: 0; font-size: 14px; font-weight: 650; line-height: 1.25; }
  .wrow .wn small { display: block; font-size: 11.5px; color: var(--hint); font-weight: 500; margin-top: 2px; }
  .wrow .ws { text-align: right; font-size: 12px; color: var(--hint); line-height: 1.15; white-space: nowrap; }
  .wrow .ws b { font-size: 16px; color: var(--text); }
  .wrow .ws small { display: block; font-size: 10.5px; }
  .wrow.ok .ws b { color: var(--ok-text); }
  .wrow.low .ws b { color: var(--danger-text); }
  .wrow .chev { color: var(--hint); font-size: 18px; }

  /* ── СДО: задание и сдача нескольких файлов ── */
  .t-due { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .t-due .eyebrow { margin: 0 0 2px; }
  .t-due b { font-size: 17px; }
  .t-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
  .t-tag { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--bg-raised); color: var(--hint); white-space: nowrap; }
  .t-tag.ok { background: rgba(61,220,132,.14); color: var(--ok-text); }
  .t-tag.warn { background: rgba(255,178,56,.14); color: var(--warn-text); }
  .t-tag.bad { background: rgba(255,99,99,.14); color: var(--danger-text); }
  .t-desc { font-size: 14px; line-height: 1.5; margin: 12px 0 0; overflow-wrap: anywhere; }
  .t-file { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
  .t-file:first-child { border-top: none; }
  .t-file .ic { font-size: 22px; }
  .t-file .nm { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
  .dlb { width: 38px; height: 38px; border-radius: 11px; border: none; background: rgba(124,127,245,.16); font-size: 17px; flex: none; }
  .dlb.sending { opacity: .5; }
  .t-go { margin-top: 14px; }   /* «Сдать работу» не впритык к файлам (дизайн-ревью, п. 7) */
  .fcount { display: flex; gap: 5px; margin: 2px 0 12px; }
  .fcount i { flex: 1; height: 4px; border-radius: 4px; background: var(--bg-raised); }
  .fcount i.on { background: var(--accent); }
  .fpick.add { justify-content: center; border-style: dashed; color: var(--accent); font-weight: 700; font-size: 14px; }

  /* ── Свои иконки вместо эмодзи (js/icons.js): размер — от шрифта места ── */
  .ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; fill: none; stroke: currentColor;
    stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .ico.inl { margin-right: 4px; }
  .ico.lg { width: 28px; height: 28px; }
  .ico.xl { width: 52px; height: 52px; stroke-width: 1.6; }
  .ico.acc { color: var(--accent); }
  .ico.ok { color: var(--ok-text); }
  nav.tabs button .ic .ico { width: 24px; height: 24px; vertical-align: 0; }
  .chat-head-btns .ico, .seg .ico, .chips-row .ico, .link-btn .ico { width: 16px; height: 16px; vertical-align: -3px; }
  h2.section .ttl { display: inline-flex; align-items: center; gap: 6px; }
  .more-grid .sq { color: #fff; }
  .more-grid .sq .ico { width: 30px; height: 30px; stroke-width: 1.8; }
  .more-grid .sq.t-files { background: linear-gradient(145deg, #4a8ff7, #3164d9); }
  .more-grid .sq.t-cal { background: linear-gradient(145deg, #38bdf8, #0284c7); }
  .more-grid .sq.t-phone { background: linear-gradient(145deg, #8b7cf6, #6a4fe0); }
  .ftype { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    flex: none; background: var(--bg-raised); color: var(--hint); font-size: 17px; }
  .ftype .ico { vertical-align: 0; }
  .ftype.pdf { color: #ff6b6b; background: rgba(255,107,107,.13); }
  .ftype.word { color: #60a5fa; background: rgba(96,165,250,.13); }
  .ftype.xls { color: #34d399; background: rgba(52,211,153,.13); }
  .ftype.ppt { color: #fb923c; background: rgba(251,146,60,.13); }
  .ftype.img { color: #c084fc; background: rgba(192,132,252,.13); }
  .fpick .ic .ftype { width: 38px; height: 38px; font-size: 19px; }
  .file-card button.dl, .dlb { color: var(--accent); }
  .wrow .wi .ico { width: 15px; height: 15px; stroke-width: 2.4; vertical-align: 0; }
  .checkbox .ico { width: 15px; height: 15px; stroke-width: 2.8; vertical-align: 0; }
  .chat-avatar .ico { width: 28px; height: 28px; vertical-align: 0; }
  .pin-btn span .ico { vertical-align: -3px; }
  .gm b .ico { width: 13px; height: 13px; stroke-width: 3; vertical-align: 0; }
  .sub-done .big .ico, .sdo-empty .big .ico { vertical-align: 0; }
  .toast span .ico { margin-right: 2px; }
  .st-dot { display: inline-block; vertical-align: 0; }
  .pin-btn.on span .ico { color: #fff; }
  .dl-actions button, .dl-actions a { display: inline-flex; align-items: center; gap: 4px; }
  .dl-actions .ico { width: 14px; height: 14px; vertical-align: 0; }
  .wrow.todo .wi { color: #fff; }
  .chat-avatar { color: #fff; }
  .dl-actions { flex-wrap: wrap; row-gap: 6px; }
  /* настроение в тексте — тоже свои: хлопушка и помахать рукой */
  .ico.mood { color: var(--warn-text); stroke-width: 1.8; }
  .ico.wave { color: #fbbf24; transform-origin: 70% 80%; animation: wave 1.6s ease 0.4s 1; }
  @keyframes wave { 0%, 100% { transform: none; } 20%, 60% { transform: rotate(14deg); } 40%, 80% { transform: rotate(-8deg); } }
  .hero .ico.mood { color: #fff; }
  /* файлы: кнопки «скачать / в чат / изменить» — ровной колонкой справа */
  .file-card > div { flex: 1; }

  /* ── Нижняя панель: у каждой вкладки свой цвет (как плитки «Ещё»).
     Невыбранные — своим цветом, но приглушённые; выбранная — цветная плитка. ── */
  nav.tabs button[data-tab="today"]     { --tc: #4a8ff7; --tc2: #3164d9; }
  nav.tabs button[data-tab="sdo"]       { --tc: #c8915a; --tc2: #8d5a2b; }   /* капибара — карамельная */
  nav.tabs button[data-tab="search"]    { --tc: #2bb3a3; --tc2: #2366b0; }
  nav.tabs button[data-tab="chat"]      { --tc: #9b7cf6; --tc2: #6a4fe0; }
  nav.tabs button[data-tab="more"]      { --tc: #f06292; --tc2: #c2185b; }
  nav.tabs button .ic { color: var(--tc); opacity: .6; transition: opacity .15s ease; }
  nav.tabs button { color: var(--hint); transition: background .2s ease, box-shadow .2s ease, color .15s ease; }
  nav.tabs button.active, nav.tabs button.open {
    color: #fff; background: linear-gradient(145deg, var(--tc), var(--tc2));
    box-shadow: 0 6px 16px color-mix(in srgb, var(--tc) 40%, transparent);
  }
  nav.tabs button.active .ic, nav.tabs button.open .ic { color: #fff; opacity: 1; }

  /* ── Безопасность (меню «Ещё») ── */
  .more-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .more-grid .sq.t-sec { background: linear-gradient(145deg, #34d399, #0f9f77); }
  .sec-hero { display: flex; align-items: center; gap: 14px; margin: 4px 0 14px; }
  .sec-hero h3 { margin: 0 0 2px; }
  .sec-hero p { margin: 0; color: var(--hint); font-size: 13px; }
  .sec-shield { width: 52px; height: 52px; border-radius: 16px; flex: none; display: flex; align-items: center; justify-content: center;
    color: #fff; background: linear-gradient(145deg, #34d399, #0f9f77); box-shadow: 0 8px 22px rgba(52,211,153,.3); font-size: 28px; }
  .sec-shield .ico { vertical-align: 0; }
  .sec-item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
  .sec-item b { font-size: 14.5px; }
  .sec-item p { margin: 3px 0 0; color: var(--hint); font-size: 13px; line-height: 1.45; }
  .sec-ic { width: 34px; height: 34px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center;
    background: rgba(52,211,153,.13); color: #34d399; font-size: 17px; }
  .sec-ic .ico { vertical-align: 0; }
  #security-sheet .sheet { max-height: 88vh; overflow-y: auto; }

  /* ── Уведомления: конструктор ── */
  .more-grid .sq.t-bell { background: linear-gradient(145deg, #fbbf24, #f0884b); }
  .sec-shield.nt-bell { background: linear-gradient(145deg, #fbbf24, #f0884b); color: #fff; }
  .nt-card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; }
  .nt-card.off { opacity: .7; }
  .nt-head, .nt-row { display: flex; align-items: center; gap: 12px; }
  .nt-head > div, .nt-row > div { flex: 1; min-width: 0; }
  .nt-head b { font-size: 15px; }
  .nt-head p, .nt-row p { margin: 2px 0 0; color: var(--hint); font-size: 12.5px; }
  .nt-row { padding: 10px 0 2px; border-top: 1px solid var(--border); margin-top: 10px; }
  .nt-row b { font-size: 14px; font-weight: 600; }
  .nt-ic { width: 36px; height: 36px; border-radius: 11px; flex: none; display: flex; align-items: center; justify-content: center;
           background: var(--bg); color: var(--accent); }
  .nt-switch { flex: none; width: 46px; height: 28px; border-radius: 14px; border: none; padding: 0; position: relative;
               background: var(--switch-off); transition: background .2s; }
  .nt-switch span { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
                    transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
  .nt-switch.on { background: var(--ok); }
  .nt-switch.on span { transform: translateX(18px); }
  .nt-days, .nt-mins { display: flex; gap: 6px; margin-top: 12px; }
  .nt-days button, .nt-mins button { flex: 1; min-width: 0; padding: 8px 0; border-radius: 10px; border: 1px solid var(--border);
               background: none; color: var(--hint); font-size: 13px; font-weight: 600; }
  .nt-days button.we { color: var(--danger-text); opacity: .8; }
  .nt-days button.on, .nt-mins button.on { background: var(--accent); border-color: var(--accent); color: #fff; opacity: 1; }
  .campus-pill { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 10px 6px; padding: 7px 12px; border-radius: 999px;
                 background: rgba(255,178,56,.14); border: 1px solid rgba(255,178,56,.35); color: var(--warn-text); font-size: 13px; font-weight: 600; }
  .campus-pill .ico { width: 15px; height: 15px; }
  .nt-remind { padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--border); }
  .nt-remind .nt-mins { margin-top: 8px; }
  .nt-sub { font-size: 14px; font-weight: 600; }
  .nt-custom { display: flex; gap: 8px; margin-top: 8px; }
  .nt-custom input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
                     background: var(--bg); color: var(--text); font-size: 16px; }
  .nt-custom button { flex: none; padding: 0 16px; border-radius: 10px; border: none; background: var(--accent); color: #fff; font-weight: 700; }
  .lesson.tap { cursor: pointer; transition: transform .12s ease; }
  .lesson.tap:active { transform: scale(.98); }
  .more-grid .sq.t-dl { background: linear-gradient(145deg, #f0884b, #e0553f); }
  /* СДО не подключён / вход устарел — красная шапочка; открыта — приглушённый кирпичный, почти без свечения */
  nav.tabs button.sdo-off { --tc: #b94a4a; --tc2: #8a2f2f; }
  nav.tabs button.sdo-off:not(.active) .ic { color: #ff6b6b; opacity: 1; }
  nav.tabs button.sdo-off.active { box-shadow: 0 4px 10px rgba(185, 74, 74, .22); }
  nav.tabs button.sdo-ok .ico { width: 27px; height: 25px; }
  nav.tabs button.sdo-ok:not(.active) .ic { opacity: .9; }
  .stale-pill { background: rgba(154,160,172,.12); border-color: var(--border); color: var(--hint); font-weight: 500; }
  .lesson .l-score { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; vertical-align: 1px;
                     font-size: 11.5px; font-weight: 700; color: var(--hint); background: var(--bg-raised); border: 1px solid var(--border); }
  .lesson .l-score.ok { color: var(--ok-text); border-color: rgba(61,220,132,.35); background: rgba(61,220,132,.1); }
  /* свои напоминания о дедлайне */
  /* своё напоминание — фиолетовым, а не оранжевым, как срок «завтра» (дизайн-ревью, п. 8) */
  .chip.remind { color: var(--accent); border-color: rgba(124,127,245,.35); background: rgba(124,127,245,.1); }
  .chip.remind .ico { width: 13px; height: 13px; }
  .rm-list { margin: 4px 0 6px; }
  .rm-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border); color: var(--text); }
  .rm-row .ico { color: var(--accent); }
  .rm-row span { flex: 1; }
  .rm-row button { background: none; border: none; color: var(--hint); padding: 4px; }
  .rm-presets { margin-top: 14px; }
  .rm-row button .ico { color: var(--hint); }
  /* светлая тема Telegram (core.js: applyTheme ставит data-theme) */
  :root { --switch-off: #3a3f4d; }
  :root[data-theme="light"] { --switch-off: #d1d1d6;
    /* светлая тема: зелёные, оранжевые и бирюзовые надписи на светлом фоне
       читались плохо (дизайн-ревью, п. 3) — тексту свои, более тёмные оттенки */
    --ok-text: #15803d; --warn-text: #b45309; --accent-2-text: #0f766e; --danger-text: #c62828; }
  :root[data-theme="light"] .sc-kind.za { color: #047857; background: rgba(4,120,87,.1); }
  :root[data-theme="light"] .sc-kind.ex { color: #1d4ed8; background: rgba(29,78,216,.09); }
  :root[data-theme="light"] .sheet-backdrop { background: rgba(0,0,0,.32); }
  :root[data-theme="light"] .lesson .l-score { background: #f2f2f7; }
  /* ── Знакомство при первом входе ── */
  .onboard { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: none; flex-direction: column;
             align-items: center; padding: calc(var(--safe-top, 0px) + 18px) 24px calc(var(--safe-bottom, 0px) + 22px); }
  .onboard.open { display: flex; animation: obIn .25s ease; }
  .ob-skip { align-self: flex-end; background: none; border: none; color: var(--hint); font-size: 15px; font-weight: 600; padding: 6px; }
  .ob-card { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
             max-width: 360px; animation: obIn .3s ease; }
  .ob-logo { display: flex; align-items: center; gap: 8px; color: var(--hint); font-weight: 700; font-size: 14px; margin-bottom: 26px; }
  .ob-logo .ico.capy { width: 26px; height: 24px; color: #c8915a; }
  .ob-ic { width: 108px; height: 108px; border-radius: 30px; display: flex; align-items: center; justify-content: center; color: #fff;
           box-shadow: 0 14px 34px rgba(0,0,0,.25); }
  .ob-ic .ico { width: 52px; height: 52px; stroke-width: 1.7; }
  .ob-ic.t-sdo { background: linear-gradient(145deg, #c8915a, #8d5a2b); }
  .ob-ic.t-bell { background: linear-gradient(145deg, #fbbf24, #f0884b); }
  .ob-ic.t-search { background: linear-gradient(145deg, #2bb3a3, #2366b0); }
  .ob-card h2 { margin: 26px 0 10px; font-size: 24px; letter-spacing: -.3px; }
  .ob-card p { margin: 0; color: var(--hint); font-size: 15.5px; line-height: 1.45; }
  .ob-act { margin-top: 18px; width: auto; padding: 10px 20px; border: 1px solid var(--border) !important; border-radius: 999px; color: var(--accent) !important; }
  .ob-dots { display: flex; gap: 7px; margin: 10px 0 16px; }
  .ob-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border); transition: all .2s; }
  .ob-dots i.on { width: 22px; border-radius: 4px; background: var(--accent); }
  .ob-next { width: 100%; max-width: 360px; }
  @keyframes obIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  /* пустые экраны с капибарой (core.js: capyEmpty) */
  .capy-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 16px 30px; }
  .capy-empty .ico.capy { width: 74px; height: 70px; color: #c8915a; opacity: .9; margin-bottom: 8px;
                          animation: capyBob 3.2s ease-in-out infinite; }
  .capy-empty b { color: var(--text); font-size: 15.5px; }
  .capy-empty span { font-size: 13px; }
  @keyframes capyBob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-2deg); } }
  @media (prefers-reduced-motion: reduce) { .capy-empty .ico.capy, .view, .onboard.open, .ob-card { animation: none; } }
  /* история баллов на экране предмета */
  .card.hist { margin-top: 12px; }
  .hist-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
  .hist-delta { font-size: 12.5px; font-weight: 700; color: var(--hint); padding: 2px 9px; border-radius: 999px; background: var(--bg-raised); }
  .hist-delta.up { color: var(--ok-text); background: rgba(61,220,132,.12); }
  .hist-svg { width: 100%; height: 110px; display: block; overflow: visible; }
  .hist-line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
  .hist-area { fill: color-mix(in srgb, var(--accent) 16%, transparent); stroke: none; }
  .hist-dot { fill: var(--accent); }
  .hist-mark { stroke: var(--border); stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
  .hist-lbl { fill: var(--hint); font-size: 9px; text-anchor: end; }
  .hist-axis { display: flex; justify-content: space-between; color: var(--hint); font-size: 12px; margin-top: 4px; }

  /* ── Дизайн-ревью 6–10 ── */
  .target-retry { display: flex; align-items: center; justify-content: center; gap: 8px; max-width: 260px; margin: 4px auto 0; }
  #target-stale .stale-pill { margin: 10px 0 0; }
  body.compact-head header.top { display: none; }
  body.compact-head main { padding-top: 12px; }
  html.fullscreen body.compact-head main { padding-top: calc(max(var(--safe-top, 0px), env(safe-area-inset-top), 44px) + 8px); }
  .pill-row { display: flex; gap: 8px; overflow-x: auto; margin: 0 -14px 12px; padding: 0 14px 2px;
              -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); }
  .pill-row > div { flex: none; margin: 0; white-space: nowrap; }
  .pill-row.at-end { -webkit-mask-image: none; mask-image: none; }
  .pill-row { scrollbar-width: none; }
  .pill-row::-webkit-scrollbar { display: none; }
  details.done-group .done-chev { width: 14px; height: 14px; vertical-align: -2px; transition: transform .2s; }
  details.done-group[open] .done-chev { transform: rotate(90deg); }


  /* ── Дизайн-ревью, п. 14 ── */
  /* Пилюли у файла вместо крошечных значков: «есть текст» — спокойная бирюзовая,
     «конспект» — заметная, в цвет акцента. Не переносится внутри себя. */
  .file-card .fpill { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 2px 7px 2px 6px;
    border-radius: 999px; font-size: 11px; font-weight: 800; line-height: 1.35; white-space: nowrap; vertical-align: 1px; }
  .file-card .fpill .ico { width: 12px; height: 12px; vertical-align: 0; stroke-width: 2.2; }
  .file-card .fpill.txt { color: var(--accent-2-text); background: rgba(67,198,172,.16); }
  .file-card .fpill.sum { color: #fff; background: linear-gradient(135deg, var(--accent) 0%, #5a5fe0 100%);
    box-shadow: 0 2px 8px rgba(124,127,245,.35); }
  .files-hint { margin: 2px 0 10px; }
  .files-hint .ico { color: var(--accent); }

  /* ── Дизайн-ревью, п. 16 ── */
  /* Быстрые даты в листе дедлайна: одной строкой, не влезло — прокрутка вбок */
  .quick-dates { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: -2px 0 10px; }
  .quick-dates::-webkit-scrollbar { display: none; }
  .quick-dates button { white-space: nowrap; cursor: pointer; flex: 1 0 auto; padding-left: 8px; padding-right: 8px; }

  /* ── Дизайн-ревью, п. 19 ── */
  /* Экран СДО без входа: что даёт вход — список с иконками в акцентных квадратиках */
  .sdo-empty { max-width: 400px; margin: 8vh auto 0; padding: 22px 18px 18px; }
  .sdo-empty .sheet-hint { margin: 0 0 4px; }
  .sdo-perks { text-align: left; margin: 10px 0 16px; }
  .sdo-perk { display: flex; align-items: center; gap: 12px; padding: 9px 0; font-size: 14px; line-height: 1.4; }
  .sdo-perk + .sdo-perk { border-top: 1px solid var(--border); }
  .sdo-perk .sec-ic { width: 32px; height: 32px; font-size: 16px;
    background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }

  /* ── Дизайн-ревью, п. 20 ── */
  /* знакомство: слайды про ИИ-чат и конспекты лекций */
  .ob-ic.t-ai { background: linear-gradient(145deg, #8b7cf6, #5c60e6); }
  .ob-ic.t-summary { background: linear-gradient(145deg, #4a8ff7, #3164d9); }

  /* ── Дизайн-ревью, п. 12 ── */
  /* плитка «Баллы СДО» на главной вместо «Поиска»: скелетон, пока журнал грузится */
  .sdo-tile .big .skel { display: block; width: 64px; height: 20px; margin: 0; }
  .sdo-tile .sub { overflow-wrap: anywhere; }

  /* ── Дизайн-ревью, п. 17 ── */
  /* «Как растут баллы»: шкала до ближайшего порога (sdo.js: histScale), пороги
     пунктиром с подписью, заливка градиентом, последняя точка со значением */
  .hist-plot { position: relative; height: 118px; margin: 14px 6px 0 28px; }
  .hist-plot .hist-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
  .hist-plot .hist-area { fill: url(#hist-fill); }
  .hist-g0 { stop-color: var(--accent); stop-opacity: .34; }
  .hist-g1 { stop-color: var(--accent); stop-opacity: 0; }
  .hist-grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
  .hist-plot .hist-mark { stroke: var(--hint); stroke-opacity: .55; stroke-dasharray: 4 4; }
  .hist-plot .hist-lbl { position: absolute; font-size: 10.5px; line-height: 13px; color: var(--hint); white-space: nowrap; pointer-events: none; }
  .hist-lbl.l { left: 2px; }
  .hist-lbl.r { right: 2px; }
  .hist-lbl.up { transform: translateY(calc(-100% - 2px)); }
  .hist-lbl.dn { transform: translateY(3px); }
  .hist-lbl.goal { color: var(--text); font-weight: 700; }
  .hist-y { position: absolute; left: -28px; width: 22px; text-align: right; font-size: 10.5px; line-height: 13px; color: var(--hint);
            transform: translateY(-50%); font-variant-numeric: tabular-nums; }
  .hist-y.top { top: 0; }
  .hist-y.bot { top: 100%; }
  .hist-plot .hist-dot { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%;
                         background: var(--accent); border: 2px solid var(--bg-card);
                         box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 24%, transparent); }
  .hist-val { position: absolute; right: -8px; transform: translateY(calc(-100% - 9px)); padding: 1px 7px; border-radius: 999px;
              background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; line-height: 17px; font-variant-numeric: tabular-nums; }
  .hist-val.dn { transform: translateY(9px); }
  .hist-plot + .hist-axis { margin: 8px 6px 0 28px; }

  /* ── Дизайн-ревью, п. 18 ── */
  /* Меню «Ещё»: 10 плиток по 4 в ряд. Flex, а не grid — неполный последний
     ряд встаёт по центру при любом числе плиток. */
  .more-backdrop { padding: 0 10px 10px; }
  .more-pop { padding: 14px 12px; }
  .more-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 8px; }
  .more-grid button { flex: 0 0 calc((100% - 3 * 8px) / 4); width: calc((100% - 3 * 8px) / 4);
    display: flex; flex-direction: column; align-items: center; }
  .more-grid .sq { border-radius: 18px; margin-bottom: 6px; }
  .more-grid .sq .ico { width: 28px; height: 28px; }
  /* подпись занимает и по половине зазора с боков: «Безопасность» целиком
     на 375px; «Написать нам» при нужде — в две строки по центру */
  .more-grid .lbl { display: block; width: calc(100% + 8px); margin: 0 -4px; font-size: clamp(10.5px, 3.07vw, 11.5px);
    font-weight: 600; letter-spacing: -.2px; line-height: 1.2; }
  .more-grid .sq.t-hw { background: linear-gradient(145deg, #f472b6, #db2777); }
  .more-grid .sq.t-news { background: linear-gradient(145deg, #a78bfa, #ec4899); }
  .more-grid .sq.t-channel { background: linear-gradient(145deg, #3bb2f0, #2481cc); }
  .more-grid .sq.t-contact { background: linear-gradient(145deg, #2bb3a3, #12877c); }
  .more-grid .sq.t-share { background: linear-gradient(145deg, #f59e0b, #e8590c); }
  /* открытие: лист мягко выезжает снизу, плитки — каскадом (--i ставит toggleMore);
     display: none → flex перезапускает анимацию при каждом открытии */
  .more-backdrop.open .more-pop { animation: moreSheetIn .28s cubic-bezier(.2, .8, .2, 1) both; }
  .more-backdrop.open .more-grid button { animation: moreTileIn .26s cubic-bezier(.2, .8, .2, 1) both;
    animation-delay: calc(40ms + var(--i, 0) * 25ms); }
  @keyframes moreSheetIn { from { opacity: 0; transform: translateY(28px) scale(.97); } to { opacity: 1; transform: none; } }
  @keyframes moreTileIn { from { opacity: 0; transform: translateY(10px) scale(.88); } to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: reduce) {
    .more-backdrop.open, .more-backdrop.open .more-pop, .more-backdrop.open .more-grid button { animation: none; }
  }

  /* ── Сдача: что принимает задание («только .zip») — как пишет СДО ── */
  .sub-rules { display: flex; gap: 12px; align-items: flex-start; background: rgba(124,127,245,.09);
    border: 1px solid rgba(124,127,245,.25); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 12px; }
  .sub-rules .ic { flex: none; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center;
    justify-content: center; background: rgba(124,127,245,.16); color: var(--accent); }
  .sub-rules > div { flex: 1; min-width: 0; }
  .sub-rules b { display: block; font-size: 14px; line-height: 1.35; }
  .sub-rules .s { color: var(--hint); font-size: 12.5px; line-height: 1.4; margin-top: 4px; }
  .sub-rules .exts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
  .sub-rules .exts span { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
    background: var(--bg-card); border: 1px solid var(--border); color: var(--text); }
  .sub-rules .exts span.ext { color: var(--accent-2-text); border-color: rgba(67,198,172,.35); }
  .sub-rules.loading { align-items: center; background: var(--bg-card); border-color: var(--border); }
  .sub-rules.loading .ic { background: none; color: var(--hint); }
  .sub-rules.loading .s { margin: 0; }
  .sub-rules.closed { background: rgba(255,99,99,.08); border-color: rgba(255,99,99,.3); }
  .sub-rules.closed .ic { background: rgba(255,99,99,.14); color: var(--danger-text); }

  /* ── Цель по предмету (sdo_goal.py, js/sdo.js goalCard) ── */
  .goal-card { margin-top: 12px; }
  .gc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .gc-head > b { font-size: 16px; }
  .gc-pill { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
  .gc-pill.ok { background: rgba(61,220,132,.15); color: var(--ok-text); }
  .gc-pill.warn { background: rgba(255,178,56,.15); color: var(--warn-text); }
  .gc-pill.bad { background: rgba(255,99,99,.15); color: var(--danger-text); }
  .gc-opts { display: flex; gap: 6px; margin: 12px 0 4px; }
  .gc-opts button { flex: 1; min-width: 0; padding: 8px 0; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg-raised); color: var(--text); font-weight: 750; font-size: 14px; }
  .gc-opts button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
  .gc-lines { display: grid; margin-top: 6px; }
  .gc-lines .gl { display: flex; align-items: flex-start; gap: 8px; padding: 9px 0; border-top: 1px solid var(--border);
    font-size: 13.5px; line-height: 1.4; }
  .gc-lines .gl:first-child { border-top: none; }
  .gc-lines .gl > span:not(.chev) { flex: 1; min-width: 0; }
  .gc-lines .gl .ico { color: var(--hint); flex: none; margin-top: 2px; }
  .gc-lines .gl.go { cursor: pointer; }
  .gc-lines .gl.go:active { opacity: .6; }
  .gc-lines .chev { color: var(--accent); font-size: 18px; font-weight: 700; line-height: 1; }
  .gc-lines b.ok { color: var(--ok-text); } .gc-lines b.warn { color: var(--warn-text); } .gc-lines b.bad { color: var(--danger-text); }
  .gc-why { margin: 8px 0 2px; font-size: 12.5px; color: var(--hint); line-height: 1.4; }

/* Поиск внутри лекций (вкладка «Файлы») */
.lec-head { margin: 18px 4px 8px; font-size: 13px; font-weight: 700; color: var(--hint); text-transform: uppercase; letter-spacing: .04em; }
.lec-hit { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.lec-hit:active { transform: scale(.99); }
.lec-hit .lh-t { font-weight: 600; font-size: 14px; }
.lec-hit .lh-t span { color: var(--accent); font-weight: 600; }
.lec-hit .lh-s { margin-top: 6px; font-size: 13px; line-height: 1.45; color: var(--hint); }
.lec-hit .lh-s mark { background: none; color: var(--text); font-weight: 600; }
.lec-hit .lh-subj { margin-top: 6px; font-size: 12px; color: var(--hint); opacity: .8; }
