:root {
  --bg: #f4f3fa;
  --card: #ffffff;
  --text: #1d1b2b;
  --muted: #6d6a80;
  --line: #e6e3f0;
  --accent: #6a4fd6;
  --accent-soft: #eee9ff;
  --ok: #1f9d64;
  --ok-soft: #e3f6ec;
  --warn: #c77a0a;
  --warn-soft: #fdf1dc;
  --danger: #d23c4f;
  --radius: 16px;
  color-scheme: light;
  --shadow: 0 1px 2px rgba(30, 20, 70, .05), 0 4px 16px rgba(30, 20, 70, .05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 Manrope, system-ui, -apple-system, Segoe UI, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.back { border: 0; background: var(--card); width: 34px; height: 34px; border-radius: 10px; font-size: 22px; line-height: 1; cursor: pointer; box-shadow: var(--shadow); }
.tabs { display: flex; gap: 4px; background: var(--card); padding: 4px; border-radius: 12px; box-shadow: var(--shadow); }
.tabs a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 9px; font-weight: 600; font-size: 14px; }
.tabs a.on { background: var(--accent); color: #fff; }

main { max-width: 860px; margin: 0 auto; padding: 16px 16px 80px; }
.loading, .empty { color: var(--muted); text-align: center; padding: 40px 0; }

h1 { font-size: 22px; margin: 4px 0 14px; line-height: 1.25; }
h2 { font-size: 16px; margin: 26px 0 10px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 24px; font-weight: 800; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.warn b { color: var(--warn); }

.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 10px; }
a.card { display: block; text-decoration: none; color: inherit; }
a.card:hover { outline: 2px solid var(--accent-soft); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.hw-title { font-weight: 700; font-size: 16px; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.grey { background: var(--line); color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 10px 14px; cursor: pointer; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); text-decoration: none;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { background: transparent; color: var(--danger); }
.btn.block { width: 100%; padding: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }
label.field > small { display: block; color: var(--muted); margin-top: 4px; font-size: 12.5px; }
input[type=text], input[type=password], input[type=url], textarea {
  width: 100%; border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 11px 12px; outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
input[type=file] { width: 100%; font-size: 13px; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.linkbox { display: flex; gap: 8px; align-items: center; background: var(--card); border-radius: 12px; padding: 8px 8px 8px 12px; box-shadow: var(--shadow); }
.linkbox code { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.items { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.items .text { white-space: pre-wrap; word-break: break-word; background: var(--bg); border-radius: 10px; padding: 9px 11px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; cursor: zoom-in; background: var(--line); }
.file { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; background: var(--bg); border-radius: 10px; font-size: 13.5px; text-decoration: none; color: var(--text); }

.sub-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.sub-name { font-weight: 700; }
.comment { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.comment textarea { min-height: 60px; }
.sent-comment { background: var(--accent-soft); border-radius: 10px; padding: 8px 11px; font-size: 14px; white-space: pre-wrap; }

.seg { display: inline-flex; background: var(--card); border-radius: 10px; padding: 3px; box-shadow: var(--shadow); }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--accent-soft); color: var(--accent); }

.progress { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1d1b2b; color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 50; max-width: calc(100% - 32px); font-weight: 600; }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; z-index: 40; cursor: zoom-out; }
.viewer-body img, .viewer-body video { max-width: 96vw; max-height: 90vh; border-radius: 8px; background: #000; }
.viewer-body audio { width: min(420px, 90vw); }

.login { max-width: 360px; margin: 60px auto; }

@media (max-width: 560px) {
  .top { flex-wrap: wrap; }
  .brand { font-size: 15px; }
  .tabs { width: 100%; }
  .tabs a { flex: 1; text-align: center; }
  .stat b { font-size: 20px; }
  h1 { font-size: 19px; }
}

/* --- статусы, работы, лента --- */
:root { --red: #d2542f; --red-soft: #fde8e1; }
.pill.red { background: var(--red-soft); color: var(--red); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn); color: #fff; font-size: 11.5px; line-height: 18px; text-align: center; }
.tabs a.on .badge { background: #fff; color: var(--accent); }

.seg.wide { display: flex; width: 100%; margin-bottom: 14px; }
.seg.wide a { flex: 1; text-align: center; text-decoration: none; padding: 8px 6px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg.wide a.on { background: var(--accent-soft); color: var(--accent); }

.list { padding: 4px 16px; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover span:first-child { color: var(--accent); }

.tl-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.tl-feedback { border-left: 4px solid var(--accent); }
.tl-feedback.accepted { border-left-color: var(--ok); background: color-mix(in srgb, var(--ok-soft) 45%, var(--card)); }
.tl-feedback.rework { border-left-color: var(--red); background: color-mix(in srgb, var(--red-soft) 45%, var(--card)); }
.tl-feedback .items .text { background: rgba(255,255,255,.7); }

details.card summary { cursor: pointer; list-style: none; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: ' ▾'; color: var(--muted); }
details[open].card summary { margin-bottom: 4px; }

.verdict-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ok-btn { background: var(--ok); color: #fff; padding: 13px; }
.red-btn { background: var(--red); color: #fff; padding: 13px; }

.banner { background: var(--ok-soft); color: var(--ok); padding: 12px 14px; border-radius: 12px; font-weight: 700; margin-bottom: 12px; }
.link-card { display: flex; flex-direction: column; gap: 8px; border: 2px solid var(--accent-soft); }
.link-card .linkbox { box-shadow: none; background: var(--bg); }
.editor { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }

/* --- кабинет ученика --- */
.hello { font-size: 20px; font-weight: 800; margin: 4px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.big-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cta { position: sticky; bottom: 12px; margin-top: 16px; }
.hw-card.rework { border: 2px solid var(--red-soft); }
@media (max-width: 560px) {
  .verdict-btns { grid-template-columns: 1fr; }
  .seg.wide a { font-size: 12px; padding: 8px 2px; }
}

.link-card .linkbox { flex-wrap: wrap; }
.link-card .linkbox code { white-space: normal; word-break: break-all; font-size: 14px; flex-basis: 100%; }
.link-card .linkbox .btn { width: 100%; }
.tabs a { white-space: nowrap; }

.pill { white-space: nowrap; }

/* --- сдача в приложении --- */
.field-label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.attach { display: flex; flex-wrap: wrap; gap: 8px; }
.att { position: relative; }
.att img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; display: block; }
.file-att { padding: 10px 30px 10px 10px; background: var(--bg); border-radius: 10px; font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #1d1b2b; color: #fff; font-size: 14px; line-height: 22px; padding: 0; cursor: pointer; }
.file-att button { top: 50%; right: 6px; transform: translateY(-50%); }
label.btn { cursor: pointer; }
#sendBtn { margin-top: 14px; }

/* --- видеоразбор и необязательные вложения --- */
.attach-more { margin-bottom: 14px; }
.attach-more summary { cursor: pointer; color: var(--accent); font-weight: 700; list-style: none; padding: 6px 0; }
.attach-more summary::-webkit-details-marker { display: none; }
.locked { text-align: center; color: var(--muted); font-weight: 600; margin-top: 14px; }
.review-card { border: 2px solid var(--accent-soft); }
