:root {
  --primary: #ffffff;
  --secondary: #c09f63;
  --secondary-light: #d8bd8e;
  --secondary-dark: #a3814a;
  --text-dark: #2b2b2b;
  --text-muted: #8a8a8a;
  --border: #e2e2e2;
  --danger: #c0504d;
  --success: #4a8a5c;
  --radius: 12px;
}

* { box-sizing: border-box; cursor: none; }
body {
  margin: 0;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text-dark);
  background: var(--primary);
}
input, textarea, button, select { font-family: inherit; }

/* фирменный курсор-точка */
.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 10px; height: 10px;
  background: var(--secondary);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 9999;
  opacity: 0;
  transition: opacity .2s ease, background-color .15s ease;
}
.cursor-dot.on-brand { background: #ffffff; }

/* ---------- LOGIN ---------- */
.login-body { height: 100vh; }
.login-page {
  display: flex;
  height: 100%;
}
.login-left {
  flex: 1.3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6vw;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 60px; position: absolute; top: 40px; left: 6vw; font-weight: 600; font-size: 15px; }
.brand-logo-img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.brand-title { font-size: 84px; margin: 0 0 16px 0; font-weight: 800; letter-spacing: 1px; color: var(--secondary); }
.brand-subtitle { color: var(--text-muted); font-size: 18px; max-width: 420px; line-height: 1.5; }
.login-right { flex: 1; display: flex; align-items: center; justify-content: center; }
.login-card {
  width: 360px;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}
.login-card h2 { margin: 0 0 4px 0; font-weight: 500; }
.login-card .muted { color: var(--text-muted); margin: 0 0 24px 0; font-size: 14px; }
.login-card label { display: block; color: var(--secondary); font-size: 14px; margin-bottom: 6px; margin-top: 16px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  outline: none;
}
.login-card input:focus { border-color: var(--secondary); }
.error-text { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 10px; }
.btn-primary {
  margin-top: 12px;
  float: right;
  background: none;
  border: none;
  color: var(--text-dark);
  font-size: 15px;
  cursor: pointer;
  padding: 6px 4px;
}
.btn-primary:hover { color: var(--secondary-dark); }
.btn-primary:disabled { opacity: .6; cursor: default; }

/* ---------- APP SHELL ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: var(--secondary);
  color: #fff;
  padding: 24px 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-header { display: flex; gap: 12px; align-items: center; padding: 0 24px 24px 24px; border-bottom: 1px solid rgba(255,255,255,0.25); margin-bottom: 20px; }
.sidebar-header .avatar-box { width: 40px; height: 40px; background: rgba(255,255,255,0.35); border-radius: 8px; flex-shrink: 0; object-fit: cover; }
.sidebar-header .brand-name { font-weight: 600; font-size: 16px; line-height: 1.25; }
.sidebar-header .brand-sub { font-size: 12px; opacity: .85; }
.sidebar-section-title { padding: 0 24px; font-size: 13px; opacity: .8; margin-bottom: 10px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  cursor: pointer;
  font-size: 15px;
  color: #fff;
  opacity: .9;
}
.nav-item .dot { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.8); flex-shrink: 0; }
.nav-item .dot svg { width: 20px; height: 20px; }
.nav-item:hover { background: rgba(255,255,255,0.12); }
.nav-item.active { background: rgba(255,255,255,0.22); opacity: 1; font-weight: 600; }
.sidebar-footer {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 16px 24px 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.25);
}
.sidebar-footer .initials {
  width: 32px; height: 32px; min-width: 32px; max-width: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-footer .name-wrap { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.sidebar-footer .logout { margin-left: auto; opacity: .8; font-size: 13px; flex-shrink: 0; }
.sidebar-footer .logout:hover { opacity: 1; text-decoration: underline; }

.content { flex: 1; padding: 32px 40px; overflow-y: auto; position: relative; }
.dashboard-page { position: relative; min-height: calc(100vh - 64px); display: flex; flex-direction: column; }
.dashboard-bg-text {
  position: absolute;
  left: 0; right: 0; top: 220px; bottom: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 0; overflow: hidden;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 85%);
  mask-image: linear-gradient(to bottom, black 0%, transparent 85%);
}
.dashboard-bg-text span {
  font-size: 90px;
  font-weight: 800;
  color: var(--secondary);
  opacity: 0.14;
  white-space: nowrap;
  line-height: 1.15;
}
.dashboard-foreground { position: relative; z-index: 1; }
.contact-box {
  margin-top: auto;
  position: relative;
  z-index: 1;
  padding-top: 24px;
}
.contact-box .contact-line { font-size: 14px; color: var(--text-muted); margin-bottom: 4px; }
.contact-box a { color: var(--secondary-dark); text-decoration: none; font-weight: 600; }
.contact-box a:hover { text-decoration: underline; }

/* stat cards */
.stat-row { display: flex; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  min-width: 180px;
  flex: 1;
}
.stat-card .stat-value { font-size: 26px; font-weight: 600; color: var(--secondary); }
.stat-card .stat-label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.stat-card .stat-bar { height: 6px; border-radius: 4px; background: #eee; margin-top: 10px; overflow: hidden; }
.stat-card .stat-bar-fill { height: 100%; background: var(--secondary); }

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.panel h3 { margin-top: 0; }

.rhythm-row {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.rhythm-row:first-of-type { border-top: none; }
.step-circle {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-muted);
  flex-shrink: 0;
}
.step-circle.active { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.step-circle.done { background: var(--success); color: #fff; border-color: var(--success); }
.step-label { font-size: 15px; }

h1.page-title { font-weight: 500; margin-bottom: 24px; }

.topic-list-item {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  cursor: pointer;
}
.topic-list-item.locked { opacity: .5; cursor: not-allowed; }
.topic-list-item:hover:not(.locked) { border-color: var(--secondary); }
.topic-list-item .t-title { font-weight: 500; }
.topic-list-item .t-order { color: var(--text-muted); font-size: 13px; margin-right: 10px; }
.badge {
  font-size: 12px; padding: 4px 10px; border-radius: 20px; font-weight: 500;
}
.badge.done { background: #e6f2e9; color: var(--success); }
.badge.pending { background: #fdf3e3; color: #b7860b; }
.badge.failed { background: #fbeceb; color: var(--danger); }
.badge.locked { background: #f0f0f0; color: var(--text-muted); }
.badge.progress { background: #eef2fb; color: #3f5fc4; }

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--secondary);
  background: var(--secondary);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}
.btn:hover { background: var(--secondary-dark); }
.btn.secondary { background: #fff; color: var(--secondary); }
.btn.secondary:hover { background: #faf6ef; }
.btn:disabled { opacity: .5; cursor: default; }

textarea, input[type=text], input[type=password], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
textarea { min-height: 120px; resize: vertical; }
label.field-label { display: block; font-size: 13px; color: var(--text-muted); margin: 14px 0 6px 0; }

.conspect-body { line-height: 1.6; font-size: 15px; white-space: pre-wrap; }
.pdf-pages-wrap { width: 100%; line-height: 0; }
.pdf-pages-wrap canvas { display: block; width: 100%; height: auto; }
.pdf-fallback-link { display: inline-block; margin-top: 10px; font-size: 13px; }
.video-wrap { margin: 16px 0; }
.video-wrap iframe, .video-wrap video { width: 100%; max-width: 640px; aspect-ratio: 16/9; border-radius: 10px; border: none; }

.question-block { margin-bottom: 20px; }
.question-title { font-weight: 500; margin-bottom: 10px; }
.option-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.option-row input { width: auto; }
.match-row { display: flex; align-items: center; gap: 14px; padding: 6px 0; }
.match-row .match-left { flex: 1; font-size: 14px; }
.match-row select { flex: 1; }

.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 18px; cursor: pointer; color: var(--text-muted); border-bottom: 2px solid transparent;
}
.tab.active { color: var(--secondary-dark); border-color: var(--secondary); font-weight: 600; }

table.admin-table { width: 100%; border-collapse: collapse; }
table.admin-table th, table.admin-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
table.admin-table th { color: var(--text-muted); font-weight: 500; font-size: 13px; }

.row-flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.mt16 { margin-top: 16px; }
.mb16 { margin-bottom: 16px; }
.muted { color: var(--text-muted); }
.link-btn { background: none; border: none; color: var(--secondary-dark); cursor: pointer; font-size: 13px; padding: 4px 8px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-box {
  background: #fff; border-radius: var(--radius); padding: 24px 28px;
  width: 560px; max-width: 92vw; max-height: 88vh; overflow-y: auto;
}
.modal-box h3 { margin-top: 0; }
.close-x { float: right; cursor: pointer; font-size: 20px; color: var(--text-muted); }

.empty-state { color: var(--text-muted); text-align: center; padding: 40px 0; }
