:root {
  --bg: #060812;
  --text: #f6f7fb;
  --muted: #9fa9bd;
  --muted-strong: #c8d0df;
  --accent: #8fb0ff;
  --accent-soft: rgba(143, 176, 255, 0.14);
  --surface: rgba(24, 29, 43, 0.78);
  --surface-hover: rgba(34, 41, 59, 0.86);
  --surface-soft: rgba(255, 255, 255, 0.055);
  --border: rgba(255, 255, 255, 0.14);
  --success: #74e0a3;
  --warning: #ffd166;
  --danger: #ff453a;
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow: 0 22px 64px rgba(0, 0, 0, 0.34);
  --blur: blur(24px) saturate(1.25);
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 176, 255, 0.42) rgba(255, 255, 255, 0.055);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.055);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: rgba(143, 176, 255, 0.42);
  border-radius: 999px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(68, 112, 255, 0.28), transparent 34rem),
    radial-gradient(circle at 100% 20%, rgba(44, 170, 118, 0.16), transparent 30rem),
    radial-gradient(circle at 48% 100%, rgba(117, 79, 255, 0.18), transparent 34rem),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.fatal {
  padding: 40px;
}

.start-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.hero-card {
  width: min(880px, 100%);
  padding: clamp(34px, 6vw, 68px);
  border: 1px solid var(--border);
  border-radius: 42px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
}

.hero-card h1 {
  max-width: 760px;
  margin: 12px 0 18px;
  font-size: clamp(44px, 7.5vw, 88px);
  line-height: 0.95;
  letter-spacing: -0.075em;
}

.hero-card p {
  max-width: 700px;
  margin: 0;
  color: var(--muted-strong);
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.45;
}

.eyebrow {
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  margin-top: 32px;
}

.onboarding-card {
  max-width: 760px;
  padding: clamp(24px, 4vw, 42px);
}

.onboarding-card h1 {
  margin: 0 0 12px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 0.98;
}

.onboarding-form {
  max-width: 560px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.onboarding-form h2 {
  margin: 0 0 6px;
  font-size: clamp(22px, 2.5vw, 30px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.onboarding-form p {
  font-size: 14px;
}

.onboarding-card > p {
  font-size: clamp(15px, 1.7vw, 18px);
}

.onboarding-card label {
  margin: 12px 0;
}

.onboarding-card input {
  padding: 12px 14px;
  border-radius: 16px;
}

label {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  color: var(--muted-strong);
  font-weight: 700;
}

input {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  background: var(--surface-soft);
  outline: none;
}

input::placeholder {
  color: rgba(200, 208, 223, 0.5);
}

input:focus {
  border-color: rgba(143, 176, 255, 0.74);
  box-shadow: 0 0 0 5px rgba(143, 176, 255, 0.16);
}

.primary,
.secondary {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 850;
}

.primary {
  color: #08101f;
  background: linear-gradient(135deg, #ffffff, #a6bdff);
}

.secondary {
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.full {
  width: 100%;
  margin-top: 12px;
}

.app-shell {
  position: relative;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 20px 24px 80px;
}

.topbar {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  width: 350px;
}

.module-dropdown,
.user-chip,
.module-tools {
  min-width: 0;
  flex: 1 1 0;
}

.module-tools {
  display: flex;
  gap: 8px;
}

.module-dropdown {
  position: relative;
  z-index: 100;
}

.help-button {
  display: grid;
  flex: 0 0 40px;
  place-items: center;
  min-height: 40px;
  border: 1px solid rgba(255, 69, 58, 0.56);
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, rgba(255, 69, 58, 0.95), rgba(120, 22, 42, 0.92));
  font-size: 16px;
  font-weight: 950;
  box-shadow: 0 10px 24px rgba(255, 69, 58, 0.18);
}

.module-dropdown summary,
.user-chip {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: none;
  backdrop-filter: var(--blur);
}

.module-dropdown summary {
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  gap: 2px;
  padding: 6px 10px;
  list-style: none;
  cursor: pointer;
}

.module-dropdown summary::-webkit-details-marker {
  display: none;
}

.module-dropdown summary span,
.user-chip span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.module-dropdown summary strong,
.user-chip strong {
  color: var(--text);
  font-size: 12px;
  letter-spacing: -0.02em;
}

.module-dropdown summary em,
.user-chip em {
  color: var(--accent);
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
}

.module-dropdown summary em {
  justify-self: end;
  align-self: end;
}

.user-chip {
  display: grid;
  align-content: center;
  gap: 1px;
  padding: 6px 10px;
}

.module-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 5000;
  width: min(340px, 90vw);
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(24, 29, 43, 0.98);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
}

.mini-progress {
  height: 7px;
  margin: 4px 4px 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.mini-progress div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--success));
}

.module-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  color: var(--muted-strong);
  font-weight: 750;
}

