@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg-page: #f6f7fb;
  --bg-card: #ffffff;
  --bg-soft: #f6f7fb;

  --text-main: #2b2d42;
  --text-muted: #6f7287;
  --text-light: #8a8fa3;

  --primary: #393a61;
  --primary-dark: #2f3050;

  --secondary: #a9b8d8;
  --secondary-dark: #94a6cb;

  --danger: #d88881;
  --danger-dark: #c8746d;
  --danger-soft: #f8e7e5;

  --success: #92c39e;
  --success-dark: #7bb089;
  --success-soft: #e7f3ea;

  --purple: #8c88b8;

  --dark: #393a61;
  --dark-hover: #2f3050;

  --border: #d9deea;
  --border-soft: #e8ecf4;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;

  --shadow-sm: 0 4px 14px rgba(57, 58, 97, 0.08);
  --shadow-md: 0 8px 24px rgba(57, 58, 97, 0.1);
  --shadow-lg: 0 12px 30px rgba(57, 58, 97, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
}

img {
  max-width: 100%;
  display: block;
}

button {
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: 0.2s ease;
  font-family: inherit;
}

input,
textarea,
select {
  box-sizing: border-box;
  font-family: inherit;
}

h1,
h2,
h3 {
  color: var(--primary);
  font-weight: 800;
}

p {
  line-height: 1.55;
}

#main-content {
  margin-left: 240px;
  padding: 40px 30px;
}

.not-found {
  text-align: center;
  margin-top: 120px;
}

