:root {
  --bg: #f5fbff;
  --bg-soft: #e6f4fb;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-soft: rgba(246, 252, 255, 0.92);
  --surface-border: rgba(26, 36, 49, 0.12);
  --panel-glow: 0 26px 80px rgba(16, 30, 44, 0.08);
  --canvas-surface-top: rgba(248, 252, 255, 0.98);
  --canvas-surface-bottom: rgba(232, 245, 250, 0.98);
  --ink: #334b60;
  --ink-strong: #101e2c;
  --muted: #62788d;
  --line: rgba(26, 36, 49, 0.12);
  --brand-navy: #101e2c;
  --brand-slate: #1a2431;
  --brand-blue: #2188ff;
  --brand-cyan: #22c7e8;
  --brand-lime: #b7ec3a;
  --brand-lime-deep: #4fdb72;
  --accent: #2188ff;
  --accent-deep: #1d6eff;
  --accent-soft: rgba(33, 136, 255, 0.12);
  --accent-emerald: #4fdb72;
  --accent-emerald-soft: rgba(183, 236, 58, 0.18);
  --accent-amber: #22c7e8;
  --danger: #fb7185;
  --warning: #f59e0b;
  --success: #4fdb72;
  --shadow: 0 18px 40px rgba(16, 30, 44, 0.1);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(33, 136, 255, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(34, 199, 232, 0.12), transparent 24%),
    radial-gradient(circle at bottom center, rgba(183, 236, 58, 0.1), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, #f6fbff 52%, #edf8fb 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(70px);
  opacity: 0.42;
}

body::before {
  top: 70px;
  left: -60px;
  width: 240px;
  height: 240px;
  background: rgba(33, 136, 255, 0.14);
}

body::after {
  right: 4%;
  bottom: 10%;
  width: 280px;
  height: 280px;
  background: rgba(34, 199, 232, 0.14);
}

code {
  font-family: "SFMono-Regular", "Menlo", monospace;
  background: rgba(228, 243, 255, 0.96);
  color: var(--brand-blue);
  border-radius: 999px;
  padding: 0.14rem 0.48rem;
}

.page-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 44px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(33, 136, 255, 0.14);
  background: rgba(247, 252, 255, 0.88);
  color: var(--ink);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 24px;
  margin-bottom: 24px;
}

.hero-card,
.panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(246, 250, 253, 0.92));
  border: 1px solid var(--surface-border);
  backdrop-filter: blur(22px);
  box-shadow: var(--panel-glow);
}

.hero-card::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(33, 136, 255, 0.06), transparent 34%),
    linear-gradient(315deg, rgba(34, 199, 232, 0.05), transparent 42%);
  pointer-events: none;
}

