:root {
  --ink: #17324d;
  --ink-soft: #436078;
  --paper: #ffffff;
  --mist: #edf5f3;
  --line: #cbdcd8;
  --teal: #176b64;
  --gold: #b98a32;
  --coral: #c85d45;
  --plum: #6e4f7a;
  --shadow: 0 18px 50px rgba(23, 50, 77, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #f8faf9;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.is-hidden {
  display: none !important;
}

.app-shell-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 12px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.brand img {
  width: 148px;
}

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

.top-nav a,
.tab-button,
.sign-out,
.secondary-action,
.ghost-action,
.primary-action {
  min-height: 42px;
  border-radius: 8px;
}

.top-nav a {
  padding: 10px 14px;
  color: var(--ink-soft);
}

.top-nav a.active,
.top-nav a:hover {
  color: var(--ink);
  background: var(--mist);
}

.auth-screen {
  min-height: calc(100vh - 78px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  gap: clamp(28px, 5vw, 74px);
  align-items: center;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 56px 0;
}

.auth-copy h1,
.workspace-head h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(38px, 5vw, 68px);
  line-height: 1;
  font-weight: 680;
  letter-spacing: 0;
}

.auth-copy p:not(.eyebrow) {
  max-width: 680px;
  color: var(--ink-soft);
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.system-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.system-strip span,
.threshold-pill,
.queue-count {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--paper);
  font-size: 13px;
  font-weight: 700;
}

.auth-panel,
.surface,
.sidebar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.auth-panel {
  display: grid;
  gap: 16px;
  padding: 28px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.panel-heading h2,
.surface h2,
.prompt-head h2,
.profile-block h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

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

input,
select {
  min-height: 46px;
  padding: 0 12px;
}

textarea {
  min-height: 116px;
  resize: vertical;
  padding: 12px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink-soft);
  font-weight: 600;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.primary-action,
.secondary-action,
.ghost-action,
.sign-out,
.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 760;
}

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

.secondary-action {
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper);
}

.ghost-action,
.sign-out {
  color: var(--teal);
  background: transparent;
}

.demo-app {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  width: min(1440px, calc(100% - 36px));
  min-height: calc(100vh - 78px);
  margin: 0 auto;
  padding: 18px 0;
}

.sidebar {
  position: sticky;
  top: 96px;
  align-self: start;
  padding: 18px;
}

.profile-block {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.profile-block img {
  width: 62px;
}

.profile-block p:last-child {
  margin: 5px 0 0;
  color: var(--ink-soft);
}

.side-tabs {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.tab-button {
  justify-content: flex-start;
  color: var(--ink-soft);
  background: transparent;
}

.tab-button.active,
.tab-button:hover {
  color: var(--ink);
  background: var(--mist);
}

.sign-out {
  width: 100%;
}

.workspace {
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 18px;
}

.metric-grid,
.dashboard-grid,
.modality-grid,
.system-map,
.conversation-layout {
  display: grid;
  gap: 14px;
}

.metric-grid {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
}

.metric {
  min-height: 144px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.metric strong {
  display: block;
  font-size: 30px;
  line-height: 1.1;
}

.metric span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.meter {
  height: 8px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ecea;
}

.meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.dashboard-grid {
  grid-template-columns: 1.05fr 0.95fr;
  margin-top: 14px;
}

.surface {
  padding: 22px;
}

.badge-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.badge-row,
.review-item,
.score-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.badge-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--coral);
  font-size: 12px;
  font-weight: 800;
}

.status.earned {
  background: var(--teal);
}

.prompt-head,
.session-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.prompt-head select {
  max-width: 260px;
}

.rubric-text {
  margin: 12px 0 20px;
  color: var(--ink-soft);
}

.conversation-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: stretch;
}

.chat-panel,
.media-panel {
  min-width: 0;
}

.chat-log {
  display: grid;
  align-content: start;
  gap: 12px;
  height: 380px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.chat-message {
  max-width: 82%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.chat-message strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.chat-message p {
  margin: 0;
  color: var(--ink-soft);
}

.chat-message.user {
  justify-self: end;
  border-color: rgba(23, 107, 100, 0.28);
  background: var(--mist);
}

.response-box {
  margin-top: 14px;
}

.response-box textarea {
  min-height: 132px;
}

.media-panel {
  display: grid;
  gap: 14px;
}

.dummy-device {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.dummy-device.active {
  border-color: rgba(23, 107, 100, 0.45);
  background: var(--mist);
}

.device-screen {
  display: grid;
  place-items: center;
  min-height: 170px;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(145deg, #17324d, #176b64);
  text-align: center;
}

.device-screen span {
  width: 54px;
  height: 54px;
  border: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
}

.audio-bars {
  display: flex;
  align-items: end;
  gap: 7px;
  height: 70px;
  padding: 12px;
  border-radius: 8px;
  background: var(--paper);
}

.audio-bars i {
  width: 100%;
  min-width: 10px;
  border-radius: 999px;
  background: var(--teal);
}

.audio-bars i:nth-child(1) { height: 35%; }
.audio-bars i:nth-child(2) { height: 70%; }
.audio-bars i:nth-child(3) { height: 48%; }
.audio-bars i:nth-child(4) { height: 86%; }
.audio-bars i:nth-child(5) { height: 52%; }

.dummy-device p {
  margin: 0;
  color: var(--ink-soft);
}

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

.modality {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.modality h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.modality p {
  min-height: 72px;
  margin: 0 0 12px;
  color: var(--ink-soft);
}

.session-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 18px;
}

.score-breakdown {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.score-row {
  grid-template-columns: 150px minmax(0, 1fr) 90px;
  align-items: center;
}

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

.review-item {
  background: var(--paper);
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.system-map article {
  min-height: 210px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.system-map span {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 16px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--plum);
  font-weight: 800;
}

.system-map p,
#nextStep p,
.review-item p {
  color: var(--ink-soft);
}

@media (max-width: 1080px) {
  .auth-screen,
  .demo-app,
  .dashboard-grid,
  .system-map,
  .conversation-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

@media (max-width: 720px) {
  .app-shell-header,
  .workspace-head,
  .prompt-head {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-screen {
    width: min(100% - 28px, 1180px);
  }

  .demo-app {
    width: min(100% - 24px, 1440px);
  }

  .metric-grid,
  .modality-grid,
  .score-row,
  .auth-actions {
    grid-template-columns: 1fr;
  }

  .chat-log {
    height: 320px;
  }

  .chat-message {
    max-width: 100%;
  }
}
