:root {
  color-scheme: light;
  --bg: #f8faf8;
  --surface: #ffffff;
  --surface-muted: #f1f4f2;
  --ink: #1f2523;
  --muted: #4f5b56;
  --line: #d5ddd8;
  --accent: #2f6f63;
  --accent-dark: #24564d;
  --accent-soft: #dfeeea;
  --danger: #a63d34;
  --danger-soft: #f6e3e0;
  --warning: #8a5a00;
  --warning-soft: #fff4d6;
  --shadow: 0 8px 22px rgba(31, 37, 35, 0.06);
  --font-ui: "IBM Plex Sans", "Avenir Next", "Aptos", Inter, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-display: "Avenir Next", "IBM Plex Sans", "Aptos Display", Inter,
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-data: "IBM Plex Mono", "SF Mono", "Roboto Mono", Menlo, Monaco,
    Consolas, monospace;
}

/* Two-page dashboard/project UI. Previous success: keep AJ-New-Code self-contained
   and do not edit the professional formul8r folder for demo-only UI changes. */
/* Success: use local font stacks only so the demo's lab-tech typography does
   not depend on Google Fonts, CDNs, or any external request during client demos. */
.app-page-header {
  max-width: 1320px;
  margin: 0 auto;
}

.dashboard-section,
.project-page > .project-tab-list,
.project-page > .lock-message,
.project-page > .project-panel {
  max-width: 1320px;
  margin-right: auto;
  margin-left: auto;
}

.project-page-header {
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0 24px;
  border-bottom: 1px solid var(--line);
}

.project-page-header h1 {
  margin: 8px 0 0;
  font-size: 2.35rem;
  line-height: 1.08;
}

.project-page-header p:last-child {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
}

.back-link {
  min-height: auto;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
}

.project-tab-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 20px 0 0;
}

.project-tab {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.project-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.project-tab.is-locked {
  border-style: dashed;
  background: #f6f8f7;
  color: #8b9691;
}

.lock-message {
  min-height: 28px;
  padding: 10px 0 0;
  color: var(--warning);
  font-weight: 800;
}

.project-panel {
  padding: 22px 0 40px;
}

.panel-heading {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.65rem;
}

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

.brief-form,
.feedback-form {
  max-width: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(31, 37, 35, 0.28);
}

.modal-card {
  width: min(100%, 440px);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 46px rgba(31, 37, 35, 0.16);
}

.modal-card h2 {
  margin: 0 0 18px;
  font-size: 1.45rem;
}

.modal-kicker {
  margin: 0 0 8px;
  color: var(--warning);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.privacy-modal-card {
  width: min(100%, 520px);
}

.privacy-modal-copy,
.privacy-modal-warning {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.5;
}

.privacy-modal-warning {
  padding: 12px 14px;
  border: 1px solid rgba(138, 90, 0, 0.24);
  border-radius: 6px;
  background: var(--warning-soft);
  color: var(--warning);
}

.privacy-modal-actions {
  justify-content: flex-end;
}

.modal-heading-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-close-action {
  flex: 0 0 auto;
}

.aio-feedback-card {
  width: min(100%, 760px);
  max-height: min(86vh, 760px);
  overflow: auto;
}

.aio-feedback-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.feedback-empty-state {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 800;
}

.aio-feedback-project {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  overflow: hidden;
}

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

.aio-feedback-project-header h3 {
  margin: 0;
  font-size: 1rem;
}

.aio-feedback-project-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-weight: 750;
}

.aio-feedback-items {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.aio-feedback-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
}

.aio-feedback-score {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.aio-feedback-score strong {
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1;
}

.aio-feedback-score span,
.feedback-saved-at {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.aio-feedback-copy {
  min-width: 0;
}

.feedback-saved-at {
  margin: 0 0 8px;
}

.aio-feedback-copy dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.aio-feedback-copy dt {
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
}

.aio-feedback-copy dd {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.modal-card label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

.modal-card input,
.modal-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.modal-card input {
  min-height: 48px;
  padding: 0 13px;
}

.modal-card textarea {
  padding: 12px 13px;
}

.related-formula-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.related-formula-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.related-formula-card h3,
.feedback-question h3 {
  margin: 6px 0 0;
  font-size: 1.1rem;
}

.related-formula-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.feedback-question {
  display: grid;
  gap: 8px;
}

.feedback-question textarea {
  width: 100%;
  min-height: 108px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.rating-control {
  align-items: center;
}

@media (max-width: 840px) {
  .project-tab-list,
  .project-card,
  .project-record-main,
  .related-formula-card {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .project-page-header {
    display: grid;
  }
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body:has(#dashboard-screen:not(.hidden)) {
  background: #f3f6f4;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.app-shell {
  width: 100%;
  margin: 0 auto;
  padding: 24px 28px;
}

.auth-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: calc(100vh - 72px);
}

.auth-stack {
  width: min(100%, 460px);
  margin: 0 auto;
}

.auth-page-title,
.dashboard-header h1 {
  max-width: 720px;
  margin: 0;
  font-size: 2.05rem;
  line-height: 1.12;
  letter-spacing: 0;
  text-align: center;
}

.auth-page-title {
  margin-bottom: 22px;
  font-size: 2.4rem;
}

.detail-header h1 {
  margin: 0;
  font-size: 2.05rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.auth-intro p,
.dashboard-header p {
  max-width: 620px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.demo-note {
  display: grid;
  gap: 4px;
  width: min(100%, 420px);
  margin-top: 30px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
}

.demo-note strong {
  color: var(--ink);
}

.auth-panel,
.project-card,
.placeholder-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: none;
}

.auth-panel {
  padding: 30px;
}

.auth-panel .auth-form {
  margin-top: 24px;
}

.demo-credentials {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
  text-align: center;
}

.demo-credentials strong {
  color: var(--ink);
}

.tab-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: 8px;
  background: var(--surface-muted);
}

.tab-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab-button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.auth-form label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.auth-form input,
.brief-form input[type="file"],
.brief-form textarea,
.feedback-form textarea,
.editor-notes-panel textarea,
.assistant-prompt-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
  color: var(--ink);
}

.auth-form input {
  min-height: 46px;
  padding: 0 13px;
}

.brief-form input[type="file"] {
  min-height: 48px;
  padding: 12px;
}

.brief-form textarea {
  min-height: 280px;
  padding: 15px;
  resize: vertical;
}

.feedback-form textarea {
  min-height: 112px;
  padding: 14px;
  resize: vertical;
}

.editor-notes-panel textarea,
.assistant-prompt-panel textarea {
  min-height: 104px;
  padding: 12px;
  resize: vertical;
}

.assistant-prompt-panel textarea {
  background: #f6f8f7;
  color: var(--muted);
}

.auth-form input:focus-visible,
.brief-form input[type="file"]:focus-visible,
.brief-form textarea:focus-visible,
.feedback-form textarea:focus-visible,
.feedback-form input:focus-visible,
.editor-notes-panel textarea:focus-visible,
.assistant-prompt-panel textarea:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(47, 111, 99, 0.28);
  outline-offset: 2px;
}

.primary-action,
.secondary-action,
.text-action {
  min-height: 48px;
  border-radius: 6px;
  font-weight: 800;
}

.primary-action {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
}

.primary-action:hover {
  background: var(--accent-dark);
}

.primary-action:disabled {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--muted);
}

.secondary-action {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.secondary-action:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.secondary-action:disabled,
.secondary-action:disabled:hover {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--muted);
}

.disabled-action,
.disabled-action:hover {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--muted);
}

.text-action {
  width: fit-content;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--accent-soft);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.92rem;
}

.error-message {
  color: var(--danger);
}

.error-message:not(:empty) {
  padding: 10px 12px;
  border: 1px solid rgba(166, 61, 52, 0.24);
  border-radius: 6px;
  background: var(--danger-soft);
}

.success-message:not(:empty),
.warning-message:not(:empty) {
  padding: 10px 12px;
  border-radius: 6px;
}

.success-message:not(:empty) {
  border: 1px solid rgba(47, 111, 99, 0.24);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.warning-message:not(:empty) {
  border: 1px solid rgba(138, 90, 0, 0.26);
  background: var(--warning-soft);
  color: var(--warning);
}

.hidden {
  display: none !important;
}

.dashboard,
.detail-screen {
  min-height: calc(100vh - 72px);
}

.dashboard-header,
.detail-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 26px 0 34px;
  border-bottom: 1px solid var(--line);
}

.dashboard-header {
  align-items: center;
  padding: 18px 0 24px;
}

.workflow-progress {
  padding: 14px 0 0;
}

.workflow-step-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  margin: 0;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.workflow-step {
  display: flex;
  gap: 7px;
  align-items: center;
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.workflow-step span {
  display: grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 900;
}

.workflow-step strong {
  overflow-wrap: anywhere;
  font-size: 0.84rem;
}

.workflow-step.is-complete {
  background: transparent;
  color: var(--accent-dark);
}

.workflow-step.is-complete span {
  border-color: var(--accent-soft);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.workflow-step.is-current {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

.workflow-step.is-current span {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

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

.dashboard-header .primary-action,
.dashboard-header .secondary-action,
.detail-header .secondary-action {
  min-width: 110px;
  padding: 0 18px;
}

.dashboard-section {
  padding: 22px 0 34px;
}

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

.section-heading h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0;
}

.section-heading p {
  max-width: 400px;
  margin: 0;
  color: var(--muted);
}

.project-list,
.placeholder-grid,
.workspace-preview,
.related-formula-list,
.assistant-suggestion-list {
  display: grid;
  gap: 18px;
}

.project-list {
  grid-template-columns: 1fr;
  gap: 10px;
}

.project-card,
.placeholder-panel {
  padding: 22px;
  box-shadow: none;
}

.project-card {
  display: grid;
  grid-template-columns: minmax(170px, 0.25fr) minmax(0, 1fr) minmax(160px, auto);
  gap: 18px;
  align-items: center;
  min-height: 112px;
  padding: 18px 20px;
  background: #ffffff;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.project-card:hover {
  border-color: rgba(47, 111, 99, 0.32);
  box-shadow: 0 10px 24px rgba(31, 37, 35, 0.06);
  transform: translateY(-1px);
}

.project-card-topline {
  display: grid;
  gap: 10px;
  align-items: start;
  justify-content: start;
  color: var(--muted);
  font-size: 0.82rem;
}

.status-chip {
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid #bfd7e6;
  border-radius: 999px;
  background: #ecf6fb;
  color: #2e5c73;
  font-weight: 800;
}

.project-updated {
  color: var(--muted);
  font-weight: 700;
}

.project-record-main {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.project-card h3,
.placeholder-panel h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0;
}

.project-card p,
.placeholder-panel p,
.detail-header p {
  color: var(--muted);
}

.project-card p {
  margin: 0;
}

.project-category {
  color: var(--accent-dark) !important;
  font-size: 0.9rem;
  font-weight: 800;
}

.project-record-footer {
  display: grid;
  gap: 10px;
  justify-items: end;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.project-card .text-action {
  width: auto;
  min-width: 118px;
  margin: 0;
  background: var(--accent-soft);
}

.placeholder-grid,
.brief-layout,
.feedback-layout,
.workspace-preview {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 28px 0;
}

.placeholder-panel {
  min-height: 220px;
}

.placeholder-panel p {
  margin: 12px 0 0;
}

.brief-layout {
  display: grid;
  gap: 18px;
}

.feedback-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
}

.brief-form,
.feedback-form,
.brief-guidance {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: none;
}

.brief-form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.brief-entry-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
}

.brief-entry-actions span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.brief-entry-actions strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 0.95rem;
}

#manual-brief-button {
  border-color: rgba(35, 201, 133, 0.55);
  background: rgba(35, 201, 133, 0.16);
  color: var(--accent-dark);
  font-weight: 900;
}

#manual-brief-button:hover,
#manual-brief-button:focus-visible {
  border-color: rgba(35, 201, 133, 0.78);
  background: rgba(35, 201, 133, 0.24);
  color: var(--ink);
}

