:root {
  color-scheme: light;
  --bg: #eef2f5;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667789;
  --line: #d7e0e8;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --metal: #c7a45d;
  --carbon: #101820;
  --warn: #a16207;
  --danger: #b42318;
  --ok: #16703c;
  --soft: #f7f9fb;
  --shadow: 0 18px 45px rgba(21, 38, 54, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

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

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 700;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button.secondary {
  background: #e7eef4;
  color: var(--ink);
}

button.secondary:hover {
  background: #d7e3ec;
}

.login-panel button:not(.text-button) {
  background: var(--carbon);
}

.login-panel button:not(.text-button):hover {
  background: #22313b;
}

a {
  color: var(--accent-strong);
}

.login-screen,
.reset-screen,
.mfa-screen,
.ack-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-screen {
  background:
    linear-gradient(135deg, rgba(16, 24, 32, 0.97), rgba(24, 45, 48, 0.94)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 88px);
}

.login-panel,
.reset-panel,
.mfa-panel,
.ack-panel {
  width: min(920px, 100%);
  gap: 32px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 34px;
}

.login-panel {
  display: grid;
  grid-template-columns: 1fr 360px;
  background: linear-gradient(135deg, #f9fbfc, #ffffff);
  border-color: rgba(199, 164, 93, 0.42);
}

.login-brand {
  min-height: 320px;
  display: grid;
  align-content: center;
  gap: 14px;
  border-right: 1px solid var(--line);
  padding-right: 30px;
}

.portal-mark {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(199, 164, 93, 0.76);
  border-radius: 8px;
  background: linear-gradient(145deg, #ffffff, #eef3f5);
  color: var(--carbon);
  font-weight: 900;
  letter-spacing: 0;
}

.portal-mark-small {
  width: 52px;
  height: 52px;
  font-size: 13px;
}

.portal-copy {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.ack-panel,
.reset-panel,
.mfa-panel {
  display: grid;
}

.reset-screen {
  background:
    linear-gradient(135deg, rgba(238, 242, 245, 0.96), rgba(255, 255, 255, 0.95)),
    repeating-linear-gradient(90deg, rgba(16, 24, 32, 0.035) 0 1px, transparent 1px 92px);
}

.reset-panel {
  width: min(560px, 100%);
  align-items: start;
  gap: 22px;
  border-color: rgba(199, 164, 93, 0.38);
}

.reset-heading {
  display: flex;
  align-items: center;
  gap: 16px;
}

.login-panel h1,
.reset-panel h1,
.mfa-panel h1,
.ack-panel h1,
.sidebar h1,
.workspace-header h2 {
  margin: 0;
  letter-spacing: 0;
}

.login-panel h1 {
  font-size: 44px;
  line-height: 1.08;
  color: var(--carbon);
}

.ack-panel h1 {
  font-size: 30px;
  line-height: 1.15;
}

.mfa-panel h1 {
  font-size: 30px;
  line-height: 1.15;
}

.reset-panel h1 {
  font-size: 30px;
  line-height: 1.15;
}

.helper-text,
.setup-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.mfa-setup-grid {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 20px;
  align-items: center;
}

.qr-box {
  width: 230px;
  height: 230px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-box img {
  width: 210px;
  height: 210px;
}

.setup-copy {
  display: grid;
  gap: 16px;
}

.ack-text {
  max-height: 42vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 18px;
  color: #273849;
  line-height: 1.58;
}

.ack-check {
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
}

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

.ack-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-form,
.question-form {
  display: grid;
  gap: 16px;
}

.login-panel .login-form {
  align-content: center;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.form-note {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.text-button {
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 800;
}

.text-button:hover {
  background: transparent;
  color: var(--carbon);
}

.access-assist {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.access-assist span {
  font-weight: 650;
}

.login-panel .access-link,
.login-panel .access-link:hover {
  min-height: auto;
  background: transparent;
}

.access-link {
  border-bottom: 1px solid rgba(15, 118, 110, 0.34);
  border-radius: 0;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.access-link:hover,
.access-link:focus-visible {
  border-bottom-color: var(--metal);
  color: var(--carbon);
}

.dev-reset-link {
  margin: 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.password-guidance {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.password-guidance.error {
  color: #9f1239;
  font-weight: 700;
}

.password-guidance.good {
  color: var(--accent-strong);
  font-weight: 700;
}

.honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px 1fr;
  background: #fff;
}

.sidebar {
  background: #13212e;
  color: #f8fbfd;
  padding: 24px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 28px;
}

.sidebar .eyebrow {
  color: #7dd3c7;
}

.sidebar h1 {
  font-size: 24px;
  line-height: 1.18;
}

.nav-tabs {
  display: grid;
  gap: 8px;
  align-content: start;
}

.nav-tab {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  color: #d8e4ec;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-tab.active,
.nav-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.account-block {
  align-self: end;
  display: grid;
  gap: 8px;
  color: #d8e4ec;
  font-size: 13px;
}

.account-block strong {
  color: #fff;
}

.account-block button {
  margin-top: 8px;
}

.workspace {
  min-width: 0;
  padding: 24px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 22px;
  background: #fff;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.workspace-header h2 {
  font-size: 28px;
}

.workspace-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.status-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.question-form,
.job-detail,
.admin-grid,
.job-card,
.notice-banner {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(21, 38, 54, 0.08);
}

.notice-banner {
  margin-bottom: 14px;
  padding: 13px 16px;
  color: var(--muted);
  font-weight: 700;
}

.notice-banner strong {
  color: var(--ink);
}

.question-form {
  padding: 20px;
}

.privacy-warning,
.pii-warning {
  border-radius: 8px;
  padding: 13px 15px;
  line-height: 1.5;
}

.privacy-warning {
  display: grid;
  gap: 3px;
  border: 1px solid #dce3ea;
  background: #f6f7f9;
  color: #3f4f5f;
}

.privacy-warning strong {
  color: var(--ink);
}

.pii-warning {
  margin: 0;
  border: 1px solid rgba(180, 35, 24, 0.28);
  background: #fff1f0;
  color: var(--danger);
  font-weight: 800;
}

.research-control-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.2fr);
  gap: 14px;
}

.model-profile-control {
  display: grid;
  gap: 9px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.model-profile-control legend {
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

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

.reasoning-control {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.segmented-control label {
  min-height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
  font-size: 13px;
  text-align: center;
}

.segmented-control label:hover {
  border-color: rgba(15, 118, 110, 0.48);
}

.segmented-control label.active {
  border-color: var(--accent);
  background: #edf8f6;
  color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.11);
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.job-detail {
  margin-top: 20px;
  overflow: hidden;
}

.job-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.job-detail-header h3 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.3;
}

.job-detail-header p,
.job-meta,
.empty-state {
  color: var(--muted);
}

.job-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: #e7eef4;
  color: #264156;
  font-weight: 800;
  font-size: 12px;
  text-transform: capitalize;
  white-space: nowrap;
}

.job-status.completed {
  background: #e5f4eb;
  color: var(--ok);
}

.job-status.failed {
  background: #fde8e7;
  color: var(--danger);
}

.job-status.running,
.job-status.queued {
  background: #fff4d6;
  color: var(--warn);
}

.job-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  padding: 24px;
}

.answer {
  line-height: 1.58;
  overflow-wrap: anywhere;
  max-width: 920px;
}

.answer h1,
.answer h2,
.answer h3 {
  line-height: 1.25;
  margin: 22px 0 10px;
}

.answer h1:first-child,
.answer h2:first-child,
.answer h3:first-child {
  margin-top: 0;
}

.answer p {
  margin: 0 0 16px;
}

.answer ul {
  margin: 0 0 18px;
  padding-left: 22px;
}

.answer li {
  margin: 6px 0;
}

.answer pre {
  white-space: pre-wrap;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.panel-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft);
}

.panel-block h4 {
  margin: 0 0 8px;
}

.report-card {
  display: grid;
  gap: 10px;
}

.report-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.report-card .download-link {
  display: block;
  margin-top: 4px;
}

.report-card .download-link button {
  width: 100%;
}

.feedback-card {
  display: grid;
  gap: 10px;
}

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

.feedback-button-row button {
  flex: 1 1 120px;
}

.feedback-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.usage-list {
  display: grid;
  gap: 7px;
  margin: 0;
}

.usage-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.usage-list dt,
.usage-list dd {
  margin: 0;
  font-size: 12px;
}

.usage-list dt {
  color: var(--muted);
}

.usage-list dd {
  color: var(--ink);
  font-weight: 800;
}

.feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(16, 24, 32, 0.46);
}

.feedback-dialog {
  width: min(680px, 100%);
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.feedback-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.feedback-dialog-header h2 {
  margin: 0;
  font-size: 22px;
}

.feedback-context {
  margin: 0;
  padding: 16px 20px 0;
  color: var(--muted);
  line-height: 1.5;
}

.feedback-privacy {
  margin: 16px 20px 0;
}

.feedback-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 20px 20px;
}

.feedback-message-field,
.feedback-form .pii-warning,
.feedback-actions,
.feedback-form .form-note,
.feedback-form .form-error {
  grid-column: 1 / -1;
}

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

.progress-card {
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, #f7fbfa, #ffffff);
  padding: 22px;
}

.progress-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.progress-card-title {
  min-width: 0;
}

.progress-card h3 {
  margin: 0;
  font-size: 22px;
}

.progress-card p {
  max-width: 720px;
  margin: 0 0 18px;
  color: #2f4356;
  line-height: 1.65;
}

.status-activity-line {
  position: relative;
  overflow: hidden;
  width: 56px;
  height: 8px;
  margin-top: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.13);
}

.status-activity-line::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: line-pass 1.35s ease-in-out infinite;
}

@keyframes line-pass {
  0% {
    left: -24px;
  }
  100% {
    left: 58px;
  }
}

.event-list,
.source-list {
  display: grid;
  gap: 9px;
  padding: 0;
  margin: 0;
  list-style: none;
  font-size: 13px;
}

.event-list li {
  color: var(--muted);
}

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

.job-card {
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.job-card h3 {
  margin: 0 0 7px;
  font-size: 16px;
  line-height: 1.35;
}

.job-card p,
.job-detail-header p {
  margin: 0;
}

.admin-grid {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.admin-table-card {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  overflow: hidden;
}

.admin-form-card {
  overflow: visible;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
}

.admin-form .form-note,
.admin-form .form-error,
.admin-form .dev-reset-link {
  grid-column: 1 / -1;
}

.admin-notice {
  padding: 14px 16px;
  background: #f4fbf8;
}

.admin-notice strong,
.admin-notice span {
  display: block;
}

.admin-notice span {
  margin-top: 6px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.admin-status-card,
.admin-error-card {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.admin-status-card span,
.admin-error-card span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.admin-error-card {
  border-color: #e8b4aa;
  background: #fff7f4;
}

.admin-error-card button {
  justify-self: start;
}

.admin-action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.audit-detail {
  display: block;
  max-width: 420px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.readiness-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.readiness-status.status-ok {
  background: #e9f7ef;
  color: #116149;
}

.readiness-status.status-warning {
  background: #fff8e6;
  color: #7a4f05;
}

.readiness-status.status-blocker {
  background: #fff1f0;
  color: #b42318;
}

.feedback-comment {
  display: block;
  max-width: 360px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
  line-height: 1.45;
}

.admin-notes-input {
  width: 260px;
  min-height: 76px;
  resize: vertical;
  font-size: 12px;
  line-height: 1.4;
}

.admin-table-header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.admin-header-with-control {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
}

.admin-table-header h3 {
  margin: 0;
}

.admin-status-filter {
  min-width: 180px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-status-filter select {
  margin-top: 6px;
}

.admin-filter-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto auto;
  gap: 10px;
  align-items: end;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table-card table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.admin-table-card th,
.admin-table-card td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.admin-table-card th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.admin-table-card td span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.policy-input-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(82px, 1fr));
  gap: 8px;
  min-width: 380px;
}

.policy-input-grid label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.policy-input-grid input {
  height: 34px;
  margin-top: 4px;
  padding: 0 8px;
  font-size: 13px;
}

.compact-button {
  min-height: 34px;
  padding: 0 10px;
}

.danger-button {
  border-color: #d7b7b0;
  color: #8f2d20;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

  .research-control-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-template-rows: auto auto;
  }

  .account-block {
    align-self: start;
  }

  .job-body {
    grid-template-columns: 1fr;
  }

  .segmented-control {
    grid-template-columns: 1fr;
  }

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

  .admin-grid,
  .admin-form,
  .admin-filter-form,
  .feedback-form,
  .mfa-setup-grid,
  .login-panel {
    grid-template-columns: 1fr;
  }

  .admin-header-with-control {
    align-items: stretch;
    flex-direction: column;
  }

  .qr-box {
    width: 100%;
  }

  .login-brand {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 24px;
  }

  .access-assist {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .workspace {
    padding: 16px;
  }

  .workspace-header,
  .job-detail-header,
  .job-card,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
    display: flex;
  }

  .workspace-header h2 {
    font-size: 23px;
  }

  .workspace-tools {
    align-items: stretch;
    flex-direction: column;
  }
}