.sidebar {
  width: 220px;
  background: var(--dark);
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  height: 100vh;
  padding-top: 30px;
  box-shadow: 4px 0 18px rgba(57, 58, 97, 0.12);
  z-index: 100;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li {
  margin: 12px 0;
}

.sidebar a {
  color: #fff;
  text-decoration: none;
  padding: 12px 16px;
  display: block;
  border-radius: 10px;
  margin: 0 10px;
  font-weight: 600;
}

.sidebar a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.login-container {
  max-width: 380px;
  margin: 100px auto;
  background: var(--bg-card);
  padding: 32px 26px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.login-container label {
  display: block;
  margin: 16px 0 6px;
  font-weight: 600;
  color: var(--text-main);
}

.login-container input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.login-container button {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
}

.login-container button:hover {
  background: var(--primary-dark);
}

.error-message {
  color: var(--danger-dark);
  margin-top: 10px;
  min-height: 20px;
  font-weight: 600;
}

.profile-block,
.editor-block,
.test-question-block,
.test-question,
.stat-block,
.admin-stats > div,
.profile-card-block,
.admin-section-block,
.course-detail-card,
.test-result-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.profile-block {
  padding: 24px 20px;
  margin-bottom: 32px;
}

.editor-block {
  padding: 22px;
  margin-bottom: 24px;
}

.test-question-block,
.test-question {
  padding: 18px 20px;
  margin-bottom: 18px;
}

.stat-block,
.admin-stats > div {
  padding: 18px 24px;
  min-width: 120px;
  text-align: center;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-header-centered {
  justify-content: center;
  text-align: center;
}

.empty-state {
  margin-top: 20px;
  color: var(--text-muted);
}

.center-text {
  text-align: center;
}

.center-content {
  display: flex;
  justify-content: center;
}

.secondary-btn {
  background: var(--secondary);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.secondary-btn:hover {
  background: var(--secondary-dark);
}

.danger-btn {
  background: var(--danger);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.danger-btn:hover {
  background: var(--danger-dark);
}

.save-course-btn,
.finish-test-btn,
.course-start-btn,
.add-course-btn,
.login-container button {
  background: var(--primary);
  color: #fff;
  padding: 8px 14px;
  font-weight: 700;
}

.save-course-btn:hover,
.finish-test-btn:hover,
.course-start-btn:hover,
.add-course-btn:hover,
.login-container button:hover {
  background: var(--primary-dark);
}

.add-question-btn {
  background: var(--success);
  color: #fff;
  padding: 10px 16px;
  font-weight: 700;
}

.add-question-btn:hover {
  background: var(--success-dark);
}

.preview-test-btn {
  background: var(--secondary);
  color: var(--text-main);
  padding: 10px 16px;
  font-weight: 700;
}

.preview-test-btn:hover {
  background: var(--secondary-dark);
}

.admin-users-table,
.admin-courses-table,
.assigned-courses-table,
.courses-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-top: 24px;
  margin-bottom: 30px;
  overflow: hidden;
}

.admin-users-table th,
.admin-users-table td,
.admin-courses-table th,
.admin-courses-table td,
.assigned-courses-table th,
.assigned-courses-table td,
.courses-table th,
.courses-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
}

.admin-users-table th,
.admin-courses-table th,
.assigned-courses-table th,
.courses-table th {
  background: var(--bg-soft);
  font-weight: 800;
  color: var(--primary);
}

.admin-users-table tr:last-child td,
.admin-courses-table tr:last-child td,
.assigned-courses-table tr:last-child td,
.courses-table tr:last-child td {
  border-bottom: none;
}

.admin-stats,
.dashboard-stats {
  display: flex;
  gap: 20px;
  margin: 30px 0 40px;
  flex-wrap: wrap;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  font-size: 15px;
  color: var(--text-light);
}

.admin-courses,
.current-courses,
.completed-courses {
  list-style: none;
  padding: 0;
  margin: 0 0 30px;
}

.admin-courses li,
.current-courses li,
.completed-courses li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 10px;
  font-size: 15px;
}

.admin-courses .activity,
.current-courses .progress {
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
}

.completed-courses .date {
  color: var(--text-light);
  font-size: 13px;
}

.completed-courses .score {
  background: #e8ecf8;
  color: var(--primary);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 14px;
  font-weight: 700;
}

.role-label {
  display: inline-block;
  background: #e8ecf8;
  color: var(--primary);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
}

.profile-info > div {
  margin-bottom: 8px;
  font-size: 15px;
}

.courses-page {
  width: 100%;
}

.course-grid,
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.course-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.course-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.course-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.course-title {
  color: var(--text-muted);
  text-align: left;
  width: 100%;
}

.course-description {
  color: var(--text-muted);
  text-align: left;
  width: 100%;
}

.course-meta {
  width: 100%;
  margin: 0;
  color: var(--text-main);
}

.course-card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 12px;
}

.course-action {
  padding: 9px 12px;
  font-size: 0.92rem;
  font-weight: 700;
  margin: 4px 0;
  border-radius: var(--radius-sm);
}

.course-action.pass {
  background: var(--success);
  color: #fff;
}

.course-action.pass:hover {
  background: var(--success-dark);
}

.course-action.edit {
  background: var(--primary);
  color: #fff;
}

.course-action.edit:hover {
  background: var(--primary-dark);
}

.course-action.details {
  background: var(--secondary);
  color: var(--text-main);
}

.course-action.details:hover {
  background: var(--secondary-dark);
}

.course-action.students {
  background: var(--primary);
  color: #fff;
}

.course-action.students:hover {
  background: var(--primary-dark);
}

.course-action.completed {
  background: var(--success);
  color: #fff;
  cursor: default;
}

.course-action.delete {
  background: var(--danger);
  color: #fff;
}

.course-action.delete:hover {
  background: var(--danger-dark);
}

.course-status.done {
  background: var(--success-soft);
  color: var(--success-dark);
  font-weight: 800;
  border-radius: var(--radius-md);
  padding: 4px 8px;
  display: inline-block;
}

.course-status-text {
  font-weight: 700;
}

.course-status-note {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.status-published,
.course-progress-done {
  color: var(--success-dark);
}

.status-pending {
  color: var(--primary);
}

.status-rejected {
  color: var(--danger-dark);
}

.course-progress {
  width: 100%;
  margin: 0;
  font-weight: 700;
}

.course-progress-pending {
  color: var(--text-muted);
}

.add-course-btn {
  margin-bottom: 10px;
  padding: 10px 16px;
}

.course-detail-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
}

.course-detail-back-wrap {
  width: 100%;
  max-width: 760px;
  display: flex;
  justify-content: flex-start;
  margin-bottom: 18px;
}

.course-back-btn {
  padding: 10px 16px;
}

.course-detail-card {
  width: 100%;
  max-width: 760px;
  overflow: hidden;
  text-align: center;
}

.course-detail-cover-wrap {
  width: 100%;
  background: var(--bg-soft);
}

.course-detail-image {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
}

.course-detail-body {
  padding: 28px 24px 32px;
}

.course-detail-title {
  margin: 0 0 18px;
  font-size: 2rem;
  line-height: 1.2;
}

.course-detail-description {
  margin: 18px auto;
  max-width: 620px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.course-detail-meta {
  margin: 0 0 22px;
  font-size: 1rem;
}

.course-detail-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.course-result {
  max-width: 620px;
  margin: 0 auto 20px;
  background: var(--success-soft);
  border: 1px solid var(--success);
  padding: 16px 18px;
  border-radius: var(--radius-md);
  text-align: center;
}

.course-result h3 {
  margin-top: 0;
  margin-bottom: 10px;
  color: var(--success-dark);
}

.course-result p {
  margin: 0;
}

.course-completed-btn,
.course-start-btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
}

.course-completed-btn {
  background: var(--success);
  color: #fff;
  cursor: default;
}

.course-editor {
  max-width: 900px;
}

.course-editor-centered {
  max-width: 1000px;
  margin: 0 auto;
}

.editor-block-centered {
  display: flex;
  justify-content: center;
}

.editor-inner {
  width: 100%;
  max-width: 720px;
}

.editor-block h2 {
  margin-top: 0;
}

.editor-block label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--text-main);
}

