:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --text: #142033;
  --muted: #647287;
  --line: #dbe3ee;
  --blue: #1458d4;
  --blue-dark: #0b347e;
  --green: #17865f;
  --gold: #b56a12;
  --shadow: 0 18px 45px rgba(20, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
}

.edit-toolbar {
  position: fixed;
  z-index: 10;
  top: 0;
  right: 0;
  left: 280px;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  min-height: 58px;
  padding: 10px 24px;
  border-bottom: 1px solid rgba(12, 24, 48, 0.14);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.edit-toolbar span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.edit-toolbar button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

#editToggle:disabled,
.edit-toolbar button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

#cancelEdit {
  background: #eef3f8;
  color: var(--text);
}

.notes-shell {
  max-width: 1120px;
  margin: 0 auto;
}

.notes-header {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 28px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.notes-header h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

.notes-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.notes-actions button,
.block-controls button,
.notes-modal button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.notes-actions button:nth-child(n + 2),
.block-controls button {
  background: #eef3f8;
  color: var(--text);
}

.blocks-list {
  display: grid;
  gap: 16px;
}

.note-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.block-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
}

.block-controls span {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.block-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.block-editable {
  padding: 22px;
  outline: 0;
}

.block-editable[contenteditable="false"] {
  cursor: default;
}

.block-editable:focus {
  box-shadow: inset 0 0 0 2px rgba(20, 88, 212, 0.28);
}

main.editing .block-editable :is(.script-day, .script-item, .message-card, .dispatch-day, .prep-card, .panel, .day-card, blockquote, pre):hover {
  outline: 1px dashed rgba(20, 88, 212, 0.3);
  outline-offset: 3px;
}

.inline-insert {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  margin: 8px 0;
  border: 1px dashed rgba(20, 88, 212, 0.18);
  border-radius: 8px;
  background: rgba(20, 88, 212, 0.025);
  opacity: 0.45;
  transition: opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.inline-insert:hover,
.inline-insert:focus-within {
  border-color: rgba(20, 88, 212, 0.45);
  background: rgba(20, 88, 212, 0.06);
  opacity: 1;
}

.inline-insert button {
  min-height: 24px;
  border: 0;
  border-radius: 6px;
  padding: 0 8px;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.inline-insert button:hover {
  background: #fff;
}

.promote-candidate {
  outline: 2px solid rgba(20, 88, 212, 0.65) !important;
  outline-offset: 4px !important;
  background: rgba(20, 88, 212, 0.04);
}

.block-editable > .section,
.block-editable > .hero {
  margin: 0;
  box-shadow: none;
}

.note-divider {
  border: 0;
  border-top: 1px solid var(--line);
}

.notes-modal {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 24, 48, 0.42);
}

.notes-modal-card {
  width: min(760px, 100%);
  max-height: 82vh;
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(12, 24, 48, 0.28);
}

.notes-modal-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.notes-modal-head h2 {
  margin: 0;
}

.notes-modal-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.trash-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.trash-item button {
  justify-self: start;
}

main.editing {
  outline: 3px solid rgba(20, 88, 212, 0.25);
  outline-offset: -8px;
}

main.editing :is(h1, h2, h3, p, li, blockquote, pre, span, strong, small):hover {
  outline: 2px dashed rgba(20, 88, 212, 0.35);
  outline-offset: 3px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 280px;
  background: #0c1830;
  color: #fff;
  padding: 24px;
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #1c64f2;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #aebbd0;
}

nav {
  display: grid;
  gap: 6px;
  margin-top: 24px;
}

nav a {
  color: #dce6f7;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.1);
}

main {
  margin-left: 280px;
  padding: 82px 36px 36px;
}

.hero,
.section {
  max-width: 1120px;
  margin: 0 auto 28px;
}

.hero {
  min-height: 430px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px;
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(12, 24, 48, 0.9), rgba(20, 88, 212, 0.76)),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.18), transparent 34%),
    #0c1830;
  color: #fff;
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: 48px;
  line-height: 1.08;
}

