/* ==========================================================================
   EVO — Emota Virtual Operations
   Shared stylesheet for the five prototype screens.
   Colour, type, shape and motion follow design.md.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts — self hosted, three weights only
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Montserrat';
  src: url('fonts/montserrat-300.woff2') format('woff2');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('fonts/montserrat-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('fonts/montserrat-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

/* --------------------------------------------------------------------------
   2. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand — confirmed */
  --purple:        #2B024C;
  --green:         #2BD3AF;
  --white:         #FEFFFE;
  --lilac:         #E3E2F3;
  --graphite:      #414156;

  /* Light shell — screens 3, 4, 5 */
  --bg:            #E3E2F3;
  --surface:       #FEFFFE;
  --surface-sunk:  #F1F0F9;
  --border:        #D3D1EA;
  --border-strong: #B9B6D8;

  /* Dark shell — screens 1 and 2 only */
  --dark-bg:       #1E0135;
  --dark-surface:  #2B024C;
  --dark-raised:   #3A0F63;
  --dark-border:   #4A2470;
  --on-dark:       #FEFFFE;
  --on-dark-muted: #B9A9CC;

  /* Text */
  --text:          #2B024C;
  --text-body:     #414156;
  --text-muted:    #6E6C82;
  --text-faint:    #9B99AE;

  /* Status */
  --success:       #2BD3AF;
  --success-text:  #0E7A61;
  --info:          #3B72C9;
  --info-text:     #2A57A0;
  --warning:       #E8A33D;
  --warning-text:  #A96410;
  --neutral:       #9B99AE;

  /* Orb gradient */
  --orb: linear-gradient(135deg,
           #2B024C 0%,
           #4A34A0 38%,
           #3B72C9 68%,
           #2BD3AF 100%);

  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --card-shadow: 0 2px 12px rgba(43, 2, 76, 0.06);
}

/* --------------------------------------------------------------------------
   3. Base
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.dark  { background: var(--dark-bg); color: var(--on-dark-muted); }
body.light { background: var(--bg); }

h1, h2, h3, p, ul, ol { margin: 0; }
ul { list-style: none; padding: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* --------------------------------------------------------------------------
   4. Typography
   -------------------------------------------------------------------------- */
.title {
  font-size: 34px;
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--text);
}
.title::after { content: "."; color: var(--green); }
.title--q::after { content: none; }          /* the home headline keeps its question mark */
body.dark .title { color: var(--on-dark); }

.section-heading {
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text);
}
body.dark .section-heading { color: var(--on-dark); font-weight: 300; }

.card-heading {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.subline {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}
body.dark .subline { color: var(--on-dark-muted); }

.label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.figure {
  font-size: 52px;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}

/* --------------------------------------------------------------------------
   5. Wordmark
   -------------------------------------------------------------------------- */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--graphite);
  line-height: 1.15;
}
body.dark .wordmark { color: var(--white); }

.wordmark::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orb);
  flex: none;
}

.wordmark-sub {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--on-dark-muted);
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  cursor: pointer;
  transition: background 240ms var(--ease), border-color 240ms var(--ease),
              color 240ms var(--ease);
}
.btn svg { flex: none; }

.btn--primary {
  background: var(--purple);
  color: var(--white);
}
.btn--primary:hover { background: var(--dark-bg); }

.btn--positive {
  background: var(--green);
  color: var(--purple);
}
.btn--positive:hover { background: var(--success-text); color: var(--white); }

.btn--secondary {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn--secondary:hover { background: var(--surface); }

.btn:focus-visible {
  outline: 2px solid var(--border-strong);
  outline-offset: 2px;
}

.text-link {
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid transparent;
  transition: color 240ms var(--ease), border-color 240ms var(--ease);
}
.text-link:hover { color: var(--text); border-bottom-color: var(--border-strong); }
body.dark .text-link { color: var(--on-dark-muted); }
body.dark .text-link:hover { color: var(--white); border-bottom-color: var(--green); }

/* --------------------------------------------------------------------------
   7. Left rail — screens 3, 4, 5
   -------------------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }

.rail {
  width: 220px;
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  /* stays in view on the long screens */
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}
.rail .wordmark { padding-left: 8px; }