.hero-copy {
  padding: 6px 0 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.brand-mark {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  filter: drop-shadow(0 14px 24px rgba(16, 30, 44, 0.12));
}

.brand-copy {
  display: grid;
  gap: 6px;
}

.brand-name {
  color: var(--ink-strong);
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow,
.panel-kicker,
.card-eyebrow {
  margin: 0;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
}

.eyebrow,
.card-eyebrow {
  color: var(--accent-deep);
}

.panel-kicker {
  margin-bottom: 6px;
  color: var(--brand-slate);
}

.hero h1,
.panel h2,
.preview-block h3,
.hero-card h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

.hero h1 {
  margin: 10px 0 16px;
  font-size: clamp(2.9rem, 5vw, 5.5rem);
  line-height: 0.94;
  max-width: none;
  color: var(--ink-strong);
}

.hero-text {
  margin: 0;
  max-width: 60ch;
  color: var(--ink);
  font-size: 1.06rem;
  line-height: 1.7;
}

.hero-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.hero-summary-item {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(247, 252, 255, 0.96);
  border: 1px solid rgba(26, 36, 49, 0.1);
}

.hero-summary-item strong {
  display: block;
  margin-top: 6px;
  color: var(--ink-strong);
  font-size: 0.96rem;
}

.hero-summary-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.badge {
  gap: 8px;
  padding: 10px 14px;
  font-size: 0.92rem;
}

.hero-card {
  border-radius: 30px;
  padding: 28px;
}

.hero-card h2 {
  margin: 8px 0 14px;
  font-size: 1.6rem;
  color: var(--ink-strong);
}

.validation-card {
  display: grid;
  align-content: start;
  gap: 18px;
}

.validation-score-card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 20px;
  background: linear-gradient(
    180deg,
    var(--validation-score-bg-top, rgba(226, 232, 240, 0.72)),
    var(--validation-score-bg-bottom, rgba(241, 245, 249, 0.94))
  );
  border: 1px solid var(--validation-score-border, rgba(148, 163, 184, 0.28));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.validation-score-label,
.efficiency-metric span {
  display: block;
  color: var(--validation-score-label, var(--brand-slate));
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.validation-score-value {
  flex: 0 0 auto;
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  line-height: 1;
  color: var(--validation-score-value, #1e293b);
  font-weight: 700;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 24px;
}

.control-panel {
  grid-column: span 3;
}

.preview-panel {
  grid-column: span 7;
}

.diagram-panel {
  grid-column: span 7;
}

.editor-panel {
  grid-column: span 3;
  align-self: start;
  position: sticky;
  top: 94px;
  max-height: calc(100vh - 112px);
  overflow: auto;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-heading > div {
  min-width: 0;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.6rem;
  color: var(--ink-strong);
}

.control-panel .panel-heading {
  display: block;
}

.control-panel .panel-heading > div {
  width: 100%;
}

.status-pill {
  margin-left: auto;
  padding-top: 6px;
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.preview-brief {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

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

.preview-brief-wide {
  grid-column: 1 / -1;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease,
    border-color 180ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.primary-button {
  background: linear-gradient(135deg, #1d6eff 0%, #22c7e8 68%, #b7ec3a 100%);
  color: #101e2c;
  box-shadow: 0 14px 28px rgba(33, 136, 255, 0.2);
}

.secondary-button {
  background: linear-gradient(135deg, #ffffff, #f1f5f9);
  color: var(--ink-strong);
  border: 1px solid rgba(33, 136, 255, 0.18);
  box-shadow: 0 14px 28px rgba(16, 30, 44, 0.08);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  border: 1px solid rgba(26, 36, 49, 0.12);
}

#downloadPdfButton {
  margin-left: auto;
  white-space: nowrap;
}

.hint,
.status-message,
.validation-summary {
  color: var(--muted);
  line-height: 1.55;
}

.hint {
  padding-top: 8px;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.field-compact {
  margin-top: 0;
}

.field span {
  font-weight: 700;
  color: var(--ink-strong);
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  outline: none;
}

textarea::placeholder,
input::placeholder {
  color: #94a3b8;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(33, 136, 255, 0.3);
  box-shadow: 0 0 0 4px rgba(33, 136, 255, 0.12);
}

textarea {
  min-height: 280px;
  resize: vertical;
}

#workflowStartInput,
#workflowFinishInput,
#correctionInput {
  min-height: 120px;
}

#transcriptInput {
  min-height: 190px;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent-deep) 50%),
    linear-gradient(135deg, var(--accent-deep) 50%, transparent 50%);
  background-position:
    calc(100% - 22px) calc(50% - 3px),
    calc(100% - 16px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 18px;
}

.metric-card {
  border-radius: var(--radius-md);
  padding: 16px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid var(--line);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hidden {
  display: none !important;
}

.empty-state {
  border-radius: 22px;
  border: 1px dashed rgba(148, 163, 184, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 249, 0.94)),
    repeating-linear-gradient(
      135deg,
      rgba(148, 163, 184, 0.05),
      rgba(148, 163, 184, 0.05) 12px,
      transparent 12px,
      transparent 24px
    );
  padding: 26px;
  color: var(--muted);
}

.preview-content {
  display: grid;
  gap: 18px;
}

.control-insights {
  margin-top: 18px;
}

.preview-block {
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
}

.preview-block-static .preview-body {
  padding-top: 0;
}

.preview-block h3 {
  margin-top: 0;
  font-size: 1.16rem;
  color: var(--ink-strong);
}

.preview-accordion {
  overflow: hidden;
}

.preview-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

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

.preview-summary h3 {
  margin: 0;
}

.preview-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(33, 136, 255, 0.12);
  color: var(--brand-blue);
  font-size: 0.85rem;
  font-weight: 700;
}

.preview-body {
  padding: 0 18px 18px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  border-radius: 16px;
  padding: 8px 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
}

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

.stack-item {
  border-radius: 16px;
  padding: 14px 15px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.stack-item strong {
  color: var(--ink-strong);
}

.stack-item small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.stack-item-collapsible {
  padding: 0;
  overflow: hidden;
}

.stack-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 15px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  text-align: left;
}

.stack-toggle:hover {
  transform: none;
  background: rgba(33, 136, 255, 0.06);
}

.stack-toggle-title {
  font-weight: 700;
}

.stack-toggle-icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(33, 136, 255, 0.12);
  color: var(--brand-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
}

.stack-item-body {
  padding: 0 15px 14px;
}

.stack-item-body small {
  margin-top: 0;
}

.validation-list {
  display: grid;
  gap: 10px;
}

.validation-card .validation-summary {
  font-size: 1.05rem;
  line-height: 1.5;
}

.validation-item {
  border-radius: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.validation-card .validation-item {
  border-radius: 24px;
  padding: 18px 18px 18px 20px;
  background: rgba(255, 255, 255, 0.96);
}

.validation-card .validation-item strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.02rem;
  letter-spacing: 0.08em;
}

.validation-card .validation-item div {
  font-size: 1.02rem;
  line-height: 1.5;
}

.validation-item.error {
  border-color: rgba(244, 63, 94, 0.2);
  background: linear-gradient(180deg, rgba(255, 241, 242, 0.96), rgba(255, 228, 230, 0.86));
}

.validation-item.warning {
  border-color: rgba(245, 158, 11, 0.22);
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.96), rgba(254, 243, 199, 0.88));
}

.validation-item.success {
  border-color: rgba(79, 219, 114, 0.24);
  background: linear-gradient(180deg, rgba(231, 255, 238, 0.96), rgba(216, 252, 225, 0.9));
}

.validation-item.info {
  border-color: rgba(96, 165, 250, 0.22);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(219, 234, 254, 0.9));
}

.diagram-viewport {
  overflow: auto;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--canvas-surface-top), var(--canvas-surface-bottom));
  border: 1px solid rgba(203, 213, 225, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

#workflowSvg {
  display: block;
  width: 100%;
  min-height: 520px;
}

.framework-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.legend-chip,
.phase-chip,
.node-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 700;
}

.legend-chip,
.phase-chip {
  padding: 7px 12px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.node-pill {
  padding: 6px 10px;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--ink);
}

.legend-chip.planning,
.phase-chip.planning {
  background: rgba(33, 136, 255, 0.12);
  color: var(--brand-blue);
}

.legend-chip.execution,
.phase-chip.execution {
  background: rgba(34, 199, 232, 0.14);
  color: #159fbd;
}

.legend-chip.review,
.phase-chip.review {
  background: rgba(183, 236, 58, 0.18);
  color: #4f9d37;
}

.framework-step-item {
  display: grid;
  gap: 12px;
}

.framework-step-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.step-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.step-role-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.framework-role-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.framework-role-chip.palette-0 {
  background: rgba(33, 136, 255, 0.12);
  border-color: rgba(33, 136, 255, 0.18);
  color: var(--brand-blue);
}

.framework-role-chip.palette-1 {
  background: rgba(34, 199, 232, 0.14);
  border-color: rgba(34, 199, 232, 0.2);
  color: #159fbd;
}

.framework-role-chip.palette-2 {
  background: rgba(183, 236, 58, 0.18);
  border-color: rgba(183, 236, 58, 0.24);
  color: #4f9d37;
}

.framework-role-chip.palette-3 {
  background: rgba(12, 27, 42, 0.08);
  border-color: rgba(12, 27, 42, 0.14);
  color: #17354c;
}

.framework-role-chip.palette-4 {
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.22);
  color: #475569;
}