.editor-block input[type="text"],
.editor-block input[type="number"],
.editor-block input[type="file"],
.editor-block textarea,
.editor-block select,
.admin-form-field input,
.admin-form-field select,
.login-container input,
.profile-file-input,
.tab-panel input[type="text"],
.tab-panel input[type="number"],
.tab-panel textarea,
.tab-panel select {
  width: 100%;
  padding: 10px 12px;
  margin: 10px 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-main);
}

.editor-block textarea {
  min-height: 120px;
  resize: vertical;
}

.editor-block input[type="checkbox"],
.editor-block input[type="radio"] {
  width: auto;
  margin: 0;
  padding: 0;
}

.editor-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.editor-actions-centered {
  justify-content: center;
}

.block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.block-header-centered {
  justify-content: space-between;
  align-items: center;
}

.course-preview {
  margin: 10px 0 20px;
}

.preview-image {
  max-width: 240px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.questions-list {
  margin-top: 20px;
}

.question-card {
  background: var(--bg-soft);
  padding: 14px;
  border-radius: var(--radius-md);
  margin-top: 12px;
}

.question-card-centered {
  text-align: center;
}

.question-card-header {
  margin-bottom: 8px;
}

.question-type {
  margin-bottom: 8px;
  color: var(--text-muted);
}

.question-image-wrap {
  margin-bottom: 10px;
}

.question-image {
  max-width: 220px;
  border-radius: var(--radius-md);
}

.question-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.material-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}

.material-file-item a {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-link-admin {
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.course-link-admin:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.material-file-item button {
  flex-shrink: 0;
}

.material-file-item:last-child {
  border-bottom: none;
}

.question-actions button {
  margin-right: 8px;
}

.question-choices-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px auto 12px;
  max-width: 420px;
  text-align: left;
}

.question-choice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.question-choice-row input[type="radio"],
.question-choice-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}

.question-choice-text {
  flex: 1;
  color: var(--text-main);
}

.question-choice-correct {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--success-dark);
  background: var(--success-soft);
  border-radius: 999px;
  padding: 4px 8px;
}

.new-question-form {
  margin-top: 20px;
}

.options-list {
  margin-bottom: 16px;
}

.option-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.option-correct-input {
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  justify-self: center;
}

.option-input {
  width: 100%;
  margin: 0 !important;
}

.remove-option-btn {
  min-width: 42px;
  height: 42px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0 12px;
}

.answer-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.test-question-block img,
.test-question img {
  max-width: 320px;
  max-height: 180px;
  border-radius: var(--radius-md);
  margin: 8px 0;
}

.test-container {
  max-width: 800px;
}

.test-page {
  display: flex;
  justify-content: center;
  width: 100%;
}

.test-container-centered {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}

