.tcal { --tcal-line: #e4e9e7; --tcal-ink: #314642; --tcal-muted: #8a9893; --tcal-blue: #377abb; --tcal-axis: 58px; position: relative; display: flex; flex: 1 1 0; flex-direction: column; min-width: 0; min-height: 260px; overflow: hidden; border: 1px solid #dce5df; border-radius: 14px; background: #fff; color: var(--tcal-ink); }
.tcal * { box-sizing: border-box; }
.tcal button, .tcal input, .tcal select { font-family: inherit; }
.tcal button { cursor: pointer; }
.tcal button:disabled { opacity: .5; cursor: wait; }
.tcal button:focus-visible, .tcal input:focus-visible, .tcal select:focus-visible, .tcal summary:focus-visible { outline: 2px solid #5b9ac7; outline-offset: 2px; }
.tcal-toolbar { display: flex; flex: 0 0 auto; align-items: center; flex-wrap: wrap; gap: 12px 18px; padding: 16px 18px; border-bottom: 1px solid var(--tcal-line); }
.tcal-toolbar h2 { flex: 1 1 auto; margin: 0; color: #38524b; font-size: 18px; font-weight: 550; line-height: 1.35; }
.tcal-navigation { display: flex; align-items: center; gap: 3px; }
.tcal-navigation button { display: grid; place-items: center; min-width: 31px; min-height: 35px; padding: 3px 8px; border: 0; border-radius: 7px; background: transparent; color: #668078; font-size: 24px; line-height: 1; }
.tcal-navigation button:first-child { margin-right: 9px; padding: 8px 13px; border: 1px solid #d4dfd8; font-size: 13px; }
.tcal-navigation button:hover { background: #f0f5f1; }
.tcal-view-controls { display: flex; align-items: center; gap: 9px; }
.tcal-view-controls input, .tcal-view-controls select { min-height: 35px; padding: 7px 9px; border: 1px solid #d6e0da; border-radius: 7px; background: white; color: #5a7167; font-size: 12px; }
.tcal-view-controls input { width: 137px; }
.tcal-view-controls select { min-width: 110px; }
.tcal-loading { flex: 0 0 auto; padding: 8px 18px; border-bottom: 1px solid #e8eee8; color: #8d9c93; font-size: 12px; }
.tcal-time-frame { flex: 1 1 0; min-height: 170px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: #cbd9ce transparent; }
.tcal-time-inner { display: flex; flex-direction: column; height: 100%; min-height: 170px; width: 100%; }
.tcal[data-calendar-mode="week"] .tcal-time-inner { min-width: 790px; }
.tcal-day-headings, .tcal-untimed, .tcal-hour-grid { display: grid; grid-template-columns: var(--tcal-axis) repeat(var(--tcal-days), minmax(0, 1fr)); }
.tcal-day-headings, .tcal-untimed { flex: 0 0 auto; padding-right: 10px; }
.tcal-day-heading { position: relative; display: flex; align-items: center; justify-content: center; min-height: 67px; padding: 7px 25px 7px 8px; border-left: 1px solid var(--tcal-line); }
.tcal-day-heading > button:first-child { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 43px; padding: 0; border: 0; background: transparent; color: #647c71; }
.tcal-day-heading > button:first-child > span { font-size: 11px; text-transform: uppercase; }
.tcal-day-heading strong { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; font-size: 22px; line-height: 1; font-weight: 450; }
.tcal-day-heading.is-today strong { background: var(--tcal-blue); color: white; }
.tcal-day-heading.is-today > button:first-child > span { color: var(--tcal-blue); }
.tcal-add { display: grid; flex: 0 0 auto; place-items: center; width: 26px; height: 27px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #96a99a; font-size: 18px; line-height: 1; }
.tcal-add:hover { background: #edf4ed; color: #4c7a53; }
.tcal-day-heading .tcal-add { position: absolute; right: 5px; bottom: 11px; }
.tcal-axis-label { display: flex; align-items: center; justify-content: center; padding: 4px 7px; color: #9ba69f; text-align: right; font-size: 10px; line-height: 1.3; }
.tcal-untimed { border-bottom: 1px solid #d5dfd8; }
.tcal-untimed-day { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-height: 42px; max-height: 124px; overflow-y: auto; padding: 4px 5px 8px; border-left: 1px solid var(--tcal-line); scrollbar-width: thin; }
.tcal-hour-scroll { flex: 1 1 0; min-height: 120px; overflow-y: scroll; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: #c5d4ca transparent; }
.tcal-hour-grid { min-height: 1184px; }
.tcal-hours { padding-top: 0; color: #95a299; text-align: center; font-size: 10px; font-variant-numeric: tabular-nums; }
.tcal-hours > div { height: 48px; padding-top: 3px; }
.tcal-hour-day { position: relative; min-width: 0; min-height: 1184px; border-left: 1px solid var(--tcal-line); background: repeating-linear-gradient(to bottom, transparent 0, transparent 47px, var(--tcal-line) 47px, var(--tcal-line) 48px); }
.tcal-hour-day.is-today { background-color: #fafcf8; }
.tcal-hour-slots { display: flex; flex-direction: column; }
.tcal-hour-create { display: flex; align-items: flex-start; justify-content: flex-end; width: 100%; height: 48px; padding: 7px 7px; border: 0; background: transparent; color: #70a07a; font-size: 16px; }
.tcal-hour-create > span { opacity: 0; }
.tcal-hour-create:hover { background: #77a2c414; }
.tcal-hour-create:hover > span { opacity: 1; }
.tcal-event { --event-color: #517caa; --event-fill: #eaf1fa; display: flex; flex: 0 0 auto; align-items: center; gap: 5px; width: 100%; min-width: 0; min-height: 29px; padding: 5px 6px; border: 0; border-left: 3px solid var(--event-color); border-radius: 5px; background: var(--event-fill); color: #365775; text-align: left; line-height: 1.35; }
.tcal-event[data-intake-state="taken"] { --event-color: #579b6d; --event-fill: #eaf5ec; color: #46754e; }
.tcal-event[data-intake-state="skipped"] { --event-color: #b09c83; --event-fill: #f4f0eb; color: #90816b; }
.tcal-event[data-board-status="idea"] { --event-color: #8c7aa3; --event-fill: #f3eff8; color: #6f5c88; border-left-style: dashed; }
.tcal-plan-label { flex: 0 0 auto; font-size: 9px; font-weight: 500; opacity: .85; }
.tcal-event:hover { filter: brightness(.975); box-shadow: 0 1px 5px #2a4b3020; }
.tcal-event.is-selected { outline: 2px solid var(--event-color); outline-offset: 0; }
.tcal-event-dot { flex: 0 0 auto; width: 9px; color: var(--event-color); font-size: 11px; text-align: center; }
.tcal-event-dot:empty { width: 5px; height: 5px; margin-right: 2px; border-radius: 50%; background: var(--event-color); }
.tcal-event-copy { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
.tcal-event-heading { display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0; }
.tcal-event-heading > .treatment-attention { flex: 0 0 auto; margin-left: 0; }
.tcal-event-name { display: block; flex: 1 1 auto; min-width: 0; overflow: hidden; color: inherit; font-size: 12px; font-weight: 550; white-space: nowrap; text-overflow: ellipsis; }
.tcal-event-time { flex: 0 0 auto; color: inherit; font-size: 10px; font-weight: 400; white-space: nowrap; opacity: .8; }
.tcal-untimed .tcal-event { flex-wrap: wrap; gap: 2px 4px; padding: 5px; }
.tcal-untimed .tcal-event-time { max-width: 100%; overflow: hidden; margin-left: 11px; white-space: nowrap; text-overflow: ellipsis; }
.tcal-untimed .tcal-event-copy { flex-basis: calc(100% - 16px); }
.tcal-hour-day > .tcal-event { position: absolute; z-index: 2; align-items: center; gap: 3px; height: 32px; padding: 4px; overflow: hidden; }
.tcal-hour-day > .tcal-event[data-time-of-day] { border-left-style: dashed; }
.tcal-hour-day .tcal-event-name { font-size: 11px; }
.tcal-hour-day .tcal-event-time { font-size: 10px; }
.tcal-hour-day .tcal-event-dot { display: none; }
.tcal-hour-day .treatment-attention { width: 14px; height: 14px; font-size: 10px; }
.tcal-weekdays { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 10px 0; border-bottom: 1px solid var(--tcal-line); background: #fff; color: #91a096; text-align: center; font-size: 11px; text-transform: uppercase; }
.tcal-month-scroll { flex: 1 1 0; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.tcal-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(112px, 1fr)); min-height: calc(100% - 35px); }
.tcal-month-day { min-width: 0; padding: 3px 4px 5px; border-right: 1px solid var(--tcal-line); border-bottom: 1px solid var(--tcal-line); }
.tcal-month-day:nth-child(7n) { border-right: 0; }
.tcal-month-day.is-outside { background: #fbfcfa; }
.tcal-month-day.is-outside > header > button:first-child { color: #b1bdb1; }
.tcal-month-day > header { display: flex; align-items: center; justify-content: space-between; min-height: 29px; margin-bottom: 3px; }
.tcal-month-day > header > button:first-child { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 25px; min-height: 25px; padding: 3px 5px; border: 0; border-radius: 20px; background: transparent; color: #6c7d6d; font-size: 12px; }
.tcal-month-day > header > button:first-child > span { font-size: 10px; }
.tcal-month-day.is-today > header > button:first-child { background: var(--tcal-blue); color: white; }
.tcal-month-day .tcal-add { width: 22px; height: 23px; font-size: 16px; }
.tcal-month-events { display: flex; flex-direction: column; gap: 3px; max-height: 106px; overflow: auto; scrollbar-width: thin; }
.tcal-event-compact { gap: 3px; min-height: 23px; padding: 3px 4px; border-left-width: 2px; }
.tcal-event-compact .tcal-event-name { font-size: 11px; font-weight: 500; }
.tcal-event-compact .tcal-event-dot { display: none; }
.tcal-event-compact .tcal-event-time { font-size: 10px; }
.tcal-year { display: grid; flex: 1 1 0; grid-template-columns: repeat(4, minmax(0, 1fr)); align-content: start; gap: 26px 20px; min-height: 0; overflow: auto; padding: 22px; scrollbar-width: thin; }
.tcal-mini-month { min-width: 0; }
.tcal-mini-month h3 { margin: 0 0 11px; padding-left: 6px; color: #57715e; font-size: 15px; font-weight: 550; text-transform: capitalize; }
.tcal-mini-weekdays, .tcal-mini-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.tcal-mini-weekdays { margin-bottom: 4px; color: #a5b09f; text-align: center; font-size: 10px; }
.tcal-mini-day, .tcal-mini-blank { min-width: 0; height: 27px; }
.tcal-mini-day { position: relative; display: grid; place-items: start center; padding: 3px 0 5px; border: 0; border-radius: 50%; background: transparent; color: #74866f; font-size: 11px; }
.tcal-mini-day:hover { background: #ecf3e8; }
.tcal-mini-day.is-today { background: var(--tcal-blue); color: #fff; }
.tcal-mini-day.has-events { color: #426f49; font-weight: 650; }
.tcal-mini-day.has-events.is-today { color: white; }
.tcal-mini-dots { position: absolute; bottom: 2px; display: flex; justify-content: center; gap: 2px; }
.tcal-mini-dots i { width: 3px; height: 3px; border-radius: 50%; background: #749bbd; }
.tcal-mini-dots i[data-intake-state="taken"] { background: #6b9e77; }
.tcal-mini-dots i[data-intake-state="skipped"] { background: #b6a591; }
.tcal-mini-day.is-today .tcal-mini-dots i { background: white; }
.tcal-agenda { flex: 1 1 0; min-height: 0; overflow: auto; padding: 3px 18px; scrollbar-width: thin; }
.tcal-agenda-day { display: grid; grid-template-columns: 145px minmax(0, 1fr); gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--tcal-line); }
.tcal-agenda-day > header { display: flex; align-items: flex-start; gap: 7px; }
.tcal-agenda-day > header > button:first-child { display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; color: #809478; text-align: left; }
.tcal-agenda-day > header strong { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; font-size: 22px; font-weight: 450; }
.tcal-agenda-day.is-today > header strong { background: var(--tcal-blue); color: white; }
.tcal-agenda-day > header span { font-size: 12px; line-height: 1.4; }
.tcal-agenda-day > div { display: grid; gap: 6px; }
.tcal-event-agenda { min-height: 42px; padding: 9px 12px; background: transparent; border-left: 0; }
.tcal-event-agenda:hover { background: var(--event-fill); }
.tcal-event-agenda .tcal-event-name { font-size: 14px; }
.tcal-event-agenda .tcal-event-time { margin-left: 14px; font-size: 12px; }
.tcal-event-dose { margin-top: 3px; color: #8ca08a; font-size: 12px; }
.tcal-empty { display: grid; flex: 1; place-items: center; min-height: 160px; padding: 28px; color: #9aa794; font-size: 14px; text-align: center; }
.tcal-event-details { position: absolute; z-index: 10; top: 76px; right: 18px; width: min(350px, calc(100% - 28px)); max-height: calc(100% - 88px); overflow: auto; padding: 23px; border: 1px solid #d2dfd6; border-radius: 12px; background: white; box-shadow: 0 9px 40px #284b332b; }
.tcal-details-close { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 29px; height: 29px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #80917e; }
.tcal-details-close svg { display: block; }
.tcal-details-close:hover { background: #f0f4ed; }
.tcal-event-details h3 { margin: 9px 20px 12px 0; color: #33543e; font-size: 20px; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }
.tcal-event-details p { margin: 8px 0; color: #83917c; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.tcal-event-details .tcal-details-status { margin: 0; color: #7b98b1; font-size: 11px; }
.tcal-details-status[data-intake-state="taken"] { color: #649774; }
.tcal-details-status[data-intake-state="skipped"] { color: #a3927c; }
.tcal-event-details .tcal-details-when { color: #607759; }
.tcal-details-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 17px 0 10px; }
.tcal-details-actions button { min-height: 34px; padding: 7px 12px; border: 1px solid #cfddc9; border-radius: 6px; background: #f2f7ed; color: #64805b; font-size: 12px; }
.tcal-details-actions button:nth-child(2) { border-color: #e1dacf; background: #fcfaf5; color: #a18f76; }
.tcal-open-chat { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; min-height: 34px; margin-top: 12px; padding: 11px 0 0; border: 0; border-top: 1px solid #e8ede4; background: transparent; color: #6c895f; font-size: 13px; text-align: left; }
.tcal-unscheduled { flex: 0 0 auto; max-height: 168px; overflow: auto; padding: 12px 18px; border-bottom: 1px solid #e4e8db; background: #fafbf6; color: #839274; font-size: 12px; scrollbar-width: thin; }
.tcal-unscheduled h3 { display: flex; align-items: center; gap: 8px; margin: 0; color: #78866b; font-size: 12px; font-weight: 550; }
.tcal-unscheduled h3 > span { color: #a6b197; font-weight: 400; }
.tcal-unscheduled > div { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 8px; }
.tcal-unscheduled button { display: flex; flex: 0 1 250px; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; min-height: 47px; padding: 7px 10px; border: 1px solid #dfe5d4; border-radius: 6px; background: #fff; color: #748665; text-align: left; font-size: 12px; overflow-wrap: anywhere; }
.tcal-unscheduled button:hover { border-color: #b9ccab; background: #f7faef; }
.tcal-unscheduled button.is-highlighted { border-color: #7d9a6a; background: #eef5e4; color: #4c5f3f; outline: 2px solid #7d9a6a; outline-offset: 0; }
.tcal-unscheduled-name { font-weight: 550; }
.tcal-unscheduled-reason { color: #98a08c; font-size: 11px; line-height: 1.4; }
@media (max-width: 1100px) { .tcal-toolbar { gap: 10px; } .tcal-toolbar h2 { font-size: 16px; } .tcal-year { gap: 22px 14px; padding: 18px; } .tcal-mini-month h3 { font-size: 14px; } }
@media (max-width: 820px) { .tcal-year { grid-template-columns: repeat(3, minmax(0, 1fr)); } .tcal-view-controls input { width: 124px; } }
@media (max-width: 600px) {
  .tcal { min-height: 240px; border-radius: 10px; --tcal-axis: 46px; }
  .tcal-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 10px; padding: 12px; }
  .tcal-navigation { grid-column: 1; grid-row: 1; gap: 0; }
  .tcal-navigation button { min-width: 26px; min-height: 34px; padding: 3px 6px; }
  .tcal-navigation button:first-child { padding: 7px 10px; margin-right: 5px; font-size: 12px; }
  .tcal-toolbar h2 { grid-column: 1; grid-row: 2; min-width: 0; font-size: 15px; }
  .tcal-view-controls { display: contents; }
  .tcal-view-controls select { grid-column: 2; grid-row: 1; width: 112px; min-width: 0; min-height: 34px; padding: 6px 7px; font-size: 12px; }
  .tcal-view-controls input { grid-column: 2; grid-row: 2; width: 112px; min-height: 33px; padding: 5px; font-size: 11px; }
  .tcal-day-headings, .tcal-untimed { padding-right: 9px; }
  .tcal[data-calendar-mode="day"] .tcal-event-name { font-size: 13px; }
  .tcal[data-calendar-mode="day"] .tcal-event-time { font-size: 12px; }
  .tcal-month-grid { grid-template-rows: repeat(6, minmax(100px, 1fr)); }
  .tcal-month-day { padding: 2px 2px 4px; }
  .tcal-month-day > header { gap: 0; }
  .tcal-month-day > header > button:first-child { min-width: 21px; min-height: 23px; padding: 2px 3px; font-size: 11px; }
  .tcal-month-day > header > button:first-child > span { display: none; }
  .tcal-month-day .tcal-add { width: 18px; height: 23px; font-size: 14px; }
  .tcal-month-events { gap: 3px; max-height: 103px; }
  .tcal-event-compact { flex-wrap: wrap; padding: 3px; gap: 1px; }
  .tcal-event-compact .tcal-event-copy { flex-basis: 100%; }
  .tcal-event-compact .tcal-event-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; overflow-wrap: anywhere; font-size: 10px; line-height: 1.25; }
  .tcal-event-compact .tcal-event-time { max-width: 100%; overflow: hidden; font-size: 9px; text-overflow: ellipsis; }
  .tcal-event-compact .treatment-attention { width: 12px; height: 12px; font-size: 9px; }
  .tcal-year { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 23px 15px; padding: 16px 12px; }
  .tcal-mini-day, .tcal-mini-blank { height: 26px; }
  .tcal-mini-month h3 { padding-left: 1px; }
  .tcal-agenda { padding: 3px 10px; }
  .tcal-agenda-day { grid-template-columns: minmax(0, 1fr); gap: 5px; padding: 11px 0; }
  .tcal-agenda-day > header { justify-content: space-between; padding-right: 5px; }
  .tcal-agenda-day > header strong { width: 31px; height: 31px; font-size: 20px; }
  .tcal-agenda-day > header > button:first-child { gap: 8px; }
  .tcal-event-agenda { min-height: 43px; padding: 8px; }
  .tcal-event-agenda .tcal-event-name { white-space: normal; overflow-wrap: anywhere; font-size: 13px; }
  .tcal-event-agenda .tcal-event-time { margin-left: 5px; max-width: 90px; white-space: normal; font-size: 11px; }
  .tcal-event-details { top: 112px; right: 10px; width: calc(100% - 20px); max-height: calc(100% - 124px); padding: 19px; }
  .tcal-event-details h3 { font-size: 18px; }
  .tcal-unscheduled { padding: 11px 13px; }
  .tcal-unscheduled button { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .tcal * { scroll-behavior: auto !important; } }
/* Dragging a dose: the chip under the mouse dims, a ghost follows the pointer and snaps into the target. */
.tcal-event[data-movable="true"] { cursor: grab; }
.tcal.is-dragging, .tcal.is-dragging * { cursor: grabbing !important; }
.tcal.is-dragging .tcal-hour-create:hover { background: transparent; }
.tcal.is-dragging .tcal-hour-create:hover > span { opacity: 0; }
.tcal-event.is-drag-source { opacity: .35; }
.tcal-drag-ghost { box-shadow: 0 10px 28px #1f3a2a3d; opacity: .96; transition: width .08s; }
.tcal-drag-ghost.is-off-target { opacity: .55; box-shadow: none; }
.tcal-event.is-moving { outline: 2px dashed var(--event-color); outline-offset: 0; }
.tcal-event.is-moved .tcal-event-time::before { content: '↷ '; }
.tcal-details-moved { color: #7b98b1; font-size: 12px; }
body.is-calendar-dragging { user-select: none; -webkit-user-select: none; }
.treatment-move-dialog { width: min(100%, 440px); padding: 26px 26px 22px; }
.treatment-move-dialog h2 { margin: 0 0 18px; color: #233e30; font-size: 21px; font-weight: 650; letter-spacing: -.02em; line-height: 1.3; }
.treatment-move-options { display: grid; gap: 2px; }
.treatment-move-option { display: flex; align-items: center; gap: 13px; padding: 10px 8px; border-radius: 8px; color: #2f4438; font-size: 15px; line-height: 1.35; cursor: pointer; }
.treatment-move-option:hover { background: #f3f7f3; }
.treatment-move-option input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; accent-color: #2f6e5c; cursor: inherit; }
.treatment-move-option.is-disabled { color: #a3ad9f; cursor: default; }
.treatment-move-option.is-disabled:hover { background: transparent; }
.treatment-move-hint { margin: 12px 0 0; color: #98a69c; font-size: 12px; line-height: 1.5; }
.treatment-move-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.treatment-move-actions .primary-button { min-height: 38px; padding: 8px 24px; font-size: 14px; }
.treatment-move-actions .treatment-text-button { min-height: 38px; padding: 8px 12px; font-size: 14px; }
@media (max-width: 600px) { .treatment-move-dialog { padding: 20px 18px 16px; } .treatment-move-option { font-size: 14px; } }
