:root {
  --navy-950: #061f35;
  --navy-900: #0b2942;
  --navy-800: #123a59;
  --navy-700: #1c4b6d;
  --ink: #0d2944;
  --muted: #64748b;
  --teal-700: #08777b;
  --teal-600: #0b8c8f;
  --teal-500: #14a7a0;
  --teal-100: #dff5f3;
  --teal-50: #eefaf9;
  --blue-50: #f4f8fb;
  --border: #d7e2ea;
  --border-strong: #c2d2df;
  --white: #ffffff;
  --green: #11875d;
  --green-bg: #e8f8f0;
  --amber: #c86b05;
  --amber-bg: #fff3df;
  --red: #c74040;
  --red-bg: #fdeaea;
  --shadow: 0 8px 24px rgba(22, 51, 76, 0.08);
  --sidebar-width: 280px;
  --header-height: 72px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--blue-50);
  color: var(--ink);
  font-family: "DM Sans", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, select, input { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

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

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 24px 0 30px;
  background: rgba(255,255,255,.97);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.brand-group, .header-actions, .profile-button, .study-picker {
  display: flex;
  align-items: center;
}

.brand-group { gap: 20px; }
.header-actions { gap: 12px; }
.portfolio-back { color: var(--teal-700); font-size: 12px; font-weight: 700; text-decoration: none; }
.portfolio-back:hover { text-decoration: underline; text-underline-offset: 3px; }

.brand {
  color: var(--navy-900);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1.4px;
  text-decoration: none;
}

.brand-accent { color: var(--teal-600); }
.brand-divider { width: 1px; height: 34px; background: var(--border-strong); }
.product-name { font-size: 18px; font-weight: 600; }
.demo-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px;
  border: 1px solid #b9e6df; border-radius: 99px; background: var(--teal-50);
  color: var(--teal-700); font-size: 10px; white-space: nowrap;
}
.demo-badge span { width: 6px; height: 6px; border-radius: 50%; background: var(--teal-500); box-shadow: 0 0 0 3px rgba(20,167,160,.12); }
.demo-badge b { font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.demo-badge em { font-style: normal; }

.study-picker {
  min-width: 168px;
  gap: 9px;
  padding: 0 12px;
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  transition: border-color .2s, box-shadow .2s;
}

.study-picker:focus-within { border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(11,140,143,.12); }
.study-picker svg { width: 19px; height: 19px; color: var(--navy-700); }
.study-picker select {
  width: 100%; height: 42px; border: 0; outline: 0; background: transparent;
  color: var(--ink); font-weight: 600; cursor: pointer;
}

.icon-button {
  width: 42px; height: 42px; display: inline-grid; place-items: center;
  border: 0; border-radius: 9px; background: transparent; cursor: pointer;
}
.icon-button:hover { background: var(--blue-50); }
.icon-button svg { width: 20px; height: 20px; }
.notification-button { position: relative; }
.notification-dot {
  position: absolute; top: 8px; right: 8px; width: 7px; height: 7px;
  background: var(--amber); border: 2px solid white; border-radius: 99px;
}

.profile-button {
  gap: 10px; padding: 4px 8px 4px 4px; border: 0; border-radius: 10px;
  background: transparent; text-align: left; cursor: pointer;
}
.profile-button:hover { background: var(--blue-50); }
.profile-button svg { width: 16px; height: 16px; }
.avatar {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  background: var(--navy-900); color: white; font-size: 13px; font-weight: 700;
}
.profile-copy { display: grid; gap: 1px; }
.profile-copy strong { font-size: 13px; }
.profile-copy small { color: var(--muted); font-size: 11px; }
.mobile-menu { display: none; }

.sidebar {
  position: fixed;
  top: var(--header-height); bottom: 0; left: 0; z-index: 30;
  width: var(--sidebar-width); display: flex; flex-direction: column;
  padding: 24px 15px 18px;
  background: linear-gradient(165deg, var(--navy-900), var(--navy-950));
  color: white; overflow-y: auto;
}

.nav-list { display: grid; gap: 5px; }
.nav-button {
  width: 100%; min-height: 48px; display: flex; align-items: center; gap: 13px;
  padding: 10px 13px; border: 0; border-radius: 9px; background: transparent;
  color: #c7d7e4; font-weight: 500; text-align: left; cursor: pointer;
  transition: color .18s, background .18s, transform .18s;
}
.nav-button:hover { background: rgba(255,255,255,.07); color: white; transform: translateX(2px); }
.nav-button.active { background: var(--teal-700); color: white; box-shadow: inset 3px 0 0 #4ee0d3; }
.nav-button svg { width: 20px; height: 20px; flex: 0 0 auto; }
.nav-button span { line-height: 1.25; }

.sidebar-footer { margin-top: auto; padding: 22px 10px 0; color: #9eb4c5; }
.sidebar-footer p { margin: 10px 0 0; font-size: 11px; }
.environment-pill { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.environment-pill span { width: 8px; height: 8px; background: #38d59e; border-radius: 50%; box-shadow: 0 0 0 4px rgba(56,213,158,.12); }
.sidebar-overlay { display: none; }

.main-content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: calc(var(--header-height) + 34px) 36px 50px;
  outline: none;
}

.page { max-width: 1440px; margin: 0 auto; animation: page-in .25s ease-out; }
@keyframes page-in { from { opacity: .2; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.page-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px;
}
.page-header h1 { margin: 0 0 7px; color: var(--navy-900); font-size: clamp(28px, 3vw, 38px); line-height: 1.1; letter-spacing: -1px; }
.page-header p { margin: 0; color: var(--muted); font-size: 15px; }
.eyebrow { margin: 0 0 7px !important; color: var(--teal-700) !important; font-size: 11px !important; font-weight: 700; letter-spacing: 1.2px; }
.demo-notice {
  display: flex; align-items: center; gap: 9px; margin: -8px 0 20px; padding: 9px 12px;
  border: 1px solid #cde8e4; border-radius: 8px; background: #f0faf8;
  color: #35686a; font-size: 11px;
}
.demo-notice svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--teal-700); }
.demo-notice strong { color: var(--teal-700); }

.button {
  min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 0 16px; border: 1px solid transparent; border-radius: 8px; font-weight: 600;
  cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s;
}
.button:hover { transform: translateY(-1px); }
.button svg { width: 18px; height: 18px; }
.button-primary { background: var(--teal-700); color: white; box-shadow: 0 5px 14px rgba(8,119,123,.18); }
.button-primary:hover { background: #066b6f; box-shadow: 0 7px 17px rgba(8,119,123,.24); }
.button-secondary { background: white; border-color: var(--border-strong); color: var(--navy-800); }
.button-secondary:hover { background: var(--blue-50); }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; margin-bottom: 20px; }
.metric-card, .card {
  background: var(--white); border: 1px solid var(--border); border-radius: 12px;
}
.metric-card {
  min-height: 124px; display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px; transition: transform .18s, box-shadow .18s, border-color .18s;
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.metric-card p { margin: 0 0 10px; color: #4e6478; font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.metric-card strong { color: var(--teal-700); font-size: 34px; line-height: 1; letter-spacing: -1px; }
.metric-card.warning strong { color: #e57b00; }
.metric-icon {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%;
  background: var(--teal-50); color: var(--teal-700);
}
.metric-card.warning .metric-icon { background: var(--amber-bg); color: #e57b00; }
.metric-icon svg { width: 24px; height: 24px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(320px,.9fr); gap: 20px; margin-bottom: 20px; }
.card { padding: 22px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.card-title { margin: 0; color: var(--navy-900); font-size: 14px; font-weight: 700; letter-spacing: .2px; }
.card-meta { color: var(--muted); font-size: 12px; }

.workflow { display: grid; grid-template-columns: repeat(7, minmax(68px,1fr)); gap: 6px; align-items: start; padding: 10px 0 3px; }
.workflow-step { position: relative; display: grid; justify-items: center; gap: 9px; text-align: center; }
.workflow-step:not(:last-child)::after {
  content: ""; position: absolute; top: 23px; left: calc(50% + 28px); right: calc(-50% + 28px);
  height: 2px; background: var(--border-strong);
}
.workflow-step.complete:not(:last-child)::after { background: var(--teal-500); }
.workflow-icon {
  position: relative; z-index: 1; width: 48px; height: 48px; display: grid; place-items: center;
  border: 2px solid var(--border-strong); border-radius: 50%; background: white; color: #7890a4;
}
.workflow-step.complete .workflow-icon { border-color: var(--teal-600); color: var(--teal-700); background: var(--teal-50); }
.workflow-step.current .workflow-icon { border-color: var(--teal-600); color: var(--teal-700); box-shadow: 0 0 0 6px rgba(11,140,143,.10); }
.workflow-icon svg { width: 21px; height: 21px; }
.workflow-check {
  position: absolute; z-index: 2; top: 34px; right: calc(50% - 28px); width: 17px; height: 17px;
  display: grid; place-items: center; background: var(--teal-700); color: white; border: 2px solid white; border-radius: 50%; font-size: 9px; font-weight: 700;
}
.workflow-step span:last-child { max-width: 86px; color: #465c70; font-size: 11px; line-height: 1.25; }

.readiness-layout { display: grid; grid-template-columns: 160px 1fr; align-items: center; gap: 18px; }
.donut {
  --score: 94;
  width: 150px; aspect-ratio: 1; position: relative; display: grid; place-items: center;
  border-radius: 50%; background: conic-gradient(var(--teal-600) calc(var(--score) * 1%), #f2a52e 0 97%, #ef6841 0);
}
.donut::before { content: ""; position: absolute; inset: 19px; background: white; border-radius: 50%; }
.donut-copy { position: relative; display: grid; text-align: center; }
.donut-copy strong { color: var(--teal-700); font-size: 30px; line-height: 1; }
.donut-copy span { color: var(--teal-700); font-size: 13px; font-weight: 700; }
.legend { display: grid; gap: 13px; }
.legend-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 9px; font-size: 12px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

.table-card { padding: 0; overflow: hidden; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 18px 20px 14px; }
.table-tools { display: flex; gap: 9px; }
.search-box { position: relative; }
.search-box svg { position: absolute; top: 50%; left: 11px; width: 17px; height: 17px; color: #8093a3; transform: translateY(-50%); }
.search-box input {
  width: 210px; height: 38px; padding: 0 12px 0 35px; border: 1px solid var(--border); border-radius: 8px;
  outline: 0; color: var(--ink); background: white;
}
.search-box input:focus { border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(11,140,143,.1); }
.filter-select { height: 38px; padding: 0 30px 0 10px; border: 1px solid var(--border); border-radius: 8px; background: white; color: var(--ink); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 14px 20px; border-top: 1px solid var(--border); font-size: 13px; text-align: left; }
th { background: #f9fbfc; color: #556c7f; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
td:first-child { color: var(--navy-900); font-weight: 700; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #fbfdfd; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.status-green { color: var(--green); background: var(--green-bg); }
.status-green::before { background: var(--green); }
.status-amber { color: var(--amber); background: var(--amber-bg); }
.status-amber::before { background: var(--amber); }
.status-red { color: var(--red); background: var(--red-bg); }
.status-red::before { background: var(--red); }
.status-neutral { color: #546a7c; background: #edf2f5; }
.status-neutral::before { background: #7d92a2; }
.finding-link { padding: 0; border: 0; background: transparent; color: var(--amber); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.empty-state { padding: 34px; color: var(--muted); text-align: center; }

.module-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; margin-bottom: 20px; }
.module-card { padding: 20px; }
.module-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.module-card h3 { margin: 0 0 4px; font-size: 15px; }
.module-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.module-icon { width: 39px; height: 39px; display: grid; place-items: center; background: var(--teal-50); color: var(--teal-700); border-radius: 9px; }
.module-icon svg { width: 19px; height: 19px; }
.progress-track { height: 7px; overflow: hidden; background: #e9eff3; border-radius: 99px; }
.progress-fill { height: 100%; background: var(--teal-600); border-radius: inherit; }
.progress-copy { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 11px; }
.module-actions { display: flex; justify-content: flex-end; margin-top: 15px; }
.text-button { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: transparent; color: var(--teal-700); font-size: 12px; font-weight: 700; cursor: pointer; }
.text-button svg { width: 15px; height: 15px; }

.activity-list { display: grid; }
.activity-item { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 13px 0; border-top: 1px solid var(--border); }
.activity-item:first-child { border-top: 0; }
.activity-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--teal-50); color: var(--teal-700); }
.activity-icon svg { width: 16px; height: 16px; }
.activity-item strong { display: block; margin-bottom: 3px; font-size: 12px; }
.activity-item p, .activity-item time { margin: 0; color: var(--muted); font-size: 11px; }
.two-column { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(300px,.8fr); gap: 20px; }

.modal { width: min(560px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 24px 80px rgba(6,31,53,.28); }
.modal::backdrop { background: rgba(6,31,53,.56); backdrop-filter: blur(3px); }
.modal-card { padding: 24px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 22px; }
.finding-detail-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; padding: 18px 0; }
.detail-block { padding: 13px; background: var(--blue-50); border-radius: 8px; }
.detail-block small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.detail-block strong { font-size: 12px; }
.finding-description { padding: 15px; background: var(--amber-bg); border-left: 3px solid #e49a29; border-radius: 6px; color: #6e4b1d; font-size: 13px; line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 80; display: grid; gap: 10px; }
.toast {
  min-width: 290px; display: flex; align-items: center; gap: 11px; padding: 14px 16px;
  background: var(--navy-900); color: white; border-radius: 9px; box-shadow: 0 16px 45px rgba(6,31,53,.24);
  font-size: 12px; animation: toast-in .25s ease-out;
}
.toast svg { width: 18px; height: 18px; color: #55dfce; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2,1fr); }
  .dashboard-grid, .two-column { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 900px) {
  .mobile-menu { display: inline-grid; }
  .product-name, .brand-divider, .notification-button, .profile-copy, .profile-button > svg, .demo-badge em, .portfolio-back { display: none; }
  .topbar { padding: 0 16px; }
  .brand-group { gap: 12px; }
  .brand { font-size: 25px; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 14px 0 40px rgba(6,31,53,.2); }
  .sidebar.open { transform: none; }
  .sidebar-overlay { position: fixed; inset: var(--header-height) 0 0 0; z-index: 25; background: rgba(6,31,53,.44); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; padding: calc(var(--header-height) + 25px) 20px 40px; }
}

@media (max-width: 680px) {
  .study-picker { min-width: 130px; }
  .profile-button { display: none; }
  .page-header { display: grid; }
  .page-header .button { width: 100%; }
  .demo-notice { align-items: flex-start; line-height: 1.45; }
  .metrics-grid, .module-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 105px; }
  .workflow { display: flex; overflow-x: auto; padding: 10px 2px 13px; }
  .workflow-step { flex: 0 0 94px; }
  .workflow-step:not(:last-child)::after { left: 62px; right: -32px; }
  .readiness-layout { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
  .table-toolbar { align-items: flex-start; flex-direction: column; }
  .table-tools { width: 100%; }
  .search-box { flex: 1; }
  .search-box input { width: 100%; }
  .finding-detail-grid { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .sidebar, .page-header .button, .table-tools, .sidebar-overlay { display: none !important; }
  .main-content { margin: 0; padding: 20px; }
  body { background: white; }
  .card, .metric-card { break-inside: avoid; }
}