.manual-brief-card {
  width: min(94vw, 1080px);
  max-height: min(90vh, 820px);
  overflow: auto;
}

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

.manual-brief-grid label:first-child,
.manual-brief-grid label:nth-child(6) {
  grid-column: 1 / -1;
}

.manual-brief-grid label {
  display: grid;
  gap: 9px;
  margin: 0;
}

.manual-brief-grid span {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 850;
}

.manual-brief-grid input,
.manual-brief-grid textarea {
  font-size: 1rem;
  line-height: 1.45;
}

.manual-brief-grid textarea {
  min-height: 132px;
  resize: vertical;
}

@media (max-width: 720px) {
  .brief-entry-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .brief-entry-actions .secondary-action {
    width: 100%;
  }

  .manual-brief-grid {
    grid-template-columns: 1fr;
  }
}

.feedback-form {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.brief-form label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 800;
}

.brief-upload-field {
  display: grid;
  gap: 8px;
}

.file-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.download-brief-file {
  justify-self: start;
  min-height: 40px;
  padding: 0 14px;
}

.feedback-question {
  display: grid;
  gap: 10px;
  margin: 0;
}

.feedback-question h2 {
  margin: 8px 0 0;
  font-size: 1.2rem;
  letter-spacing: 0;
}

.feedback-question label,
.trust-fieldset legend,
.rating-control label {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 800;
}

.rating-control {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(160px, 2fr) 48px;
  gap: 12px;
  align-items: center;
}

.rating-control input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.rating-range-wrap {
  display: grid;
  gap: 6px;
}

