#treatmentsView { padding: 0; overflow: hidden; }
.treatments-page { position: relative; }
.treatments-header-actions { display: flex; align-items: center; gap: 16px; }
.treatment-view-switch { display: inline-flex; align-items: center; padding: 4px; gap: 2px; border: 1px solid #dbe5de; border-radius: 10px; background: #edf2ec; }
.treatment-view-switch button { min-height: 34px; padding: 7px 13px; border: 0; border-radius: 7px; background: transparent; color: #728477; font: inherit; font-size: 13px; cursor: pointer; }
.treatment-view-switch button[aria-pressed="true"] { background: #fff; color: #244d3d; box-shadow: 0 1px 5px #173f3112; }
.treatment-view-switch button:focus-visible, .treatment-calendar button:focus-visible { outline: 2px solid #78aea0; outline-offset: 2px; }
.treatment-calendar { min-height: 0; overflow: auto; border: 1px solid #dce5dd; border-radius: 14px; background: #fff; }
.treatment-calendar-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; padding: 18px 20px; }
.treatment-calendar-toolbar h2 { margin: 0; color: #294a3a; font-size: 17px; font-weight: 550; }
.treatment-calendar-navigation { display: flex; align-items: center; gap: 5px; }
.treatment-calendar-navigation button { min-width: 33px; min-height: 34px; padding: 5px 10px; border: 1px solid #dce5df; border-radius: 7px; background: white; color: #416653; font: inherit; font-size: 14px; cursor: pointer; }
.treatment-calendar-navigation button:first-child { margin-right: 6px; }
.treatment-calendar-navigation button:not(:first-child) { font-size: 23px; line-height: 1; }
.treatment-calendar-legend { display: flex; gap: 16px; margin-left: auto; color: #749180; font-size: 12px; }
.treatment-calendar-explanation { margin: 0; padding: 0 20px 16px; color: #89968b; font-size: 12px; line-height: 1.5; }
.treatment-calendar-loading { margin: 0; padding: 7px 20px; color: #65816f; font-size: 13px; }
.treatment-calendar-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: 61px; grid-auto-rows: minmax(110px, auto); grid-auto-flow: column; min-height: 390px; border-top: 1px solid #e3eae4; }
.treatment-calendar-day { display: grid; grid-template-rows: subgrid; grid-row: span var(--calendar-rows, 2); min-width: 0; border-right: 1px solid #e4eae5; }
.treatment-calendar-day:last-child { border-right: 0; }
.treatment-calendar-day > header { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 5px; border-bottom: 1px solid #e5ece5; background: #fafbf8; }
.treatment-calendar-day > header span { color: #8b9c8e; font-size: 11px; text-transform: uppercase; }
.treatment-calendar-day > header strong { color: #486653; font-size: 20px; font-weight: 500; }
.treatment-calendar-day.is-today { background: #fbfdf8; }
.treatment-calendar-day.is-today > header { background: #f0f6ed; }
.treatment-calendar-day.is-today > header strong { display: grid; place-items: center; width: 31px; height: 31px; margin: -3px; border-radius: 50%; color: white; background: #5a8064; }
.treatment-calendar-day-events { display: grid; align-content: start; gap: 9px; padding: 9px 7px 18px; border-bottom: 1px solid #edf1ea; }
.treatment-calendar-event { min-width: 0; padding: 10px 9px 7px; border: 1px solid #e7e7d7; border-left: 3px solid #c5ad72; border-radius: 7px; background: #faf8ee; overflow-wrap: anywhere; }
.treatment-calendar-event[data-intake-state="taken"] { border-color: #d5e7d8; border-left-color: #73a37d; background: #eef6ef; }
.treatment-calendar-event[data-intake-state="skipped"] { border-color: #e8e1dc; border-left-color: #b7a99a; background: #f5f2ef; }
.treatment-event-time { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 8px; justify-content: space-between; margin-bottom: 6px; color: #96804f; font-size: 12px; font-weight: 550; }
.treatment-calendar-event[data-intake-state="taken"] .treatment-event-time { color: #659271; }
.treatment-event-title { display: block; width: 100%; padding: 0; border: 0; background: transparent; color: #3d533f; text-align: left; font: inherit; font-size: 14px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; cursor: pointer; }
.treatment-event-title:hover { text-decoration: underline; }
.treatment-event-dose { margin: 5px 0; color: #6d7965; font-size: 12px; line-height: 1.4; }
.treatment-event-project { overflow: hidden; margin: 5px 0 8px; color: #9caa97; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.treatment-intake-label { display: block; margin: 0; color: #938567; font-size: 12px; font-weight: 400; }
.treatment-unplanned-label { display: block; margin-top: 5px; color: #829082; font-size: 12px; }
.treatment-calendar-event[data-intake-state="taken"] .treatment-intake-label { color: #518562; }
.treatment-calendar-event[data-intake-state="skipped"] .treatment-intake-label { color: #958374; }
.treatment-intake-actions { display: flex; flex-wrap: wrap; gap: 0 8px; margin-top: 5px; padding-top: 3px; border-top: 1px solid #72845f16; }
.treatment-intake-actions button { min-height: 27px; padding: 3px 0; border: 0; border-radius: 3px; background: transparent; color: #52755a; font: inherit; font-size: 12px; cursor: pointer; }
.treatment-intake-actions button:hover { text-decoration: underline; }
.treatment-intake-actions button:disabled { opacity: .45; cursor: wait; }
.treatment-intake-actions button:nth-child(2) { color: #9c907b; }
.treatment-calendar-empty { margin: 15px 0; color: #b2bdb2; font-size: 11px; text-align: center; }
.treatment-calendar-unscheduled { padding: 16px 20px; border-top: 1px solid #e5ebe3; color: #83947f; font-size: 12px; }
.treatment-calendar-unscheduled summary { width: fit-content; cursor: pointer; }
.treatment-calendar-unscheduled p { color: #96a28f; line-height: 1.5; }
.treatment-calendar-unscheduled > div { display: flex; flex-wrap: wrap; gap: 8px; }
.treatment-calendar-unscheduled button { padding: 7px 10px; border: 1px solid #dce5d8; border-radius: 6px; background: #fbfcf8; color: #657c5d; font: inherit; cursor: pointer; }
.treatment-board-column[data-status="active"] { --column-accent: #bf9454; --column-tint: #f3e9d8; }
.treatment-board-column[data-status="completed"] { --column-accent: #4e9380; --column-tint: #deebe3; }
.treatment-board-card { padding: 18px 35px 16px 18px; }
.treatment-card-regimen { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 7px 0 0; color: #738279; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.treatment-item-count { flex: 0 0 auto; color: #829289; font-size: 12px; }
.treatment-board-grip.taskboard-grip { display: grid; place-items: center; position: absolute; left: auto; top: auto; bottom: 8px; right: 4px; width: 28px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: #9bada2; font-size: 22px; cursor: grab; touch-action: none; }
.treatment-board-grip:hover { color: #527262; background: #edf3ef; }
.treatment-card-list:has([data-treatment-card]) > .taskboard-empty { display: none; }
.treatment-card-list:not(:has([data-treatment-card])) { min-height: 72px; }
.treatment-board-card .taskboard-card-footer { min-height: 20px; }
.treatment-board-card .taskboard-project { --project-accent: #8baba0; }
.treatment-board-card .taskboard-actions > summary { opacity: .65; }
.treatment-board-card:hover .taskboard-actions > summary, .treatment-board-card:focus-within .taskboard-actions > summary { opacity: 1; }
.treatment-board-card.sortable-fallback .treatment-board-grip { visibility: hidden; }
.treatment-dialog-backdrop { position: fixed; z-index: 90; inset: 0; display: grid; place-items: center; overflow-y: auto; padding: 24px; background: rgba(16,39,32,.28); backdrop-filter: blur(3px); }
.treatment-editor { width: min(100%, 520px); max-height: calc(100dvh - 48px); overflow-y: auto; padding: 24px; border: 1px solid #d5e0d8; border-radius: 17px; background: #fff; box-shadow: 0 22px 80px #173f312b; color: var(--ink, #193236); }
.treatment-editor-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.treatment-editor-header h2 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.025em; }
.treatment-editor-header button { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border: 0; border-radius: 7px; background: #f1f5f2; color: #6b7e73; font-size: 25px; }
.treatment-form-fields { display: grid; gap: 13px; min-width: 0; padding: 0; margin: 0; border: 0; }
.treatment-form-fields label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 7px; margin: 0; color: #62766b; font-size: 12px; line-height: 1.4; }
.treatment-form-fields input, .treatment-form-fields textarea, .treatment-form-fields select { display: block; flex: 1 1 100%; width: 100%; min-width: 0; min-height: 38px; padding: 8px 10px; border: 1px solid #d5e0d8; border-radius: 7px; background: #fff; color: var(--ink, #193236); font: inherit; font-size: 14px; line-height: 1.4; }
.treatment-form-fields textarea { resize: vertical; }
.treatment-form-fields select { padding-right: 25px; }
.treatment-form-fields input:focus-visible, .treatment-form-fields textarea:focus-visible, .treatment-form-fields select:focus-visible, .treatment-form-fields summary:focus-visible, .treatment-fields-shell button:focus-visible, .treatment-editor button:focus-visible { outline: 2px solid #78aea0; outline-offset: 2px; }
.treatment-form-fields:disabled { opacity: .65; }
.treatment-natural-input { margin-bottom: 18px; }
.treatment-natural-input > label { color: #5e796c; font-size: 13px; }
.treatment-natural-input textarea { min-height: 92px; background: #fbfdfb; font-size: 15px; }
.treatment-input-hint { margin: -5px 0 0; color: #98a69c; font-size: 11px; line-height: 1.5; }
.treatment-parse-actions { display: flex; align-items: center; gap: 16px; }
.treatment-parse-actions .primary-button { min-height: 38px; padding: 9px 16px; font-size: 13px; }
.treatment-secondary-button { padding: 7px 11px; min-height: 34px; border: 1px solid #d4e3d6; border-radius: 7px; background: #f7faf6; color: #65815d; font: inherit; font-size: 12px; cursor: pointer; }
.treatment-parse-notice { margin: 0 0 14px; color: #789168; font-size: 12px; line-height: 1.5; }
.treatment-source-editor { margin-bottom: 10px; color: #82927b; font-size: 12px; }
.treatment-source-editor > summary { overflow: hidden; cursor: pointer; white-space: nowrap; text-overflow: ellipsis; }
.treatment-source-editor > summary > span { margin-left: 8px; color: #a3ad9d; }
.treatment-source-editor[open] > summary { margin-bottom: 12px; }
.treatment-parse-questions { color: #9c8560; font-size: 12px; line-height: 1.5; }
.treatment-schedule-fields { display: grid; gap: 13px; min-width: 0; }
.treatment-extra-item > .treatment-schedule-fields { grid-column: 1 / -1; }
.treatment-time-fields { display: grid; gap: 8px; }
.treatment-day-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.treatment-form-fields .treatment-day-choices label { display: inline-flex; position: relative; cursor: pointer; }
.treatment-day-choices label > span { display: block; padding: 7px 10px; border: 1px solid #dfe7dc; border-radius: 6px; color: #8a9b82; font-size: 12px; }
.treatment-form-fields .treatment-day-choices input { position: absolute; opacity: 0; width: 1px; min-height: 0; height: 1px; padding: 0; margin: 0; }
.treatment-day-choices input:checked + span { color: #537044; border-color: #b7cba7; background: #eef5e7; }
.treatment-day-choices input:focus-visible + span { outline: 2px solid #78aea0; outline-offset: 2px; }
.treatment-schedule-summary { margin: 9px 0 0; color: #829373; font-size: 12px; line-height: 1.6; }
.treatment-field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(130px, .65fr); gap: 12px; }
.treatment-optional { color: #94a297; font-size: 11px; }
.treatment-more-fields > summary { width: fit-content; color: #688376; font-size: 12px; cursor: pointer; }
.treatment-more-content { display: grid; gap: 13px; padding-top: 13px; }
.treatment-extra-item { display: grid; grid-template-columns: minmax(0, 1fr) 125px; gap: 9px; padding-top: 10px; border-top: 1px solid #e9eeea; }
.treatment-extra-regimen { grid-column: 1 / -1; }
.treatment-text-button { width: fit-content; min-height: 30px; padding: 5px 0; border: 0; border-radius: 5px; background: transparent; color: #527762; font: inherit; font-size: 12px; cursor: pointer; }
.treatment-text-button:hover { color: #234c3b; text-decoration: underline; }
.treatment-editor-actions { position: sticky; bottom: -24px; display: flex; align-items: center; gap: 18px; margin-top: 22px; padding: 14px 0 8px; border-top: 1px solid #eaf0e6; background: #fff; }
.treatment-editor-actions .primary-button { min-height: 40px; padding: 10px 16px; font-size: 14px; }
.treatment-error, .treatment-conflict { margin: 10px 0 0; color: #a54d53; font-size: 12px; line-height: 1.55; }
.treatment-error button { margin-left: 6px; padding: 5px 9px; border: 1px solid #ddc8c8; border-radius: 6px; background: white; color: inherit; font: inherit; }
.treatment-conflict { color: #6c796b; }
.treatments-page > .treatment-error { margin: 0 3px 12px; }

/* The selected item is a readable summary; its full editor opens on demand. */
.treatment-detail-page .project-scope-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.treatment-detail-page .project-nav-head h1, .treatment-detail-page .mobile-scope-close { color: var(--ink, #193236); }
.treatment-detail-page .scope-chat-head, #treatmentFields { flex: 0 0 auto; }
.treatment-detail-page .project-chat-shell { flex: 1 1 0; min-height: 0; }
#treatmentFields { max-height: min(58vh, 680px); overflow-y: auto; border-bottom: 1px solid #e6ece5; }
.treatment-fields-shell { width: 100%; margin: 0; padding: 0; background: transparent; }
.treatment-fields-shell .treatment-form-fields { grid-template-columns: minmax(0, 1fr); gap: 15px; }
.treatment-fields-shell .treatment-form-fields label { font-size: 13px; gap: 7px; }
.treatment-fields-shell .treatment-field-row { gap: 15px; }
.treatment-fields-shell .treatment-form-fields input, .treatment-fields-shell .treatment-form-fields textarea, .treatment-fields-shell .treatment-form-fields select { min-height: 40px; padding: 9px 11px; font-size: 16px; }
.treatment-fields-shell .treatment-more-fields > summary { font-size: 13px; }
.treatment-fields-shell .treatment-more-content { grid-template-columns: minmax(0, 1fr); gap: 15px; }
.treatment-fields-shell .treatment-extra-item { gap: 12px; }
.treatment-fields-footer { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.treatment-fields-footer .primary-button { min-height: 37px; padding: 8px 15px; border-radius: 7px; font-size: 13px; }
.treatment-fields-shell .treatment-error, .treatment-fields-shell .treatment-conflict { font-size: 13px; }
.treatment-history { margin-top: 10px; color: #789080; font-size: 13px; }
.treatment-history > summary { width: fit-content; cursor: pointer; }
.treatment-history-list { display: grid; gap: 8px; padding-top: 8px; }
.treatment-history-version { padding: 10px 12px; border: 1px solid #e0e9e2; border-radius: 8px; background: white; }
.treatment-history-version header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.treatment-history-version header > span { white-space: nowrap; color: #8b988e; font-size: 12px; }
.treatment-history-version p { margin: 5px 0 0; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.treatment-source-description { margin-top: 7px; color: #849180; font-size: 12px; }
.treatment-source-description summary { width: fit-content; cursor: pointer; }
.treatment-history-version:focus { outline: 2px solid #78aea0; outline-offset: 2px; }

@media (min-width: 901px) { .workspace:has(#treatmentsView:not(.hidden)) > .topbar { display: none; } }
@media (max-width: 1100px) { .treatment-board-card { padding: 14px 34px 14px 14px; } }
@media (max-width: 760px) {
  .treatments-header { align-items: center; }
  .treatments-header h1 { font-size: 26px; }
  .treatments-header > button { max-width: 150px; padding: 8px 11px; font-size: 12px; }
  .treatments-header { align-items: flex-start; flex-direction: column; gap: 17px; }
  .treatments-header-actions { width: 100%; justify-content: space-between; gap: 10px; }
  .treatments-header-actions > .primary-button { padding: 10px 12px; font-size: 12px; }
  .treatment-view-switch button { min-height: 36px; padding: 7px 10px; font-size: 12px; }
  .treatment-calendar-toolbar { gap: 12px; padding: 15px 14px 10px; }
  .treatment-calendar-toolbar h2 { font-size: 15px; }
  .treatment-calendar-legend { width: 100%; margin-left: 0; gap: 14px; }
  .treatment-calendar-explanation { padding: 0 14px 14px; font-size: 11px; }
  .treatment-calendar-week { display: block; min-height: 0; }
  .treatment-calendar-day { display: block; border-right: 0; border-bottom: 1px solid #e3eae1; }
  .treatment-calendar-day > header { justify-content: flex-start; padding: 11px 14px; border-bottom: 0; }
  .treatment-calendar-day > header span { min-width: 24px; }
  .treatment-calendar-day-events { grid-template-columns: minmax(0, 1fr); padding: 0 10px 10px; gap: 8px; border: 0; }
  .treatment-calendar-day-events.is-empty-slot:not(:has(.treatment-calendar-empty)) { display: none; }
  .treatment-calendar-day-events:has(> .treatment-calendar-empty) { display: block; padding-bottom: 6px; }
  .treatment-calendar-empty { margin: 1px 4px 8px; text-align: left; }
  .treatment-calendar-event { padding: 12px 10px 7px; }
  .treatment-event-time { font-size: 12px; }
  .treatment-intake-label { font-size: 12px; }
  .treatment-intake-actions button { min-height: 34px; font-size: 12px; }
  .treatment-calendar-unscheduled { padding: 14px; }
  .treatment-dialog-backdrop { padding: 14px; }
  .treatment-editor { padding: 20px; max-height: calc(100dvh - 28px); }
  .treatment-fields-shell .treatment-form-fields { gap: 13px; }
  .treatment-fields-shell .treatment-more-content { grid-template-columns: minmax(0, 1fr); }
  .treatment-fields-shell .treatment-form-fields input, .treatment-fields-shell .treatment-form-fields textarea, .treatment-fields-shell .treatment-form-fields select { font-size: 16px; }
  #treatmentFields { max-height: 54vh; }
  .treatment-board-grip.taskboard-grip { width: 30px; height: 38px; }
  .treatment-board-card .taskboard-actions > summary { width: 32px; height: 36px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .treatments-header-actions { gap: 9px; }
  .treatment-view-switch button { padding: 6px 9px; }
  .treatments-header-actions > .primary-button { font-size: 12px; padding: 10px; }
  .treatment-calendar-week { min-width: 770px; }
}
@media (max-width: 420px) {
  .treatment-editor { padding: 17px; }
  .treatment-field-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9px; }
  .treatment-day-choices { gap: 5px; }
  .treatment-day-choices label > span { padding: 7px 8px; }
  .treatments-header-actions > .primary-button { max-width: 136px; }
}
@media (pointer: coarse) { .treatment-board-grip.taskboard-grip { width: 34px; height: 40px; } .treatment-board-card { padding-left: 14px; padding-right: 38px; } }
.treatment-attention { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: 4px; border-radius: 50%; background: #fff0c9; color: #825313; font: 700 14px/1 system-ui, sans-serif; vertical-align: middle; flex: 0 0 auto; }
#treatmentQuestions { flex: 0 1 auto; min-height: 0; max-height: 44vh; overflow-y: auto; padding: 0 24px; }
#treatmentQuestions:empty { display: none; }
.treatment-question { max-width: 970px; margin: 6px auto 12px; padding: 18px 20px; border: 1px solid #d8e3d8; border-radius: 12px; background: #f5f8f2; color: #193d35; }
.treatment-question-caption { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 12px; color: #6b7c6b; }
.treatment-question h3 { margin: 0 0 14px; font-size: 18px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.treatment-question-options { display: flex; flex-wrap: wrap; gap: 8px; }
.treatment-question-options button { min-height: 40px; padding: 9px 14px; border: 1px solid #c8d8c8; border-radius: 9px; background: white; color: #294d3c; font: inherit; font-size: 14px; cursor: pointer; }
.treatment-question-options button:hover { background: #e8f0e3; border-color: #8ba88b; }
.treatment-question button:disabled { opacity: .5; cursor: default; }
.treatment-question button:focus-visible, .treatment-question textarea:focus-visible, .treatment-custom-answer summary:focus-visible { outline: 2px solid #588563; outline-offset: 3px; }
.treatment-custom-answer { margin-top: 12px; }
.treatment-custom-answer summary { width: fit-content; color: #4f6b55; font-size: 14px; cursor: pointer; }
.treatment-custom-answer form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding-top: 10px; }
.treatment-custom-answer label { flex: 1 1 220px; display: grid; gap: 6px; color: #697c69; font-size: 12px; }
.treatment-custom-answer textarea { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #ccd9cb; border-radius: 8px; background: white; color: #1f3d34; font: inherit; font-size: 16px; resize: vertical; }
.treatment-custom-answer .primary-button { min-height: 40px; padding: 9px 16px; font-size: 14px; }
.treatment-question-error { margin: 10px 0 0; font-size: 13px; color: #a54539; }
.treatment-question-saving { margin: 10px 0 0; font-size: 12px; color: #6a7b69; }
@media (max-width: 760px) {
  #treatmentQuestions { padding: 0 12px; max-height: 43dvh; }
  .treatment-question { padding: 14px; margin-bottom: 8px; }
  .treatment-question h3 { font-size: 16px; }
  .treatment-question-options button { min-height: 42px; padding: 9px 12px; }
}