.framework-role-chip.palette-5 {
  background: rgba(225, 241, 255, 0.92);
  border-color: rgba(33, 136, 255, 0.16);
  color: #156bc9;
}

.node-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-form {
  display: grid;
  gap: 18px;
}

.efficiency-panel {
  grid-column: 1 / -1;
}

.efficiency-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.efficiency-heading h2 {
  margin: 0;
  font-size: 1.8rem;
  color: var(--ink-strong);
}

.efficiency-score {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: var(--ink-strong);
  white-space: nowrap;
}

.efficiency-score span {
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 0.95;
  font-weight: 700;
}

.efficiency-score small {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 700;
}

.efficiency-content {
  display: grid;
  gap: 22px;
}

.efficiency-copy {
  display: grid;
  gap: 10px;
}

.efficiency-copy h3 {
  margin: 0;
  font-size: 1.8rem;
  color: var(--ink-strong);
}

.efficiency-copy p {
  margin: 0;
  line-height: 1.6;
}

#efficiencySummary,
.efficiency-method {
  color: #475569;
}

.efficiency-method {
  font-size: 0.98rem;
}

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

.efficiency-metric {
  border-radius: 20px;
  padding: 16px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.efficiency-metric strong {
  display: block;
  margin-top: 10px;
  color: var(--ink-strong);
  font-size: 1.6rem;
  line-height: 1.1;
}

.branch-editor-list {
  display: grid;
  gap: 10px;
}

.branch-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.branch-row label {
  color: var(--muted);
  font-size: 0.88rem;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.18);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(34, 211, 238, 0);
  }
}

.is-recording {
  animation: pulse 1.7s ease-in-out infinite;
}

@media (max-width: 1180px) {
  .hero,
  .app-grid {
    grid-template-columns: 1fr;
  }

  .control-panel,
  .preview-panel,
  .diagram-panel,
  .editor-panel {
    grid-column: auto;
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 860px) {
  .hero-summary {
    grid-template-columns: 1fr;
  }

  .preview-brief-grid {
    grid-template-columns: 1fr;
  }

  .framework-step-header {
    flex-direction: column;
  }

  .step-role-list {
    margin-left: 0;
    justify-content: flex-start;
  }

  .efficiency-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    padding-top: 16px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 18px;
  }

  .hero h1 {
    font-size: 2.6rem;
  }

  .brand-lockup {
    gap: 12px;
  }

  .brand-mark {
    width: 68px;
    height: 68px;
  }

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

  .panel-heading {
    flex-wrap: wrap;
  }

  .status-pill,
  #downloadPdfButton {
    margin-left: 0;
  }

  .efficiency-heading {
    flex-direction: column;
  }
}
