:root {
  color-scheme: dark;
  --ink: #eef5f8;
  --muted: #9aaab2;
  --line: rgba(156, 190, 208, 0.18);
  --paper: #070b0f;
  --surface: #0d151b;
  --surface-2: #101d25;
  --accent: #1e80ff;
  --accent-strong: #58a6ff;
  --success: #35c46d;
  --warning: #e6ae3a;
  --danger: #f15d5d;
  --violet: #8a6cff;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(30, 128, 255, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    var(--paper);
  background-size: 52px 52px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: rgba(5, 9, 13, 0.96);
  color: var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.brand strong {
  font-size: 1.25rem;
  letter-spacing: 0;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
}

.nav-tabs {
  display: grid;
  gap: 7px;
}

.nav-tabs button,
.primary-action,
.ghost-button,
.danger-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 13px;
  font-weight: 750;
}

.nav-tabs button {
  color: #dce8ee;
  background: transparent;
  text-align: left;
}

.nav-tabs button.active,
.nav-tabs button:hover {
  border-color: rgba(30, 128, 255, 0.45);
  background: rgba(30, 128, 255, 0.16);
  color: #ffffff;
}

.primary-action {
  background: var(--accent);
  color: #ffffff;
}

.sidebar .primary-action {
  margin-top: auto;
  box-shadow: 0 12px 28px rgba(30, 128, 255, 0.26);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
  color: var(--ink);
}

.danger-button {
  background: rgba(241, 93, 93, 0.12);
  border-color: rgba(241, 93, 93, 0.3);
  color: #ff9b9b;
}

main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 8px;
  font-size: 2.35rem;
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.22rem;
}

h3 {
  margin-bottom: 0;
  font-size: 0.98rem;
}

.lead {
  max-width: 820px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.48;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 440px;
}

.top-actions span,
.tag-row span,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #c9d7dd;
  font-size: 0.75rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #081117;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
}

.stage {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #d8e4ea;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.stage span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.stage small {
  color: var(--muted);
}

.stage.done span {
  background: rgba(53, 196, 109, 0.2);
  color: var(--success);
}

.stage.active {
  border-color: rgba(30, 128, 255, 0.5);
  background: rgba(30, 128, 255, 0.14);
}

.opportunity-hero,
.metric,
.project-item,
.editor-panel,
.budget-row,
.room-row,
.task-row,
.viability-card,
.assistant-panel,
.assistant-panel article,
.option-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 21, 27, 0.86);
  box-shadow: var(--shadow);
}

.opportunity-hero {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 310px;
  gap: 16px;
  align-items: stretch;
  padding: 12px;
  margin-bottom: 14px;
}

.media-tile {
  min-height: 166px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.58)),
    url("/assets/ioarc-logo-glow.jpeg") center / cover no-repeat;
  overflow: hidden;
}

.media-tile span {
  display: inline-flex;
  margin: 10px;
  border-radius: 6px;
  padding: 6px 10px;
  background: rgba(30, 128, 255, 0.34);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.opportunity-copy {
  display: grid;
  align-content: center;
  gap: 12px;
  min-width: 0;
}

.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.pill.alert {
  border-color: rgba(241, 93, 93, 0.35);
  color: #ff9b9b;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.opportunity-copy p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.48;
}

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

.summary-grid article,
.estimate-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.035);
}

.summary-grid small,
.estimate-panel small {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.summary-grid strong,
.estimate-panel strong {
  display: block;
  margin-top: 5px;
}

.estimate-panel {
  display: grid;
  align-content: center;
  gap: 11px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.65rem;
}

.workband {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head.compact {
  margin: 20px 0 10px;
}

.project-list,
.budget-table,
.insight-stack {
  display: grid;
  gap: 10px;
}

.project-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 14px;
}

.project-item button {
  align-self: center;
}

.project-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.project-title strong {
  font-size: 1.02rem;
}

.project-meta,
.budget-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.progress-track {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

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

.decision-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  gap: 16px;
}

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

.viability-card {
  min-height: 230px;
  padding: 15px;
  box-shadow: none;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-head span {
  align-self: start;
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.viability-card ul,
.option-card ul {
  margin: 0;
  padding-left: 18px;
  color: #c5d2d9;
  line-height: 1.48;
}

.viability-card li,
.option-card li {
  margin: 8px 0;
}

.viability-card.success {
  border-color: rgba(53, 196, 109, 0.32);
}

.viability-card.warning {
  border-color: rgba(230, 174, 58, 0.35);
}

.viability-card.info {
  border-color: rgba(30, 128, 255, 0.32);
}

.assistant-panel {
  position: sticky;
  top: 18px;
  padding: 16px;
}

.assistant-panel h3 {
  margin-bottom: 14px;
}

.assistant-panel article {
  padding: 13px;
  box-shadow: none;
}

.assistant-panel strong {
  display: block;
  margin-bottom: 7px;
}

.assistant-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.option-card {
  display: grid;
  gap: 14px;
  min-height: 350px;
  padding: 16px;
}

.option-meta {
  display: grid;
  gap: 8px;
}

.option-meta span {
  display: block;
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-weight: 850;
}

.option-card button {
  align-self: end;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.92fr) minmax(420px, 1.08fr);
  align-items: start;
  gap: 16px;
}

.editor-panel {
  padding: 18px;
}

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

.editor-panel > label {
  margin-top: 14px;
}

.inline-builder {
  margin-top: 2px;
}

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

.room-row,
.task-row {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 1.1fr 0.7fr 42px;
  gap: 8px;
  align-items: end;
  padding: 12px;
  box-shadow: none;
}

.task-row {
  grid-template-columns: 1.4fr 1fr 0.8fr 72px 42px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #ff9b9b;
  font-weight: 900;
}

.check-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
}

.check-wrap input {
  width: 20px;
  height: 20px;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.budget-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, minmax(120px, 0.32fr));
  gap: 16px;
  align-items: center;
  padding: 16px;
}

.money {
  font-weight: 850;
  text-align: right;
}

.budget-health {
  min-width: 86px;
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(30, 128, 255, 0.16);
  color: #b8d7ff;
  text-align: center;
  font-weight: 850;
}

.budget-health.over {
  background: rgba(241, 93, 93, 0.18);
  color: #ff9b9b;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(20px);
  opacity: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #101d25;
  color: #ffffff;
  box-shadow: var(--shadow);
  transition: 180ms ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

@media (max-width: 1280px) {
  .opportunity-hero,
  .decision-layout {
    grid-template-columns: 1fr;
  }

  .media-tile {
    min-height: 220px;
  }

  .estimate-panel,
  .assistant-panel {
    position: static;
  }

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

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

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

  .topbar {
    display: grid;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .metric-grid,
  .summary-grid,
  .split-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  main {
    padding: 14px;
  }

  h1 {
    font-size: 2rem;
  }

  .pipeline,
  .viability-board,
  .options-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .project-item,
  .budget-row,
  .room-row,
  .task-row {
    grid-template-columns: 1fr;
  }

  .project-item button,
  .money {
    text-align: left;
  }

  .form-actions {
    flex-direction: column-reverse;
  }
}