.rating-scale-labels {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.rating-control output {
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 1.1rem;
  font-weight: 900;
}

.trust-fieldset {
  padding: 0;
  border: 0;
}

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

.radio-card {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.radio-card:has(input:checked) {
  border-color: var(--accent);
  background: #f6fbf9;
  box-shadow: 0 0 0 3px rgba(47, 111, 99, 0.12);
}

.field-help {
  margin: 0 0 12px;
  color: var(--muted);
}

.review-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.review-summary-strip article {
  min-height: auto;
  padding: 12px 14px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
}

.review-summary-strip article:last-child {
  border-right: 0;
}

.review-summary-strip span,
.feedback-preview dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.review-summary-strip strong,
.feedback-preview dd {
  display: block;
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 800;
}

.brief-analysis-results {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 16px;
}

.brief-analysis-results span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.brief-analysis-results p {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.45;
}

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

.brief-analysis-meta article {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.brief-analysis-meta strong {
  color: var(--ink);
}

.brief-analysis-lists ul {
  min-height: 40px;
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-weight: 700;
}

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

.form-actions .primary-action,
.form-actions .secondary-action {
  padding: 0 18px;
}

.brief-guidance {
  align-self: start;
  padding: 22px;
}

.brief-guidance h2 {
  margin: 12px 0 0;
  font-size: 1.25rem;
  letter-spacing: 0;
}

.brief-guidance ul {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  padding-left: 20px;
  color: var(--ink);
}

.brief-guidance p {
  margin: 0;
  color: var(--muted);
}

#workspace-brief-summary {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(270px, 0.78fr) minmax(0, 1.7fr);
  gap: 20px;
  padding: 28px 0;
  align-items: start;
}

.workspace-context,
.workspace-workbench {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: none;
}

.workspace-context {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.workspace-context h2,
.workbench-heading h2,
.formula-editor-summary h3,
.context-group h3 {
  margin: 0;
  letter-spacing: 0;
}

.workspace-context h2,
.workbench-heading h2 {
  margin-top: 10px;
  font-size: 1.35rem;
}

.workspace-status-line {
  margin: 0;
  color: var(--accent-dark);
  font-weight: 800;
}

.workspace-context p,
.workbench-heading p,
.related-formula-card p,
.assistant-suggestion-card p,
.editor-notes-panel p,
.assistant-prompt-panel p,
.assistant-selected-panel p {
  margin: 0;
  color: var(--muted);
}

.brief-summary-box {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.brief-summary-box span,
.formula-total-box span,
.context-group h3 {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.context-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 18px;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.spec-item {
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.spec-item span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.spec-item strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.workspace-workbench {
  padding: 22px;
}

.workbench-heading,
.formula-editor-summary {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
}

.formula-editor-actions {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.formula-editor-actions .primary-action {
  min-width: 132px;
  padding: 0 16px;
}

.workspace-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 20px 0;
  padding: 5px;
  border-radius: 8px;
  background: var(--surface-muted);
}

.workspace-tab {
  display: grid;
  gap: 2px;
  min-height: 56px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.tab-detail {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.workspace-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}

.workspace-tab.active .tab-detail {
  color: var(--accent-dark);
}

.workspace-panel {
  min-height: 430px;
}

.related-formula-list,
.assistant-suggestion-list {
  grid-template-columns: 1fr;
  gap: 12px;
}

.related-formula-card,
.assistant-suggestion-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.related-formula-card,
.assistant-suggestion-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: auto;
  padding: 16px;
}

.related-formula-card {
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.related-formula-card:hover {
  border-color: rgba(47, 111, 99, 0.45);
  transform: translateY(-1px);
}

.related-formula-card.selected {
  border-color: var(--accent);
  background: #f6fbf9;
  box-shadow: 0 0 0 3px rgba(47, 111, 99, 0.14);
}

.related-formula-header {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.formula-rank-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.rank-label {
  padding: 5px 8px;
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  background: #f6fbf9;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.match-score {
  min-width: 54px;
  color: var(--accent-dark);
  font-size: 1.2rem;
  text-align: right;
}

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

.formula-tag {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.related-formula-card.selected .formula-tag {
  border-color: var(--accent-soft);
  color: var(--accent-dark);
}

.related-formula-card h3,
.assistant-suggestion-card h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.assistant-note {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.formula-total-box {
  min-width: 130px;
  padding: 12px 14px;
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.formula-total-box.is-valid {
  border-color: rgba(47, 111, 99, 0.28);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.formula-total-box.is-warning {
  border-color: rgba(138, 90, 0, 0.34);
  background: var(--warning-soft);
  color: var(--warning);
}

.formula-total-box strong {
  display: block;
  margin-top: 4px;
  font-size: 1.25rem;
}

.formula-editor-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 12px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.formula-editor-metrics article {
  min-height: auto;
  padding: 12px 14px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
}

.formula-editor-metrics article:last-child {
  border-right: 0;
}

.formula-editor-metrics span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.formula-editor-metrics strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
}

.editor-notes-panel,
.assistant-prompt-panel,
.assistant-selected-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.editor-notes-panel {
  display: grid;
  gap: 12px;
  margin: 12px 0 0;
  padding: 16px;
}

.editor-notes-panel h3,
.assistant-prompt-panel h3,
.assistant-selected-panel h3 {
  margin: 6px 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.assistant-placeholder-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.assistant-prompt-panel,
.assistant-selected-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
}

.assistant-selected-panel {
  background: var(--surface-muted);
}

.assistant-suggestion-card.selected {
  border-color: var(--accent);
  background: #f6fbf9;
  box-shadow: 0 0 0 3px rgba(47, 111, 99, 0.14);
}

.formula-validation-status {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.formula-ingredient-list {
  margin-top: 12px;
  overflow-x: auto;
}

.formula-empty-state,
.generated-formula-preview,
.formula-version-empty,
.formula-version-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.formula-empty-state {
  display: grid;
  gap: 8px;
  padding: 22px;
  color: var(--muted);
}

.formula-empty-state strong {
  color: var(--ink);
}

.generated-formula-preview {
  display: grid;
  gap: 16px;
  margin: 16px 0;
  padding: 18px;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.generated-formula-preview .form-actions {
  margin: 0;
}

.formula-version-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.formula-version-empty,
.formula-version-card {
  padding: 12px;
  color: var(--muted);
}

.formula-version-card {
  display: grid;
  gap: 4px;
}

.formula-version-card strong {
  color: var(--ink);
}

.formula-version-card p {
  margin: 0;
}

.formula-editor-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border: 1px solid var(--line);
  border-radius: 8px;
  border-spacing: 0;
  background: var(--surface);
  overflow: hidden;
}

.formula-editor-table th,
.formula-editor-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.formula-editor-table th {
  background: #f4f7f5;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.formula-editor-table tr:last-child td {
  border-bottom: 0;
}

.formula-editor-table td:first-child {
  width: 15%;
}

.formula-editor-table td:nth-child(4) {
  width: 27%;
}

.formula-editor-table td:nth-child(5) {
  width: 12%;
}

.formula-editor-table input,
.formula-editor-table textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.formula-editor-table input {
  min-height: 42px;
  padding: 0 10px;
  text-align: right;
}

.formula-editor-table textarea {
  min-width: 0;
  min-height: 62px;
  padding: 9px 10px;
  resize: vertical;
}

.formula-editor-table input[aria-invalid="true"] {
  border-color: var(--warning);
  background: var(--warning-soft);
}

.ingredient-inci {
  color: var(--accent-dark) !important;
  font-size: 0.9rem;
  font-weight: 800;
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.45fr);
  gap: 20px;
  padding: 28px 0;
  align-items: start;
}

.review-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: none;
  padding: 22px;
}

.review-panel h2,
.review-panel h3 {
  margin: 10px 0 0;
  letter-spacing: 0;
}

.review-panel h2 {
  font-size: 1.35rem;
}

.review-panel h3 {
  font-size: 1.05rem;
}

.review-panel p,
.review-formula-row p,
.review-checkpoint-note,
.feedback-learning-note,
.feedback-guidance p {
  color: var(--muted);
}

.review-checkpoint-note,
.feedback-learning-note {
  margin: 8px 0 0;
}

.chemist-checklist {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  background: #f6fbf9;
}

.chemist-checklist ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.chemist-checklist li {
  color: var(--ink);
}

#review-brief-summary {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.review-panel-heading {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
}

.review-formula-summary-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.review-summary-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
}

.review-formula-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.review-percent {
  color: var(--accent-dark);
  font-size: 1rem;
  text-align: right;
}

.review-actions {
  margin-top: 18px;
}

.feedback-preview {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.feedback-preview h2 {
  margin: 6px 0 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.feedback-preview dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.feedback-preview dl div {
  min-height: auto;
  padding: 10px 12px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
}

.feedback-preview dl div:last-child {
  border-right: 0;
}

.feedback-preview dd {
  margin-left: 0;
}

.feedback-guidance {
  max-width: 620px;
}

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

.workspace-card {
  display: flex;
  flex-direction: column;
  min-height: 280px;
  padding: 22px;
  box-shadow: none;
}

.card-kicker {
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.workspace-card h2 {
  margin: 12px 0 0;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.workspace-card p {
  margin: 12px 0 20px;
  color: var(--muted);
}

.workspace-card .text-action {
  margin-top: auto;
}

.session-list {
  display: grid;
  gap: 12px;
  margin: auto 0 0;
}

.session-list div {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.session-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.session-list dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
}

@media (max-width: 840px) {
  .app-shell {
    width: min(100% - 24px, 680px);
    padding: 24px 0;
  }

  .auth-layout {
    min-height: calc(100vh - 48px);
  }

  .auth-page-title,
  .dashboard-header h1 {
    font-size: 2.35rem;
  }

  .detail-header h1 {
    font-size: 1.9rem;
  }

  .dashboard-header {
    display: grid;
  }

  .detail-header {
    display: grid;
  }

  .header-actions,
  .dashboard-header .primary-action,
  .dashboard-header .secondary-action,
  .detail-header .secondary-action {
    width: 100%;
  }

  .header-actions {
    display: grid;
  }

  .project-list,
  .placeholder-grid,
  .brief-layout,
  .feedback-layout,
  .formula-editor-metrics,
  .review-summary-strip,
  .feedback-preview dl,
  .workspace-preview,
  .workspace-layout,
  .assistant-placeholder-layout,
  .related-formula-list,
  .assistant-suggestion-list {
    grid-template-columns: 1fr;
  }

  .project-card,
  .project-record-main {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .project-record-footer {
    justify-items: start;
  }

  .workflow-step-list {
    gap: 8px 12px;
  }

  .formula-editor-metrics article,
  .review-summary-strip article,
  .feedback-preview dl div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .formula-editor-metrics article:last-child,
  .review-summary-strip article:last-child,
  .feedback-preview dl div:last-child {
    border-bottom: 0;
  }

  .section-heading {
    display: grid;
    align-items: start;
  }

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

  .workbench-heading,
  .formula-editor-summary,
  .review-panel-heading {
    display: grid;
  }

  .formula-editor-actions,
  .review-layout {
    grid-template-columns: 1fr;
  }

  .formula-editor-actions {
    display: grid;
  }

  .rating-control,
  .choice-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .auth-panel {
    padding: 22px;
  }

  .auth-page-title {
    font-size: 2rem;
  }

  .dashboard-header .secondary-action,
  .dashboard-header .primary-action,
  .detail-header .secondary-action {
    width: 100%;
  }

  .project-card-topline {
    display: grid;
    justify-content: start;
  }

  .status-chip {
    max-width: 100%;
  }

  .workspace-tabs {
    grid-template-columns: 1fr;
  }

  .workflow-step-list {
    grid-template-columns: 1fr;
  }

  .review-formula-row,
  .spec-grid {
    grid-template-columns: 1fr;
  }

  .formula-ingredient-list {
    overflow-x: visible;
  }

  .formula-editor-table {
    min-width: 0;
    border: 0;
    background: transparent;
  }

  .formula-editor-table thead {
    display: none;
  }

  .formula-editor-table,
  .formula-editor-table tbody,
  .formula-editor-table tr,
  .formula-editor-table td {
    display: block;
    width: 100%;
  }

  .formula-editor-table tr {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
  }

  .formula-editor-table td {
    display: grid;
    grid-template-columns: minmax(94px, 0.36fr) minmax(0, 1fr);
    gap: 10px;
    border-bottom: 1px solid var(--line);
  }

  .formula-editor-table td:last-child {
    border-bottom: 0;
  }

  .formula-editor-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  .formula-editor-table input {
    text-align: left;
  }

  .review-percent {
    text-align: left;
  }
}

/* Final overrides for the two-page dashboard/project rebuild. */
.dashboard-section,
.project-page > .project-tab-list,
.project-page > .lock-message,
.project-page > .project-panel,
.app-page-header {
  max-width: 1320px;
  margin-right: auto;
  margin-left: auto;
}

.project-page-header {
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0 24px;
  border-bottom: 1px solid var(--line);
}

.project-tab-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 20px 0 0;
}

.project-tab {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.project-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.project-tab.is-locked {
  border-style: dashed;
  background: #f6f8f7;
  color: #8b9691;
}

.project-panel {
  padding: 22px 0 40px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(31, 37, 35, 0.28);
}

.modal-card {
  width: min(100%, 440px);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 46px rgba(31, 37, 35, 0.16);
}

.modal-card input,
.feedback-question textarea {
  width: 100%;
}

.related-formula-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 840px) {
  .project-tab-list,
  .project-card,
  .project-record-main,
  .related-formula-card {
    grid-template-columns: 1fr;
  }
}

/* Clean lab software pass. */
@keyframes surfaceIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

h1,
h2,
h3,
.auth-page-title,
.dashboard-header h1,
.project-page-header h1,
.panel-heading h2,
.section-heading h2 {
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font-family: var(--font-ui);
}

.eyebrow,
.status-chip,
.project-updated,
.project-category,
.project-record-footer,
.review-summary-strip span,
.feedback-preview dt,
.brief-summary-box span,
.formula-total-box span,
.context-group h3,
.spec-item span,
.rank-label,
.formula-tag,
.formula-editor-metrics span,
.formula-validation-status,
.formula-editor-table th,
.ingredient-row label,
.review-formula-table th {
  font-family: var(--font-data);
  font-weight: 650;
  letter-spacing: 0;
}

.match-score,
.formula-total-box strong,
.formula-editor-metrics strong,
.rating-control output,
.formula-editor-table input,
.review-percent,
.review-formula-table td:last-child {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
}

.dashboard:not(.hidden),
.project-page:not(.hidden),
.auth-layout:not(.hidden) {
  animation: surfaceIn 180ms ease-out;
}

.app-shell {
  background: #f7faf8;
}

.dashboard-header,
.project-page-header {
  padding-top: 16px;
  padding-bottom: 18px;
}

.dashboard-header h1,
.project-page-header h1 {
  font-size: clamp(2rem, 3.3vw, 3rem);
}

.dashboard-section {
  padding-top: 22px;
}

.section-heading {
  margin-bottom: 12px;
}

.dashboard-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.dashboard-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-controls input,
.dashboard-controls select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  text-transform: none;
}

.dashboard-controls input {
  padding: 0 12px;
}

.dashboard-controls select {
  padding: 0 10px;
}

.section-heading h2 {
  font-size: 1.35rem;
}

.project-list {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.project-card {
  grid-template-columns: 180px minmax(0, 1fr) 138px;
  min-height: 86px;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  transform: none;
}

.project-card:last-child {
  border-bottom: 0;
}

.project-card.is-archived {
  background: #fafafa;
}

.project-card:hover,
.project-card:focus-visible {
  background: #fbfdfc;
  border-color: var(--line);
  box-shadow: none;
  transform: none;
}

.project-card-topline {
  gap: 8px;
}

.status-chip {
  width: fit-content;
  border-radius: 999px;
  background: #eef7f5;
  color: var(--accent-dark);
}

.project-record-main {
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 24px;
}

.project-card h3 {
  font-size: 1.08rem;
}

.project-card p {
  font-size: 0.96rem;
}

.project-record-footer {
  justify-items: end;
}

.project-card .text-action {
  min-height: 38px;
  min-width: 112px;
  padding: 0 12px;
  border: 1px solid transparent;
  background: #e8f3f0;
}

.project-card .archive-project {
  background: #f5f2ef;
  color: #7a5b3f;
}

.project-card .text-action:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.project-empty-state {
  padding: 20px;
  color: var(--muted);
  font-weight: 800;
}

.related-formula-loading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 104px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--ink);
}

.loading-spinner {
  width: 24px;
  height: 24px;
  margin-top: 2px;
  flex: 0 0 24px;
  border: 3px solid #d8e8e4;
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: formula-loading-spin 850ms linear infinite;
}

.related-formula-loading-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.related-formula-loading-copy strong {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 1rem;
}

.related-formula-loading-copy > span {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
}

.loading-dots {
  display: inline-flex;
  gap: 3px;
}

.loading-dots span {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
  animation: formula-loading-dot 1s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 140ms;
}

.loading-dots span:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes formula-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes formula-loading-dot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-spinner,
  .loading-dots span {
    animation: none;
  }
}

.project-page-status,
#project-page-status {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 8px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef7f5;
  color: var(--accent-dark);
  letter-spacing: 0;
  text-transform: none;
}

.project-tab-list {
  display: flex;
  gap: 24px;
  padding: 16px 0 0;
  border-bottom: 1px solid var(--line);
}

.project-tab {
  min-height: 42px;
  padding: 0 0 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  transition:
    color 140ms ease,
    box-shadow 140ms ease;
}

.project-tab.active {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.project-tab.is-locked {
  background: transparent;
  color: #9aa4a0;
  box-shadow: none;
}

.lock-message {
  min-height: 0;
  padding-top: 8px;
  font-size: 0.9rem;
}

.lock-message:empty {
  display: none;
}

.project-panel {
  padding-top: 22px;
  animation: surfaceIn 160ms ease-out;
}

.panel-heading {
  margin-bottom: 14px;
}

.panel-heading h2 {
  font-size: 1.45rem;
}

.panel-heading p,
.feedback-panel .panel-heading p {
  display: none;
}

.brief-form {
  gap: 14px;
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(290px, 0.8fr) minmax(0, 1.35fr);
  gap: 16px;
  padding: 0;
  align-items: start;
}

.related-formula-pane,
.workspace-workbench,
.workspace-context,
.workspace-notes {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.workspace-context,
.workspace-notes {
  margin-top: 0;
}

.workspace-notes textarea {
  width: 100%;
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.pane-heading,
.workbench-heading {
  margin-bottom: 14px;
}

.pane-heading h3,
.workbench-heading h3 {
  margin: 0;
  font-size: 1.1rem;
}

.related-formula-list {
  display: grid;
  gap: 10px;
}

.related-formula-card {
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.related-formula-card:hover {
  transform: translateY(-1px);
}

.related-formula-card.is-selected {
  border-color: var(--accent);
  background: #f2faf8;
}

.related-formula-card .secondary-action {
  width: fit-content;
  min-height: 36px;
  padding: 0 12px;
}

.related-formula-content {
  display: grid;
  gap: 10px;
}

.related-reason-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.related-warning-list {
  display: grid;
  gap: 6px;
}

.related-warning-list span {
  border: 1px solid #e3b7a9;
  border-radius: 6px;
  padding: 8px 10px;
  color: #8a3e2e;
  background: #fff3ef;
  font-size: 0.86rem;
}

.related-score-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.related-score-breakdown span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.formula-editor-metrics {
  margin-bottom: 14px;
}

.formula-ingredient-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ingredient-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 16px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.ingredient-row:last-child {
  border-bottom: 0;
}

.ingredient-row h3 {
  margin: 2px 0 0;
  font-size: 0.98rem;
}

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

.ingredient-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ingredient-row input {
  min-height: 38px;
  padding: 0 8px;
  text-align: right;
}

.review-layout {
  grid-template-columns: minmax(240px, 0.55fr) minmax(0, 1.45fr);
  gap: 16px;
  padding: 0;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 0;
}

.review-panel h3,
.review-panel h4 {
  margin-top: 6px;
}

.review-formula-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.review-formula-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.review-formula-table td {
  color: var(--ink);
  font-size: 0.92rem;
}

.review-formula-table td span {
  display: block;
  margin-top: 3px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.review-formula-table tr:last-child td {
  border-bottom: 0;
}

.feedback-form {
  gap: 16px;
  max-width: 860px;
}

.feedback-question h3 {
  margin: 0;
}

.panel-heading h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.project-panel[data-project-panel="brief"] .panel-heading,
.project-panel[data-project-panel="feedback"] .panel-heading {
  height: 0;
  margin: 0;
  overflow: hidden;
}

.project-panel[data-project-panel="workspace"] .panel-heading,
.project-panel[data-project-panel="generate"] .panel-heading,
.project-panel[data-project-panel="finalized"] .panel-heading {
  justify-content: flex-end;
}

.project-tab:focus-visible {
  outline: 0;
  box-shadow: 0 2px 0 rgba(47, 111, 99, 0.3);
}

.project-tab.active:focus-visible {
  box-shadow: inset 0 -2px 0 var(--accent), 0 2px 0 rgba(47, 111, 99, 0.2);
}

.historical-formulas-screen:not(.hidden) {
  max-width: 1320px;
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 36px 0 48px;
}

.historical-formulas-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--line);
}

.historical-formulas-header h1 {
  margin: 8px 0 0;
  font-size: 2.35rem;
  line-height: 1.08;
}

.historical-formulas-header p:last-child {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
}

.historical-formulas-section {
  padding: 22px 0 0;
}

.history-notice {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(138, 90, 0, 0.24);
  border-radius: 6px;
  background: var(--warning-soft);
  color: var(--warning);
  font-weight: 800;
}

.historical-formulas-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 0.75fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.historical-formula-list {
  display: grid;
  gap: 10px;
}

.historical-formula-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, auto);
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.historical-formula-card:hover,
.historical-formula-card:focus-visible,
.historical-formula-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(31, 37, 35, 0.06);
}

.historical-formula-card.is-selected {
  background: var(--accent-soft);
}

.historical-card-main {
  min-width: 0;
}

.historical-card-main h3 {
  margin: 5px 0 0;
  font-size: 1.08rem;
}

.historical-card-main p {
  margin: 5px 0 0;
  color: var(--muted);
}

.historical-card-meta {
  display: grid;
  gap: 4px;
  justify-items: end;
  color: var(--muted);
  font-family: var(--font-data);
}

.historical-card-meta strong {
  color: var(--ink);
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.historical-formula-detail {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 116px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.detail-empty-state {
  padding: 28px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.historical-detail-header h2 {
  margin: 6px 0 0;
  font-size: 1.45rem;
}

.historical-detail-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.history-detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.history-detail-summary article {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-right: 1px solid var(--line);
}

.history-detail-summary article:last-child {
  border-right: 0;
}

.history-detail-summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.history-detail-summary strong {
  font-family: var(--font-data);
}

.historical-detail-tags {
  margin-bottom: 16px;
}

.historical-ingredient-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

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

.historical-ingredient-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.historical-ingredient-table td:last-child {
  width: 76px;
  font-family: var(--font-data);
  font-weight: 800;
  text-align: right;
}

.raw-material-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.raw-material-actions .secondary-action {
  width: 190px;
  min-height: 58px;
  text-align: center;
}

.raw-material-upload-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.raw-material-detail-table th {
  width: 132px;
}

.raw-material-detail-table td:last-child {
  width: auto;
  font-family: inherit;
  font-weight: 700;
  text-align: left;
}

.modal-card {
  animation: modalIn 140ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}

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

  .project-card,
  .project-record-main,
  .historical-formulas-header,
  .historical-formulas-layout,
  .historical-formula-card,
  .history-detail-summary,
  .workspace-layout,
  .generate-layout,
  .review-layout,
  .brief-analysis-meta,
  .brief-analysis-lists,
  .ingredient-row {
    grid-template-columns: 1fr;
  }

  .project-tab-list {
    gap: 14px;
    overflow-x: auto;
  }
}

/* Dark product UI pass. Previous success: keep this final layer additive so ticket-specific behavior stays intact. */
:root {
  color-scheme: dark;
  --bg: #07100e;
  --surface: #0f1c18;
  --surface-muted: #152720;
  --surface-raised: #13231f;
  --surface-strong: #182c25;
  --ink: #eef8f3;
  --muted: #93a8a0;
  --line: rgba(184, 248, 221, 0.16);
  --border: var(--line);
  --accent: #23c985;
  --accent-dark: #72e6b6;
  --accent-soft: rgba(35, 201, 133, 0.14);
  --danger: #ff887c;
  --danger-soft: rgba(255, 136, 124, 0.13);
  --warning: #f6c96d;
  --warning-soft: rgba(246, 201, 109, 0.14);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

html {
  background: #050b09;
}

body,
body:has(#dashboard-screen:not(.hidden)) {
  background:
    linear-gradient(120deg, rgba(35, 201, 133, 0.09), transparent 34%),
    linear-gradient(180deg, #0a1512 0%, #07100e 48%, #050b09 100%);
  color: var(--ink);
}

body::selection {
  background: rgba(35, 201, 133, 0.34);
}

.app-shell {
  position: relative;
  width: min(100%, 1600px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 34px 48px;
  background: transparent;
}

.dashboard:not(.hidden),
.project-page:not(.hidden),
.historical-formulas-screen:not(.hidden),
.auth-layout:not(.hidden) {
  position: relative;
  max-width: none;
  min-height: calc(100vh - 56px);
  padding: 30px;
  border: 1px solid rgba(184, 248, 221, 0.13);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(18, 36, 30, 0.88), rgba(8, 18, 15, 0.92)),
    #0b1512;
  box-shadow: var(--shadow);
}

.auth-layout:not(.hidden) {
  align-items: center;
}

.dashboard-section,
.project-page > .project-tab-list,
.project-page > .lock-message,
.project-page > .project-panel,
.app-page-header,
.historical-formulas-screen:not(.hidden) .app-page-header,
.historical-formulas-section {
  max-width: none;
}

.dashboard-header,
.project-page-header,
.historical-formulas-header {
  padding: 0 0 24px;
  border-bottom: 1px solid var(--line);
}

.dashboard-header h1,
.project-page-header h1,
.historical-formulas-header h1,
.auth-page-title {
  color: var(--ink);
  font-weight: 720;
}

.dashboard-header h1,
.project-page-header h1,
.historical-formulas-header h1 {
  text-align: left;
}

.auth-page-title {
  text-align: center;
}

.dashboard-header p,
.project-page-header p:last-child,
.historical-formulas-header p:last-child,
.section-heading p,
.panel-heading p,
.project-card p,
.workspace-context p,
.workbench-heading p,
.related-formula-card p,
.review-panel p,
.historical-card-main p,
.historical-detail-header p,
.demo-credentials,
.privacy-modal-copy {
  color: var(--muted);
}

.header-actions {
  align-items: center;
}

.primary-action,
.secondary-action,
.text-action {
  border-radius: 12px;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.primary-action {
  border-color: rgba(35, 201, 133, 0.72);
  background: linear-gradient(135deg, #22c982, #189d69);
  color: #03110c;
  box-shadow: 0 12px 28px rgba(35, 201, 133, 0.18);
}

.primary-action:hover {
  background: linear-gradient(135deg, #43dda0, #23c985);
  transform: translateY(-1px);
}

.secondary-action,
.text-action,
.back-link {
  border-color: rgba(184, 248, 221, 0.14);
  background: rgba(238, 248, 243, 0.06);
  color: var(--ink);
}

.secondary-action:hover,
.text-action:hover,
.back-link:hover {
  border-color: rgba(35, 201, 133, 0.48);
  background: rgba(35, 201, 133, 0.12);
  color: var(--accent-dark);
}

.primary-action:disabled,
.secondary-action:disabled,
.secondary-action:disabled:hover {
  border-color: var(--line);
  background: rgba(238, 248, 243, 0.05);
  color: rgba(238, 248, 243, 0.42);
  box-shadow: none;
  transform: none;
}

.dashboard-controls input,
.dashboard-controls select,
.auth-form input,
.modal-card input,
.brief-form input[type="file"],
.brief-form textarea,
.feedback-form textarea,
.workspace-notes textarea,
.formula-editor-table input,
.formula-editor-table textarea,
.ingredient-row input,
textarea,
input,
select {
  border-color: rgba(184, 248, 221, 0.14);
  background: rgba(5, 13, 10, 0.48);
  color: var(--ink);
}

.dashboard-controls input::placeholder,
.auth-form input::placeholder,
.brief-form textarea::placeholder,
.feedback-form textarea::placeholder,
.workspace-notes textarea::placeholder {
  color: rgba(147, 168, 160, 0.72);
}

.auth-form input:focus-visible,
.dashboard-controls input:focus-visible,
.dashboard-controls select:focus-visible,
.brief-form input[type="file"]:focus-visible,
.brief-form textarea:focus-visible,
.feedback-form textarea:focus-visible,
.feedback-form input:focus-visible,
.workspace-notes textarea:focus-visible,
.formula-editor-table input:focus-visible,
.formula-editor-table textarea:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(35, 201, 133, 0.25);
  outline-offset: 2px;
}

.auth-panel,
.modal-card,
.project-list,
.project-card,
.placeholder-panel,
.brief-analysis-results,
.related-formula-pane,
.workspace-workbench,
.workspace-context,
.workspace-notes,
.review-panel,
.feedback-question,
.feedback-preview,
.historical-formula-card,
.historical-formula-detail,
.history-detail-summary,
.formula-editor-metrics,
.formula-ingredient-list,
.review-formula-table,
.brief-summary-box,
.spec-item,
.assistant-note,
.editor-notes-panel,
.assistant-prompt-panel,
.assistant-selected-panel {
  border-color: var(--line);
  background: rgba(15, 28, 24, 0.84);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
}

.project-list {
  gap: 0;
  overflow: hidden;
  border-radius: 18px;
}

.project-card {
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(35, 201, 133, 0.06), transparent 38%),
    rgba(15, 28, 24, 0.82);
}

.project-card:hover,
.project-card:focus-visible {
  background:
    linear-gradient(90deg, rgba(35, 201, 133, 0.12), transparent 42%),
    rgba(21, 39, 32, 0.96);
}

.project-card.is-archived {
  background: rgba(14, 22, 19, 0.78);
}

.project-card h3,
.historical-card-main h3,
.related-formula-card h3,
.review-panel h3,
.feedback-question h3 {
  color: var(--ink);
}

.status-chip,
.project-page-status,
#project-page-status,
.rank-label,
.formula-tag,
.card-kicker {
  border-color: rgba(35, 201, 133, 0.25);
  background: rgba(35, 201, 133, 0.12);
  color: var(--accent-dark);
}

.project-category,
.ingredient-inci,
.review-formula-table td span,
.workspace-status-line {
  color: var(--accent-dark) !important;
}

.project-card .text-action,
.project-card .archive-project {
  border-color: rgba(184, 248, 221, 0.13);
  background: rgba(238, 248, 243, 0.06);
  color: var(--ink);
}

.project-card .archive-project {
  color: #e6c896;
}

.dashboard-controls label,
.auth-form label,
.modal-card label,
.ingredient-row label,
.rating-control label,
.file-status,
.project-updated,
.historical-card-meta,
.formula-editor-metrics span,
.brief-analysis-results span,
.brief-analysis-meta span,
.brief-analysis-lists span,
.history-detail-summary span,
.historical-ingredient-table th,
.review-formula-table th {
  color: var(--muted);
}

.project-tab-list {
  gap: 10px;
  padding: 18px 0;
  border-bottom-color: var(--line);
}

.project-tab {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(184, 248, 221, 0.12);
  border-radius: 999px;
  background: rgba(238, 248, 243, 0.05);
  color: var(--muted);
}

.project-tab.active {
  border-color: rgba(35, 201, 133, 0.5);
  background: rgba(35, 201, 133, 0.14);
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px rgba(35, 201, 133, 0.08);
}

.project-tab.is-locked {
  background: rgba(238, 248, 243, 0.03);
  color: rgba(147, 168, 160, 0.58);
}

.brief-form,
.feedback-form {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(15, 28, 24, 0.72);
}

.brief-analysis-results {
  border-radius: 16px;
}

.brief-analysis-meta article,
.history-detail-summary article,
.feedback-preview dl div,
.formula-editor-metrics article,
.ingredient-row,
.review-formula-table th,
.review-formula-table td,
.historical-ingredient-table th,
.historical-ingredient-table td {
  border-color: var(--line);
}

.brief-analysis-meta article,
.spec-item,
.formula-editor-metrics article,
.history-detail-summary article {
  background: rgba(238, 248, 243, 0.035);
}

.brief-analysis-lists ul,
.chemist-checklist li,
.session-list dd,
.historical-card-meta strong,
.history-detail-summary strong,
.formula-editor-metrics strong,
.brief-analysis-meta strong,
.review-formula-table td,
.historical-ingredient-table td {
  color: var(--ink);
}

.workspace-layout {
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.36fr);
  gap: 18px;
}

.generate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.36fr) minmax(280px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.selection-status {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.related-formula-pane,
.workspace-workbench,
.workspace-context,
.workspace-notes,
.review-panel,
.historical-formula-detail {
  border-radius: 18px;
}

.related-formula-card,
.assistant-suggestion-card,
.historical-formula-card {
  border-color: rgba(184, 248, 221, 0.13);
  border-radius: 16px;
  background: rgba(238, 248, 243, 0.045);
}

.related-formula-card:hover,
.historical-formula-card:hover,
.historical-formula-card:focus-visible {
  border-color: rgba(35, 201, 133, 0.46);
  background: rgba(35, 201, 133, 0.08);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.2);
}

.related-formula-card.is-selected,
.related-formula-card.selected,
.assistant-suggestion-card.selected,
.historical-formula-card.is-selected {
  border-color: rgba(35, 201, 133, 0.62);
  background: rgba(35, 201, 133, 0.13);
  box-shadow: 0 0 0 3px rgba(35, 201, 133, 0.1);
}

.related-warning-list span,
.privacy-modal-warning,
.history-notice,
.warning-message:not(:empty) {
  border-color: rgba(246, 201, 109, 0.24);
  background: var(--warning-soft);
  color: var(--warning);
}

.success-message:not(:empty),
.assistant-note {
  border-color: rgba(35, 201, 133, 0.24);
  background: rgba(35, 201, 133, 0.1);
  color: var(--accent-dark);
}

.error-message:not(:empty) {
  border-color: rgba(255, 136, 124, 0.24);
  background: var(--danger-soft);
  color: var(--danger);
}

.formula-total-box,
.formula-total-box.is-valid {
  border-color: rgba(35, 201, 133, 0.32);
  background: rgba(35, 201, 133, 0.12);
  color: var(--accent-dark);
}

.formula-total-box.is-warning,
.formula-editor-table input[aria-invalid="true"] {
  border-color: rgba(246, 201, 109, 0.34);
  background: var(--warning-soft);
  color: var(--warning);
}

.formula-ingredient-list,
.review-formula-table {
  background: rgba(5, 13, 10, 0.28);
}

.ingredient-row {
  background: transparent;
}

.ingredient-row label {
  min-width: 0;
}

.ingredient-row input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.formula-editor-table th,
.review-formula-table th {
  background: rgba(238, 248, 243, 0.04);
}

.related-formula-loading {
  border-color: rgba(35, 201, 133, 0.2);
  border-radius: 16px;
  background: rgba(35, 201, 133, 0.08);
  color: var(--ink);
}

.loading-spinner {
  border-color: rgba(35, 201, 133, 0.18);
  border-top-color: var(--accent);
}

.loading-dots span {
  background: var(--accent);
}

.modal-backdrop {
  background: rgba(2, 7, 5, 0.68);
  backdrop-filter: blur(10px);
}

.modal-card {
  border-radius: 20px;
  background: rgba(15, 28, 24, 0.96);
}

.historical-formulas-layout {
  gap: 18px;
}

.historical-formula-detail {
  top: 28px;
}

.rating-control input[type="range"] {
  accent-color: var(--accent);
}

@media (max-width: 980px) {
  .app-shell {
    padding: 18px;
  }

  .dashboard:not(.hidden),
  .project-page:not(.hidden),
  .historical-formulas-screen:not(.hidden),
  .auth-layout:not(.hidden) {
    min-height: calc(100vh - 36px);
    padding: 20px;
    border-radius: 20px;
  }

  .dashboard-header,
  .project-page-header,
  .historical-formulas-header {
    display: grid;
  }

  .header-actions {
    flex-wrap: wrap;
  }
}

/* Neutral charcoal correction. Previous failure: page-level green tints made dark mode feel green instead of black/charcoal with green accents. */
:root {
  --bg: #060708;
  --surface: #121416;
  --surface-muted: #181b1d;
  --surface-raised: #1d2022;
  --surface-strong: #23282a;
  --ink: #f3f5f4;
  --muted: #9ea8aa;
  --line: rgba(231, 237, 234, 0.14);
  --border: var(--line);
  --accent: #23c985;
  --accent-dark: #62dca8;
  --accent-soft: rgba(35, 201, 133, 0.12);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
}

html {
  background: #050607;
}

body,
body:has(#dashboard-screen:not(.hidden)) {
  background:
    radial-gradient(circle at 85% 5%, rgba(255, 255, 255, 0.035), transparent 32%),
    linear-gradient(180deg, #101214 0%, #070809 48%, #050607 100%);
}

.dashboard:not(.hidden),
.project-page:not(.hidden),
.historical-formulas-screen:not(.hidden),
.auth-layout:not(.hidden) {
  border-color: rgba(231, 237, 234, 0.12);
  background:
    linear-gradient(180deg, rgba(24, 26, 28, 0.93), rgba(9, 10, 11, 0.96)),
    #0d0f10;
}

.auth-panel,
.modal-card,
.project-list,
.project-card,
.placeholder-panel,
.brief-analysis-results,
.related-formula-pane,
.workspace-workbench,
.workspace-context,
.workspace-notes,
.review-panel,
.feedback-question,
.feedback-preview,
.historical-formula-card,
.historical-formula-detail,
.history-detail-summary,
.formula-editor-metrics,
.formula-ingredient-list,
.review-formula-table,
.brief-summary-box,
.spec-item,
.assistant-note,
.editor-notes-panel,
.assistant-prompt-panel,
.assistant-selected-panel {
  background: rgba(18, 20, 22, 0.88);
}

.dashboard-controls input,
.dashboard-controls select,
.auth-form input,
.modal-card input,
.brief-form input[type="file"],
.brief-form textarea,
.feedback-form textarea,
.workspace-notes textarea,
.formula-editor-table input,
.formula-editor-table textarea,
.ingredient-row input,
textarea,
input,
select {
  border-color: rgba(231, 237, 234, 0.14);
  background: rgba(5, 6, 7, 0.58);
}

.secondary-action,
.text-action,
.back-link,
.project-card .text-action {
  border-color: rgba(231, 237, 234, 0.14);
  background: rgba(255, 255, 255, 0.06);
}

.project-card,
.project-card:hover,
.project-card:focus-visible,
.project-card.is-archived {
  background: rgba(18, 20, 22, 0.9);
}

.project-card:hover,
.project-card:focus-visible,
.historical-formula-card:hover,
.historical-formula-card:focus-visible,
.related-formula-card:hover {
  border-color: rgba(35, 201, 133, 0.42);
  background: rgba(25, 28, 30, 0.96);
}

.related-formula-card,
.assistant-suggestion-card,
.historical-formula-card,
.ingredient-row {
  background: rgba(255, 255, 255, 0.035);
}

.project-tab,
.workspace-tab,
.tab-button {
  background: rgba(255, 255, 255, 0.045);
}

.project-tab.active,
.workspace-tab.active,
.tab-button.active,
.related-formula-card.is-selected,
.related-formula-card.selected,
.assistant-suggestion-card.selected,
.historical-formula-card.is-selected {
  background: rgba(35, 201, 133, 0.1);
}

.related-formula-loading,
.success-message:not(:empty),
.assistant-note,
.formula-total-box,
.formula-total-box.is-valid {
  background: rgba(35, 201, 133, 0.09);
}

.formula-editor-table th,
.review-formula-table th,
.brief-analysis-meta article,
.spec-item,
.formula-editor-metrics article,
.history-detail-summary article {
  background: rgba(255, 255, 255, 0.035);
}

.modal-card {
  background: rgba(18, 20, 22, 0.97);
}

.aio-feedback-card {
  width: min(100%, 760px);
  max-height: min(86vh, 760px);
  overflow: auto;
}

@media (max-width: 640px) {
  .modal-heading-row,
  .aio-feedback-project-header,
  .aio-feedback-item {
    grid-template-columns: 1fr;
  }

  .modal-heading-row,
  .aio-feedback-project-header {
    display: grid;
  }

  .modal-close-action {
    width: 100%;
  }
}

/* Previous decision: remove the side rail so the project workspace has full horizontal room. */
.app-shell {
  padding-left: 34px;
}

@media (max-width: 980px) {
  .app-shell {
    padding: 18px;
  }
}

/* Previous failure: later modal-card overrides collapsed the manual brief modal back to a narrow 440px card. */
#manual-brief-modal {
  padding: 34px;
}

#manual-brief-modal .manual-brief-card {
  width: min(88vw, 1440px) !important;
  max-height: min(90vh, 920px);
  padding: 38px;
}

#manual-brief-modal .manual-brief-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px 28px;
}

#manual-brief-modal .manual-brief-grid label:first-child,
#manual-brief-modal .manual-brief-grid label:nth-child(6) {
  grid-column: 1 / -1;
}

#manual-brief-modal .manual-brief-grid input,
#manual-brief-modal .manual-brief-grid textarea {
  border-color: rgba(231, 237, 234, 0.18);
  background: rgba(5, 6, 7, 0.74);
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.5;
}

#manual-brief-modal .manual-brief-grid input {
  min-height: 58px;
}

#manual-brief-modal .manual-brief-grid textarea {
  min-height: 150px;
}

#manual-brief-modal .manual-brief-grid input::placeholder,
#manual-brief-modal .manual-brief-grid textarea::placeholder {
  color: rgba(243, 245, 244, 0.46);
}

@media (max-width: 900px) {
  #manual-brief-modal .manual-brief-grid {
    grid-template-columns: 1fr;
  }

  #manual-brief-modal .manual-brief-card {
    width: min(94vw, 760px) !important;
    padding: 26px;
  }
}
