:root {
  --bg: #f1f5f9;
  --card: #fff;
  --ink: #0f172a;
  --muted: #64748b;
  --brand: #0a2540;
  --accent: #f59e0b;
  --danger: #be123c;
  --ok: #15803d;
  --border: #e2e8f0;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.4;
}
#app { min-height: 100%; }
button, input, select, textarea { font: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  border: 1px solid var(--border); background: #fff; color: var(--ink);
  padding: 0.45rem 0.75rem; border-radius: 8px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #f8fafc; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost.light { color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.row { display: flex; align-items: center; }
.gap { gap: 0.5rem; flex-wrap: wrap; }
.muted { color: var(--muted); }
.muted.light, .light { color: rgba(255,255,255,0.85); }
.tiny { font-size: 0.8rem; }
.hidden { display: none !important; }
.pill {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px;
  background: #e2e8f0; font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
}
.pill.tiny { font-size: 0.65rem; margin-left: 0.25rem; }
.sync-badge {
  background: #fef3c7; color: #92400e; font-size: 0.75rem; font-weight: 700;
  padding: 0.2rem 0.5rem; border-radius: 999px;
}
.badge {
  background: var(--danger); color: #fff; border-radius: 999px;
  min-width: 1.25rem; height: 1.25rem; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; padding: 0 0.35rem;
}
.urgent-tag {
  background: var(--danger); color: #fff; font-size: 0.65rem; padding: 0.15rem 0.4rem;
  border-radius: 4px; margin-left: 0.35rem; vertical-align: middle;
}
.access { color: #9a3412; background: #ffedd5; padding: 0.2rem 0.4rem; border-radius: 4px; }
.warn { background: #fef3c7; padding: 0.5rem 0.75rem; border-radius: 8px; border-left: 4px solid var(--accent); }
.flag {
  display: inline-block; background: #dbeafe; color: #1e40af; font-size: 0.7rem; font-weight: 700;
  padding: 0.1rem 0.4rem; border-radius: 4px; margin-right: 0.25rem;
}
.flag.top { background: #dcfce7; color: #166534; }
.flag.top.big { display: block; text-align: center; padding: 0.4rem; margin-bottom: 0.5rem; font-size: 0.9rem; }
.pad { padding: 1rem; }
.boot { padding: 2rem; text-align: center; }
.boot.error { color: var(--danger); }

/* Auth */
.auth-card {
  max-width: 400px; margin: 10vh auto; background: var(--card); padding: 1.5rem;
  border-radius: var(--radius); box-shadow: 0 8px 30px rgba(15,23,42,0.08);
}
.brand-lg { font-size: 1.6rem; font-weight: 800; color: var(--brand); }
.form-grid { display: grid; gap: 0.75rem; }
.form-grid label { display: grid; gap: 0.25rem; font-size: 0.9rem; font-weight: 600; }
.form-grid input, .form-grid select, .form-grid textarea {
  font-weight: 400; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; width: 100%;
}
.form-grid .check { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.form-grid .check input { width: auto; }

/* Desktop */
.desk-layout {
  display: grid; grid-template-columns: 300px 1fr; min-height: 100vh;
}
.desk-sidebar {
  background: var(--brand); color: #fff; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem;
}
.desk-sidebar .brand { font-weight: 800; font-size: 1.1rem; }
.desk-sidebar .user-chip { background: rgba(255,255,255,0.1); padding: 0.5rem 0.65rem; border-radius: 8px; }
.queue-nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; overflow: auto; }
.queue-btn {
  display: flex; justify-content: space-between; align-items: center;
  background: transparent; border: 0; color: #cbd5e1; text-align: left;
  padding: 0.45rem 0.55rem; border-radius: 8px; cursor: pointer; font-size: 0.85rem;
}
.queue-btn:hover, .queue-btn.active { background: rgba(255,255,255,0.12); color: #fff; }
.queue-btn .count {
  background: #fff; color: #1d4ed8; border-radius: 999px; min-width: 1.4rem; height: 1.4rem;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 0.35rem; font-size: 0.75rem; font-weight: 700;
}
.queue-btn.urgent .count,
.queue-btn .count.count-urgent {
  background: var(--danger); color: #fff;
}
.desk-sidebar .desk-queue-panel,
.desk-queue-panel { display: none !important; }
.sidebar-foot { display: flex; flex-direction: column; gap: 0.25rem; }
.sidebar-foot .btn.ghost { color: #cbd5e1; justify-content: flex-start; }

.desk-main { display: flex; flex-direction: column; min-width: 0; }
.desk-topbar {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem;
  background: var(--card); border-bottom: 1px solid var(--border);
}
.desk-topbar h1 { font-size: 1rem; margin: 0; flex: 1; text-align: center; }
.diary-wrap { overflow: auto; padding: 0.75rem; flex: 1; }
.diary-people-filter {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.55rem 0.75rem; margin-bottom: 0.65rem;
}
.diary-filter-head {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.4rem;
}
.diary-filter-head .btn.small { padding: 0.15rem 0.45rem; font-size: 0.75rem; }
.diary-filter-ticks {
  display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem;
}
.diary-tick {
  display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem;
  cursor: pointer; user-select: none;
}
.diary-tick input { accent-color: var(--uc, #1e40af); }
.diary-tick .tick-swatch {
  width: 10px; height: 10px; border-radius: 2px; background: var(--uc, #64748b);
}
.diary-empty {
  background: var(--card); padding: 1.25rem; text-align: center; color: var(--muted); font-size: 0.9rem;
}
.diary-grid {
  display: grid;
  grid-template-columns: 120px repeat(7, minmax(110px, 1fr));
  gap: 2px; background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  min-width: 900px;
}
.diary-corner, .diary-dayhead, .diary-user, .diary-cell {
  background: var(--card); padding: 0.4rem; min-height: 64px;
}
.diary-dayhead { font-weight: 700; font-size: 0.8rem; text-align: center; background: #f8fafc; }
.diary-dayhead.today { background: #fef3c7; }
.diary-user { font-weight: 700; font-size: 0.85rem; display: flex; flex-direction: column; justify-content: center; }
.diary-user small { font-weight: 500; color: var(--muted); }
.diary-cell { display: flex; flex-direction: column; gap: 0.25rem; }
.diary-cell.desk-day-timed {
  display: block; position: relative; padding: 0; overflow: hidden;
  background: repeating-linear-gradient(
    to bottom,
    #fff 0,
    #fff calc(var(--px-hour, 54px) - 1px),
    #e2e8f0 calc(var(--px-hour, 54px) - 1px),
    #e2e8f0 var(--px-hour, 54px)
  );
}
.desk-day-canvas { position: relative; width: 100%; height: 100%; }
.desk-hour-line {
  position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid #e2e8f0;
  pointer-events: none;
}
.desk-hour-line.half { border-top: 1px dashed #eef2f7; }
.job-block.job-block-timed { right: auto; box-sizing: border-box; }
.job-block {
  border: 0; border-radius: 6px; color: #fff; text-align: left; padding: 0.3rem 0.4rem;
  cursor: pointer; font-size: 0.7rem; display: flex; flex-direction: column; gap: 0.1rem;
}
.job-block.job-block-timed {
  overflow: hidden; box-shadow: 0 1px 3px rgba(15,23,42,0.18);
}
.job-block .jb-time { font-size: 0.65rem; font-weight: 700; opacity: 0.95; }
.job-block .jb-num { font-weight: 800; }
.job-block .jb-badges { opacity: 0.95; font-weight: 700; }
.job-block.tbc {
  background: color-mix(in srgb, var(--job-colour, #0a2540) 40%, transparent) !important;
  border: 2px dashed var(--job-colour, #0a2540);
  color: #0f172a;
  opacity: 1 !important;
}
.job-block.tbc .jb-num,
.job-block.tbc .jb-desc,
.job-block.tbc .jb-badges,
.job-block.tbc .jb-time { color: #0f172a; }


.desk-detail { padding: 0 0.75rem 1rem; }
.detail-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem;
}
.detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; align-items: flex-start; }
.detail-card h2, .detail-card h3 { margin-top: 0; }
.msg-list { list-style: none; padding: 0; margin: 0; }
.msg-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.msg-list pre { white-space: pre-wrap; font-size: 0.8rem; background: #f8fafc; padding: 0.5rem; border-radius: 6px; }

.desk-sidebar .desk-queue-panel {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; padding: 0.65rem; overflow: auto; flex: 1; min-height: 140px;
  color: #e2e8f0;
}
.desk-queue-panel h2 { font-size: 0.9rem; margin: 0 0 0.5rem; color: #fff; }
.queue-list { list-style: none; padding: 0; margin: 0; }
.queue-list li {
  padding: 0.45rem 0.35rem; border-bottom: 1px solid rgba(255,255,255,0.1); cursor: pointer;
  display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.8rem;
}
.queue-list li:hover { background: rgba(255,255,255,0.08); }
.queue-list li .muted { color: #94a3b8; }
.queue-list li.urgent { border-left: 3px solid var(--danger); padding-left: 0.45rem; }
.btn.toggle-on { background: #166534; color: #fff; border-color: #166534; }
.rates { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.rates th, .rates td { border-bottom: 1px solid var(--border); padding: 0.4rem; text-align: left; }

/* Phone */
.phone-shell { display: flex; flex-direction: column; min-height: 100vh; max-width: 560px; margin: 0 auto; background: var(--bg); }
.phone-shell-diary {
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}
.phone-diary-chrome {
  flex-shrink: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 8;
}
.phone-diary-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}
.phone-header {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1rem; color: #fff; position: relative; z-index: 5;
}
.phone-toolbar { display: flex; gap: 0.35rem; padding: 0.5rem; flex-wrap: wrap; background: var(--card); border-bottom: 1px solid var(--border); }
.phone-date { padding: 0.5rem 1rem; font-weight: 700; background: var(--bg); }
.phone-diary-body { flex: 1; overflow: auto; padding-bottom: 0.5rem; }
.phone-week-chrome { background: var(--bg); }
.phone-week-heads-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.phone-list { flex: 1; padding: 0.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.phone-list-compact { flex: none; }
.phone-section-title {
  margin: 0.75rem 0.75rem 0.35rem; font-size: 0.85rem; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.03em;
}
.phone-day-title {
  margin: 0.35rem 0.75rem 0.4rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text, #0f172a);
  letter-spacing: 0.01em;
}
.phone-people-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem 0.25rem;
  align-items: center;
}
.phone-chip {
  border: 1px solid var(--border, #cbd5e1);
  background: #fff;
  color: #0f172a;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  border-left: 4px solid var(--c, var(--brand, #0a2540));
}
.phone-chip.active {
  background: var(--c, var(--brand, #0a2540));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--c, #0a2540) 35%, transparent);
}
.phone-chip.active:not(:disabled) {
  opacity: 1;
}
.day-empty-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: var(--muted, #64748b);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  padding: 1rem;
  z-index: 1;
}
.phone-unscheduled {
  margin-top: 0.5rem;
  padding-bottom: 0.75rem;
  opacity: 0.92;
}
.phone-unscheduled-title {
  font-size: 0.75rem !important;
}
.phone-unscheduled-empty {
  margin: 0 0.75rem 0.5rem;
}
.phone-unscheduled .phone-list-compact .phone-job {
  padding: 0.55rem 0.65rem;
  font-size: 0.88rem;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.phone-day-board {
  display: grid;
  grid-template-columns: 48px 1fr;
  margin: 0 0.5rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  overflow: hidden;
  min-height: var(--board-h, 1296px);
}
.day-gutter {
  position: relative;
  background: #f8fafc;
  border-right: 1px solid var(--border);
}
.day-gutter-label {
  position: absolute;
  left: 0; right: 0;
  transform: translateY(-50%);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  padding: 0 1px;
  line-height: 1.1;
}
.day-canvas {
  position: relative;
  background: repeating-linear-gradient(
    to bottom,
    #fff 0,
    #fff calc(var(--px-hour, 54px) - 1px),
    #eef2f7 calc(var(--px-hour, 54px) - 1px),
    #eef2f7 var(--px-hour, 54px)
  );
}
.day-hour {
  position: absolute; left: 0; right: 0; height: 0;
  border-top: 1px solid #e2e8f0;
  pointer-events: none;
}
.day-hour.half { border-top: 1px dashed #e8eef5; }
.day-hour.quarter { border-top: 1px dotted #f1f5f9; }
.day-hour-label { display: none; }
.day-job.phone-job,
.phone-job-block {
  position: absolute;
  margin: 0;
  right: auto;
  border-radius: 6px;
  padding: 0.22rem 0.35rem;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.16);
  touch-action: manipulation;
  box-sizing: border-box;
}
.day-job .pj-num { font-size: 0.72rem; margin-bottom: 0.05rem; line-height: 1.15; }
.day-job .dj-desc,
.day-job .dj-client,
.day-job .dj-addr { font-size: 0.65rem; line-height: 1.15; opacity: 0.95; }
.day-job .dj-time { font-size: 0.6rem; margin-top: 0.1rem; }
.day-job .status-pill,
.phone-job-block .status-pill {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  padding: 0.05rem 0.35rem;
  margin-bottom: 0.12rem;
  line-height: 1.2;
}
.phone-job.tbc .status-pill {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fdba74;
}
.phone-job {
  text-align: left; border: 0; border-radius: 12px; padding: 0.75rem; background: var(--c, var(--brand));
  color: #fff; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.phone-job.tbc {
  background: color-mix(in srgb, var(--c, var(--brand)) 40%, transparent) !important;
  border: 2px dashed var(--c, var(--brand));
  color: #0f172a;
  opacity: 1;
}
.phone-job.tbc .muted { color: #334155; }
.phone-job .flag.tbc-flag {
  background: #fff7ed; color: #9a3412; border: 1px solid #fdba74;
}
.phone-job .pj-num { font-weight: 800; margin-bottom: 0.25rem; }
.phone-job .muted { color: rgba(255,255,255,0.85); }
.phone-nav {
  padding: 0.55rem 0.75rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--card);
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  z-index: 6;
}
.phone-shell-diary .phone-nav {
  /* pinned by flex layout under the scroll area */
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.06);
}
.phone-nav-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.phone-nav-tabs .btn { width: 100%; font-weight: 700; }

/* Week grid — hours × Mon–Sun */
.phone-week-grid-wrap {
  margin: 0 0.35rem 0.5rem;
}
.phone-week-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.phone-week-month {
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.25rem 0.4rem 0.35rem;
  color: var(--ink, #0f172a);
}
.phone-week-heads {
  display: grid;
  grid-template-columns: 48px 1fr;
  margin-bottom: 0.25rem;
  min-width: 560px;
}
.phone-week-heads-gutter { }
.phone-week-heads-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(72px, 1fr));
  gap: 2px;
}
.phone-week-head-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.35rem 0.2rem;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  color: var(--ink, #0f172a);
}
.phone-week-head-chip .pwh-dow { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; }
.phone-week-head-chip .pwh-dom { font-size: 0.9rem; font-weight: 800; }
.phone-week-head-chip.is-today {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
}
.phone-week-head-chip.is-focused:not(.is-today) {
  border-color: var(--brand, #0a2540);
}
.phone-week-grid {
  display: grid;
  grid-template-columns: 48px 1fr;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  overflow: hidden;
  min-height: var(--board-h, 1296px);
  min-width: 560px;
}
.phone-week-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(72px, 1fr));
  position: relative;
  min-height: var(--board-h, 1296px);
  background: repeating-linear-gradient(
    to bottom,
    #fff 0,
    #fff calc(var(--px-hour, 54px) - 1px),
    #eef2f7 calc(var(--px-hour, 54px) - 1px),
    #eef2f7 var(--px-hour, 54px)
  );
}
.phone-week-day-col {
  position: relative;
  border-left: 1px solid #e8eef5;
  min-height: var(--board-h, 1296px);
  overflow: hidden;
}
.phone-week-day-col.is-today {
  background: rgba(59, 130, 246, 0.04);
}
.phone-week-block {
  font-size: 0.62rem;
}
.phone-week-block .pj-num { font-size: 0.62rem; }
.phone-week-block .dj-client,
.phone-week-block .dj-addr,
.phone-week-block .dj-desc { font-size: 0.58rem; }
.phone-week-block .status-pill { font-size: 0.5rem; padding: 0.02rem 0.28rem; }

/* Legacy week list (unused in v19 grid) */
.phone-week { display: none; }

/* Profile */
.phone-profile {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 1rem;
}
.phone-profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}
.phone-profile-dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.phone-profile-dl > div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.35rem;
  align-items: baseline;
}
.phone-profile-dl dt {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.phone-profile-dl dd {
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}
.phone-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.phone-toggle:last-of-type { border-bottom: 0; }
.phone-toggle input[type="checkbox"] {
  width: 1.35rem;
  height: 1.35rem;
  accent-color: var(--brand, #0a2540);
  flex-shrink: 0;
}
.phone-toggle .block { display: block; margin-top: 0.15rem; }
.phone-job-detail { padding: 1rem; display: grid; gap: 0.75rem; }
.action-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.note-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem; }
.stack { display: flex; flex-direction: column; gap: 0.4rem; }

@media (max-width: 1100px) {
  .desk-layout { grid-template-columns: 260px 1fr; }
}
@media (max-width: 899px) {
  .desk-layout { display: none; }
}


/* —— Job tab form modal —— */
body.jt-open { overflow: hidden; }
.jt-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: stretch; justify-content: center;
}
.jt-modal.hidden { display: none !important; }
.jt-backdrop {
  position: absolute; inset: 0; background: rgba(15, 23, 42, 0.55);
}
.jt-panel {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  width: min(920px, 100%);
  min-height: 240px;
  max-height: min(92vh, 900px);
  margin: auto;
  background: var(--card, #fff);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.28);
  overflow: hidden;
}
.jt-modal.jt-phone .jt-panel {
  width: 100%; max-height: 100%; height: 100%;
  margin: 0; border-radius: 0;
}
.jt-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem;
  padding: 0.85rem 1rem; background: var(--brand, #0a2540); color: #fff;
  flex-shrink: 0;
}
.jt-title { font-weight: 800; font-size: 1.05rem; }
.jt-head .muted, .jt-head .tiny { color: rgba(255,255,255,0.8); }
.jt-head .btn.ghost { color: #fff; border-color: transparent; }
.jt-tabs {
  display: flex; align-items: center; gap: 0.25rem;
  overflow-x: auto; overflow-y: visible;
  padding: 0.65rem 0.75rem;
  min-height: 48px;
  background: #f8fafc; border-bottom: 1px solid var(--border, #e2e8f0);
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}
.jt-tab {
  flex: 0 0 auto; border: 1px solid transparent; background: transparent;
  min-height: 40px; line-height: 1.25;
  padding: 0.55rem 0.85rem; border-radius: 999px; cursor: pointer;
  font-size: 0.82rem; font-weight: 700; color: var(--muted, #64748b); white-space: nowrap;
  overflow: visible;
}
.jt-tab.active {
  background: var(--brand, #0a2540); color: #fff; border-color: var(--brand, #0a2540);
}
.jt-body { flex: 1; overflow: auto; padding: 1rem; }
.jt-section { display: grid; gap: 0.85rem; }
.jt-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.choice-group {
  margin: 0; padding: 0; border: none;
}
.choice-group > legend {
  font-size: 0.95rem; font-weight: 700; margin-bottom: 0.45rem; padding: 0;
}
.yn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.yn-btn {
  position: relative; flex: 1 1 calc(50% - 0.25rem); min-width: 110px; cursor: pointer;
}
.yn-btn.yn-third { flex: 1 1 calc(33.33% - 0.35rem); min-width: 90px; }
.yn-btn input {
  position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer;
}
.yn-btn > span {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0.55rem 0.75rem;
  border: 2px solid var(--border, #e2e8f0); border-radius: 12px;
  background: #fff; font-weight: 700; font-size: 0.95rem;
}
.yn-btn input:checked + span {
  border-color: var(--brand, #0a2540); background: #e8eef5; color: var(--brand, #0a2540);
}
.yn-btn input:focus-visible + span { outline: 2px solid var(--accent, #f59e0b); outline-offset: 2px; }
.jt-reveal.hidden { display: none !important; }
.jt-reveal-body { display: grid; gap: 0.65rem; margin-top: 0.5rem; }
.jt-cool {
  display: flex; align-items: center; gap: 0.5rem;
  background: #dcfce7; color: #166534; border-radius: 10px; padding: 0.75rem 0.9rem;
  font-weight: 600;
}
.jt-cool-icon {
  display: inline-flex; width: 1.6rem; height: 1.6rem; align-items: center; justify-content: center;
  background: #166534; color: #fff; border-radius: 999px; font-size: 0.85rem;
}
.jt-field { display: grid; gap: 0.25rem; font-size: 0.9rem; font-weight: 600; }
.jt-field textarea, .jt-field input[type="file"] { font-weight: 400; }
.jt-rv { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.note-card {
  background: var(--card, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px; padding: 0.65rem;
}
.action-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.warn {
  background: #fef3c7; padding: 0.5rem 0.75rem; border-radius: 8px;
  border-left: 4px solid var(--accent, #f59e0b);
}
.btn.toggle-on { background: #166534; color: #fff; border-color: #166534; }
.flag.top.big { display: block; text-align: center; padding: 0.4rem; margin-bottom: 0.5rem; font-size: 0.9rem; }

/* Queue search */
.queue-search {
  width: 100%; margin: 0 0 0.5rem; padding: 0.45rem 0.55rem;
  border: 1px solid rgba(255,255,255,0.2); border-radius: 8px;
  background: rgba(0,0,0,0.2); color: #fff; font-size: 0.85rem;
}
.queue-search::placeholder { color: #94a3b8; }
.queue-list li[data-kind] { cursor: pointer; }

/* Profile overlay (reuses jt-modal / jt-panel) */
.profile-modal .jt-panel { width: min(640px, 100%); }
.profile-foot {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.75rem 1rem; border-top: 1px solid var(--border, #e2e8f0);
  background: #f8fafc; flex-shrink: 0;
}
.profile-foot .profile-saved { color: #166534; font-weight: 700; margin-left: auto; }
.profile-attach-list { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 0.4rem; }
.profile-attach-list li {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.45rem 0.55rem; border: 1px solid var(--border, #e2e8f0); border-radius: 8px;
  font-size: 0.85rem;
}
.profile-attach-list li .att-name { flex: 1; min-width: 8rem; font-weight: 600; }
.contact-same-lock input[readonly], .contact-same-lock textarea[readonly] {
  background: #f1f5f9; color: #334155;
}
.btn.small { padding: 0.2rem 0.5rem; font-size: 0.75rem; }

.jt-foot {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.75rem 1rem; border-top: 1px solid var(--border, #e2e8f0);
  background: #f8fafc; flex-shrink: 0;
}
.jt-close-btn {
  flex-shrink: 0; background: rgba(255,255,255,0.15); color: #fff !important;
  border: 1px solid rgba(255,255,255,0.45) !important; font-weight: 700;
  padding: 0.45rem 0.85rem; border-radius: 8px;
}
.jt-close-btn:hover { background: rgba(255,255,255,0.28); }


/* TBC toggle bar in job modal */
.jt-tbc-bar {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.55rem 1rem; background: #fff7ed; border-bottom: 1px solid #fed7aa;
  flex-shrink: 0;
}
.jt-tbc-bar .tbc-toggle {
  font-weight: 800; border: 2px dashed #ea580c; background: #ffedd5; color: #9a3412;
}
.jt-tbc-bar .tbc-toggle.tbc-on {
  background: #fdba74; border-style: solid; color: #7c2d12;
}
.jt-hours, .jt-hours-inline { font-size: 0.85rem; font-weight: 600; color: #9a3412; }
.jt-hours-inline { margin: 0.35rem 0 0.75rem; }


/* Pop-out list windows */
body.list-window, body[data-shell="list"] { background: var(--bg); }
.list-page { max-width: 960px; margin: 0 auto; padding: 1rem 1.25rem 2rem; }
.list-page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.75rem; }
.list-page-head h1 { margin: 0.15rem 0 0; font-size: 1.45rem; }
.brand-sm { font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.list-page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.list-page-toolbar { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.list-search { flex: 1; padding: 0.55rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.list-page-rows { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list-row { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.7rem 0.85rem; border-bottom: 1px solid var(--border); cursor: pointer; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover, .list-row:focus { background: #f8fafc; outline: none; }
.list-row.urgent { border-left: 3px solid var(--danger); }
.list-empty { padding: 1rem; }
.warn { background: #fff7ed; border-left: 4px solid var(--accent); padding: 0.55rem 0.75rem; border-radius: 6px; font-size: 0.9rem; }


/* New job / call-out form — client search + 15m booking */
.job-create-form .form-section {
  display: grid;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.job-create-form .section-label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.client-search-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.client-search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.client-search-wrap input[type="search"] {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}
.client-add-btn {
  min-width: 44px;
  min-height: 44px;
  font-size: 1.35rem;
  font-weight: 700;
  padding: 0 0.65rem;
  flex-shrink: 0;
}
.client-search-results {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  max-height: 220px;
  overflow: auto;
}
.client-search-results li { margin: 0; }
.client-search-results .csr-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.65rem 0.85rem;
  font: inherit;
  cursor: pointer;
  min-height: 44px;
}
.client-search-results .csr-item:hover,
.client-search-results .csr-item:focus {
  background: #e8eef5;
  outline: none;
}
.client-search-results .csr-empty {
  padding: 0.65rem 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.time-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 0.5rem;
}
.time-row label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.time-row input,
.time-row select {
  min-height: 44px;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
@media (max-width: 520px) {
  .time-row { grid-template-columns: 1fr; }
}
.phone-shell .job-create-form {
  padding-bottom: 2rem;
}
.muted.tiny { font-size: 0.8rem; font-weight: 500; }

/* Co-assignee chips on diary blocks (field shared jobs) */
.co-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-left: 0.35rem;
  vertical-align: middle;
}
.co-chip {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: var(--c, #0a2540);
  color: #fff;
  max-width: 5.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-block .co-chip,
.phone-job.tbc .co-chip {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.35);
}
/* v34 Pricing */
.pz-grid{display:grid;grid-template-columns:minmax(320px,440px) 1fr;gap:16px;align-items:start;margin-top:8px}
.pz-map{height:560px;border:1px solid #ccd;border-radius:8px}
.pz-res{background:#f3f7ff;border:1px solid #cfe0ff;border-radius:8px;padding:8px 10px;margin:8px 0}
.pz-travel{font-size:.9rem;padding:4px 0}
.pz-docrow{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:8px 0;padding:6px 8px;background:#f7f8fa;border-radius:6px}
.pz-docrow #ddTravel{flex-basis:100%}
.pz-rates input{width:110px}
@media (max-width:900px){.pz-grid{grid-template-columns:1fr}.pz-map{height:380px}}
/* v35 job card */
.jc-card{border:1px solid #d9e2ef;border-radius:8px;padding:6px 10px;margin:8px 0;background:#fbfcfe}
.jc-card h4{margin:2px 0 4px}
.jc-review{padding:6px 8px;border-radius:6px;margin-bottom:6px;font-size:.9rem}
.jc-review.pending{background:#fff6e0;border:1px solid #f0d48a}.jc-review.ok{background:#eaf7ee;border:1px solid #b5e0c1}
.pz-legend{background:#fff;padding:6px 8px;border-radius:6px;font-size:12px;line-height:1.5;box-shadow:0 1px 4px rgba(0,0,0,.2)}
.pz-legend i{display:inline-block;width:12px;height:12px;margin-right:6px;vertical-align:-1px;opacity:.7}
/* v36 labour costing (office only) */
.lb-cost{flex-basis:100%;background:#fff8e6;border:1px dashed #e0b85a;border-radius:6px;padding:5px 8px;font-size:.85rem;margin-bottom:4px}
.os-box{border:1px solid #cfe0ff;background:#f6f9ff;border-radius:8px;padding:6px 10px;margin:8px 0}
.os-row{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:4px 0}
.os-note{min-width:220px}
.jc-part{margin:4px 0;padding:4px 6px;border-left:3px solid #9bb7e0}
.jc-travel{border-left-color:#e0b85a}
.qe-box{margin:6px 0}
.q-est{margin:6px 0}