.hero p {
  max-width: 680px;
  color: #e4ecfa;
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #b9d1ff;
}

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

.metrics div {
  min-height: 96px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.metrics span,
.metrics small {
  display: block;
}

.metrics span {
  font-size: 22px;
  font-weight: 800;
}

.metrics small {
  margin-top: 4px;
  color: #d4e0f3;
}

.section {
  padding: 34px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-head {
  margin-bottom: 22px;
}

h2,
h3 {
  margin: 0 0 12px;
  line-height: 1.2;
}

h2 {
  font-size: 30px;
}

h3 {
  font-size: 20px;
}

.grid {
  display: grid;
  gap: 18px;
}

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

.panel,
.day-card,
.script-box,
.message-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.panel {
  padding: 24px;
}

.panel.accent {
  border-color: rgba(20, 88, 212, 0.28);
  background: #f2f7ff;
}

.note {
  padding: 14px;
  border-left: 4px solid var(--blue);
  background: #fff;
  color: var(--blue-dark);
}

ul,
ol {
  padding-left: 20px;
}

li + li {
  margin-top: 8px;
}

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

.checklist label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

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

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

.prep-card h3 {
  margin-bottom: 4px;
}

.prep-card label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid #d6e0ec;
  border-radius: 8px;
  background: #ffffff;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--green);
}

.day-card {
  padding: 24px;
  margin-bottom: 18px;
}

.day-title {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.day-title span {
  padding: 7px 10px;
  border-radius: 8px;
  background: #e9f0ff;
  color: var(--blue-dark);
  font-weight: 800;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline div {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-2);
}

.timeline p {
  margin: 0;
}

.timeline strong {
  color: var(--blue-dark);
}

blockquote {
  margin: 18px 0 0;
  padding: 16px 18px;
  border-left: 4px solid var(--gold);
  background: #fff7ed;
  color: #5c390a;
}

.script-box {
  margin-top: 18px;
  padding: 24px;
  background: #f8fbff;
}

.accordion {
  display: grid;
  gap: 12px;
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px 18px;
}

summary {
  cursor: pointer;
  font-weight: 800;
}

.message-card {
  padding: 18px;
  background: #fbfcff;
}

.message-card strong {
  display: block;
  margin-bottom: 12px;
  color: var(--blue-dark);
}

.message-card p {
  margin: 0 0 10px;
}

.message-card p:last-child {
  margin-bottom: 0;
}

.dispatch-list {
  display: grid;
  gap: 18px;
}

.dispatch-list + .dispatch-list {
  margin-top: 28px;
}

.dispatch-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.dispatch-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  background: #e9f0ff;
  color: var(--blue-dark);
  font-weight: 800;
  text-decoration: none;
}

.subsection-title {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.subsection-title p {
  margin: 0;
  color: var(--muted);
}

.dispatch-day {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.dispatch-day h3 {
  margin-bottom: 0;
}

.script-day {
  margin-bottom: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.script-day h3 {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.script-item {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.script-item span {
  color: var(--blue-dark);
  font-weight: 800;
}

pre {
  width: 100%;
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid #cdd9e8;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (max-width: 920px) {
  .edit-toolbar {
    left: 0;
    right: 0;
    top: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
    min-height: 92px;
  }

  .sidebar {
    position: static;
    width: auto;
  }

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

  main {
    margin-left: 0;
    padding: 112px 18px 18px;
  }

  .hero {
    min-height: auto;
    padding: 32px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .notes-header {
    flex-direction: column;
  }

  .notes-actions,
  .block-controls {
    justify-content: flex-start;
  }

  .block-controls {
    flex-wrap: wrap;
  }

  .block-controls span {
    width: 100%;
  }

  .metrics,
  .grid.two,
  .checklist,
  .prep-groups {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .section {
    padding: 22px;
  }

  nav {
    grid-template-columns: 1fr;
  }

  .timeline div {
    grid-template-columns: 1fr;
  }
}