.rail-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.rail-toggle { display: none; }          /* menu button is mobile only */

.rail-nav { display: flex; flex-direction: column; gap: 4px; }

/* Sits below the nav items, separated by a rule */
.rail-cta {
  margin-top: 24px;
  padding: 12px 16px;
  width: 100%;
  justify-content: center;
  font-size: 13px;
}

.rail-group {
  display: block;
  margin: 16px 0 4px;
  padding-left: 14px;
}

.rail-item {
  position: relative;
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-muted);
  transition: background 240ms var(--ease), color 240ms var(--ease);
}
.rail-item:hover { background: var(--surface-sunk); color: var(--text); }

.rail-item.is-active {
  background: var(--lilac);
  color: var(--purple);
}
.rail-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: var(--green);
}

.main {
  flex: 1;
  padding: 48px;
  min-width: 0;
}
.content { max-width: 1120px; }

/* --------------------------------------------------------------------------
   8. Cards and panels
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--card-shadow);
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px;
}
.panel--sunk { background: var(--surface-sunk); }

/* --------------------------------------------------------------------------
   9. Status pills and dots
   -------------------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
  white-space: nowrap;
}
.pill--complete { background: rgba(43,211,175,.14);  border: 1px solid rgba(43,211,175,.35);  color: var(--success-text); }
.pill--progress { background: rgba(59,114,201,.12);  border: 1px solid rgba(59,114,201,.32);  color: var(--info-text); }
.pill--risk     { background: rgba(232,163,61,.16);  border: 1px solid rgba(232,163,61,.40);  color: var(--warning-text); }
.pill--upcoming { background: rgba(155,153,174,.12); border: 1px solid rgba(155,153,174,.32); color: var(--text-muted); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  display: inline-block;
}
.dot--complete { background: var(--success); }
.dot--progress { background: var(--info); animation: dot-pulse 1.5s var(--ease) infinite; }
.dot--risk     { background: var(--warning); }
.dot--upcoming { background: var(--neutral); }

@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* --------------------------------------------------------------------------
   10. Home screen (dark)
   -------------------------------------------------------------------------- */
.home {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.home-brand {
  position: relative;
  z-index: 1;
  padding: 48px;
}
.home-brand .wordmark-sub { display: block; margin-top: 8px; padding-left: 18px; }

.home-centre {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 48px 64px;
  margin-top: -48px;
}

.home-wash {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 700px;
  height: 700px;
  margin: -350px 0 0 -350px;
  border-radius: 50%;
  background: var(--orb);
  opacity: 0.45;
  filter: blur(150px);
  pointer-events: none;
  z-index: 0;
}

.home-headline { text-align: center; margin-bottom: 48px; }

/* Two-step flow: pick the project, then describe the request */
.step {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.step.is-current { display: flex; }

body.dark .label { color: var(--on-dark-muted); }
.step-label { display: block; margin-bottom: 16px; }
.step-hint { margin-top: 24px; text-align: center; }

.select-wrap { position: relative; flex: 1; min-width: 0; }

.home-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--dark-raised);
  border: 1px solid var(--dark-border);
  border-radius: 999px;
  padding: 18px 56px 18px 28px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  color: var(--on-dark);
  cursor: pointer;
  transition: border-color 240ms var(--ease), box-shadow 240ms var(--ease);
}
.home-select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(43, 211, 175, 0.2);
}
.home-select option { color: var(--text); background: var(--white); }

.select-chevron {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--on-dark-muted);
}

.btn[disabled] { opacity: 0.4; cursor: default; }
.btn[disabled]:hover { background: var(--purple); }

/* The chosen project, carried into step 2 */
.project-tag {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding: 10px 10px 10px 20px;
  border: 1px solid var(--dark-border);
  border-radius: 999px;
  background: var(--dark-raised);
  font-size: 14px;
  color: var(--on-dark);
}
.project-tag .label { margin: 0; }
.project-tag-change {
  background: none;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--on-dark-muted);
  cursor: pointer;
  transition: color 240ms var(--ease), background 240ms var(--ease);
}
.project-tag-change:hover { color: var(--white); background: var(--dark-border); }

.home-form {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 880px;          /* leaves the input itself at roughly 720px */
}

