:root {
  --bg: #eef2f0;
  --panel: #ffffff;
  --ink: #13211f;
  --muted: #63706d;
  --line: #d7dfdc;
  --navy: #102a43;
  --petrol: #0c6b67;
  --teal: #15948b;
  --amber: #c88719;
  --coral: #c95f4b;
  --soft: #f7f8f5;
  --shadow: 0 18px 48px rgba(19, 33, 31, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(140deg, rgba(12, 107, 103, 0.12), transparent 38%),
    linear-gradient(320deg, rgba(200, 135, 25, 0.11), transparent 42%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(18px, 4vw, 44px);
  background: rgba(238, 242, 240, 0.88);
  border-bottom: 1px solid rgba(215, 223, 220, 0.78);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.1;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 7px;
  color: var(--muted);
  white-space: nowrap;
  background: transparent;
}

.tab.active {
  background: var(--navy);
  color: #fff;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}

.btn.secondary {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
}

.btn.ghost {
  background: transparent;
  color: var(--petrol);
}

.btn.icon-only {
  width: 38px;
  padding: 0;
}

.wrap {
  width: min(1420px, 100%);
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 44px) 52px;
}

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

.section-head h2 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.35rem);
  line-height: 1;
}

.section-head p {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
}

.section-head.compact {
  align-items: start;
  margin-bottom: 12px;
}

.section-head.compact h3 {
  margin-bottom: 4px;
}

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

.dashboard-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.two-col {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  border: 1px solid rgba(215, 223, 220, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.card.pad {
  padding: 18px;
}

.canvas-card {
  box-shadow: none;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
}

.score-ring {
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--petrol) calc(var(--score) * 1%), #e5ece9 0);
}

.score-ring span {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  font-weight: 800;
}

.risk-list,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.tag,
.risk-list li {
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 999px;
  background: #edf5f2;
  color: #174743;
  font-size: 0.8rem;
  line-height: 1.2;
}

.risk-list li {
  background: #fff3e0;
  color: #684314;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ece9;
}

.progress-track span {
  display: block;
  width: var(--w);
  height: 100%;
  background: linear-gradient(90deg, var(--petrol), var(--amber));
}

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

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  color: #33433f;
  font-size: 0.83rem;
  font-weight: 750;
}

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

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus,
select:focus {
  outline: 3px solid rgba(21, 148, 139, 0.18);
  border-color: var(--teal);
}

.assessment-list {
  display: grid;
  gap: 12px;
}

.model-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.model-strip div {
  min-height: 116px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.model-strip strong,
.model-strip span {
  display: block;
}

.model-strip strong {
  color: var(--navy);
  font-size: 0.86rem;
}

.model-strip span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.dimension {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 360px);
  gap: 18px;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.dimension p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.scale {
  display: grid;
  gap: 9px;
}

.scale-output {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.score-pill {
  display: inline-flex;
  min-width: 96px;
  justify-content: center;
  padding: 6px 9px;
  border-radius: 999px;
  background: #edf5f2;
  color: #174743;
  font-size: 0.82rem;
  font-weight: 800;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--petrol);
}

.canvas-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

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

.canvas-block {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.canvas-block.wide {
  grid-column: 1 / -1;
}

.canvas-block h3 {
  margin-bottom: 10px;
  color: var(--navy);
  font-size: 0.91rem;
  text-transform: uppercase;
}

.canvas-block textarea {
  min-height: 128px;
  border: 0;
  padding: 0;
  background: transparent;
}

.canvas-block textarea:focus {
  outline: 0;
}

.heatmap {
  display: grid;
  gap: 9px;
}

.heat-row {
  display: grid;
  grid-template-columns: minmax(125px, 1fr) 1.7fr 34px;
  gap: 9px;
  align-items: center;
}

.bar {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ece9;
}

.bar span {
  display: block;
  width: var(--w);
  height: 100%;
  background: var(--c);
}

.roadmap {
  overflow-x: auto;
}

.automation-panel {
  margin-bottom: 16px;
  box-shadow: none;
}

.integration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 14px 0;
}

.codebox {
  min-height: 190px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.83rem;
}

.status-panel {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid #cfe0dc;
  border-radius: 8px;
  background: #f4faf8;
}

.status-panel p {
  margin: 7px 0 0;
}

.mini-stat {
  box-shadow: none;
}

.mini-stat span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.mini-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 2rem;
  line-height: 1;
}

.mini-stat.high strong {
  color: var(--coral);
}

.mini-stat.medium strong {
  color: var(--amber);
}

.mini-stat.low strong {
  color: var(--petrol);
}

.area-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.m365-area-card {
  margin: 16px 0;
  box-shadow: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td input,
td textarea,
td select {
  width: 100%;
  min-height: 36px;
  padding: 8px;
}

td textarea {
  min-height: 58px;
  resize: vertical;
}

.compact-textarea {
  min-height: 44px;
}

.timeframe {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf5f2;
  color: #174743;
  font-size: 0.8rem;
  font-weight: 800;
}

.empty {
  display: grid;
  min-height: 260px;
  place-items: center;
  padding: 32px;
  text-align: center;
}

.empty p {
  max-width: 480px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: none;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}

@media (max-width: 980px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    justify-content: space-between;
  }

  .two-col,
  .three-col,
  .canvas-layout,
  .canvas-grid,
  .model-strip,
  .area-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .topbar {
    gap: 12px;
    padding: 14px clamp(16px, 5vw, 22px);
  }

  .brand {
    min-width: 0;
  }

  .brand h1 {
    font-size: 1rem;
  }

  .brand p {
    max-width: calc(100vw - 118px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tabs {
    margin-inline: -2px;
    scroll-padding-inline: 8px;
  }

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

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .actions {
    flex-wrap: wrap;
  }

  .tab {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.9rem;
  }

  .roadmap {
    padding: 0;
    overflow: hidden;
  }

  .roadmap table {
    display: block;
    min-width: 0;
  }

  .roadmap thead {
    display: none;
  }

  .roadmap tbody {
    display: grid;
    gap: 0;
  }

  .roadmap tr {
    display: grid;
    grid-template-columns: 1fr;
    padding: 14px;
    border-bottom: 1px solid var(--line);
  }

  .roadmap tr:last-child {
    border-bottom: 0;
  }

  .roadmap td {
    display: grid;
    grid-template-columns: minmax(94px, 0.38fr) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    width: 100%;
    padding: 8px 0;
    border-bottom: 0;
  }

  .roadmap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
  }

  .roadmap td input,
  .roadmap td textarea,
  .roadmap td select {
    min-width: 0;
    max-width: 100%;
    font-size: 0.95rem;
  }

  .roadmap td textarea {
    min-height: 86px;
    overflow: visible;
  }

  .roadmap td .compact-textarea {
    min-height: 58px;
  }

  .roadmap .icon-only {
    width: 44px;
  }
}
