/* schedule.css — admin schedule + requests (.sch-) */

.sch-page { min-width: 0; }
.sch-toolbar { display: flex; flex-direction: column; gap: 12px; }
.sch-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-width: 0; }
.sch-tools > * { min-width: 0; max-width: 100%; }
.sch-tools > .row { flex-wrap: wrap; }
.sch-tools .seg { flex-wrap: wrap; }
.sch-tools .seg button { min-width: 0; white-space: normal; }
.sch-tools > [hidden] { display: none; }
.sch-title { margin: 0; }
.sch-date { width: auto; flex: 1 1 160px; min-width: 0; max-width: 100%; }
.sch-body { min-width: 0; }

/* scroll container with sticky gutter + header */
.sch-scroll { overflow: auto; max-width: 100%; max-height: max(240px, calc(100dvh - 260px)); min-height: 240px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sch-grid { display: grid; position: relative; min-width: max-content; }
.sch-corner { position: sticky; top: 0; left: 0; z-index: 4; min-height: 72px; background: var(--surface); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.sch-colhead { position: sticky; top: 0; z-index: 3; min-height: 72px; min-width: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; padding: 8px 10px; font-weight: 700; font-size: .92rem; text-align: center; background: var(--surface); border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); overflow-wrap: anywhere; }
.sch-colhead-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--aqua); }
.sch-colhead-loose { color: var(--ink-soft); font-style: italic; }
.sch-gutter { position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--line); }
.sch-gutter-t { position: absolute; right: 8px; transform: translateY(-50%); font-size: .74rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sch-gutter-first { transform: none; top: 4px !important; }
.sch-col { position: relative; border-left: 1px solid var(--line); cursor: pointer; }
.sch-col:hover { background: color-mix(in srgb, var(--aqua-tint) 40%, transparent); }
.sch-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); pointer-events: none; }
.sch-off, .sch-hatch { background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--ink) 7%, transparent) 8px 10px); }
.sch-off { position: absolute; left: 0; right: 0; pointer-events: none; }
.sch-col-loose { background: var(--yellow-tint); }
.sch-now { position: absolute; grid-row: 2; grid-column: 2 / -1; left: 0; right: 0; height: 0; border-top: 2px solid var(--bad); z-index: 2; pointer-events: none; }
.sch-now::before { content: ""; position: absolute; left: -5px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }

/* blocks */
.sch-block { position: absolute; left: 4px; right: 4px; display: flex; flex-direction: column; gap: 1px; padding: 3px 8px 3px 12px; border: 1px solid transparent; border-radius: var(--radius-sm); text-align: left; font: inherit; font-size: .8rem; line-height: 1.25; color: var(--ink); cursor: pointer; overflow: hidden; z-index: 1; background: var(--aqua-tint); box-shadow: var(--shadow-sm); }
.sch-block::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--sch-cat, var(--aqua)); }
.sch-block:hover { z-index: 2; box-shadow: var(--shadow-md); }
.sch-block-time { font-size: .7rem; color: var(--ink-soft); white-space: nowrap; }
.sch-block-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sch-block-treat { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); }
.sch-tone-warn { background: var(--warn-tint); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.sch-tone-aqua { background: var(--aqua-tint); border-color: color-mix(in srgb, var(--aqua-deep) 50%, transparent); }
.sch-tone-ok { background: var(--ok-tint); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.sch-tone-dark { background: color-mix(in srgb, var(--ink) 8%, var(--surface)); border-color: var(--line); }
.sch-tone-dark .sch-block-name, .sch-tone-dark .sch-block-treat { text-decoration: line-through; text-decoration-color: var(--ink-faint); }
.sch-tone-bad { background: var(--bad-tint); border-color: color-mix(in srgb, var(--bad) 40%, transparent); opacity: .8; }
.sch-cat-0 { --sch-cat: var(--aqua); }
.sch-cat-1 { --sch-cat: var(--yellow); }
.sch-cat-2 { --sch-cat: #7c3aed; }
.sch-cat-3 { --sch-cat: #f97316; }
.sch-cat-4 { --sch-cat: #0ea5e9; }
.sch-cat-5 { --sch-cat: #ec4899; }
.sch-cat-6 { --sch-cat: #16a34a; }
.sch-cat-7 { --sch-cat: #a16207; }

/* week */
.sch-week { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); min-width: max-content; }
.sch-wcol { border-left: 1px solid var(--line); padding: 0 6px 12px; min-width: 0; min-height: 320px; display: flex; flex-direction: column; gap: 6px; }
.sch-wcol:first-child { border-left: 0; }
.sch-wcol.sch-today .sch-whead { background: var(--yellow); color: var(--brand-dark); }
.sch-whead { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0 -6px 6px; padding: 8px 6px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); font: inherit; color: inherit; cursor: pointer; position: sticky; top: 0; z-index: 2; }
.sch-wday { font-size: .7rem; letter-spacing: .08em; color: inherit; opacity: .75; }
.sch-wnum { font-family: var(--font-display); font-size: 1.3rem; line-height: 1; }
.sch-week .sch-block { position: static; margin: 0; }
.sch-week .sch-block-time { display: inline; }

/* month */
.sch-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.sch-mhead { text-align: center; font-size: .72rem; letter-spacing: .08em; color: var(--ink-faint); padding: 4px 0; }
.sch-mcell { min-width: 0; min-height: 84px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font: inherit; color: inherit; text-align: left; cursor: pointer; }
.sch-mcell:hover { border-color: var(--aqua-deep); }
.sch-mcell.sch-mout { opacity: .45; }
.sch-mcell.sch-today { border-color: var(--yellow-deep); box-shadow: inset 0 0 0 2px var(--yellow); }
.sch-mnum { font-family: var(--font-display); font-size: 1.1rem; }
.sch-mcount { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .9rem; }
.sch-mcount b { font-size: 1.2rem; }

/* closed + agenda */
.sch-closed { border: 1px solid var(--line); border-radius: var(--radius); min-height: 240px; display: grid; place-items: center; background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--ink) 7%, transparent) 8px 10px); }
.sch-closed-inner { display: flex; align-items: center; gap: 14px; max-width: 100%; padding: 18px 24px; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.sch-closed-inner > div { min-width: 0; overflow-wrap: anywhere; }
.sch-closed-inner svg { width: 28px; height: 28px; flex: none; }
.sch-agenda-row { display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; border-left: 5px solid var(--sch-tone, var(--aqua)); }
.sch-agenda-row.sch-tone-warn { --sch-tone: var(--warn); }
.sch-agenda-row.sch-tone-ok { --sch-tone: var(--ok); }
.sch-agenda-row.sch-tone-dark { --sch-tone: var(--ink-faint); }
.sch-agenda-row.sch-tone-bad { --sch-tone: var(--bad); }
.sch-agenda-row .title, .sch-agenda-row .sub { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.sch-agenda-time { display: flex; flex-direction: column; min-width: 78px; }
.sch-agenda-time b { font-variant-numeric: tabular-nums; }

/* drawers + rows */
.sch-drawer { min-width: 0; }
.sch-patient { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--aqua-tint); }
.sch-pname { max-width: 100%; font-family: var(--font-display); font-size: 1.3rem; padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.sch-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.sch-actions .btn { min-width: 0; max-width: 100%; }
.sch-danger { color: var(--bad); }
.sch-inline { padding: 14px; }
.sch-inline .label { margin-bottom: 8px; }
.sch-reasons .chips { margin-top: 6px; }
.sch-picked { padding: 8px 10px; }
.sch-req { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.sch-req > *, .sch-req .row-between > div { min-width: 0; overflow-wrap: anywhere; }
.sch-req-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 1.15rem; }
.sch-req-name .textlink { font: inherit; padding: 0; border: 0; background: none; cursor: pointer; }
.sch-req-what { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.sch-booking-link { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px; }
.sch-booking-link > .stack { flex: 1 1 280px; min-width: 0; }
.sch-booking-link h3, .sch-booking-link p { margin: 0; }
.sch-booking-url { overflow-wrap: anywhere; }
.sch-request-error { flex-wrap: wrap; }
.sch-request-error > span { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.sch-request-status:empty { display: none; }
.sch-req-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: .82rem; color: var(--ink-soft); }
.sch-req-ref { color: var(--ink-faint); font-size: .75rem; }
.sch-req-what { display: grid; gap: 5px; }
.sch-req-what b { font-size: .95rem; }
.sch-booking-link { padding: 18px 22px; background: var(--surface); }
.sch-booking-link h3 { font: 600 1rem/1.4 var(--font-body); }
.sch-booking-url { font-size: .84rem; color: var(--aqua-text); }
.sch-disclosure { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.sch-disclosure > summary { padding: 14px 16px; cursor: pointer; font-size: .86rem; font-weight: 600; color: var(--ink-soft); min-height: 46px; }
.sch-disclosure-body { padding: 0 16px 16px; min-width: 0; }
.sch-disclosure-body .field + .field { margin-top: 0; }
.sch-book-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; list-style: none; padding: 0; margin: 0; }
.sch-book-steps li { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: .79rem; font-weight: 600; }
.sch-book-steps li > span { width: 25px; height: 25px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); display: grid; place-items: center; flex: none; }
.sch-book-steps .done > span { color: var(--aqua-text); background: var(--aqua-tint); border-color: var(--aqua-deep); }
.sch-agenda-row:focus-visible { outline: 3px solid var(--aqua-deep); outline-offset: 3px; }
.sch-paste .card-head { margin-bottom: 8px; }
.sch-import { padding: 18px; display: flex; flex-direction: column; gap: 12px; border: 2px solid var(--aqua-deep); }

/* toast with action */
.sch-toast { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sch-toast > span { min-width: 0; overflow-wrap: anywhere; }
.sch-toast-btn { border: 0; background: var(--yellow); color: var(--brand-dark); font: inherit; font-weight: 700; font-size: .85rem; padding: 6px 12px; border-radius: var(--pill); cursor: pointer; min-height: 36px; }

@media (max-width: 899px) {
  .sch-scroll { max-height: max(240px, calc(100dvh - var(--tabbar-h) - 220px)); }
  .sch-tools { gap: 8px; }
  .sch-month { gap: 2px; }
  .sch-mcell { min-height: 64px; padding: 6px; }
  .sch-mcount { font-size: .8rem; }
  .sch-mcount .tag { display: none; }
}
@media (max-width: 560px) {
  .sch-agenda-row { grid-template-columns: 68px minmax(0, 1fr); gap: 10px; padding: 12px; }
  .sch-agenda-time { min-width: 0; font-size: .88rem; }
  .sch-agenda-row .end { grid-column: 2; }
  .sch-mcell { padding: 5px 3px; }
  .sch-mcount { gap: 3px; }
  .sch-mcount b { font-size: 1rem; }
}
@media (max-height: 600px) {
  .sch-scroll { min-height: 180px; max-height: max(180px, calc(100dvh - 220px)); }
}

@media (max-width: 560px) {
  .sch-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
  .sch-tools > .seg:not([hidden]) { grid-column: 1 / -1; display: flex; width: 100%; }
  .sch-tools > .seg button { flex: 1; min-height: 44px; padding: 10px 12px; }
  .sch-tools > .row { grid-column: 1 / -1; display: grid; grid-template-columns: 44px minmax(80px, 1fr) 44px; gap: 10px; width: 100%; }
  .sch-tools > .row .btn { width: 100%; min-height: 44px; }
  .sch-tools .sch-date { grid-column: 1 / -1; width: 100%; }
  .sch-tools > .btn { grid-column: 2; }
  .sch-title { font-size: clamp(1.1rem, 4.5vw, 1.4rem); line-height: 1.45; }
}
