:root {
  --bg: #eef3f6;
  --surface: #ffffff;
  --surface-2: #f8fbfc;
  --ink: #071b2c;
  --muted: #5d6f7b;
  --line: #d4e0e6;
  --red: #d21f2b;
  --navy: #081f33;
  --blue: #0057c8;
  --teal: #008c72;
  --amber: #f0a620;
  --green: #138a5b;
  --shadow: 0 18px 50px rgba(7, 27, 44, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(0, 87, 200, 0.06), transparent 34%),
    linear-gradient(315deg, rgba(210, 31, 43, 0.06), transparent 34%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 306px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 38%),
    linear-gradient(135deg, #071b2c, #102f49);
  color: #f8fbfc;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}

.brand {
  display: block;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 176px;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 8px;
  margin: 0 auto;
}

.eyebrow,
.hero-copy p,
.progress-strip span,
.sidebar-footer {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.sidebar-footer {
  color: rgba(248, 251, 252, 0.72);
}

.course-list {
  display: grid;
  gap: 12px;
}

.service-group {
  display: grid;
  gap: 8px;
}

.service-button {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.075);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.service-button.active,
.service-button:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.34);
}

.service-button span {
  font-weight: 800;
}

.service-toggle {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 1rem;
}

.service-button small {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.service-trainings {
  display: grid;
  gap: 7px;
}

.service-trainings[hidden] {
  display: none;
}

body.admin-mode .course-list {
  display: none;
}

body.admin-mode .admin-sidebar-panel {
  margin-top: 18px;
}

body.admin-mode .sidebar-footer {
  margin-top: auto;
}

.admin-sidebar-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.admin-sidebar-panel[hidden] {
  display: none;
}

.admin-sidebar-panel p {
  margin: 0;
  color: rgba(248, 251, 252, 0.76);
  font-size: 0.83rem;
  font-weight: 800;
  text-transform: uppercase;
}

.course-button {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.065);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.empty-service {
  margin: 0;
  padding: 8px 10px;
  color: rgba(248, 251, 252, 0.65);
  font-size: 0.86rem;
}

.course-button.active,
.course-button:hover {
  background: #f8fbfc;
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.course-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(210, 31, 43, 0.18), rgba(0, 87, 200, 0.12));
  color: var(--red);
  font-weight: 900;
}

.course-button small {
  display: block;
  margin-top: 2px;
  color: currentColor;
  opacity: 0.68;
}

.course-state {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #899aa2;
}

.course-state.complete {
  background: var(--green);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #53d69d;
}

.workspace {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 34px;
}

.topbar,
.panel-heading,
.progress-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.account-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar {
  padding: 6px 0 20px;
  border-bottom: 1px solid rgba(8, 31, 51, 0.08);
}

.account-chip,
.account-warning {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
}

.account-chip strong {
  margin-left: 4px;
  color: var(--ink);
}

.account-warning {
  border-color: #f1c879;
  background: #fff8e8;
  color: #855f16;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
}

h2 {
  margin-bottom: 0;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--red);
  font-weight: 800;
  text-transform: uppercase;
}

.ghost-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  text-decoration: none;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

.primary-button {
  border-color: var(--red);
  background: linear-gradient(135deg, var(--red), #a91521);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(210, 31, 43, 0.22);
}

.primary-button:disabled {
  border-color: #b6c2c7;
  background: #b6c2c7;
  cursor: not-allowed;
}

.hero-panel {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  align-items: stretch;
  margin-top: 24px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.training-area[hidden] {
  display: none !important;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding: 20px;
  border: 1px solid rgba(0, 140, 114, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(0, 140, 114, 0.1), rgba(255, 255, 255, 0.9)),
    #ffffff;
  box-shadow: 0 12px 34px rgba(7, 27, 44, 0.08);
}

.auth-panel[hidden] {
  display: none;
}

.auth-panel p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.hero-art {
  position: relative;
  min-height: 244px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(8, 31, 51, 0.92), rgba(8, 31, 51, 0.38)),
    repeating-linear-gradient(120deg, #d21f2b 0 16px, #f8fbfc 16px 30px, #0057c8 30px 46px, #008c72 46px 60px);
}

.hero-art.has-training-image {
  padding: 12px;
  background: #11191d;
}

.hero-training-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
}

.signal-card {
  position: absolute;
  right: 24px;
  bottom: 24px;
  display: grid;
  grid-template-columns: repeat(3, 22px) auto;
  align-items: end;
  gap: 8px;
  padding: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--navy);
}

