/* Dispatch board: techs across, hours down. Loaded after style.css by dispatch.html. */
.board-page {
  --time-w: 58px;
  --head-h: 46px;
  --row-h: 64px;
  --col-min: 150px;
  --soft: #f8fafc;
  --rule: #e2e8f0;
  --rule-soft: #edf1f5;
  --muted-on-bg: #55657a; /* muted text on the page background, 5.5:1 */
}
.board-page .empty-note { color: var(--muted); } /* the shared grey is too faint on white */

/* ---- layout ---- */
.board-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; padding: 16px; max-width: 1500px; margin: 0 auto; align-items: start; }
.board-main { min-width: 0; } /* the grid scrolls inside its own box instead of widening the page */
.side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 74px; min-width: 0; }
.side .card { padding: 14px 16px; }
body.embed .top { display: none; }
body.embed .board-layout { padding: 12px; gap: 12px; grid-template-columns: minmax(0, 1fr) 280px; }
body.embed .side { top: 12px; }
body.embed .sms-card { display: none; } /* the demo page shows the texts right beside the call */

.board-top .short { display: none; }
.board-top a { white-space: nowrap; }

/* ---- toolbar: days, title, legend ---- */
.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.days { position: relative; display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; overscroll-behavior-x: contain; }
.day { position: relative; flex: 0 0 auto; min-width: 86px; display: grid; gap: 1px; text-align: left; padding: 7px 30px 7px 11px; border-radius: 10px; border: 1px solid var(--rule); background: var(--panel); color: var(--ink); line-height: 1.2; }
.day .d1 { font-weight: 650; font-size: 13px; }
.day .d2 { font-size: 12px; color: var(--muted); white-space: nowrap; }
.day .n { position: absolute; top: 7px; right: 7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #e2e8f0; color: #334155; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.day:hover { border-color: #cbd5e1; }
.day:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.day.closed:not(.active) { background: repeating-linear-gradient(135deg, #f8fafc 0 6px, #f1f5f9 6px 12px); }
.day.closed .d1, .day.closed .d2 { color: #475569; }
.day.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25); }
.day.active .d1 { color: #fff; }
.day.active .d2 { color: #ccfbf1; }
.day.active .n { background: rgba(255, 255, 255, 0.2); color: #fff; }
.days.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); }
.days.more-left { -webkit-mask-image: linear-gradient(to right, transparent, #000 56px); mask-image: linear-gradient(to right, transparent, #000 56px); }
.days.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent); }
.day.has-new::after { content: ""; position: absolute; top: -3px; left: -3px; width: 10px; height: 10px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 2px var(--bg); }

.toolbar-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; }
.day-title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.day-meta { margin: 0; font-size: 13px; color: var(--muted-on-bg); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 0 auto; align-self: center; }
.btn-sm { padding: 6px 12px; font-size: 13px; align-self: center; }
.touch-hint { display: none; margin: 0; font-size: 12.5px; color: var(--muted-on-bg); }

/* ---- grid ---- */
.grid-scroll { overflow: auto; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); overscroll-behavior-x: contain; scrollbar-width: thin; }
.grid-scroll:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.grid {
  display: grid;
  grid-template-columns: var(--time-w) repeat(var(--cols, 4), minmax(var(--col-min), 1fr));
  grid-template-rows: var(--head-h) repeat(var(--rows, 9), var(--row-h));
  position: relative;
  min-width: min-content;
  user-select: none;
}
.grid > * { min-width: 0; }
.grid .corner { position: sticky; top: 0; left: 0; z-index: 7; background: var(--soft); border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.grid .head { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 0 10px; background: var(--soft); border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-weight: 650; font-size: 13px; white-space: nowrap; }
.grid .head .avatar-sm { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--c); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.grid .head-unassigned .avatar-sm { background: transparent; border: 2px dashed #94a3b8; }
.grid .head .head-name { overflow: hidden; text-overflow: ellipsis; }
.grid .head .count { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 12px; }
.grid .head.has-open .count { padding: 1px 8px; border-radius: 999px; background: #fef3c7; color: #92400e; font-weight: 700; }
.grid .time { position: sticky; left: 0; z-index: 5; padding: 5px 8px 0 0; text-align: right; background: #fcfdfe; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule-soft); font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid .cell { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule-soft); }
.grid .cell.unassigned { background: #fbfcfd; }
.grid .cell.past { background: #f5f7f9; }
.grid .cell.closed { background: repeating-linear-gradient(135deg, #f8fafc 0 6px, #f1f5f9 6px 12px); }
.grid .cell.over { background: #ecfdf5; outline: 2px dashed var(--brand); outline-offset: -3px; }

/* the current time, across today's grid */
.now-line { position: relative; z-index: 4; align-self: start; height: 2px; margin-top: calc(var(--frac, 0) * var(--row-h) - 1px); background: #dc2626; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #dc2626; }
.now-tag { position: sticky; left: 0; z-index: 6; align-self: start; justify-self: stretch; margin-top: calc(var(--frac, 0) * var(--row-h) - 9px); padding-right: 4px; text-align: right; pointer-events: none; }
.now-tag span { display: inline-block; padding: 1px 5px; border-radius: 6px; background: #dc2626; color: #fff; font-size: 10.5px; font-weight: 700; line-height: 1.5; font-variant-numeric: tabular-nums; }

/* ---- job cards ---- */
.job { position: relative; z-index: 1; margin: 3px; padding: 4px 8px; display: flex; flex-direction: column; gap: 1px; overflow: hidden; border-radius: 8px; background: #fff; border: 1px solid var(--rule); border-left: 4px solid var(--c, #94a3b8); box-shadow: 0 1px 2px rgba(16, 32, 42, 0.06); cursor: grab; font-size: 12.5px; line-height: 1.22; transition: box-shadow 0.15s; }
.job:hover { box-shadow: 0 4px 12px rgba(16, 32, 42, 0.12); }
.job:active { cursor: grabbing; }
.job:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.job.selected { z-index: 2; outline: 2px solid var(--brand); outline-offset: 1px; box-shadow: 0 6px 18px rgba(15, 118, 110, 0.22); }
.job.dragging { opacity: 0.45; }
.job .who { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job .what { color: #334155; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.job.short .what { display: block; white-space: nowrap; text-overflow: ellipsis; }
.job .meta { margin-top: auto; display: flex; align-items: center; gap: 5px; flex-wrap: nowrap; overflow: hidden; color: #475569; font-size: 11px; }
.job:not(.short) .meta { flex-wrap: wrap; row-gap: 3px; }
.job .when { flex: none; font-variant-numeric: tabular-nums; }
.job.urgent { border-left-color: #d97706; }
.job.emergency { border-left-color: var(--danger); background: #fef2f2; }
.job.enroute { background: #f0fdf4; }
.job.done { background: #f8fafc; border-left-color: #94a3b8; box-shadow: none; }
.job.done .who { color: #475569; text-decoration: line-through; }
.job.done .what { color: #475569; }

.tag { flex: none; display: inline-block; padding: 1px 6px; border-radius: 999px; font-size: 10px; font-weight: 700; line-height: 1.4; letter-spacing: 0.03em; text-transform: uppercase; }
.tag.urgent { background: #fef3c7; color: #92400e; }
.tag.emergency { background: #fee2e2; color: #991b1b; }
.tag.enroute { background: #dcfce7; color: #166534; }
.tag.done { background: #e2e8f0; color: #475569; }
.tag.new { background: var(--brand); color: #fff; animation: glow 1.4s ease-in-out 4; }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.6); } 50% { box-shadow: 0 0 0 6px rgba(15, 118, 110, 0); } }

/* a job arriving; a booking from the receptionist also rings */
.job.fx-land { animation: land 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.job.fx-flash { animation: land 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.2), ring 1s ease-out 0.45s 3; }
@keyframes land { from { transform: scale(0.6) translateY(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.55); } 100% { box-shadow: 0 0 0 14px rgba(15, 118, 110, 0); } }

/* ---- job panel ---- */
.panel-h { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.panel .empty-note { margin: 8px 0 0; }
.panel-top { display: flex; align-items: center; justify-content: space-between; margin: -4px -6px 6px 0; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; }
.icon-btn:hover { background: #f1f5f9; color: var(--ink); }
.icon-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.job-name { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; }
.job-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: 2px; }
.job-when { margin: 3px 0 0; font-size: 13.5px; color: #334155; }
.panel dl { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 6px 10px; margin: 12px 0 14px; font-size: 13px; }
.panel dt { color: var(--muted); }
.panel dd { margin: 0; overflow-wrap: anywhere; }
.panel .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.panel .btn { padding: 7px 12px; font-size: 13.5px; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-note { font-weight: 400; }
.btn-note::before { content: "· "; }
.move { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--rule); }
.move summary { display: flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; font-size: 13.5px; font-weight: 650; }
.move summary::-webkit-details-marker { display: none; }
.move summary::before { content: "▸"; color: var(--muted); transition: transform 0.15s; }
.move[open] summary::before { transform: rotate(90deg); }
.move summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.move-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.move-form label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.move-form .wide { grid-column: 1 / -1; }
.move-form select { min-width: 0; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 13.5px; }
.move-form select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.move-form .btn { grid-column: 1 / -1; justify-self: start; }

.sms-card .feed { max-height: 360px; }
.toast { position: fixed; bottom: calc(var(--sheet-h, 0px) + 16px); left: 50%; transform: translateX(-50%); z-index: 40; max-width: min(92vw, 520px); padding: 10px 16px; border-radius: 10px; background: #16202a; color: #fff; font-size: 13px; text-align: center; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* ---- tablets and phones: the job opens as a sheet over the bottom of the board ---- */
@media (max-width: 960px) {
  .board-layout, body.embed .board-layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  .legend { display: none; }
  .touch-hint { display: block; }
  .panel { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 30; max-height: min(58vh, 460px); overflow: auto; box-shadow: 0 -6px 30px rgba(16, 32, 42, 0.2); transform: translateY(calc(100% + 24px)); visibility: hidden; transition: transform 0.22s ease, visibility 0s linear 0.22s; }
  .panel.is-open { transform: none; visibility: visible; transition: transform 0.22s ease; }
  .panel dl { grid-template-columns: 64px minmax(0, 1fr); margin: 10px 0 12px; }
  .panel dl .opt { display: none; }
  /* a sheet: a handle instead of the "Job" heading row, which stays for screen readers */
  .panel.is-open { padding-top: 22px; }
  .panel.is-open::before { content: ""; position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: #cbd5e1; }
  .panel-top { margin: 0; }
  .panel-top .panel-h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .panel-top .icon-btn { position: absolute; top: 10px; right: 10px; }
  .job-name { padding-right: 36px; }
  .btn-note { display: block; font-size: 11.5px; }
  .btn-note::before { content: none; }
}
@media (max-width: 600px) {
  .board-page { --time-w: 50px; --col-min: 136px; --head-h: 42px; }
  .board-layout, body.embed .board-layout { padding: 10px; }
  .board-top { padding: 10px 14px; }
  .board-top .brand { gap: 8px; font-size: 15px; }
  .board-top .brand .logo { width: 28px; height: 28px; font-size: 15px; }
  .board-top .sub, .board-top .long { display: none; }
  .board-top .short { display: inline; }
  .day { min-width: 76px; padding: 6px 28px 6px 9px; }
  .day-title { font-size: 16px; }
  .grid .head { padding: 0 8px; gap: 6px; }
  .grid .time { padding-right: 6px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .job.fx-land, .job.fx-flash, .tag.new { animation: none; }
  .job.fx-flash { outline: 3px solid var(--brand); outline-offset: 1px; }
  .panel, .panel.is-open { transition: none; }
}
