/* MURALY CRM — фирменная дизайн-система
   Палитра: глубокий лесной зелёный, тёмный изумрудный, тёплый айвори, приглушённый шалфейный, графитовый, белый. */
:root {
  --forest: #1f3d2b;
  --forest-2: #173022;
  --emerald: #23523d;
  --emerald-2: #2c6249;
  --ivory: #f6f2e9;
  --ivory-2: #efe9dc;
  --sage: #9fb19a;
  --sage-2: #dfe6da;
  --sage-3: #eef2ea;
  --graphite: #2a2d2b;
  --muted: #5f6762;
  --line: #e3ddd0;
  --line-2: #d6cfbf;
  --white: #ffffff;
  --ok: #3d7556;
  --warn: #a9843a;
  --bad: #a24c3c;
  --info: #4a6a86;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(31, 61, 43, .05), 0 8px 24px rgba(31, 61, 43, .06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Cormorant Garamond", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --side: 248px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 15px; line-height: 1.45; color: var(--graphite); background: var(--ivory); -webkit-font-smoothing: antialiased; }
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 600; color: var(--forest); letter-spacing: .1px; }
h1 { font-size: 28px; margin: 0; line-height: 1.15; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 16.5px; margin: 0 0 10px; }
a { color: var(--emerald); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--ok); } .neg { color: var(--bad); }