.home-input {
  flex: 1;
  min-width: 0;
  background: var(--dark-raised);
  border: 1px solid var(--dark-border);
  border-radius: 999px;
  padding: 18px 28px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  color: var(--on-dark);
  transition: border-color 240ms var(--ease), box-shadow 240ms var(--ease);
}
.home-input::placeholder { color: var(--on-dark-muted); }
.home-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(43, 211, 175, 0.2);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  width: 1040px;         /* wide enough to hold all four chips on one line */
}

.chip {
  background: transparent;
  border: 1px solid var(--dark-border);
  border-radius: 999px;
  padding: 10px 18px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  color: var(--on-dark-muted);
  cursor: pointer;
  transition: border-color 240ms var(--ease), color 240ms var(--ease);
}
.chip:hover { border-color: var(--green); color: var(--white); }
.chip:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.chip[disabled] {
  opacity: 0.35;
  cursor: default;
  border-color: var(--dark-border);
  color: var(--on-dark-muted);
}
.chip[disabled]:hover { border-color: var(--dark-border); color: var(--on-dark-muted); }

.home-foot {
  position: relative;
  z-index: 1;
  padding: 0 48px 48px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   11. Processing screen (dark)
   -------------------------------------------------------------------------- */
.proc {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.proc-wash {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 760px;
  height: 760px;
  margin: -380px 0 0 -380px;
  border-radius: 50%;
  background: var(--orb);
  opacity: 0.45;
  filter: blur(150px);
  pointer-events: none;
}

.proc-stage {
  position: relative;
  width: 560px;
  min-height: 320px;
  display: none;
}
.proc-stage.is-current { display: block; }
.proc-stage .section-heading { margin-bottom: 32px; }

.proc-lines { display: flex; flex-direction: column; gap: 16px; }

.proc-line {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 15px;
  color: var(--on-dark);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 300ms var(--ease), transform 300ms var(--ease);
}
.proc-line.is-in { opacity: 1; transform: none; }
.proc-line svg { flex: none; color: var(--green); }

.proc-nodes {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 24px 0 32px;
}

.node {
  background: var(--dark-raised);
  border: 1px solid var(--dark-border);
  border-radius: 999px;
  padding: 16px 32px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--on-dark);
  flex: none;
}
.node.is-pulsing { animation: node-pulse 1.5s var(--ease) infinite; }

@keyframes node-pulse {
  0%, 100% { border-color: var(--dark-border); box-shadow: 0 0 0 0 rgba(43, 211, 175, 0); }
  50%      { border-color: var(--green);       box-shadow: 0 0 0 6px rgba(43, 211, 175, 0.12); }
}

.wire {
  flex: 1;
  height: 2px;
  background: var(--dark-border);
  position: relative;
  overflow: hidden;
}
.wire-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  /* the orb, windowed onto its lighter half so the whole line reads on the dark ground */
  background-image: var(--orb);
  background-size: 170% 100%;
  background-position: 100% 0;
  transition: width 1200ms var(--ease);
}
.wire-fill.is-drawn { width: 100%; }

.proc-caption { text-align: center; }

.proc-skip {
  position: fixed;
  right: 48px;
  bottom: 48px;
  background: none;
  border: 0;
  padding: 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--on-dark-muted);
  cursor: pointer;
  transition: color 240ms var(--ease);
  z-index: 2;
}
.proc-skip:hover { color: var(--white); }

.proc-fade {
  position: fixed;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms var(--ease);
  z-index: 3;
}
.proc-fade.is-lit { opacity: 1; }

/* --------------------------------------------------------------------------
   12. Page header (light screens)
   -------------------------------------------------------------------------- */
.page-head { margin-bottom: 32px; }
.page-head .subline { margin-top: 8px; }

/* The job number every generated document is assigned to */
.project-ref {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}
.project-ref .label { margin: 0; }

.crumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.crumb a { border-bottom: 1px solid transparent; transition: border-color 240ms var(--ease); }
.crumb a:hover { color: var(--text); border-bottom-color: var(--border-strong); }

/* --------------------------------------------------------------------------
   13. Summary dashboard
   -------------------------------------------------------------------------- */
.dash { margin-bottom: 24px; }

