/* Desktop layout: sidebar, main view, and the job panel on the right. */

.d-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); height: 100%; }

/* ---- sidebar ------------------------------------------------------------------ */

.d-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 14px 12px 12px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 4px 6px; font-size: calc(15px * var(--fs)); font-weight: 700; }
.brand img { border-radius: 7px; }

.d-nav { display: grid; gap: 2px; }
.d-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 600;
}
.d-nav-item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.d-nav-item.on { background: var(--accent-soft); color: var(--accent-ink); }
.d-side-fill { flex: 1; }

.d-timer { display: grid; gap: 4px; padding: 12px; border-radius: var(--radius); background: var(--go-soft); }
.d-timer-top { display: flex; align-items: center; gap: 7px; font-size: calc(12px * var(--fs)); font-weight: 700; color: var(--go-ink); }
.d-timer-job {
  padding: 0;
  border: 0;
  background: none;
  font-weight: 650;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.d-timer-job:hover { text-decoration: underline; }
.d-timer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.d-timer-time { font-size: calc(20px * var(--fs)); font-weight: 700; }

.d-foot { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.d-foot .sync { padding: 0 6px; }
.d-user { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-sm); color: var(--text); }
.d-user:hover, .d-user.on { background: var(--hover); text-decoration: none; }
.d-user-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-user .icon { color: var(--text-3); }

/* ---- main view ---------------------------------------------------------------- */

.d-main { min-width: 0; min-height: 0; }
.view { display: flex; flex-direction: column; height: 100%; }
.view-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 66px; padding: 16px 24px 12px; }
.view-title { margin-right: auto; font-size: calc(20px * var(--fs)); font-weight: 700; letter-spacing: -0.01em; }
/* The way back to a list, above the title of what was opened from it ("All quotes"). */
.view-back { display: inline-flex; flex-basis: 100%; align-items: center; gap: 2px; margin: -4px 0 -6px -2px; font-weight: 600; }
.view-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.view-body { flex: 1; min-height: 0; padding: 4px 24px 24px; overflow: auto; }

/* Narrow windows: the sidebar shrinks to a rail of icons so the schedule keeps its room.
   Every hidden label is still there as a tooltip. */
@media (max-width: 1100px) {
  .d-shell { grid-template-columns: 64px minmax(0, 1fr); }
  .d-side { align-items: center; padding: 14px 8px 12px; }
  .brand { padding: 2px 0 6px; }
  .brand span,
  .d-side > .btn span,
  .d-nav-item span,
  .d-timer-top,
  .d-timer-job,
  .d-timer .btn span,
  .d-foot .sync span:last-child,
  .d-user-name,
  .d-user .icon { display: none; }
  .d-side > .btn { width: 44px; padding: 0; }
  .d-nav { width: 100%; }
  .d-nav-item { justify-content: center; height: 40px; padding: 0; }
  .d-timer { justify-items: center; padding: 8px 4px; }
  .d-timer-row { flex-direction: column; gap: 6px; margin: 0; }
  .d-timer-time { font-size: calc(11px * var(--fs)); }
  .d-timer .btn { width: 32px; padding: 0; }
  .d-foot { justify-items: center; width: 100%; }
  .d-foot .sync { padding: 0; }
  .d-user { padding: 4px; }
  .view-head { padding: 14px 16px 10px; }
  .view-body { padding: 4px 16px 16px; }
}

/* ---- job panel ---------------------------------------------------------------- */

.drawer {
  position: fixed;
  z-index: 30;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(440px, 100vw);
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  animation: drawer-in 0.16s ease-out;
}
@keyframes drawer-in { from { opacity: 0; transform: translateX(24px); } }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--border); }
.drawer-label { font-size: calc(12px * var(--fs)); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); }
.drawer-body { flex: 1; min-height: 0; padding: 18px 20px 28px; overflow-y: auto; }

/* ---- schedule ----------------------------------------------------------------- */

/* The day columns scroll on their own, so the view itself does not. */
.sched { display: flex; flex-direction: column; gap: 10px; overflow: hidden; }