/* ---------- Каркас */
.app { display: flex; min-height: 100vh; }
.side { width: var(--side); background: var(--forest); color: #e9efe6; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; }
.side .brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side .brand img { width: 40px; height: 40px; }
.side .brand .name { font-family: var(--serif); font-size: 21px; letter-spacing: 2.5px; color: #f6f2e9; }
.side .brand .slogan { font-size: 11.5px; color: var(--sage); letter-spacing: .6px; margin-top: 1px; }
.nav { overflow-y: auto; padding: 10px 10px 24px; flex: 1; }
.nav .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.4px; color: rgba(233,239,230,.45); margin: 16px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8.5px 12px; border-radius: 10px; color: #dfe7db; font-size: 14.5px; text-decoration: none; }
.nav a:hover { background: rgba(255,255,255,.06); }
.nav a.on { background: var(--emerald); color: #fff; }
.nav a svg { width: 18px; height: 18px; opacity: .85; flex: none; }
.nav a .cnt { margin-left: auto; background: #b9c9b1; color: var(--forest); border-radius: 20px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.main { margin-left: var(--side); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; background: rgba(246,242,233,.92); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 28px; min-height: 60px; }
.top .burger { display: none; }
.search { position: relative; flex: 1; max-width: 460px; }
.search input { width: 100%; padding: 9px 14px 9px 36px; border: 1px solid var(--line-2); border-radius: 22px; background: var(--white); outline: none; }
.search input:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(159,177,154,.25); }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search .results { position: absolute; top: 44px; left: 0; right: 0; background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; z-index: 50; }
.search .results a { display: block; padding: 9px 14px; color: var(--graphite); border-bottom: 1px solid var(--sage-3); text-decoration: none; }
.search .results a:hover { background: var(--sage-3); }
.top .sp { flex: 1; }
.iconbtn { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--white); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--forest); }
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn .dot { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.lang { display: inline-flex; border: 1px solid var(--line-2); border-radius: 20px; overflow: hidden; background: var(--white); }
.lang button { border: 0; background: none; padding: 6px 11px; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.lang button.on { background: var(--forest); color: #fff; }
.userchip { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 4px 6px 4px 4px; border-radius: 22px; border: 1px solid transparent; }
.userchip:hover { border-color: var(--line-2); background: var(--white); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sage-2); color: var(--forest); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex: none; }
.userchip .meta { font-size: 13px; line-height: 1.15; }
.userchip .meta .r { color: var(--muted); font-size: 11.5px; }
.demo-banner { background: #efe3c6; color: #6b5420; font-size: 12.5px; text-align: center; padding: 5px 12px; border-bottom: 1px solid #e2d3ae; }
.content { padding: 24px 28px 60px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 14px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Компоненты */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-2); background: var(--white); color: var(--forest); padding: 8.5px 15px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 500; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--sage); background: var(--sage-3); text-decoration: none; }
.btn.primary { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.btn.primary:hover { background: var(--forest); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .55; cursor: default; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; }
.card > h3:first-child, .card > h2:first-child { margin-top: 0; }
.card .card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi .l { font-size: 12.5px; color: var(--muted); }
.kpi .v { font-family: var(--serif); font-size: 24px; color: var(--forest); margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.tone-bad .v { color: var(--bad); } .kpi.tone-ok .v { color: var(--ok); } .kpi.tone-warn .v { color: var(--warn); }
.kpi.hero { background: var(--forest); border-color: var(--forest); }
.kpi.hero .l, .kpi.hero .s { color: var(--sage); } .kpi.hero .v { color: #fff; font-size: 30px; }
.progress { height: 7px; background: var(--sage-2); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: var(--emerald); border-radius: 6px; }
.kpi.hero .progress { background: rgba(255,255,255,.15); } .kpi.hero .progress > i { background: #c9d8c2; }
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 12px; background: var(--sage-3); color: var(--forest); border: 1px solid var(--sage-2); white-space: nowrap; }
.badge.ok { background: #e6f0e9; color: var(--ok); border-color: #cfe2d5; }
.badge.warn { background: #f5ecd9; color: #8a6a26; border-color: #ead9b3; }
.badge.bad { background: #f4e3df; color: var(--bad); border-color: #e8cbc4; }
.badge.info { background: #e5ecf2; color: var(--info); border-color: #cfdbe6; }
.badge.mute { background: #f0eee8; color: var(--muted); border-color: #e4e0d6; }
.list { display: flex; flex-direction: column; }
.list .row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--sage-3); }
.list .row:last-child { border-bottom: 0; }
.list .row .grow { flex: 1; min-width: 0; }
.list .row .t { font-weight: 500; }
.list .row .d { font-size: 12.5px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; font-size: 14px; }
.alert { border-radius: 12px; padding: 11px 14px; background: var(--sage-3); border: 1px solid var(--sage-2); font-size: 14px; }
.alert.warn { background: #f8f1e1; border-color: #eadbb7; color: #6b5420; }
.alert.bad { background: #f7e9e5; border-color: #ebcfc8; color: #7d3628; }
.alert.ok { background: #e8f1eb; border-color: #cfe2d5; color: #2c5a41; }
ul.clean { margin: 0; padding-left: 18px; } ul.clean li { margin: 4px 0; }

/* таблицы */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fbf9f4; position: sticky; top: 0; cursor: default; }
table.t th.sortable { cursor: pointer; } table.t th.sortable:hover { color: var(--forest); }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--sage-3); vertical-align: middle; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #faf8f2; }
table.t td.num, table.t th.num { text-align: right; }
table.t tfoot td { font-weight: 600; border-top: 1px solid var(--line); background: #fbf9f4; }

/* формы */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea, .input { width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--white); outline: none; min-height: 40px; }
.field textarea { min-height: 86px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(159,177,154,.25); }
.field .chk { display: flex; align-items: center; gap: 8px; min-height: 40px; color: var(--graphite); font-size: 14px; }
.field .chk input { width: 18px; height: 18px; min-height: 0; accent-color: var(--emerald); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.fieldset-title { grid-column: 1 / -1; font-family: var(--serif); color: var(--forest); font-size: 15px; margin-top: 6px; border-top: 1px solid var(--sage-3); padding-top: 10px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input, .filters select { width: auto; min-width: 150px; min-height: 38px; padding: 7px 10px; }
.seg { display: inline-flex; background: var(--white); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 13.5px; color: var(--muted); }
.seg button.on { background: var(--forest); color: #fff; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabs button, .tabs a { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 14px; text-decoration: none; }
.tabs .on { color: var(--forest); border-bottom-color: var(--emerald); font-weight: 500; }

/* модальные окна и уведомления */
.overlay { position: fixed; inset: 0; background: rgba(23,48,34,.38); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; animation: fade .15s ease; }
.modal { background: var(--white); border-radius: 18px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(23,48,34,.25); animation: rise .18s ease; }
.modal.wide { max-width: 980px; }
.modal .mh { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 8px; }
.modal .mh h2 { margin: 0; font-size: 21px; }
.modal .mb { padding: 10px 22px 8px; }
.modal .mf { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; flex-wrap: wrap; }
.modal .x { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
@keyframes fade { from { opacity: 0; } } @keyframes rise { from { transform: translateY(10px); opacity: 0; } }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--forest); color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; max-width: 380px; animation: rise .2s ease; }
.toast.bad { background: var(--bad); } .toast.warn { background: #8a6a26; }

/* вход */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { background: var(--forest); color: #e9efe6; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; position: relative; overflow: hidden; }
.login .art .big { font-family: var(--serif); font-size: 44px; line-height: 1.1; color: #f6f2e9; max-width: 520px; }
.login .art .q { color: var(--sage); font-size: 16px; max-width: 440px; margin-top: 16px; }
.login .art img.mark { position: absolute; right: -60px; bottom: -40px; width: 420px; opacity: .08; }
.login .box { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.login .logo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login .logo-row .n { font-family: var(--serif); font-size: 26px; letter-spacing: 3px; color: var(--forest); }

/* расписание */
.sched-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.sched-toolbar .period { font-family: var(--serif); font-size: 18px; color: var(--forest); min-width: 180px; text-align: center; }
.sched { position: relative; display: grid; border: 1px solid var(--line); border-radius: 14px; background: var(--white); overflow: auto; max-height: calc(100vh - 230px); }
.sched .hcell { position: sticky; top: 0; z-index: 3; background: #fbf9f4; border-bottom: 1px solid var(--line); padding: 8px 6px; font-size: 13px; text-align: center; color: var(--forest); font-weight: 500; }
.sched .tcol { position: sticky; left: 0; z-index: 2; background: #fbf9f4; border-right: 1px solid var(--line); }
.sched .tlabel { height: 56px; font-size: 11.5px; color: var(--muted); text-align: right; padding: 2px 6px 0 0; border-top: 1px solid var(--sage-3); }
.sched .col { position: relative; border-right: 1px solid var(--sage-3); }
.sched .col .slot { height: 56px; border-top: 1px solid var(--sage-3); }
.sched .col .slot.half { border-top-style: dashed; }
.sched .col.drop { background: #f3f7f1; }
.lesson { position: absolute; left: 3px; right: 3px; border-radius: 9px; padding: 5px 7px; font-size: 12px; line-height: 1.25; overflow: hidden; cursor: pointer; color: var(--graphite); background: #eef2ea; border-left: 4px solid var(--emerald); box-shadow: 0 1px 2px rgba(0,0,0,.05); user-select: none; -webkit-user-select: none; }
.lesson:hover { box-shadow: 0 2px 10px rgba(31,61,43,.15); z-index: 2; }
.lesson .lt { font-weight: 600; color: var(--forest); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson .lm { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson .lf { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.lesson.done { opacity: .78; }
.lesson.conflict { outline: 2px solid var(--bad); }
.lesson.dragging { opacity: .9; box-shadow: 0 10px 30px rgba(31,61,43,.3); z-index: 10; }
.lesson .st { position: absolute; top: 4px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--sage); }
.lesson .st.done { background: var(--ok); } .lesson .st.cancelled { background: var(--bad); }
.week-grid { display: grid; border: 1px solid var(--line); border-radius: 14px; overflow: auto; background: var(--white); }
.week-grid .wh { background: #fbf9f4; padding: 8px; font-size: 13px; font-weight: 500; color: var(--forest); border-bottom: 1px solid var(--line); border-right: 1px solid var(--sage-3); position: sticky; top: 0; }
.week-grid .wr { background: #fbf9f4; padding: 8px; font-size: 13px; color: var(--forest); border-right: 1px solid var(--line); border-bottom: 1px solid var(--sage-3); position: sticky; left: 0; z-index: 1; }
.week-grid .wc { border-right: 1px solid var(--sage-3); border-bottom: 1px solid var(--sage-3); padding: 5px; min-height: 90px; display: flex; flex-direction: column; gap: 4px; }
.week-grid .wc.drop { background: #f3f7f1; }
.week-grid .lesson { position: relative; left: 0; right: 0; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--white); }
.month-grid .mh { background: #fbf9f4; padding: 8px; font-size: 12.5px; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); }
.month-grid .md { min-height: 96px; border-right: 1px solid var(--sage-3); border-bottom: 1px solid var(--sage-3); padding: 6px 7px; font-size: 12.5px; cursor: pointer; }
.month-grid .md:hover { background: #faf8f2; }
.month-grid .md.out { background: #fbfaf6; color: #b3ada0; }
.month-grid .md.today .dn { background: var(--emerald); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.month-grid .md .chip { display: block; font-size: 11.5px; margin-top: 3px; padding: 1px 5px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--sage-3); border-left: 3px solid var(--emerald); }
.heat { border-collapse: separate; border-spacing: 3px; font-size: 12px; }
.heat td, .heat th { text-align: center; padding: 0; }
.heat th { font-weight: 500; color: var(--muted); padding: 2px 6px; }
.heat td.c { width: 40px; height: 28px; border-radius: 6px; color: var(--graphite); font-size: 11px; }

/* канбан заявок */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: 260px; gap: 12px; overflow-x: auto; padding-bottom: 12px; -webkit-overflow-scrolling: touch; }
.kcol { background: #f1ede3; border-radius: 14px; padding: 10px; min-height: 200px; display: flex; flex-direction: column; gap: 8px; }
.kcol.drop { background: #e6ede2; }
.kcol .kh { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 500; color: var(--forest); padding: 2px 4px 4px; }
.kcard { background: var(--white); border: 1px solid var(--line); border-radius: 11px; padding: 9px 11px; font-size: 13px; cursor: grab; user-select: none; -webkit-user-select: none; }
.kcard:hover { border-color: var(--sage); }
.kcard .n { font-weight: 600; color: var(--graphite); }
.kcard .d { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kcard.due { border-left: 3px solid var(--warn); }
.kcard.overdue { border-left: 3px solid var(--bad); }

/* посещаемость (быстрый отчёт) */
.att-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--sage-3); flex-wrap: wrap; }
.att-row .nm { flex: 1; min-width: 160px; font-weight: 500; }
.att-row .seg button { padding: 8px 12px; }
.att-row .seg button.on.st-absent { background: var(--bad); } .att-row .seg button.on.st-late { background: var(--warn); } .att-row .seg button.on.st-excused { background: var(--info); }
.att-row input.score { width: 66px; } .att-row input.cm { flex: 2; min-width: 160px; }

/* ИИ */
.chat { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 860px; border-radius: 14px; padding: 12px 16px; }
.msg.q { align-self: flex-end; background: var(--forest); color: #fff; }
.msg.a { background: var(--white); border: 1px solid var(--line); }
.msg.a pre { white-space: pre-wrap; font-family: var(--sans); margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { border: 1px solid var(--line-2); background: var(--white); border-radius: 20px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--forest); }
.chip-btn:hover { background: var(--sage-3); }

/* графики */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { font-size: 10px; fill: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.bar-h { display: grid; grid-template-columns: 180px 1fr 60px; gap: 10px; align-items: center; font-size: 13px; padding: 4px 0; }
.bar-h .track { height: 10px; background: var(--sage-3); border-radius: 6px; position: relative; overflow: hidden; }
.bar-h .track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; }

/* мобильная навигация */
.bottom-nav { display: none; }
.drawer-bg { display: none; }

@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .2s ease; width: 280px; }
  .side.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.3); }
  .drawer-bg.open { display: block; position: fixed; inset: 0; background: rgba(23,48,34,.35); z-index: 39; }
  .main { margin-left: 0; }
  .top { padding: 8px 14px; gap: 8px; }
  .top .burger { display: inline-flex; }
  .userchip .meta { display: none; }
  .content { padding: 16px 14px calc(84px + var(--safe-b)); }
  h1 { font-size: 23px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .login { grid-template-columns: 1fr; }
  .login .art { padding: 28px 24px; min-height: 220px; }
  .login .art .big { font-size: 30px; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); text-decoration: none; padding: 4px 0; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.on { color: var(--emerald); }
  .modal { border-radius: 16px; }
  .overlay { padding: 3vh 8px; }
  .search .results { position: fixed; left: 10px; right: 10px; top: 58px; }
  .toasts { left: 12px; right: 12px; bottom: calc(78px + var(--safe-b)); }
  .bar-h { grid-template-columns: 110px 1fr 50px; }
  .list .row { flex-wrap: wrap; row-gap: 6px; }
  .list .row .grow { min-width: 55%; }
  .att-row .seg { width: 100%; } .att-row .seg button { flex: 1; }
  .kpi .v { font-size: 21px; }
  .kpi.hero .v { font-size: 25px; }
  .sched { max-height: none; }
}
@media (max-width: 520px) {
  .g4, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { max-width: none; }
  .lang { display: none; }
  .page-head .actions .btn { flex: 1; }
}
@media print {
  .side, .top, .bottom-nav, .page-head .actions, .filters, .demo-banner { display: none !important; }
  .main { margin: 0; } .content { padding: 0; } .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* Экран «CRM недоступна» и подсказка установки на телефон */
.offline { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 32px 24px; max-width: 460px; margin: 0 auto; }
.offline h2 { font-family: var(--serif); color: var(--forest); margin: 10px 0 0; }
.offline p { margin: 0; }
.offline .btn { margin-top: 14px; padding: 12px 22px; }
.install-hint { font-size: 13px; line-height: 1.45; background: #eef3ec; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--graphite); }

/* ============================ Учебный модуль и кабинет ученика ============================ */
.video { position: relative; padding-top: 56.25%; border-radius: 12px; overflow: hidden; background: #0f1a14; margin-bottom: 12px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.files { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.files .file { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.files .file a { display: inline-flex; align-items: center; gap: 6px; }
.files .file svg { width: 16px; height: 16px; }
.files video { width: 100%; max-width: 640px; border-radius: 10px; background: #000; }
.files img { max-width: 220px; max-height: 220px; border-radius: 10px; border: 1px solid var(--line); }
.prose { white-space: pre-wrap; line-height: 1.6; margin: 6px 0; overflow-wrap: anywhere; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; max-height: 220px; overflow: auto; padding: 6px 2px; }
.num-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; border-radius: 50%; background: var(--sage-3); color: var(--forest); font-weight: 600; font-size: 13px; flex: none; }
.num-badge.ok { background: var(--emerald); color: var(--ivory); }
details.topic > summary, details.task > summary { cursor: pointer; list-style: none; }
details.topic > summary::-webkit-details-marker, details.task > summary::-webkit-details-marker { display: none; }
details.topic + details.topic { margin-top: 10px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.row-actions .sp { flex: 1; }
.sticky-actions { position: sticky; bottom: calc(70px + var(--safe-b)); z-index: 5; display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; background: rgba(246,242,233,.95); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-top: 14px; }
@media (min-width: 901px) { .sticky-actions { bottom: 12px; } }
.sticky-actions .small { margin-right: auto; }
.q-edit { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; background: #fff; }
.q-edit textarea { width: 100%; margin-top: 6px; }
.opt-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.opt-row input[type=radio], .opt-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--emerald); flex: none; }
.opt-row .input { flex: 1; }
.list-cards { display: flex; flex-direction: column; gap: 10px; }
.list-cards > .card.row { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
a.card.course { display: block; text-decoration: none; color: inherit; transition: box-shadow .15s ease, transform .15s ease; }
a.card.course:hover { box-shadow: 0 6px 20px rgba(23,48,34,.08); transform: translateY(-1px); }
.bar { height: 8px; border-radius: 8px; background: var(--sage-2); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--emerald); border-radius: 8px; }
.hello { font-family: var(--serif); font-size: 28px; color: var(--forest); margin: 4px 0 14px; }
.rank-card { background: var(--forest); color: var(--ivory); border-radius: 18px; padding: 18px 20px; }
.rank-card .rank-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.rank-card .rank-l { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--sage); }
.rank-card .rank-n { font-family: var(--serif); font-size: 26px; color: #fff; }
.rank-card .rank-coins { text-align: right; }
.rank-card .rank-coins .coin { font-size: 24px; color: #f2d58a; }
.rank-card .bar { background: rgba(255,255,255,.16); }
.rank-card .bar span { background: #d6b266; }
.rank-card .rank-sub { font-size: 13px; color: #c9d8c2; margin-top: 8px; }
.coin { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.ach { text-align: center; padding: 10px 6px; border-radius: 12px; border: 1px dashed var(--line-2); opacity: .45; filter: grayscale(1); }
.ach.on { opacity: 1; filter: none; border-style: solid; border-color: var(--sage-2); background: var(--sage-3); }
.ach .i { font-size: 26px; } .ach .n { font-size: 11.5px; line-height: 1.25; margin-top: 4px; color: var(--forest); }
.tutor { margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--ivory-2); border: 1px solid var(--line); }
.take-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; position: sticky; top: 60px; z-index: 6; background: rgba(246,242,233,.95); backdrop-filter: blur(8px); padding: 8px 4px; }
.timer { font-family: var(--serif); font-size: 24px; font-variant-numeric: tabular-nums; color: var(--forest); padding: 4px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.timer.low { color: var(--bad); border-color: #e8cbc4; }
.card.q { position: relative; padding-left: 56px; }
.card.q .q-n { position: absolute; left: 14px; top: 14px; width: 30px; height: 30px; border-radius: 50%; background: var(--sage-3); color: var(--forest); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.card.q.q-ok .q-n { background: #e6f0e9; color: var(--ok); } .card.q.q-bad .q-n { background: #f4e3df; color: var(--bad); }
.card.q .q-p { font-size: 16px; margin-bottom: 10px; white-space: pre-wrap; }
.card.q > .input { width: 100%; font-size: 16px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; gap: 10px; align-items: center; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; font-size: 15.5px; }
.opt:has(input:checked) { border-color: var(--emerald); background: var(--sage-3); }
.opt input { width: 20px; height: 20px; accent-color: var(--emerald); flex: none; }
.expl { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--ivory-2); font-size: 14px; }
.result-card { display: flex; gap: 18px; align-items: center; border-radius: 18px; padding: 18px 20px; background: #fff; border: 1px solid var(--line); }
.result-card .big { font-family: var(--serif); font-size: 46px; color: var(--forest); font-variant-numeric: tabular-nums; }
.result-card.ok { border-color: #cfe2d5; background: #f1f7f2; } .result-card.warn { border-color: #ead9b3; background: #fbf6ec; }
.row.lb .place { width: 40px; text-align: center; font-size: 20px; font-weight: 700; color: var(--forest); }
.row.lb.me { background: var(--sage-3); border-radius: 10px; }
.balance { display: flex; align-items: baseline; gap: 10px; } .balance .coin { font-size: 30px; color: var(--forest); }
.card.reward .gift { font-size: 34px; }
.card.reward h3 { margin: 6px 0 2px; }
table.journal th, table.journal td { white-space: nowrap; font-size: 13px; padding: 6px 7px; }
table.journal th.hw, table.journal th.ts { background: var(--sage-3); }
table.journal td.att-absent { color: var(--bad); } table.journal td.att-present { color: var(--ok); } table.journal td.att-late, table.journal td.att-excused { color: #8a6a26; }
.card.sub .form { grid-template-columns: 140px 1fr; }
@media (max-width: 600px) { .card.sub .form { grid-template-columns: 1fr; } .hello { font-size: 24px; } .card.q { padding-left: 48px; } }