.dash-top {
  display: flex;
  align-items: center;
  gap: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.ring { position: relative; flex: none; text-align: center; }
.ring svg { display: block; }
.ring-value {
  position: absolute;
  top: 75px;
  left: 0;
  right: 0;
  transform: translateY(-50%);
}
.ring-label { margin-top: 8px; }

.tiles {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.tile {
  background: var(--surface-sunk);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}
.tile-value {
  font-size: 34px;
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 4px;
}
.tile-label { display: flex; align-items: center; gap: 8px; }
.tile--complete .tile-value { color: var(--success-text); }
.tile--progress .tile-value { color: var(--info-text); }
.tile--upcoming .tile-value { color: var(--text-muted); }
.tile--risk     .tile-value { color: var(--warning-text); }

/* Timeline ---------------------------------------------------------------- */
.timeline { padding: 32px 0 0; }

.timeline-track {
  position: relative;
  height: 40px;
  margin: 24px 0 8px;
}
.timeline-rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 17px;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
}

.tl-event {
  position: absolute;
  top: 4px;
  bottom: 4px;
  background: rgba(43, 2, 76, 0.12);
  border-top: 2px solid var(--green);
  border-radius: 2px;
}

.tl-marker {
  position: absolute;
  top: 20px;
  width: 9px;
  height: 9px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-sizing: content-box;
}
.tl-marker--complete { background: var(--success); }
.tl-marker--progress { background: var(--info); }
.tl-marker--risk     { background: var(--warning); }
.tl-marker--upcoming { background: var(--neutral); }

.tl-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--purple);
}
.tl-today-label {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--purple);
}

.timeline-ends {
  display: flex;
  justify-content: space-between;
}

.countdown {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.countdown .figure { line-height: 1; }

/* --------------------------------------------------------------------------
   14. Source panel
   -------------------------------------------------------------------------- */
.source {
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--green);
  border-radius: 16px;
  background: var(--surface-sunk);
  padding: 20px 24px;
  margin-bottom: 24px;
}
.source-lines { margin: 12px 0 12px; }
.source-lines li { font-size: 15px; color: var(--text-body); }
.source-lines li:first-child { font-weight: 600; color: var(--text); }

/* --------------------------------------------------------------------------
   15. Planner table
   -------------------------------------------------------------------------- */
.planner { padding: 8px 24px 8px; }
.planner-head { padding: 16px 0 8px; }

.planner-table {
  width: 100%;
  border-collapse: collapse;
}
.planner-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.planner-table th:last-child,
.planner-table td:last-child { text-align: right; }

.planner-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  height: 60px;
}
.planner-table tr:last-child td { border-bottom: 0; }

.row-name { font-size: 15px; color: var(--text); font-weight: 400; }
.row-reason {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--warning-text);
}
.row-date { white-space: nowrap; color: var(--text-body); }
.row-days {
  white-space: nowrap;
  text-align: right;
  font-size: 14px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.row-status { width: 150px; }
.row-go-cell { width: 32px; }

.planner-table tbody tr { cursor: default; }
.planner-table tbody tr.row--link {
  cursor: pointer;
  transition: background 240ms var(--ease);
}
.planner-table tbody tr.row--link:hover { background: var(--lilac); }
.planner-table tbody tr.row--link:focus-visible {
  outline: 2px solid var(--border-strong);
  outline-offset: -2px;
}
.row-go { color: var(--text-faint); }
.row--link:hover .row-go { color: var(--purple); }

/* --------------------------------------------------------------------------
   16. Action bar
   -------------------------------------------------------------------------- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

/* --------------------------------------------------------------------------
   17. Ask EVO panel
   -------------------------------------------------------------------------- */
.ask {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  padding: 32px;
  display: none;
  flex-direction: column;
  gap: 24px;
  z-index: 10;
}
.ask.is-open { display: flex; }

.ask-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.ask-close {
  background: none;
  border: 0;
  padding: 4px;
  line-height: 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 240ms var(--ease);
}
.ask-close:hover { color: var(--text); }

.ask-q {
  background: var(--lilac);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 15px;
  color: var(--text);
  align-self: flex-end;
  max-width: 300px;
}
.ask-a {
  background: var(--surface-sunk);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 15px;
  color: var(--text-body);
}
.ask-a .label { display: block; margin-bottom: 8px; }

/* --------------------------------------------------------------------------
   18. Milestone detail
   -------------------------------------------------------------------------- */
.ms-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.ms-head .title { margin-right: 8px; }
.ms-meta { display: flex; align-items: center; gap: 16px; }

.cols {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
  align-items: start;
}
.col { display: flex; flex-direction: column; gap: 24px; }

.risk-panel {
  /* amber tint laid over white, not over the lilac page */
  background: linear-gradient(rgba(232,163,61,.12), rgba(232,163,61,.12)), var(--surface);
  border: 1px solid rgba(232,163,61,.40);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--card-shadow);
}
.risk-panel .card-heading { color: var(--warning-text); margin-bottom: 8px; }