.test-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.test-header-centered {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.test-title {
  margin: 0;
  text-align: center;
  flex: 1;
}

.test-timer {
  font-weight: 800;
  color: var(--danger-dark);
}

.test-form {
  width: 100%;
}

.course-material-card {
  max-width: 760px;
  margin: 0 auto;
  padding: 26px;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  text-align: left;
}

.course-material-image-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.course-material-image {
  width: 100%;
  max-width: 720px;
  height: auto;
  border-radius: var(--radius-md);
}

.course-material-content h3 {
  margin-top: 0;
  margin-bottom: 14px;
}

.course-material-content p {
  line-height: 1.7;
  color: var(--text-muted);
  margin: 0;
}

.test-question-centered {
  max-width: 760px;
  margin: 0 auto 18px;
  text-align: center;
}

.test-question-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.test-question-image-wrap {
  display: flex;
  justify-content: center;
  margin: 10px 0 14px;
}

.test-question-image {
  max-width: 320px;
  max-height: 200px;
  border-radius: var(--radius-md);
  object-fit: cover;
}

.test-choices,
.test-options {
  margin: 10px 0 0;
}

.test-choices label,
.test-options label {
  display: block;
  margin-bottom: 6px;
  cursor: pointer;
}

.test-options-centered {
  max-width: 420px;
  margin: 0 auto;
  text-align: left;
}

.test-option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
}

.test-option-row input[type="radio"],
.test-option-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}

.test-submit-btn,
.finish-test-btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
}

.test-submit-btn:disabled {
  background: #b8bcc9;
  cursor: not-allowed;
}

.test-actions {
  margin-top: 26px;
}

.test-actions-centered {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.test-result-card {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 32px 24px;
  text-align: center;
}

.admin-panel-page {
  max-width: 1200px;
  margin: 0 auto;
}

.admin-tabs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  justify-content: center;
}

.tab-btn {
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 700;
}

.tab-btn:hover {
  border-color: var(--border);
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-dark);
}

