html[data-project] {
  --project-rail: 232px;
  --project-current: #2e6050;
  --project-wash: #e3ede7;
  --project-surface: #fff;
  --project-inset: #edf3ef;
  --project-primary: #245746;
  --project-primary-hover: #194234;
  --bg-app: #e6ede9;
  --bg-subtle: var(--project-inset);
  --fs-body: 15px;
  --fs-sm: 13px;
  --fs-caption: 12px;
  --border-default: #d4dfd8;
  --border-subtle: #e5ebe7;
}

html[data-project] body { padding-left: var(--project-rail); }
html[data-project] .site-header { z-index: 40; border: 0; background: transparent; backdrop-filter: none; }
html[data-project] .nlm-only, html[data-project] .ws-hide, html[data-project] .chara,
html[data-mode="workshop"]:not([data-project]) .project-source-entry { display: none !important; }
html[data-project] .page-intro { padding: 0; border: 0; margin-bottom: 24px; }
html[data-project] .page-intro h1 { margin-top: 0; font-size: clamp(22px, 3vw, 28px); letter-spacing: 0; }
html[data-project] .sec-title { font-size: 18px; letter-spacing: 0; }
html[data-project] :is(.sec-title, .caution-head)::after { content: none; }
html[data-project] :is(.sec-title, .caution-head) .en { display: none; }
html[data-project] :is(.card, .note-row, .q-card, .stat, .tbl-wrap, .empty, .notice, .caution, .record-options, .rec-panel, .prepared-row) {
  border: 0;
  border-radius: 10px;
  box-shadow: none;
}
html[data-project] :is(.card:not(.q-hero, .stash-alert), .note-row, .q-card, .stat, .tbl-wrap, .empty) { background: var(--project-surface); }
html[data-project] :is(.q-card.flagged, .stash-alert) { background: var(--risk-bg); }
html[data-project] :is(.rec-panel, .record-options, .caution, .prepared-row, .card .stat) { background: var(--project-inset); }
html[data-project] :is(.card .tbl-wrap, .note-row .tbl-wrap) { background: var(--project-inset); }
html[data-project] :is(.prepared-group, .source-help, .q-editor, .ai-prompt, .site-footer) { border: 0; }
html[data-project] :is(.q-tabs, .q-tab, .tabs.top-tabs button, .badge) { border: 0; }
html[data-project] :is(.q-tab, .tabs.top-tabs button) { border-radius: 8px; background: var(--project-surface); }
html[data-project] :is(.q-tab[aria-selected="true"], .tabs.top-tabs button.on) { background: var(--project-primary); color: #fff; }
html[data-project] .q-tab-n { color: var(--project-primary); }
html[data-project] .tbl :is(th, td) { border: 0; }
html[data-project] .tbl tbody tr:nth-child(even) { background: var(--project-inset); }
html[data-project] .site-footer { background: var(--project-wash); padding-inline-end: 112px; }
html[data-project] .btn { border-radius: 8px; }
html[data-project] .btn-line { background: var(--project-inset); color: var(--project-primary); border-color: transparent; }
html[data-project] .btn-line:hover:not(:disabled) { background: var(--project-wash); color: var(--project-primary-hover); border-color: transparent; }
html[data-project] .btn-dark { background: var(--project-primary); border-color: var(--project-primary); }
html[data-project] .btn-dark:hover:not(:disabled) { background: var(--project-primary-hover); border-color: var(--project-primary-hover); }
html[data-project] .rec-btn:not(.on) { background: var(--project-primary); box-shadow: none; }
html[data-project] .rec-btn:not(.on):hover:not(:disabled) { background: var(--project-primary-hover); }
html[data-project] :is(.record-options, .caution) { border-radius: 8px; }
html[data-project] :is(.record-options[open] > summary, .steps, .steps li, .process-steps, .live-record-body) { border-block: 0; }
html[data-project] .steps { margin-top: 8px; }
html[data-project] .steps li { min-height: 32px; padding-block: 6px; }
html[data-project] .rec-safety { border: 0; border-radius: 8px; background: var(--project-wash); }
html[data-project] .pipe:not(.err, .hold) .pipe-bar > i { background-color: var(--project-primary); }

.rec-progress:not([hidden]) {
  display: block;
  width: 100%;
  height: 9px;
  margin-block: 20px 6px;
  accent-color: #245746;
}
#rec-progress-hint { margin-top: 8px; }

.passkey-settings .hint { margin-top: 8px; }
.passkey-settings .row { margin-top: 16px; }
.passkey-settings [role="status"]:not(:empty) { margin-top: 8px; }

html:has(.passkey-setup-dialog[open]) { overflow: hidden; }
.passkey-setup-dialog {
  width: min(440px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  padding: clamp(16px, 4vw, 24px);
  overflow: auto;
  border: 0;
  border-radius: 16px;
  background: var(--project-surface);
  color: var(--text-primary);
  box-shadow: 0 16px 48px #17302940;
}
.passkey-setup-dialog::backdrop { background: #17282091; }
.passkey-setup-dialog h2 { margin: 0 0 8px; font-size: 20px; }
.passkey-setup-dialog p { margin: 0; color: var(--text-secondary); }
.passkey-setup-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 12px;
  cursor: pointer;
}
.passkey-setup-choice input { accent-color: var(--project-primary); }
.passkey-setup-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.passkey-setup-dialog .passkey-setup-status:not(:empty) { margin-top: 8px; }

.project-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  width: var(--project-rail);
  height: 100dvh;
  padding: 24px 16px;
  overflow: auto;
  overscroll-behavior: contain;
  background: white;
}

.project-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-inline: 8px;
  margin-bottom: 24px;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.35;
}
.project-brand:hover { text-decoration: none; }
.project-brand-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  background: var(--ginkgo-wash);
  border-radius: 8px;
}
.project-brand-icon .ic, .project-page-link .ic { width: 19px; height: 19px; }
.project-switch-label { margin: 0 8px 8px; font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.project-current, .project-option, .project-page-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  color: var(--text-primary);
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
}
.project-current {
  justify-content: space-between;
  min-height: 48px;
  padding: 8px 12px;
  background: var(--project-wash);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
summary.project-current { cursor: pointer; list-style: none; }
summary.project-current::-webkit-details-marker { display: none; }
.project-switch[open] summary .ic { transform: rotate(180deg); }
.project-options { display: grid; gap: 2px; margin-top: 8px; padding: 4px; background: var(--project-inset); border-radius: 10px; }
.project-option { min-height: 44px; padding: 6px 8px; border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; }
.project-option[aria-current="true"] { justify-content: space-between; background: var(--project-wash); font-weight: 700; }
.project-option.project-add { color: var(--project-current); font-weight: 700; }
.project-options-status { padding: 8px; color: var(--text-secondary); font-size: 12px; overflow-wrap: anywhere; }
.project-pages { display: grid; gap: 4px; margin-block: 24px; }
.project-page-link { gap: 12px; min-height: 44px; padding: 8px 12px; font-size: 14px; font-weight: 700; }
.project-option:hover, .project-page-link:hover { background: var(--project-wash); text-decoration: none; }
.project-page-link[aria-current="page"] { background: var(--project-current); color: white; }
.project-page-link .nav-badge { position: static; flex: none; margin-left: auto; }
.project-account { display: grid; gap: 4px; margin-top: auto; }
.project-logout { color: var(--text-secondary); font-size: 13px; }
.project-mobile-bar, .project-drawer-shade, .project-icon-btn { display: none; }

.project-create {
  width: min(440px, calc(100% - 32px));
  color: var(--text-primary);
  border: 0;
  border-radius: 14px;
  background: white;
  padding: 24px;
  box-shadow: var(--shadow-modal, 0 12px 36px #26352d29);
}
.project-create::backdrop { background: #24362e77; }
.project-create form { display: grid; gap: 16px; }
.project-create h2 { font-size: 20px; }
.project-create .row { justify-content: flex-end; }
.project-create [role="status"]:empty { display: none; }
.project-create [role="alert"]:empty { display: none; }
.member-access-fields { margin-block: 12px; }
.member-access-role { display: inline-flex; gap: 10px; align-items: center; }
.member-access-role .input { width: auto; }
.member-access-fields fieldset { border: 0; padding: 0; margin: 10px 0 0; min-inline-size: 0; }
.member-access-fields legend { padding: 0; font-weight: 600; }
.member-project-options { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 6px; }
.member-access-fields [data-access-all] { margin-top: 6px; }

.live-records { margin-bottom: 36px; }
.live-record + .live-record, .live-record-more { margin-top: 8px; }
.live-record { padding: 0; }
.live-record > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 12px 16px;
  font-size: var(--fs-body);
  line-height: 1.45;
  list-style: none;
  cursor: pointer;
}
.live-record > summary::-webkit-details-marker { display: none; }
.live-record[open] > summary > .ic { transform: rotate(180deg); }
.live-record-label { display: grid; flex: 1; min-width: 0; gap: 3px; overflow-wrap: anywhere; }
.live-record-label small { font-size: var(--fs-caption); color: var(--text-secondary); }
.live-record > summary .badge { flex: none; }
.live-record-body { padding: var(--space-2) var(--space-4) var(--space-4); overflow-wrap: anywhere; }
.live-record-raw { margin-top: var(--space-3); font-size: var(--fs-sm); }
.live-record-notes[hidden] + .live-record-raw { margin-top: 0; }
.live-record-raw summary, .live-record-more > summary { color: var(--text-secondary); cursor: pointer; }
.live-record-raw > div { margin-top: 8px; white-space: pre-wrap; }
.live-record-more > summary { padding-block: 8px; }

@media (max-width: 1040px) {
  html[data-project] body { padding-left: 0; }
  html.project-drawer-open { overflow: hidden; }
  .project-sidebar { width: min(300px, 86vw); transform: translateX(-102%); visibility: hidden; }
  .project-sidebar.is-open { transform: none; visibility: visible; }
  .project-sidebar .project-brand { padding-right: 42px; }
  .project-drawer-shade { display: block; position: fixed; inset: 0; background: #24362e77; }
  .project-mobile-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 4px 16px;
    background: white;
    font-size: 15px;
    font-weight: 700;
  }
  .project-icon-btn {
    display: grid;
    place-items: center;
    flex: none;
    min-width: 44px;
    min-height: 44px;
    padding: 4px;
    border: 0;
    border-radius: 8px;
    color: var(--text-primary);
    background: var(--project-inset);
  }
  .project-icon-btn .ic { width: 20px; height: 20px; }
  .project-icon-btn[data-drawer-close] { position: absolute; top: 16px; right: 12px; }
}