.dep-group + .dep-group { margin-top: 24px; }
.dep-group .label { display: block; margin-bottom: 12px; }
.dep-list { display: flex; flex-direction: column; gap: 12px; }
.dep-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: var(--text-body);
}

.owner-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
}
.owner-row .card-heading { font-size: 15px; font-weight: 400; color: var(--text-body); }

.doc-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.doc {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-sunk);
  border: 1px solid var(--border);
}
.doc svg { flex: none; color: var(--text-muted); }
.doc-name { flex: 1; font-size: 14px; color: var(--text-body); }
.doc-link {
  background: none;
  border: 0;
  padding: 4px 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--info-text);
  cursor: pointer;
  white-space: nowrap;
  transition: color 240ms var(--ease);
}
.doc-link:hover { color: var(--purple); }

.rec-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--card-shadow);
}
.rec-panel p { margin: 8px 0 24px; color: var(--text-body); }

.ms-foot { margin-top: 32px; }

/* --------------------------------------------------------------------------
   19. Library
   -------------------------------------------------------------------------- */
.statement {
  background: var(--purple);
  border-radius: 24px;
  padding: 32px;
  margin-bottom: 32px;
  font-size: 20px;
  font-weight: 300;
  line-height: 1.55;
  color: var(--white);
  max-width: 860px;
}

.tpl-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.tpl {
  display: block;
  position: relative;
  transition: border-color 240ms var(--ease), box-shadow 240ms var(--ease);
}
a.tpl:hover { border-color: var(--border-strong); }

.tpl-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.tpl-note { font-size: 13px; color: var(--text-muted); }
.tpl--active .tpl-note { color: var(--success-text); }

.tpl.is-disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

.activity-list { margin-top: 16px; }
.activity-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  color: var(--text-body);
}
.activity-list li:last-child { border-bottom: 0; }
.activity-list li:first-child { padding-top: 0; }
.activity-time { flex: none; }

/* --------------------------------------------------------------------------
   20. Project Checklist
   -------------------------------------------------------------------------- */
.check-summary { margin-bottom: 24px; }
.check-summary .subline { margin-top: 16px; }

.check-section + .check-section { margin-top: 32px; }

.check-list { margin-top: 8px; }

.check-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.check-item:last-child { border-bottom: 0; }

.check-box {
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.check-box--complete { background: var(--success); border-color: var(--success); color: var(--white); }
.check-box--progress { border-color: var(--info); }
.check-box--risk     { border-color: var(--warning); }

.check-name { flex: 1; font-size: 15px; color: var(--text); }
.check-item--done .check-name { color: var(--text-body); }

.check-date {
  flex: none;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text-muted);
}
.check-sub {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Rows whose name carries a second line: align the marker to the first line. */
.check-item--top { align-items: flex-start; }
.check-item--top > .dot { margin-top: 8px; }
.check-status {
  flex: none;
  width: 150px;
  display: flex;
  justify-content: flex-end;
}
.check-go { flex: none; width: 16px; height: 16px; color: var(--text-faint); }

.check-item--link {
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 240ms var(--ease);
}
.check-item--link:hover { background: var(--lilac); }
.check-item--link:hover .check-go { color: var(--purple); }
.check-item--link:focus-visible {
  outline: 2px solid var(--border-strong);
  outline-offset: -2px;
}

/* --------------------------------------------------------------------------
   21. Event Timeline
   -------------------------------------------------------------------------- */
.tiles--three { grid-template-columns: repeat(3, 1fr); }
.tiles--three .tile-value { color: var(--text); }

.pill--phase { background: rgba(43,2,76,.08); border: 1px solid rgba(43,2,76,.18); color: var(--purple); }

.et-day + .et-day { margin-top: 32px; }

.et-day-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.et-entries {
  position: relative;
  margin-top: 8px;
}
.et-entries::before {
  content: "";
  position: absolute;
  left: 74px;
  top: 20px;
  bottom: 20px;
  width: 1px;
  background: var(--border);
}

.et-entry {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
}

.et-time {
  width: 52px;
  flex: none;
  font-size: 14px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.et-dot {
  width: 9px;
  height: 9px;
  margin-top: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--neutral);
  border: 2px solid var(--surface);
  box-sizing: content-box;
  position: relative;
}
.et-dot--risk { background: var(--warning); }

.et-body {
  flex: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}
.et-title { font-size: 15px; color: var(--text); }
.et-owner { flex: none; font-size: 13px; color: var(--text-muted); }

.et-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--warning-text);
}