.module-row.active {
  color: var(--text);
  background: var(--accent-soft);
}

.module-row span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 42px;
  align-items: start;
  margin-top: 0;
}

.learning-flow {
  width: min(900px, 100%);
  justify-self: center;
  padding: 0 4px 80px;
}

.right-rail {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 40px);
  margin-top: 54px;
  overflow-y: auto;
  padding-right: 4px;
  align-self: start;
}

.step-header {
  display: grid;
  gap: 5px;
  margin: 0 0 12px;
}

.pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  background: var(--surface);
  font-size: 11px;
  font-weight: 900;
}

.step-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.step-header h2 {
  max-width: 850px;
  margin: 6px 0 0;
  font-size: clamp(40px, 5.4vw, 68px);
  line-height: 1;
  letter-spacing: -0.065em;
}

.theory-block {
  display: grid;
  gap: 10px;
  max-width: 900px;
  margin: 14px 0 26px;
  padding: 0;
  border: 0;
  background: transparent;
}

.theory-block > strong {
  display: block;
  max-width: 760px;
  font-size: clamp(21px, 2.1vw, 30px);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.theory-block > p {
  max-width: 800px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 15px;
  line-height: 1.55;
}

.theory-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.theory-grid article {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.theory-grid span {
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.theory-grid p,
.theory-grid ul {
  margin: 8px 0 0;
  color: var(--muted-strong);
  line-height: 1.5;
}

.theory-grid ul {
  padding-left: 18px;
}

.is-tip-target {
  position: relative;
  outline: 2px solid rgba(255, 209, 102, 0.78);
  outline-offset: 5px;
  box-shadow: 0 0 0 8px rgba(255, 209, 102, 0.08);
}

.learning-flow > h3 {
  max-width: 850px;
  margin: 18px 0 16px;
  font-size: clamp(22px, 2.6vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.045em;
}

.options {
  display: grid;
  gap: 12px;
  max-width: 900px;
}

.option {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 24px;
  color: var(--text);
  text-align: left;
  background: var(--surface);
}

.option:hover:not(:disabled) {
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.option span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text);
  background: var(--accent-soft);
  font-weight: 900;
}

.option.correct {
  border-color: rgba(116, 224, 163, 0.42);
  background: rgba(116, 224, 163, 0.12);
}

.option.incorrect {
  border-color: rgba(255, 69, 58, 0.42);
  background: rgba(255, 69, 58, 0.12);
}

.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.result-card,
.artifact-card {
  max-width: 900px;
  margin-top: 24px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
}

.result-card p,
.artifact-card p,
.muted {
  color: var(--muted-strong);
  line-height: 1.6;
}

.panel,
.dashboard-panel,
.rail-panel,
.mail-item,
.task-card,
.backlog-card,
.metric-card {
  border: 1px solid var(--border);
  background: var(--surface);
}

.dashboard-panel {
  min-height: 0;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(17, 72, 54, 0.88), rgba(16, 32, 38, 0.9));
  box-shadow: none;
  backdrop-filter: var(--blur);
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-title h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
}

.panel-title > span {
  min-width: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

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

.metric-card {
  display: grid;
  gap: 4px;
  min-height: 50px;
  padding: 10px;
  border-radius: 16px;
}

.metric-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-card strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.rail-panels {
  display: grid;
  gap: 10px;
}

.rail-panel {
  overflow: hidden;
  border-radius: 20px;
  box-shadow: none;
  backdrop-filter: var(--blur);
}

.rail-panel-emails {
  border-color: rgba(255, 255, 255, 0.28);
  background: linear-gradient(145deg, rgba(245, 248, 255, 0.38), rgba(92, 106, 140, 0.74));
}

.rail-panel-backlog {
  background: linear-gradient(145deg, rgba(42, 102, 220, 0.28), rgba(20, 35, 76, 0.84));
}

.rail-panel-tasks {
  background: linear-gradient(145deg, rgba(128, 38, 64, 0.34), rgba(55, 20, 36, 0.86));
}

.rail-panel summary {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 13px 14px;
  list-style: none;
  cursor: pointer;
}

.rail-panel summary::-webkit-details-marker {
  display: none;
}

.rail-panel summary span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
}

.panel-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-style: normal;
  font-size: 13px;
  line-height: 1;
}

.rail-panel summary b {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #fff;
  background: var(--danger);
  font-size: 12px;
}

.rail-panel summary em {
  min-width: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.rail-panel-body {
  padding: 0 12px 12px;
}

.mail-list,
.task-list,
.backlog-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding-right: 2px;
}

.mail-item,
.task-card,
.backlog-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border-radius: 16px;
}