.tray {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.tray-label { margin-right: 4px; font-size: calc(12.5px * var(--fs)); font-weight: 700; color: var(--text-2); }
.tray-hint { font-size: calc(12.5px * var(--fs)); color: var(--text-3); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  height: 26px;
  padding: 0 9px 0 8px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--st);
  border-radius: 7px;
  background: var(--surface);
  font-size: calc(12.5px * var(--fs));
  cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); border-left-color: var(--st); }
.chip-time { flex: none; color: var(--text-2); font-variant-numeric: tabular-nums; }
.chip-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.st-done .chip-name { color: var(--text-2); }
.chip.st-cancelled .chip-name { color: var(--text-2); text-decoration: line-through; }

/* Days never get narrower than a readable card; a narrow window scrolls the week sideways instead. */
.week { display: grid; flex: 1; grid-template-columns: repeat(7, minmax(128px, 1fr)); gap: 8px; min-height: 0; overflow-x: auto; }
.day {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.day.past { background: transparent; }
.day-head { display: flex; align-items: center; gap: 7px; padding: 6px 4px 6px 12px; border-bottom: 1px solid var(--border); }
.day-name { font-size: calc(11.5px * var(--fs)); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); }
.day-num { font-size: calc(15px * var(--fs)); font-weight: 700; }
.day.today .day-name { color: var(--accent-ink); }
.day.today .day-num {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}
.day-head .btn { opacity: 0; }
.day:hover .day-head .btn, .day-head .btn:focus-visible { opacity: 1; }
.day-jobs { display: flex; flex: 1; flex-direction: column; gap: 6px; min-height: 0; padding: 8px; overflow-x: hidden; overflow-y: auto; }

.job-card {
  display: grid;
  gap: 2px;
  padding: 7px 9px 8px 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--st);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  cursor: pointer;
}
.job-card:hover { border-color: var(--border-strong); border-left-color: var(--st); }
.day.past .job-card { box-shadow: none; }
.job-card-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 6px; min-height: 18px; }
.job-card-time { font-size: calc(12px * var(--fs)); font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums; }
.job-card-time > span { white-space: nowrap; }
.job-card-title { font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; -webkit-hyphens: auto; hyphens: auto; }
.job-card-sub {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: calc(12.5px * var(--fs));
  color: var(--text-2);
  overflow: hidden;
}
.job-card.st-done .job-card-title, .job-card.st-cancelled .job-card-title { font-weight: 600; color: var(--text-2); }
.job-card.st-cancelled .job-card-title { text-decoration: line-through; }
.job-card.dragging, .chip.dragging { opacity: 0.45; }

/* Where a dragged job will land. */
.tray.drop, .day.drop, .month-cell.drop { background: var(--accent-soft); outline: 2px solid var(--accent-ink); outline-offset: -2px; }

.month {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto repeat(var(--weeks), minmax(0, 1fr));
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.month-dow {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  font-size: calc(11.5px * var(--fs));
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
}
.month-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  padding: 5px 6px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
}
.month-cell:nth-child(7n) { border-right: 0; }
.month-cell:hover { background: var(--hover); }
.month-cell.other { background: var(--surface-2); }
.month-cell.other .month-num { color: var(--text-3); }
.month-num {
  display: grid;
  align-self: flex-start;
  place-items: center;
  flex: none;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: calc(12.5px * var(--fs));
  font-weight: 650;
}
.month-cell.today .month-num { padding: 0 6px; background: var(--accent); color: #fff; }
.month-cell .chip { flex: none; max-width: 100%; height: calc(22px * var(--fs)); font-size: calc(12px * var(--fs)); }
.month-more { padding-left: 4px; font-size: calc(11.5px * var(--fs)); color: var(--text-2); }

/* ---- jobs table --------------------------------------------------------------- */

.table {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
}
.table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: calc(12px * var(--fs));
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-3);
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--hover); }
.row-link:focus-visible { outline-offset: -2px; }
.cell-when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-strong { font-weight: 650; }
.cell-sub { font-size: calc(12.5px * var(--fs)); color: var(--text-2); }
.cell-wrap { max-width: 280px; overflow-wrap: anywhere; }
.cell-num, .table th.cell-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