.tab-panel {
  display: none;
  background: var(--bg-soft);
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.tab-panel.active {
  display: block;
}

.admin-section-block {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
}

.admin-section-inner {
  width: 100%;
  padding: 24px;
}

.admin-section-inner h2 {
  margin-top: 0;
  margin-bottom: 18px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
  align-items: end;
}

.admin-form-field {
  display: flex;
  flex-direction: column;
}

.admin-form-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.admin-form-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.add-user-inline {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.add-user-inline select {
  flex: 1;
}

.selected-employees-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 60px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.selected-employee-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
}

.selected-employee-placeholder {
  color: var(--text-muted);
}

.full-width {
  grid-column: 1 / -1;
}

.admin-search-row {
  grid-template-columns: 1fr;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.assign-table-wrap {
  max-height: 280px;
  overflow-y: auto;
}

.assign-users-table th,
.assign-users-table td {
  padding: 8px 10px;
  font-size: 0.92rem;
}

.assign-users-table thead {
  background: #f3f5fb;
}

.assign-users-table td {
  white-space: nowrap;
}

.assign-users-table button {
  min-width: 64px;
}

.selected-employees-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 60px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.add-user-inline {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.add-user-inline select {
  flex: 1;
}

.selected-employee-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
}

.selected-employee-placeholder {
  color: var(--text-muted);
}

.admin-message {
  margin-top: 14px;
  min-height: 20px;
  font-weight: 700;
}

.admin-message.success {
  color: var(--success-dark);
}

.admin-message.error {
  color: var(--danger-dark);
}

.table-action-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-page {
  max-width: 960px;
  margin: 0 auto;
}

.profile-card-block {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
}

.profile-card-inner {
  width: 100%;
  max-width: 720px;
  padding: 28px 24px 32px;
  text-align: center;
}

.profile-avatar-wrap {
  display: flex;
  justify-content: center;
  margin: 18px 0 14px;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-soft);
  border: 4px solid var(--border-soft);
}

.profile-avatar-form {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.profile-file-input {
  max-width: 260px;
}

.profile-message {
  min-height: 22px;
  margin-bottom: 18px;
  font-weight: 700;
}

.profile-message.success {
  color: var(--success-dark);
}

.profile-message.error {
  color: var(--danger-dark);
}

.profile-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
  text-align: left;
}

.profile-info-item {
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.profile-info-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.profile-info-value {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  word-break: break-word;
}

@media (max-width: 1024px) {
  .course-grid,
  .courses-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #main-content {
    margin-left: 220px;
    padding: 30px 20px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    padding-top: 10px;
    padding-bottom: 16px;
  }

  .sidebar ul#sidebar-bottom {
    position: static !important;
    bottom: auto !important;
    width: 100% !important;
    margin-top: 16px;
  }

  .sidebar ul#sidebar-bottom li {
    margin: 0;
  }

  .sidebar ul#sidebar-top,
  .sidebar ul#sidebar-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 10px;
  }

  .sidebar li {
    margin: 0;
    flex: 1 1 calc(50% - 8px);
  }

  .sidebar a {
    margin: 0;
    padding: 10px 12px;
  }

  #main-content {
    margin-left: 0;
    padding: 20px 15px;
  }

  .course-grid,
  .courses-grid {
    grid-template-columns: 1fr;
  }

  .admin-stats,
  .dashboard-stats {
    flex-direction: column;
  }

  .admin-courses li,
  .current-courses li,
  .completed-courses li {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .test-header,
  .test-header-centered {
    flex-direction: column;
    align-items: center;
  }

  .test-title {
    text-align: center;
  }

  .course-detail-card {
    max-width: 100%;
  }

  .course-detail-image {
    height: 220px;
  }

  .course-detail-body {
    padding: 22px 16px 24px;
  }

  .course-detail-title {
    font-size: 1.6rem;
  }

  .course-detail-description {
    max-width: 100%;
  }

  .block-header,
  .block-header-centered {
    flex-direction: column;
    align-items: center;
  }

  .editor-inner {
    max-width: 100%;
  }

  .question-choices-preview,
  .test-options-centered {
    max-width: 100%;
  }

  .option-row {
    grid-template-columns: 24px 1fr;
  }

  .remove-option-btn {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .admin-form-actions {
    align-items: stretch;
  }

  .table-action-group {
    flex-direction: column;
  }

  .profile-card-inner {
    max-width: 100%;
    padding: 22px 16px 24px;
  }

  .profile-info-grid {
    grid-template-columns: 1fr;
  }

  .profile-avatar-form {
    flex-direction: column;
  }

  .test-question-centered {
    max-width: 100%;
  }

  .admin-tabs {
    justify-content: flex-start;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .admin-tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex: 1 1 140px;
    min-width: 140px;
    white-space: nowrap;
  }

  .admin-section-inner {
    padding: 16px;
    box-sizing: border-box;
  }

  .tab-panel {
    padding: 16px;
  }

  .admin-form-field input,
  .admin-form-field select,
  .admin-form-field textarea,
  .tab-panel input,
  .tab-panel select,
  .tab-panel textarea {
    max-width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 768px) {
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }

  .table-wrap table thead {
    display: none;
  }

  .table-wrap table tbody tr {
    display: block;
    border-bottom: 1px solid var(--border-soft);
    padding: 10px 0;
  }

  .table-wrap table td {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    white-space: normal;
    word-break: break-word;
  }

  .table-wrap table td[data-label]::before {
    content: attr(data-label) ": ";
    font-weight: 700;
    color: var(--text-muted);
    margin-right: 8px;
    flex: 0 0 auto;
  }

  .table-wrap table td a {
    display: inline-block;
    max-width: 65%;
    word-break: break-word;
  }
}
.course-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin: 6px 0 4px;
  line-height: 1.3;
}

.question-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
  line-height: 1.5;
}
input#course-title,
input#material-title,
input#question-text {
  width: 100%;
  box-sizing: border-box;
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  margin: 10px 0 16px;
}
/* Сетка новостей */
.news-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 20px;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.news-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 400px; /* минимальная высота блока */
  flex: 1 1 0;
}

.news-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.news-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin: 10px 12px 6px;
}

.news-content {
  font-size: 15px;
  color: var(--text-main);
  line-height: 1.5;
  margin: 0 12px 12px;
  /* адаптивный перенос текста */
  overflow-wrap: break-word;
  word-break: break-word;
  flex-grow: 1; /* текст занимает оставшееся место */
}

/* Адаптивные медиазапросы */
@media (max-width: 1024px) {
  .course-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .course-grid {
    grid-template-columns: 1fr;
  }
}

.tabs,
.admin-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  background: var(--bg-soft);
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ===== ADMIN TABS ===== */

.tabs,
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  background: #ffffff;
  border: 1px solid #d9deea;
  border-radius: 8px;
  color: #393a61;
  font-weight: 700;
  cursor: pointer;
}

.tab-btn.active {
  background: #393a61;
  color: #ffffff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}