.et-entry--link {
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 240ms var(--ease);
}
.et-entry--link:hover { background: var(--lilac); }
.et-entry--link:focus-visible {
  outline: 2px solid var(--border-strong);
  outline-offset: -2px;
}
.et-entry--link .et-dot { border-color: var(--surface); }
.et-entry--link:hover .et-dot { border-color: var(--lilac); }

/* --------------------------------------------------------------------------
   22. Toasts
   -------------------------------------------------------------------------- */
.toast-stack {
  position: fixed;
  right: 48px;
  bottom: 48px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 20;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--purple);
  color: var(--white);
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 14px;
  line-height: 1.15;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
}
.toast.is-in { opacity: 1; transform: none; }
.toast svg { flex: none; color: var(--green); }

/* ==========================================================================
   23. Tablet and mobile

   Everything below this line lives inside a media query. Nothing above it
   is modified, so the 1440px desktop rendering is unchanged.
   ========================================================================== */

/* --- Tablet and narrow laptop: collapse the two-column grids ------------- */
@media (max-width: 1024px) {
  .main { padding: 32px; }
  .cols { grid-template-columns: 1fr; }
  .tpl-grid { grid-template-columns: 1fr; }
  .statement { max-width: none; }
}

/* --- Phone and small tablet ---------------------------------------------- */
@media (max-width: 768px) {

  /* Shell: the rail becomes a sticky top bar */
  .shell { flex-direction: column; }

  /* The rail becomes a sticky bar with a collapsible menu */
  .rail {
    width: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
    height: auto;              /* undo the desktop full-height rail */
    align-self: auto;
    overflow-y: visible;
  }
  .rail .wordmark { padding-left: 0; font-size: 16px; letter-spacing: 0.12em; }

  .rail-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-right: -10px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
  }
  .rail-toggle .icon-close { display: none; }
  .rail-toggle[aria-expanded="true"] .icon-open { display: none; }
  .rail-toggle[aria-expanded="true"] .icon-close { display: inline; }

  .rail-nav { display: none; }
  .rail-nav.is-open {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 0 4px;
  }
  .rail-group { margin: 12px 0 4px; padding-left: 12px; }
  .rail-cta { margin-top: 12px; }

  .main { padding: 24px 16px 48px; }
  .content { max-width: none; }

  /* Type */
  .title { font-size: 26px; }
  .section-heading { font-size: 18px; }
  .figure { font-size: 40px; }
  .tile-value { font-size: 28px; }
  .statement { font-size: 17px; padding: 24px; border-radius: 16px; }

  .card { padding: 16px; }
  .panel, .source { padding: 16px; }
  .page-head { margin-bottom: 24px; }

  /* Home */
  .home-brand { padding: 24px 16px; }
  .home-centre { padding: 0 16px 48px; margin-top: 0; }
  .home-headline { margin-bottom: 32px; }

  .home-form { width: 100%; flex-direction: column; gap: 12px; }
  .home-input { width: 100%; padding: 16px 24px; font-size: 15px; }
  .home-form .btn { width: 100%; justify-content: center; }

  .select-wrap { width: 100%; flex: none; }
  .home-select { padding: 16px 52px 16px 24px; font-size: 15px; }
  .select-chevron { right: 22px; }
  .project-tag { margin-bottom: 24px; font-size: 13px; }

  .chips { width: 100%; margin-top: 16px; }

  /* Touch targets: 44px minimum on the things people actually tap */
  .chip { font-size: 13px; padding: 12px 18px; }
  .btn { padding: 14px 24px; }
  .rail-item { padding: 12px; }
  .doc-link { padding: 10px 8px; }
  .ask-close { padding: 10px; }
  .proc-skip { padding: 12px; }

  .home-foot { padding: 0 16px 32px; }
  .home-wash, .proc-wash {
    width: 440px; height: 440px; margin: -220px 0 0 -220px; filter: blur(110px);
  }

  /* Processing */
  .proc-stage { width: 100%; padding: 0 24px; min-height: 260px; }
  .proc-stage .section-heading { margin-bottom: 24px; }
  .proc-line { font-size: 14px; gap: 12px; }
  .node { padding: 12px 18px; font-size: 13px; letter-spacing: 0.02em; }
  .proc-nodes { margin: 16px 0 24px; }
  .proc-skip { right: 16px; bottom: 16px; }

  /* Planner dashboard */
  .dash-top { flex-direction: column; align-items: stretch; gap: 24px; padding-bottom: 24px; }
  .ring { align-self: center; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tile { padding: 16px; }
  .timeline { padding: 24px 0 0; }
  .tl-marker { width: 7px; height: 7px; margin: -3px 0 0 -3px; border-width: 1px; }
  .countdown { margin-top: 16px; padding-top: 16px; }

  /* Planner table reflows to stacked rows */
  .planner { padding: 8px 16px; }
  .planner-table, .planner-table tbody { display: block; }
  .planner-table thead { display: none; }

  .planner-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
  }
  .planner-table tbody tr:last-child { border-bottom: 0; }
  .planner-table td {
    display: block;
    height: auto;
    padding: 0;
    border-bottom: 0;
  }
  .row-name { flex: 1 0 100%; }
  .row-status { width: auto; }
  .row-days { text-align: left; }
  .row-go-cell { width: auto; margin-left: auto; }
  /* No hover on touch, so drop the inset hover padding and keep dividers aligned */
  .planner-table tbody tr.row--link {
    margin: 0;
    padding-left: 0;
    padding-right: 0;
  }

  /* Checklist and briefing rows wrap onto two lines */
  .check-item { flex-wrap: wrap; gap: 8px 12px; }
  .check-name { flex: 1 0 calc(100% - 36px); }
  .check-status { width: auto; justify-content: flex-start; }
  .check-go { margin-left: auto; }
  .check-item--link, .check-item--top.check-item--link {
    margin: 0;
    padding-left: 0;
    padding-right: 0;
  }

  /* Event timeline entries stack their title and owner */
  .et-body { flex-direction: column; align-items: flex-start; gap: 2px; }
  .et-owner { font-size: 12px; }
  .et-day-head { flex-wrap: wrap; gap: 8px; }
  .et-entry--link { margin: 0; padding-left: 0; padding-right: 0; }

  /* Source document rows put their action on a second line */
  .doc { flex-wrap: wrap; }
  .doc-name { flex: 1 0 calc(100% - 30px); }
  .doc-link { margin-left: auto; padding-left: 0; }

  /* Milestone */
  .ms-head { gap: 12px; margin-bottom: 24px; }
  .ms-meta { flex-wrap: wrap; gap: 12px; }
  .rec-panel, .risk-panel { padding: 16px; }

  /* Ask EVO becomes a full-width drawer */
  .ask { width: 100%; padding: 24px; gap: 16px; }
  .ask-q { max-width: 85%; }

  /* Actions and toasts */
  .actions .btn { flex: 1 1 auto; justify-content: center; }
  .toast-stack { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: 100%; }
}

/* --- Small phones --------------------------------------------------------- */
@media (max-width: 420px) {
  .title { font-size: 23px; }
  .figure { font-size: 34px; }
  .tiles--three { grid-template-columns: 1fr; }
  .ring svg { width: 128px; height: 128px; }
  .ring-value { top: 64px; font-size: 34px; }
  .row-name, .check-name, .et-title { font-size: 14px; }
}
