:root { --bg:#f5f3ee; --card:#fff; --ink:#1f2933; --muted:#6b7280; --accent:#1f6f5c; --danger:#b42318; --line:#e2ded3; }
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--ink); font:18px/1.45 system-ui, "Segoe UI", sans-serif; }
main { max-width: 1000px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.7rem; margin: .6em 0; }
h2 { font-size: 1.2rem; margin: 0 0 .6em; }
.top { display:flex; align-items:center; gap:16px; padding:10px 16px; background:var(--accent); color:#fff; }
.top a { color:#fff; text-decoration:none; padding:6px 12px; border-radius:8px; }
.top nav { flex:1; display:flex; gap:6px; }
.top nav a.active, .top nav a:hover { background:rgba(255,255,255,.2); }
.brand { font-weight:700; font-size:1.2rem; }
.logout { margin:0; }
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:16px; margin-bottom:16px; }
.narrow { max-width: 420px; }
label { display:block; margin-bottom:12px; font-weight:600; }
input, select, textarea { display:block; width:100%; margin-top:4px; padding:10px 12px; font:inherit; border:1px solid #c9c4b6; border-radius:8px; background:#fff; }
.row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:8px; }
.row input, .row select { width:auto; margin:0; flex:1 1 180px; }
.row.grow, .grow { flex:1 1 300px; }
.item { padding:8px 0; border-top:1px solid var(--line); margin:0; }
.inactive { opacity:.55; }
.btn { display:inline-block; padding:10px 18px; font:inherit; font-weight:600; color:#fff; background:var(--accent); border:0; border-radius:8px; cursor:pointer; text-decoration:none; }
.btn.small { padding:6px 12px; font-size:.9rem; }
.btn.ghost { background:transparent; color:var(--accent); border:1px solid var(--accent); }
.btn.danger { background:var(--danger); }
.muted { color:var(--muted); font-size:.9rem; }
.flash { padding:10px 14px; border-radius:8px; margin-bottom:12px; }
.flash.ok { background:#dcf3e8; color:#14532d; }
.flash.err { background:#fde4e1; color:#7a1810; }
.lesson-title { font-weight:600; color:var(--ink); text-decoration:none; }
.arabic { font-family:"Amiri","Traditional Arabic","Scheherazade New",serif; font-size:1.7rem; line-height:2; }
.arabic-view { font-family:"Amiri","Traditional Arabic","Scheherazade New",serif; font-size:2.4rem; line-height:2.2; }
form { margin:0; }

/* ---- экран записи (интерактивная доска) ---- */
.board { padding: 20px; }
.big-select { font-size: 1.5rem; font-weight: 700; padding: 14px 16px; margin: 0 0 16px; }
.arabic-board { font-family:"Amiri","Traditional Arabic","Scheherazade New",serif; font-size: 3rem; line-height: 2.3; white-space: pre-wrap; max-height: 46vh; overflow-y: auto; padding: 0 8px; }
.controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.controls .rec { margin-left: auto; }
.btn.big { font-size: 1.5rem; padding: 18px 30px; border-radius: 12px; }
.btn.rec { background: #c0262d; min-width: 220px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.seg { display: flex; gap: 0; }
.seg .btn { border-radius: 0; background: #fff; color: var(--accent); border: 2px solid var(--accent); }
.seg .btn:first-child { border-radius: 12px 0 0 12px; }
.seg .btn:last-child { border-radius: 0 12px 12px 0; border-left: 0; }
.seg .btn.on { background: var(--accent); color: #fff; }
.live-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.live-head .btn { margin-left: auto; }
.timer { font-size: 2.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.rec-dot { width: 22px; height: 22px; border-radius: 50%; background: #c0262d; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.wave { width: 100%; height: 140px; display: block; background: #f1efe8; border-radius: 10px; touch-action: none; }
.wave.tall { height: 220px; cursor: ew-resize; }
.trim-info { margin: 8px 0 12px; font-size: 1.05rem; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 14px; padding: 20px; width: min(1100px, 100%); max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.stud-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.btn.stud { text-align: left; font-size: 1.3rem; padding: 14px 18px; }
[hidden] { display: none !important; }

/* ---- проверка записей ---- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); white-space: nowrap; }
.tbl th { font-size: .85rem; color: var(--muted); border-top: 0; }
.grade { display: inline-block; min-width: 28px; text-align: center; padding: 2px 8px; border-radius: 8px; color: #fff; background: var(--accent); }
.grade.g1, .grade-btn.g1.on { background: #b42318; }
.grade.g2, .grade-btn.g2.on { background: #d9560b; }
.grade.g3, .grade-btn.g3.on { background: #b88a00; }
.grade.g4, .grade-btn.g4.on { background: #5a9a2f; }
.grade.g5, .grade-btn.g5.on { background: #1f6f5c; }
.rev-meta { font-size: 1.05rem; }
.player { margin-top: 12px; }
.timer.sm { font-size: 1.4rem; }
.speed { margin-left: auto; }
.speed .seg-btn { padding: 10px 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.btn.chip { background: #fff; color: var(--accent); border: 2px solid var(--accent); }
.btn.chip.on { background: var(--accent); color: #fff; }
#markNote { margin-bottom: 12px; }
.mark-n { display: inline-block; min-width: 26px; text-align: center; background: #b42318; color: #fff; border-radius: 6px; font-weight: 700; }
.grades { display: flex; gap: 10px; margin-bottom: 12px; }
.grade-btn { background: #fff; color: #444; border: 2px solid #c9c4b6; min-width: 72px; }
.grade-btn.on { color: #fff; border-color: transparent; }

/* ---- записи ученика и таблица оценок ---- */
.stats { display: flex; flex-wrap: wrap; gap: 32px; }
.stats > div { display: flex; flex-direction: column; }
.big-num { font-size: 2.2rem; font-weight: 700; line-height: 1.1; }
.cmt { white-space: normal !important; min-width: 180px; color: var(--muted); font-size: .95rem; }
.grid .lcol { max-width: 120px; white-space: normal; font-size: .8rem; vertical-align: bottom; }
.grid td, .grid th { text-align: center; }
.grid .stick { text-align: left; position: sticky; left: 0; background: var(--card); z-index: 1; }
.grid tr.grp td { background: #efece3; font-weight: 700; text-align: left; border-top: 1px solid var(--line); }
.gcell a { text-decoration: none; }
a.grade { min-width: 34px; padding: 4px 10px; }
.dotmark { color: var(--muted); font-size: 1.4rem; text-decoration: none; }
.card .seg-btn { font-size: 1rem; padding: 10px 18px; }
.grid .stick a { color: var(--ink); text-decoration: none; font-weight: 600; }
.grid .stick a:hover { text-decoration: underline; }

/* ---- дашборд ---- */
.chart { width: 100%; min-height: 300px; }
.chart svg { display: block; max-width: 100%; touch-action: pan-y; }
.chart-tip { position: absolute; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; box-shadow: 0 2px 8px rgba(0,0,0,.12); pointer-events: none; font-size: .95rem; white-space: nowrap; }
.lesson-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.lchip { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); background: #fff; }
.lchip .lt { flex: 1; font-weight: 600; }
.lchip.none { opacity: .6; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(140px, 240px) 1fr 40px; align-items: center; gap: 12px; }
.hb-track { background: #f1efe8; border-radius: 6px; height: 18px; overflow: hidden; }
.hb-fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.hb-val { font-weight: 700; font-variant-numeric: tabular-nums; }

/* узкие экраны: меню переносится, а не расширяет страницу */
.top { flex-wrap: wrap; }
.top nav { flex-wrap: wrap; }
.hbar { grid-template-columns: minmax(100px, 240px) 1fr 40px; }

/* ---- настройки ---- */
.cmd { display: block; padding: 10px 14px; background: #f1efe8; border-radius: 8px; word-break: break-all; }
details { margin-top: 16px; }
summary { cursor: pointer; font-weight: 600; }