.rail-panel-emails .mail-item {
  border-color: rgba(143, 176, 255, 0.34);
  background: rgba(18, 24, 38, 0.5);
}

.rail-panel-emails .mail-item strong {
  color: #ffffff;
}

.rail-panel-emails .mail-item span {
  color: rgba(223, 231, 247, 0.82);
}

.rail-panel-emails .mail-expanded {
  border-top-color: rgba(255, 255, 255, 0.18);
}

.rail-panel-emails .mail-expanded p {
  color: rgba(244, 247, 255, 0.92);
}

.mail-item button {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  text-align: left;
  background: transparent;
}

.mail-new-badge {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 7px;
  border-radius: 50%;
  color: #fff;
  background: var(--danger);
  font-size: 12px;
  line-height: 1;
  vertical-align: 1px;
}

.mail-item strong,
.task-card strong,
.backlog-card strong {
  font-size: 13px;
  line-height: 1.25;
}

.mail-item span,
.task-card small {
  color: var(--muted);
  font-size: 12px;
}

.mail-item.active {
  border-color: rgba(143, 176, 255, 0.64);
}

.mail-expanded {
  margin-top: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}

.mail-expanded p {
  margin: 0;
  color: var(--muted-strong);
  line-height: 1.55;
  white-space: pre-line;
}

.task-card {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.task-card.is-linked {
  cursor: pointer;
}

.task-card.is-linked:hover {
  background: var(--surface-hover);
}

.task-card.is-done {
  border-color: rgba(116, 224, 163, 0.34);
  background: rgba(116, 224, 163, 0.1);
}

.return-work {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(143, 176, 255, 0.45);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(143, 176, 255, 0.2), rgba(24, 29, 43, 0.9));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
  backdrop-filter: var(--blur);
}

.return-work span {
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.45;
}

.return-work button {
  width: 100%;
}

.tip-card {
  position: fixed;
  top: 160px;
  left: max(24px, calc((100vw - 1440px) / 2 + 72px));
  z-index: 9000;
  width: min(390px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid rgba(255, 209, 102, 0.38);
  border-radius: 24px;
  background: rgba(18, 22, 34, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
}

.tip-card-dashboard,
.tip-card-mail,
.tip-card-backlog,
.tip-card-tasks,
.tip-card-actions {
  left: auto;
  right: max(390px, calc((100vw - 1440px) / 2 + 400px));
}

.tip-card-dashboard {
  top: 96px;
}

.tip-card-mail {
  top: 220px;
}

.tip-card-backlog {
  top: 320px;
}

.tip-card-tasks {
  top: 420px;
}

.tip-card-case {
  top: 470px;
}

.tip-card-actions {
  top: auto;
  bottom: 72px;
}

.tip-card span {
  color: var(--warning);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tip-card h3 {
  margin: 8px 0;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.tip-card p {
  margin: 0;
  color: var(--muted-strong);
  line-height: 1.5;
}

.tip-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.status,
.tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 900;
}

.status-done,
.status-ready-for-pilot {
  color: var(--success);
  background: rgba(116, 224, 163, 0.14);
}

.status-rework,
.status-needs-clarification,
.status-blocked-by-weak-input {
  color: var(--warning);
  background: rgba(255, 209, 102, 0.14);
}

.empty {
  color: var(--muted);
}

.new {
  animation: pulseNew 1.5s ease;
}

@keyframes pulseNew {
  0% {
    box-shadow: 0 0 0 0 rgba(143, 176, 255, 0.32);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(143, 176, 255, 0);
  }
}

@media (max-width: 1180px) {
  .topbar {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
    margin-bottom: 18px;
    justify-content: stretch;
  }

  .module-dropdown,
  .user-chip {
    width: auto;
    flex: 1 1 0;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .right-rail {
    position: static;
    max-height: none;
    margin-top: 0;
  }

  .tip-card,
  .tip-card-dashboard,
  .tip-card-mail,
  .tip-card-backlog,
  .tip-card-tasks,
  .tip-card-case,
  .tip-card-actions {
    top: auto;
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px 14px 60px;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .module-dropdown summary,
  .user-chip {
    min-height: 44px;
  }

  .step-header h2 {
    font-size: clamp(38px, 13vw, 58px);
  }
}
