:root {
  --bg: #12101F;
  --card: #1B1830;
  --card2: #241F42;
  --line: #322B54;
  --line2: #4A3F7A;
  --text: #EDEBF7;
  --muted: #A7A3C4;
  --muted2: #7C789E;
  --accent: #4CB944;
  --accent2: #1E8F7A;
  --danger: #E5484D;
  --prim: #5B8CFF;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #1D1A38 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  min-height: 100vh;
}

.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 10px 18px; background: rgba(18, 16, 31, .92);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-mark { width: 34px; height: 34px; display: inline-flex; }
.logo-mark svg { width: 100%; height: 100%; }
.brand-name { font-weight: 700; font-size: 19px; letter-spacing: .3px; }
.topnav { display: flex; gap: 6px; flex-wrap: wrap; margin-left: 8px; }
.navbtn {
  color: var(--muted); text-decoration: none; padding: 7px 13px; border-radius: 9px; font-size: 15px;
}
.navbtn:hover { color: var(--text); background: var(--card); }
.navbtn.active { color: var(--text); background: var(--card2); }
.topright { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.rolebadge { font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px; }
.rolebadge.admin { color: #FFD37A; border-color: #6b5a2a; }
.inlineform { display: inline; }

.wrap { max-width: 980px; margin: 0 auto; padding: 22px 16px 60px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px; margin-bottom: 16px;
}
.card.nopad { padding: 0; overflow: hidden; }
.pagehead { display: flex; align-items: center; gap: 14px; margin: 4px 2px 14px; flex-wrap: wrap; }
.title { font-size: 24px; margin: 0; }
.muted { color: var(--muted); font-size: 14px; }
.err { color: #FF6B81; margin-top: 10px; }
.msg { color: var(--accent); margin-top: 8px; min-height: 20px; font-size: 14px; }
.foot { text-align: center; color: var(--muted2); font-size: 13px; padding: 18px 0 26px; }

/* кнопки */
.btn {
  border: 1px solid transparent; border-radius: 11px; padding: 9px 16px; cursor: pointer;
  font-size: 15px; font-weight: 600; color: #fff; background: var(--line);
  transition: transform .08s ease, filter .15s ease, box-shadow .15s ease;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--prim); }
.btn.accent { background: var(--accent); color: #10240d; }
.btn.secondary { background: transparent; border-color: var(--line2); color: var(--text); }
.btn.danger { background: transparent; border-color: var(--danger); color: #FF9AA0; }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.big { padding: 13px 20px; font-size: 17px; }
.btn.full { width: 100%; }
.btn.success { background: var(--accent) !important; color: #10240d !important; }
.iconbtn { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: 6px 10px; cursor: pointer; font-size: 15px; }
.iconbtn:hover { color: var(--text); }
.iconbtn.round { border-radius: 50%; width: 36px; height: 36px; }

/* логин */
.loginbox { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.loginlogo { width: 74px; height: 74px; margin: 4px auto 10px; animation: float 3.2s ease-in-out infinite; }
.loginlogo svg { width: 100%; height: 100%; }
.loginform { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; text-align: left; }
.inp {
  background: #141226; border: 1px solid var(--line); color: var(--text); border-radius: 10px;
  padding: 10px 12px; font-size: 16px; outline: none; width: 100%;
}
.inp:focus { border-color: var(--line2); }
.inp.small { width: 70px; padding: 6px 8px; }

/* dropzone */
.dropzone {
  border: 2px dashed var(--line2); border-radius: 16px; padding: 34px 16px; text-align: center;
  cursor: pointer; transition: border-color .2s, background .2s, transform .15s;
}
.dropzone:hover, .dropzone:focus { border-color: var(--accent); background: rgba(76, 185, 68, .05); outline: none; }
.dropzone.drag { border-color: var(--accent); background: rgba(76, 185, 68, .12); transform: scale(1.01); }
.dz-ico { color: var(--muted); transition: color .2s, transform .25s ease; }
.dropzone:hover .dz-ico, .dropzone.drag .dz-ico { color: var(--accent); transform: translateY(-4px); animation: bounce 1.1s ease infinite; }
.dz-text { margin-top: 8px; font-size: 17px; }
.dz-name { margin-top: 10px; color: var(--accent); font-weight: 600; word-break: break-all; }

.opts { display: flex; gap: 18px; flex-wrap: wrap; margin: 14px 2px; }
.opt { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; cursor: pointer; }
.opt input { accent-color: var(--accent); width: 17px; height: 17px; }
.opt input:disabled { opacity: .4; }

/* прогресс */
.progresswrap { margin-top: 16px; }
.phase { color: var(--muted); font-size: 15px; margin-bottom: 8px; }
.pbar { height: 10px; border-radius: 6px; background: #141226; border: 1px solid var(--line); overflow: hidden; }
.pfill {
  height: 100%; width: 0%; border-radius: 6px;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  background-size: 200% 100%;
  animation: flow 1.4s linear infinite;
  transition: width .4s ease;
}

/* результат */
.resultcard { margin-top: 16px; border: 1px solid var(--accent); background: rgba(76, 185, 68, .07); border-radius: 14px; padding: 14px; animation: popin .35s ease; }
.rc-head { display: flex; align-items: center; gap: 12px; }
.dl-ico { color: var(--accent); flex: 0 0 auto; }
.rc-stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.chip { background: var(--card); border: 1px solid var(--line); padding: 5px 11px; border-radius: 18px; font-size: 14px; color: var(--muted); }
.chip b { color: var(--text); }
.chip-btn { cursor: pointer; color: #FFD37A; border-color: #6b5a2a; font-family: inherit; }
.chip-btn:hover { background: rgba(255, 211, 122, .08); }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(6, 5, 14, .7); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal {
  background: var(--card); border: 1px solid var(--line2); border-radius: 16px;
  padding: 18px; max-width: 560px; width: 100%; max-height: 80vh; overflow: auto;
  animation: popin .25s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 18px; }
.unsigned-list { display: flex; flex-direction: column; gap: 6px; }
.unsigned-item { background: #16132A; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 15px; word-break: break-all; }
.rc-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.rc-btns .btn.downloading { animation: pulse .9s ease infinite; }

/* файлы */
.filelist { display: flex; flex-direction: column; gap: 6px; }
.filehead { color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.fileitem { display: flex; align-items: center; gap: 10px; background: #16132A; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.fileitem:hover { border-color: var(--line2); background: var(--card2); }
.fmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--text); }
.fnamerow { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fname { font-weight: 600; word-break: break-all; font-size: 16px; }
.fmeta { color: var(--muted2); font-size: 14px; }
.fileitem.downloaded .dl-ico { color: var(--accent); }
.hist-check { accent-color: var(--danger); width: 17px; height: 17px; flex: 0 0 auto; cursor: pointer; }
.whlearn-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0; }

/* таблицы */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; color: var(--muted); font-size: 13px; font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid rgba(50, 43, 84, .5); font-size: 15px; }
.tbl.small td, .tbl.small th { font-size: 13.5px; padding: 6px 8px; }
.tbl td.radio { text-align: center; }
.tbl td.radio input { accent-color: var(--accent); width: 17px; height: 17px; cursor: pointer; }
.artcell { font-weight: 600; }
.rowbtns { display: flex; gap: 10px; margin-top: 14px; align-items: center; flex-wrap: wrap; }
.wrapbtns .btn { margin: 2px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } .topnav { order: 3; width: 100%; } }
.adminform { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.adminform label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 14px; }
.toggles { display: flex; flex-direction: column; gap: 10px; }
.splitload { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.pdfframe { width: 100%; height: 78vh; border: 0; display: block; background: #fff; }
.bad { color: #FF6B81; }
.splitfile-item { margin-top: 10px; }

@keyframes flow { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.35); } }
@keyframes popin { 0% { transform: scale(.96); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes spin { to { transform: rotate(360deg); } }