.signal-card span {
  display: block;
  width: 22px;
  background: var(--teal);
  border-radius: 4px 4px 0 0;
}

.signal-card span:nth-child(1) {
  height: 26px;
}

.signal-card span:nth-child(2) {
  height: 42px;
  background: var(--amber);
}

.signal-card span:nth-child(3) {
  height: 58px;
  background: var(--red);
}

.signal-card strong {
  margin-left: 6px;
  align-self: center;
}

.hero-copy {
  padding: 34px;
}

.hero-copy h2 {
  max-width: 680px;
  font-size: clamp(1.55rem, 2.4vw, 2.3rem);
}

.hero-copy p:last-of-type {
  max-width: 760px;
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.course-media,
.module-body .resource-link {
  margin-top: 14px;
}

.training-image {
  display: block;
  width: min(100%, 620px);
  height: auto;
  max-height: none;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.resource-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-right: 10px;
  padding: 0 12px;
  border: 1px solid #b9d7cf;
  border-radius: 8px;
  background: #eef8f5;
  color: var(--teal);
  font-weight: 800;
  text-decoration: none;
}

.progress-strip {
  margin: 18px 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.progress-strip div {
  min-width: 0;
}

.progress-strip strong {
  display: block;
  margin-top: 4px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  gap: 18px;
}

.panel,
.completion-panel,
.management-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(24, 41, 54, 0.07);
}

.panel {
  padding: 20px;
}

.module-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.module-tab {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
}

.module-tab.active {
  border-color: var(--navy);
  background: var(--navy);
  color: #ffffff;
}

.module-body {
  line-height: 1.65;
}

.module-body ul {
  padding-left: 20px;
}

.module-body li + li {
  margin-top: 8px;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e9f7f4;
  color: var(--teal);
  font-weight: 800;
}

.quiz-form {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.question {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.question legend {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 0;
  margin-bottom: 4px;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
}

.question legend span {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--navy);
  color: #ffffff;
  font-size: 0.88rem;
}

.answer-list {
  display: grid;
  gap: 9px;
  width: 100%;
}

.answer {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease;
}

.answer-radio {
  flex: 0 0 18px;
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  accent-color: var(--red);
}

.answer:has(input:checked) {
  border-color: rgba(210, 31, 43, 0.55);
  background: #fff5f6;
  box-shadow: 0 8px 18px rgba(210, 31, 43, 0.12);
}

.answer:hover {
  border-color: rgba(0, 87, 200, 0.36);
  background: #ffffff;
}

.answer-copy {
  flex: 1 1 auto;
  display: block;
  width: auto;
  min-width: 0;
  text-align: left !important;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.quiz-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.result-text {
  margin: 0;
  font-weight: 800;
}

.completion-panel {
  margin-top: 18px;
  padding: 24px;
}

.management-panel {
  margin-top: 18px;
  padding: 24px;
}

.management-panel[hidden] {
  display: none;
}

.manager-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: start;
  gap: 22px;
  margin-top: 18px;
}

.manager-layout > div:first-child {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.analytics-panel {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.analytics-panel[hidden],
.manager-layout[hidden] {
  display: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.6rem;
}

.analytics-table-wrap {
  overflow-x: auto;
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.analytics-table th,
.analytics-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.analytics-table th {
  background: #edf4f8;
  color: var(--ink);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.manager-form {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.builder-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf4f8;
}

.builder-list {
  display: grid;
  gap: 12px;
}

.builder-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.builder-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
  text-transform: uppercase;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  color: var(--ink);
  padding: 10px 12px;
}

input[type="checkbox"] {
  width: auto;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

.manager-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  font-weight: 800;
}

.danger-button {
  border-color: #efb4b8;
  color: #a91d25;
}

.certificate {
  margin: 16px 0;
  padding: 18px;
  border: 2px dashed var(--green);
  border-radius: 8px;
  background: #f1fbf6;
  line-height: 1.7;
}

.ticket-link {
  width: fit-content;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .course-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid,
  .hero-panel,
  .manager-layout,
  .stats-grid,
  .answer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .course-list {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-heading,
  .account-actions,
  .auth-panel,
  .progress-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .ghost-button,
  .primary-button {
    width: 100%;
  }

  .hero-copy {
    padding: 22px;
  }
}
