:root {
  --ink: #181a26;
  --muted: #666b7a;
  --line: #e4e6ec;
  --paper: #ffffff;
  --canvas: #eceef3;
  --accent: #6857f5;
  --accent-dark: #4c3cda;
  --accent-soft: #f0edff;
  --red: #e04452;
  --red-soft: #fff1f2;
  --orange: #f09a32;
  --orange-soft: #fff7e8;
  --green: #2b9b6a;
  --green-soft: #ebf8f1;
  --shadow: 0 24px 70px rgba(29, 31, 45, .13), 0 3px 10px rgba(29, 31, 45, .06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  color: #fff;
  background: var(--ink);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.header-inner {
  width: min(1180px, calc(100% - 40px));
  min-height: 76px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 180px 1fr auto;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  width: 33px;
  height: 33px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 3px;
  padding: 5px;
  background: var(--accent);
  border-radius: 9px;
  transform: rotate(-7deg);
}

.brand-mark i {
  display: block;
  border-radius: 2px 2px 0 0;
  background: #fff;
}

.brand-mark i:nth-child(1) { height: 9px; }
.brand-mark i:nth-child(2) { height: 17px; }
.brand-mark i:nth-child(3) { height: 22px; }

.brand-name {
  font-size: 10px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: .13em;
}

.header-title {
  justify-self: center;
  display: flex;
  align-items: baseline;
  gap: 11px;
}

.header-title .eyebrow {
  color: #969baa;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .13em;
}

.header-title strong {
  font-size: 15px;
  font-weight: 600;
}

.review-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: #d9dbe3;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 999px;
}

.review-badge span {
  width: 7px;
  height: 7px;
  background: #7ae0ad;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(122, 224, 173, .1);
}

.tabs-shell {
  position: sticky;
  top: 76px;
  z-index: 19;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid #dadde4;
  backdrop-filter: blur(12px);
}

.tabs {
  width: min(930px, calc(100% - 24px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.tab {
  position: relative;
  min-height: 59px;
  padding: 8px 14px;
  color: #747886;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: color .2s ease, background .2s ease;
}

.tab span {
  margin-right: 6px;
  color: #a9acb5;
  font-size: 10px;
}

.tab::after {
  position: absolute;
  right: 18px;
  bottom: -1px;
  left: 18px;
  height: 3px;
  content: "";
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  transform: scaleX(0);
  transition: transform .2s ease;
}

.tab:hover {
  color: var(--ink);
  background: #fafafd;
}

.tab.is-active {
  color: var(--ink);
}

.tab.is-active span {
  color: var(--accent);
}

.tab.is-active::after {
  transform: scaleX(1);
}

.tab:focus-visible,
.page-navigation button:focus-visible,
#reset-checklist:focus-visible,
.checklist input:focus-visible {
  outline: 3px solid rgba(104, 87, 245, .3);
  outline-offset: 2px;
}

.workspace {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 26px 24px 54px;
}

.workspace-meta {
  width: min(210mm, 100%);
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #6e7280;
  font-size: 11px;
}

.workspace-meta p {
  margin: 0;
}

.workspace-meta p:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
}

.workspace-meta span {
  color: #3f4350;
  font-weight: 700;
}

.workspace-meta small {
  color: #888c98;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  margin-right: 4px;
  color: #565b68;
  background: #f7f8fa;
  border: 1px solid #d7dae1;
  border-bottom-width: 2px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 11px;
}

.a4-page {
  position: relative;
  width: min(210mm, 100%);
  min-height: 297mm;
  margin: 0 auto;
  padding: 18mm 17mm 15mm;
  overflow: hidden;
  background:
    radial-gradient(circle at 90% 2%, rgba(104, 87, 245, .045), transparent 22%),
    var(--paper);
  box-shadow: var(--shadow);
  animation: pageIn .28s ease both;
}

.a4-page[hidden] {
  display: none;
}

@keyframes pageIn {
  from { opacity: .4; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.section-no {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
}

.document-label {
  color: #989ba7;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .16em;
}

.page-heading {
  margin: 19px 0 18px;
}

.page-heading.compact {
  margin-bottom: 14px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 31px;
  line-height: 1.08;
  letter-spacing: -.045em;
}

.lead {
  max-width: 690px;
  margin: 10px 0 0;
  color: #626674;
  font-size: 11px;
  line-height: 1.65;
}

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

.principle-card {
  position: relative;
  min-height: 201px;
  padding: 18px 16px 14px;
  background: #fafafd;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.principle-card:nth-child(1),
.principle-card:nth-child(6) {
  background: var(--accent-soft);
  border-color: #dcd5ff;
}

.card-no {
  display: block;
  margin-bottom: 9px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
}

.principle-card h2 {
  max-width: 280px;
  margin: 0;
  font-size: 13px;
  line-height: 1.34;
  letter-spacing: -.02em;
}

.principle-card > p {
  margin: 8px 0 0;
  color: #666a77;
  font-size: 9px;
  line-height: 1.53;
}

.practice {
  position: absolute;
  right: 16px;
  bottom: 13px;
  left: 16px;
  padding-top: 9px;
  color: #555967;
  border-top: 1px solid #e1e2e8;
  font-size: 8px;
  line-height: 1.45;
}

.practice b {
  color: var(--ink);
}

.page-footer {
  position: absolute;
  right: 17mm;
  bottom: 9mm;
  left: 17mm;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  color: #a1a4ad;
  border-top: 1px solid var(--line);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.page-footer span:first-child {
  color: var(--accent);
  font-weight: 800;
}

.traffic-stack {
  display: grid;
  gap: 10px;
}

.traffic-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.traffic-card > header {
  display: grid;
  grid-template-columns: 23px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
}

.traffic-card.red > header { background: var(--red-soft); }
.traffic-card.orange > header { background: var(--orange-soft); }
.traffic-card.green > header { background: var(--green-soft); }

.traffic-light {
  width: 15px;
  height: 15px;
  border-radius: 50%;
}

.red .traffic-light { background: var(--red); box-shadow: 0 0 0 5px rgba(224, 68, 82, .1); }
.orange .traffic-light { background: var(--orange); box-shadow: 0 0 0 5px rgba(240, 154, 50, .1); }
.green .traffic-light { background: var(--green); box-shadow: 0 0 0 5px rgba(43, 155, 106, .1); }

.traffic-card header p {
  margin: 0 0 2px;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .12em;
}

.red header p { color: var(--red); }
.orange header p { color: #bc6d10; }
.green header p { color: var(--green); }

.traffic-card header h2 {
  margin: 0;
  font-size: 12px;
  line-height: 1.25;
}

.priority-tag {
  padding: 4px 7px;
  color: #7d808b;
  background: rgba(255, 255, 255, .7);
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: 999px;
  font-size: 7px;
  font-weight: 800;
}

.traffic-content {
  padding: 11px 14px 12px;
}

.traffic-content ul {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.traffic-content li {
  position: relative;
  padding-left: 14px;
}

.traffic-content li::before {
  position: absolute;
  top: 4px;
  left: 0;
  width: 6px;
  height: 6px;
  content: "";
  border-radius: 50%;
}

.red li::before { background: var(--red); }
.orange li::before { background: var(--orange); }
.green li::before { background: var(--green); }

.traffic-content b,
.traffic-content span {
  display: block;
}

.traffic-content b {
  font-size: 8.5px;
  line-height: 1.35;
}

.traffic-content span {
  margin-top: 2px;
  color: #757985;
  font-size: 7.5px;
  line-height: 1.42;
}

.decision-rule {
  margin-top: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  color: #fff;
  background: var(--ink);
  border-radius: 10px;
}

.decision-rule span {
  padding-right: 10px;
  color: #a7aab4;
  border-right: 1px solid #393c49;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.decision-rule strong {
  font-size: 9px;
}

.decision-rule i {
  color: #9b91ff;
  font-style: normal;
}

.rhythm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.rhythm-card {
  min-height: 243px;
  padding: 15px;
  background: #fafafd;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.rhythm-card header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.rhythm-card header > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}

.rhythm-card:nth-child(2) header > span { background: #2f7abf; }
.rhythm-card:nth-child(3) header > span { background: #2b9b6a; }
.rhythm-card:nth-child(4) header > span { background: #db7f31; }

.rhythm-card header p {
  margin: 0 0 2px;
  color: #8b8f9a;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .1em;
}

.rhythm-card h2 {
  margin: 0;
  font-size: 12px;
}

.rhythm-card ul {
  margin: 12px 0 10px;
  padding: 0;
  list-style: none;
}

.rhythm-card li {
  position: relative;
  margin: 0 0 7px;
  padding-left: 14px;
  color: #5d616e;
  font-size: 8.5px;
  line-height: 1.45;
}

.rhythm-card li::before {
  position: absolute;
  top: 4px;
  left: 0;
  width: 5px;
  height: 5px;
  content: "";
  background: #b8b2ff;
  border-radius: 50%;
}

.output {
  margin: 0;
  padding-top: 9px;
  color: #666a77;
  border-top: 1px solid var(--line);
  font-size: 8px;
  line-height: 1.4;
}

.output b {
  color: var(--ink);
}

.routine-strip {
  margin-top: 12px;
  padding: 13px 15px;
  color: #fff;
  background: var(--ink);
  border-radius: 10px;
}

.routine-strip > p {
  margin: 0 0 10px;
  color: #9c9fab;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .11em;
}

.routine-strip div {
  display: grid;
  grid-template-columns: 18px 1fr auto 18px 1fr auto 18px 1fr;
  align-items: center;
  gap: 7px;
}

.routine-strip span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
  font-size: 7px;
  font-weight: 800;
}

.routine-strip strong {
  font-size: 7.5px;
  line-height: 1.35;
}

.routine-strip i {
  color: #666a78;
  font-style: normal;
}

.traps-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.trap-card {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 2px 10px;
  min-height: 112px;
  padding: 13px;
  background: #fafafd;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.trap-card > span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #cc4e58;
  background: #fff0f1;
  border-radius: 50%;
  font-size: 8px;
  font-weight: 800;
}

.trap-card h2 {
  margin: 0;
  font-size: 10px;
  line-height: 1.35;
}

.trap-card p {
  margin: 3px 0 0;
  color: #787b86;
  font-size: 7.5px;
  line-height: 1.4;
}

.trap-card strong {
  grid-column: 2;
  align-self: end;
  color: var(--accent-dark);
  font-size: 7.5px;
  line-height: 1.35;
}

.pause-box {
  margin-top: 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  color: #fff;
  background: var(--ink);
  border-radius: 10px;
}

.pause-box span {
  padding: 5px 8px;
  color: #fff;
  background: var(--red);
  border-radius: 5px;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .08em;
}

.pause-box p {
  margin: 0;
  font-size: 8.5px;
  line-height: 1.45;
}

.checklist-heading {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 20px;
  margin-bottom: 14px;
}

.progress-ring {
  --progress: 0deg;
  position: relative;
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  align-content: center;
  background: conic-gradient(var(--accent) var(--progress), #ececf2 var(--progress));
  border-radius: 50%;
}

.progress-ring::before {
  position: absolute;
  width: 53px;
  height: 53px;
  content: "";
  background: #fff;
  border-radius: 50%;
}

.progress-ring strong,
.progress-ring span {
  position: relative;
  z-index: 1;
}

.progress-ring strong {
  font-size: 12px;
}

.progress-ring span {
  margin-top: 1px;
  color: #8b8e99;
  font-size: 6px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.checklist fieldset {
  margin: 0;
  min-width: 0;
  padding: 0 14px 7px;
  background: #fafafd;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.checklist legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 7px;
  font-size: 10px;
  font-weight: 800;
}

.checklist legend span {
  color: var(--accent);
  font-size: 7px;
}

.checklist label {
  display: grid;
  grid-template-columns: 17px 1fr;
  gap: 8px;
  align-items: start;
  padding: 9px 0;
  color: #575b68;
  border-top: 1px solid var(--line);
  cursor: pointer;
  font-size: 8px;
  line-height: 1.5;
}

.checklist input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.checklist label:has(input:checked) span {
  color: #9295a0;
  text-decoration: line-through;
}

.checklist-action {
  margin-top: 11px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--accent-soft);
  border: 1px solid #ddd7ff;
  border-radius: 10px;
}

.checklist-action > div {
  flex: 1;
}

.checklist-action div > span:first-child {
  display: block;
  color: var(--accent-dark);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .08em;
}

.write-line {
  display: block;
  height: 16px;
  border-bottom: 1px solid #bbb3ef;
}

#reset-checklist {
  flex: 0 0 auto;
  padding: 7px 9px;
  color: #6c628f;
  background: rgba(255, 255, 255, .75);
  border: 1px solid #d6d0f6;
  border-radius: 6px;
  cursor: pointer;
  font-size: 7px;
  font-weight: 700;
}

.page-navigation {
  width: min(210mm, 100%);
  margin: 20px auto 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.page-navigation button {
  width: fit-content;
  padding: 10px 14px;
  color: #4e5260;
  background: #fff;
  border: 1px solid #d8dbe2;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: transform .15s ease, box-shadow .15s ease;
}

.page-navigation button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(28, 30, 43, .08);
}

.page-navigation button:disabled {
  opacity: .4;
  cursor: not-allowed;
}

#next-page {
  justify-self: end;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.page-dots {
  display: flex;
  gap: 7px;
}

.page-dots i {
  width: 6px;
  height: 6px;
  background: #c9ccd4;
  border-radius: 50%;
  transition: width .2s ease, background .2s ease;
}

.page-dots i.is-active {
  width: 17px;
  background: var(--accent);
  border-radius: 99px;
}

@media (max-width: 760px) {
  .header-inner {
    width: calc(100% - 28px);
    min-height: 65px;
    grid-template-columns: 1fr auto;
  }

  .header-title {
    display: none;
  }

  .tabs-shell {
    top: 65px;
    overflow-x: auto;
  }

  .tabs {
    width: 620px;
    margin: 0;
  }

  .tab {
    min-height: 52px;
  }

  .workspace {
    padding: 18px 12px 40px;
  }

  .keyboard-hint {
    display: none;
  }

  .a4-page {
    min-height: 0;
    padding: 26px 20px 72px;
  }

  .page-footer {
    right: 20px;
    bottom: 25px;
    left: 20px;
  }

  .principles-grid,
  .rhythm-grid,
  .traps-grid,
  .checklist,
  .traffic-content ul {
    grid-template-columns: 1fr;
  }

  .principle-card {
    min-height: 190px;
  }

  .decision-rule {
    grid-template-columns: 1fr;
  }

  .decision-rule i {
    transform: rotate(90deg);
  }

  .routine-strip div {
    grid-template-columns: 18px 1fr;
  }

  .routine-strip i {
    display: none;
  }

  .checklist-heading {
    align-items: start;
  }

  .page-navigation {
    margin-top: 14px;
  }
}

@media (max-width: 430px) {
  .review-badge {
    padding: 7px 9px;
    font-size: 9px;
  }

  .workspace-meta small {
    display: none;
  }

  h1 {
    font-size: 27px;
  }

  .lead {
    font-size: 10px;
  }

  .checklist-heading {
    grid-template-columns: 1fr;
  }

  .progress-ring {
    width: 58px;
    height: 58px;
  }

  .progress-ring::before {
    width: 45px;
    height: 45px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    background: #fff;
  }

  .app-header,
  .tabs-shell,
  .workspace-meta,
  .page-navigation {
    display: none !important;
  }

  .workspace {
    width: auto;
    margin: 0;
    padding: 0;
  }

  .a4-page {
    display: block !important;
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    box-shadow: none;
    break-after: page;
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
