:root {
  --ink: #0b1537;
  --muted: #67718a;
  --line: #dbe3ee;
  --soft-line: #e9eef5;
  --surface: #ffffff;
  --canvas: #f5f8fb;
  --accent: #079a78;
  --accent-dark: #04785e;
  --accent-soft: #e5f8f2;
  --shadow: 0 12px 34px rgba(20, 38, 72, 0.1);
  --radius: 16px;
  --day-width: 20%;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html.planner-runtime-pending body { visibility: hidden; }

.demo-badge.is-server { color: #075f50; background: #e8f8f3; }
.save-state.has-error .save-dot { background: #dc4c3f; box-shadow: 0 0 0 4px rgba(220, 76, 63, .12); }

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 1100px;
  min-height: 100%;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
}

body {
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

svg {
  display: block;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(7, 154, 120, 0.22);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 83% 4%, rgba(7, 154, 120, 0.05), transparent 20%),
    var(--surface);
}

.app-header {
  height: 76px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 10px rgba(31, 45, 74, 0.04);
  position: relative;
  z-index: 40;
}

.brand {
  min-width: 244px;
  display: inline-flex;
  align-items: center;
  gap: 13px;
  padding-right: 30px;
  border-right: 1px solid var(--line);
  color: var(--ink);
  font-size: 25px;
  line-height: 1;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.035em;
}

.brand-mark {
  width: 35px;
  height: 35px;
  color: var(--accent);
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark circle {
  fill: currentColor;
  stroke: none;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item {
  height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #13203e;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: 160ms ease;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item:hover {
  background: #f2f6fa;
}

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #5d6880;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.demo-badge > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f0a51b;
  box-shadow: 0 0 0 4px rgba(240, 165, 27, 0.13);
}

.whatsapp-button {
  height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, #078d6b, #08ad82);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 9px 18px rgba(7, 154, 120, 0.24);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.whatsapp-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(7, 154, 120, 0.3);
}

.whatsapp-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.planner-layout {
  height: calc(100vh - 76px);
  min-height: 660px;
  display: grid;
  grid-template-columns: 292px minmax(808px, 1fr);
}

.sidebar {
  padding: 24px 14px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fafc, #f3f6fa);
  overflow-y: auto;
}

.sidebar-section {
  display: grid;
  gap: 12px;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  min-height: 28px;
  gap: 10px;
  padding: 0 5px;
}

.sidebar-heading h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.count-badge {
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 0 7px;
  border-radius: 999px;
  background: #e8edf4;
  color: #5f6c83;
  font-size: 12px;
  font-weight: 800;
}

.drag-dots,
.legend-dots {
  width: 14px;
  height: 20px;
  opacity: 0.7;
  background-image: radial-gradient(circle, #60708c 1.4px, transparent 1.6px);
  background-size: 6px 6px;
}

.heading-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #253450;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.backlog-list,
.employees-list {
  display: grid;
  gap: 9px;
}

.backlog-card,
.employee-card {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid #d9e1eb;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 7px rgba(34, 51, 78, 0.04);
  cursor: grab;
  user-select: none;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.backlog-card:hover,
.employee-card:hover {
  border-color: #b8c6d7;
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(34, 51, 78, 0.08);
}

.backlog-card:active,
.employee-card:active {
  cursor: grabbing;
}

.mini-grip {
  width: 11px;
  height: 28px;
  flex: 0 0 11px;
  opacity: 0.42;
  background-image: radial-gradient(circle, #64748b 1.2px, transparent 1.5px);
  background-size: 5px 6px;
}

.backlog-copy {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.backlog-copy strong {
  overflow: hidden;
  color: #17223f;
  font-size: 15px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operator-label {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--operator-color);
  background: color-mix(in srgb, var(--operator-color) 11%, white);
  border: 1px solid color-mix(in srgb, var(--operator-color) 15%, white);
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.operator-label::before {
  content: "⚑";
  font-size: 12px;
}

.sidebar-add {
  height: 38px;
  border: 1px dashed #bfcbd9;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.5);
  color: #5f6c83;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.sidebar-add:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.sidebar-add span {
  font-size: 18px;
  vertical-align: -1px;
}

.sidebar-add-group { display: grid; gap: 7px; }
.sidebar-add-secondary { color: #42506a; background: #fff; border-color: #d2dde8; }
.sidebar-add-secondary:hover { color: var(--accent); background: #f7fbfa; }

.backlog-meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.source-chip,
.source-kind {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  color: #075f50;
  background: #e5f7f1;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .03em;
  white-space: nowrap;
}

.sidebar-divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line);
}

.employee-card {
  min-height: 53px;
  padding: 6px 10px;
}

.employee-card strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-avatar {
  --avatar-color: #53657e;
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.2) 0 18%, transparent 19%),
    linear-gradient(145deg, color-mix(in srgb, var(--avatar-color) 72%, white), var(--avatar-color));
  border: 2px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 2px 7px rgba(20, 35, 60, 0.18);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.person-avatar::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 4px;
  right: 4px;
  height: 9px;
  border-radius: 9px 9px 3px 3px;
  background: var(--helmet, #f4b426);
  border-bottom: 2px solid color-mix(in srgb, var(--helmet, #f4b426) 72%, black);
}

.person-avatar.has-image {
  overflow: hidden;
  padding: 0;
  background: color-mix(in srgb, var(--avatar-color) 16%, white);
}

.person-avatar.has-image::before {
  display: none;
}

.person-avatar.has-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  pointer-events: none;
  user-select: none;
}

.drop-instruction {
  display: none;
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed #ee8d45;
  border-radius: 10px;
  color: #9a4b14;
  background: #fff6ed;
  font-size: 12px;
  font-weight: 700;
}

.employees-section.is-drop-target .drop-instruction,
.employees-section.is-assignment-drag .drop-instruction {
  display: block;
}

.employees-section.is-drop-target .drop-instruction {
  border-style: solid;
  background: #ffead7;
}

.workspace {
  min-width: 0;
  padding: 18px 18px 16px;
  background: #fff;
  overflow: auto;
}

.board-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 11px;
}

.date-navigation {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(20, 35, 60, 0.04);
}

.icon-button:hover {
  border-color: #aebdce;
  background: #f8fafc;
}

.icon-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-range-button {
  min-width: 370px;
  height: 48px;
  display: grid;
  grid-template-columns: 25px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(20, 35, 60, 0.04);
}

.date-range-button:hover {
  border-color: #aebdce;
}

.date-range-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: #273655;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-range-button span {
  font-size: 18px;
  font-weight: 800;
  text-align: left;
}

.date-range-button small {
  padding: 5px 8px;
  border-radius: 7px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.view-switch {
  height: 48px;
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f8fafc;
}

.view-switch button {
  min-width: 110px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #26324e;
  font-weight: 800;
  cursor: pointer;
}

.view-switch button.is-active {
  color: #fff;
  background: linear-gradient(135deg, #078d6b, #09aa82);
  box-shadow: 0 4px 10px rgba(7, 154, 120, 0.2);
}

.save-strip {
  min-height: 28px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin: -3px 2px 6px;
  color: #68758b;
  font-size: 11px;
}

.server-conflict-bar {
  margin: 0 14px 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #f0b85c;
  border-radius: 12px;
  background: #fff8e8;
  color: #68450b;
  box-shadow: 0 5px 16px rgba(112, 72, 5, .08);
}

.server-conflict-bar[hidden] { display: none; }
.server-conflict-bar > div:first-child { display: grid; gap: 2px; }
.server-conflict-bar strong { font-size: 13px; }
.server-conflict-bar span { font-size: 12px; }
.server-conflict-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.server-conflict-actions button {
  border: 1px solid #d7a348;
  border-radius: 8px;
  background: #fff;
  color: #68450b;
  padding: 6px 9px;
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}
.server-conflict-actions button:disabled { opacity: .45; cursor: default; }
.server-conflict-actions button:first-child { background: #68450b; color: #fff; border-color: #68450b; }

.app-shell.is-read-only .resize-handle,
.app-shell.is-read-only .add-person-button,
.app-shell.is-read-only .crew-more + .add-person-button,
.app-shell.is-read-only .sidebar-add { display: none; }
.app-shell.is-read-only .backlog-card,
.app-shell.is-read-only .employee-card,
.app-shell.is-read-only .crew-person,
.app-shell.is-read-only .task-header { cursor: default; }

@media (max-width: 900px) {
  .server-conflict-bar { align-items: stretch; flex-direction: column; }
  .server-conflict-actions { justify-content: flex-start; }
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #17a779;
}

.save-state.is-saving .save-dot {
  background: #e49a18;
  animation: pulse 700ms infinite alternate;
}

.save-strip button {
  padding: 3px 8px;
  border: 0;
  background: transparent;
  color: #53617a;
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
}

@keyframes pulse {
  to { opacity: 0.35; }
}

.board-view {
  min-height: 0;
}

.week-board {
  border: 1px solid #cfd9e6;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 6px 18px rgba(24, 41, 70, 0.06);
}

.week-days {
  height: 52px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid #dbe3ee;
  background: linear-gradient(180deg, #f9fbfd, #f0f4f8);
}

.week-day {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-right: 1px solid #d8e1ec;
  font-size: 17px;
  font-weight: 850;
}

.week-day:last-child {
  border-right: 0;
}

.week-day.is-today {
  color: var(--accent-dark);
  background: linear-gradient(180deg, #effbf7, #e5f7f1);
}

.week-day small {
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: rgba(7, 154, 120, 0.12);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.week-lanes {
  position: relative;
  min-height: 548px;
  overflow: hidden;
  background: #fff;
}

.day-columns {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  pointer-events: none;
}

.day-column {
  border-right: 1px solid #d8e1ec;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.3), rgba(255, 255, 255, 0));
}

.day-column:last-child {
  border-right: 0;
}

.day-column.is-today {
  background: rgba(7, 154, 120, 0.025);
}

.tasks-layer {
  position: absolute;
  inset: 0;
}

.empty-board-hint {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 9px 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: #7b879b;
  background: rgba(248, 250, 252, 0.88);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

.week-lanes.is-drop-target::after {
  content: "Upuść na wybrany dzień";
  position: absolute;
  inset: 10px;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 14px;
  border: 2px dashed rgba(7, 154, 120, 0.58);
  border-radius: 13px;
  color: var(--accent-dark);
  background: rgba(226, 249, 242, 0.18);
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

.task-bar {
  --task-color: #079a78;
  position: absolute;
  left: calc((var(--start) * 20%) + 10px);
  top: calc(20px + (var(--row) * 166px));
  width: calc((var(--span) * 20%) - 20px);
  min-width: 150px;
  height: 146px;
  z-index: 5;
  border: 2px solid var(--task-color);
  border-radius: 27px;
  background: color-mix(in srgb, var(--task-color) 7%, white);
  box-shadow: 0 8px 17px color-mix(in srgb, var(--task-color) 13%, transparent);
  overflow: visible;
  transition: box-shadow 130ms ease, transform 130ms ease;
}

.task-bar:hover {
  z-index: 10;
  box-shadow: 0 13px 24px color-mix(in srgb, var(--task-color) 20%, transparent);
}

.task-bar.is-dragging {
  opacity: 0.55;
  transform: scale(0.99);
}

.task-bar.is-selected {
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--task-color) 16%, transparent),
    0 13px 24px color-mix(in srgb, var(--task-color) 20%, transparent);
}

.task-header {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px 0 27px;
  border-bottom: 1px solid color-mix(in srgb, var(--task-color) 20%, white);
  border-radius: 24px 24px 0 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--task-color) 12%, white), color-mix(in srgb, var(--task-color) 3%, white));
  cursor: grab;
  user-select: none;
}

.task-header:active {
  cursor: grabbing;
}

.task-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(15px, 1.55vw, 21px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.task-header .operator-label {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.72);
  border-color: color-mix(in srgb, var(--task-color) 17%, white);
  color: var(--task-color);
  font-size: 11px;
}

.task-menu-button {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: #526078;
  font-weight: 900;
  cursor: pointer;
}

.task-days {
  height: calc(100% - 48px);
  display: grid;
  grid-template-columns: repeat(var(--span), minmax(0, 1fr));
  border-radius: 0 0 25px 25px;
  overflow: hidden;
}

.task-day-cell {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-right: 1px solid color-mix(in srgb, var(--task-color) 20%, white);
  background: rgba(255, 255, 255, 0.55);
  transition: background 120ms ease, box-shadow 120ms ease;
  overflow: hidden;
}

.task-day-cell:last-child {
  border-right: 0;
}

.task-day-cell.is-drop-target {
  background: color-mix(in srgb, var(--task-color) 16%, white);
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--task-color) 55%, transparent);
}

.crew-list {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  overflow: hidden;
}

.crew-person {
  width: 48px;
  flex: 0 0 48px;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
  user-select: none;
}

.crew-person:active {
  cursor: grabbing;
}

.crew-person .person-avatar {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
}

.crew-person .person-name {
  max-width: 48px;
  padding: 2px 5px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--task-color) 23%, #d4dde8);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: #14213d;
  font-size: 9px;
  font-weight: 900;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(20, 35, 60, 0.08);
}

.crew-more {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--task-color) 30%, #ccd6e3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--task-color);
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}

.add-person-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  border: 1.5px dashed color-mix(in srgb, var(--task-color) 52%, #8ea0b6);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.48);
  color: color-mix(in srgb, var(--task-color) 75%, #17213b);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.add-person-button:hover {
  background: #fff;
  transform: scale(1.04);
}

.resize-handle {
  position: absolute;
  top: 48px;
  bottom: 22px;
  width: 24px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--task-color);
  border-radius: 10px;
  background: #fff;
  color: var(--task-color);
  font-size: 13px;
  font-weight: 900;
  cursor: ew-resize;
  box-shadow: 0 4px 9px rgba(20, 35, 60, 0.11);
  user-select: none;
  touch-action: none;
}

.resize-handle::before {
  content: "Ⅱ";
  transform: scaleX(0.75);
}

.resize-handle.start {
  left: -14px;
}

.resize-handle.end {
  right: -14px;
}

.task-bar.is-resizing {
  z-index: 50;
  transition: none;
  box-shadow: 0 14px 30px color-mix(in srgb, var(--task-color) 28%, transparent);
}

.interaction-legend {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 22px;
  margin: -1px 5px 0;
  padding: 0 20px;
  border: 1px solid #d8e1ec;
  border-radius: 0 0 14px 14px;
  background: #fff;
  color: #2c3854;
  font-size: 12px;
  font-weight: 700;
}

.interaction-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.interaction-legend svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #2e3c5a;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.interaction-legend i {
  width: 1px;
  height: 25px;
  background: #dbe3ee;
}

.interaction-legend strong {
  width: 25px;
  height: 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #7a8aa2;
  border-radius: 50%;
  font-size: 17px;
  font-weight: 500;
}

.resize-symbol {
  width: 40px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--accent);
  border-radius: 10px;
  color: var(--accent);
  font-weight: 900;
}

.drag-hint {
  position: fixed;
  left: 50%;
  top: 90px;
  z-index: 200;
  transform: translate(-50%, -10px);
  padding: 9px 15px;
  border: 1px solid #9f7aea;
  border-radius: 10px;
  color: #5b21b6;
  background: #f6f0ff;
  box-shadow: 0 8px 20px rgba(91, 33, 182, 0.18);
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: 130ms ease;
}

.drag-hint.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.calendar-shell {
  border: 1px solid #d4deea;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(24, 41, 70, 0.06);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: #f3f6f9;
  border-bottom: 1px solid #d8e1ec;
}

.calendar-weekdays span {
  padding: 12px;
  border-right: 1px solid #d8e1ec;
  text-align: center;
  font-size: 12px;
  font-weight: 850;
}

.calendar-weekdays span:last-child {
  border-right: 0;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(105px, 1fr);
  min-height: 610px;
}

.month-day {
  min-width: 0;
  padding: 8px;
  border-right: 1px solid #e1e7ef;
  border-bottom: 1px solid #e1e7ef;
  background: #fff;
  cursor: pointer;
}

.month-day:nth-child(7n) {
  border-right: 0;
}

.month-day.is-outside {
  background: #f8fafc;
  color: #9aa5b5;
}

.month-day.is-today {
  background: #f0fbf7;
}

.month-day-number {
  width: 27px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 850;
}

.month-day.is-today .month-day-number {
  color: #fff;
  background: var(--accent);
}

.month-task {
  margin-top: 4px;
  padding: 5px 6px;
  overflow: hidden;
  border-left: 3px solid var(--task-color);
  border-radius: 6px;
  color: #1a2845;
  background: color-mix(in srgb, var(--task-color) 9%, white);
  font-size: 10px;
  line-height: 1.15;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quarter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.mini-month {
  padding: 16px;
  border: 1px solid #d4deea;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(24, 41, 70, 0.06);
}

.mini-month h3 {
  margin: 0 0 14px;
  font-size: 18px;
  text-align: center;
}

.mini-weekdays,
.mini-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.mini-weekdays {
  margin-bottom: 5px;
  color: #768298;
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}

.mini-day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: #4a5770;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.mini-day:hover {
  background: #f0f4f8;
}

.mini-day.is-outside {
  opacity: 0.28;
}

.mini-day.has-task {
  color: #14213d;
  background: #eef7f4;
}

.mini-day.has-task::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 4px;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--accent);
}

.mini-day.is-today {
  color: #fff;
  background: var(--accent);
}

.mini-day.is-today::after {
  background: #fff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(9, 17, 38, 0.42);
  backdrop-filter: blur(4px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(680px, 94vw);
  max-height: 88vh;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(9, 17, 38, 0.28);
}

.task-modal,
.catalog-modal {
  width: min(780px, 94vw);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 21px 24px 17px;
  border-bottom: 1px solid #e3e8ef;
  background: linear-gradient(180deg, #fff, #f9fbfc);
}

.modal-header h2 {
  margin: 3px 0 0;
  font-size: 23px;
  letter-spacing: -0.03em;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.modal-close {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8e1ec;
  border-radius: 10px;
  background: #fff;
  color: #56647c;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}

.modal-body {
  max-height: calc(88vh - 90px);
  padding: 22px 24px 24px;
  overflow: auto;
}

.whatsapp-header {
  background: linear-gradient(135deg, #e8faf4, #f8fffc);
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: #3b4862;
  font-size: 12px;
  font-weight: 850;
}

.date-input,
.detail-input,
.detail-textarea {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid #cfd9e5;
  border-radius: 10px;
  background: #fff;
  color: #1c2945;
}

.detail-textarea {
  min-height: 90px;
  resize: vertical;
}

.message-info {
  display: flex;
  gap: 9px;
  margin: 14px 0;
  padding: 11px 13px;
  border-radius: 10px;
  color: #53617a;
  background: #f2f7fa;
  font-size: 12px;
  line-height: 1.4;
}

.message-info span {
  color: var(--accent);
  font-size: 15px;
}

.message-preview {
  width: 100%;
  min-height: 310px;
  padding: 16px;
  border: 1px solid #cbd7e4;
  border-radius: 13px;
  color: #192642;
  background: #fbfcfd;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.button-primary,
.button-secondary,
.button-danger,
.button-danger-quiet,
.catalog-row button,
.conflict-resolution-actions button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 850;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.button-primary {
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
}

.button-secondary {
  border: 1px solid #ccd7e3;
  color: #34415c;
  background: #fff;
}

.button-primary:hover { background: #087d66; border-color: #087d66; }
.button-secondary:hover,
.catalog-row button:hover,
.conflict-resolution-actions button:hover { border-color: #9db0c4; background: #f7fafc; }

.button-primary:focus-visible,
.button-secondary:focus-visible,
.button-danger:focus-visible,
.button-danger-quiet:focus-visible,
.catalog-row button:focus-visible,
.conflict-resolution-actions button:focus-visible {
  outline: 3px solid rgba(7, 154, 120, .2);
  outline-offset: 2px;
}

.button-primary:disabled,
.button-secondary:disabled,
.button-danger:disabled,
.button-danger-quiet:disabled,
.catalog-row button:disabled,
.conflict-resolution-actions button:disabled {
  opacity: .5;
  cursor: not-allowed;
  box-shadow: none;
}

.button-primary svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.picker-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.picker-person {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border: 1px solid #d8e1ec;
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.picker-person:hover {
  border-color: var(--accent);
  background: #f0faf7;
}

.picker-person.is-assigned {
  color: #78849a;
  background: #f4f6f8;
  cursor: default;
}

.picker-person span:last-child {
  font-weight: 800;
}

.task-detail-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 14px;
}

.detail-field {
  display: grid;
  gap: 6px;
}

.detail-field.full {
  grid-column: 1 / -1;
}

.modal-actions.detail-field {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.detail-field label {
  color: #53617a;
  font-size: 11px;
  font-weight: 850;
}

.detail-section-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0 -1px;
  padding-top: 14px;
  border-top: 1px solid #e1e7ef;
  font-size: 14px;
  font-weight: 900;
}

.daily-note-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e0e6ee;
  border-radius: 11px;
  background: #fafbfd;
}

.daily-note-row strong {
  padding-top: 8px;
  color: #394760;
  font-size: 11px;
}

.catalog-list {
  display: grid;
  gap: 10px;
}

.catalog-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 13px 14px;
  border: 1px solid #dce4ed;
  border-radius: 12px;
  background: #fff;
}

.catalog-toolbar,
.catalog-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}

.catalog-section-heading {
  align-items: flex-start;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line, #dce4ec);
}

.catalog-section-heading small,
.catalog-toolbar small { color: #748196; }

.catalog-row-actions,
.conflict-resolution-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.catalog-row.is-archived { opacity: .86; }

.team-search-form {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #dce4ec;
  border-radius: 12px;
  background: #f8fafc;
}

.team-search-form label { display: block; margin-bottom: 7px; font-weight: 700; }
.team-search-form > div { display: flex; gap: 8px; }
.team-search-form input { min-width: 0; flex: 1; }

.task-management-actions {
  margin-top: 6px;
  padding: 13px;
  border: 1px solid #e5e9ef;
  border-radius: 12px;
  background: #fafbfc;
}

.task-management-actions > strong,
.task-management-actions > small { display: block; }
.task-management-actions > small { margin: 4px 0 10px; color: #748196; }
.task-management-actions > div { display: flex; flex-wrap: wrap; gap: 8px; }

.task-asset-badges {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.task-asset-badges > span {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--task-color, #64748b) 24%, #dce4ec);
  border-radius: 999px;
  color: #4d5a70;
  background: rgba(255,255,255,.78);
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.task-asset-badges > .has-warning { color: #8a4b05; border-color: #f0c879; background: #fff8e8; }
.overview-task-meta .task-asset-badges { margin-top: 2px; }

.source-summary {
  padding: 11px 12px;
  border: 1px solid #cfe4de;
  border-radius: 11px;
  background: #f2fbf8;
}

.source-summary > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.source-summary strong { color: #075f50; }
.source-summary span,
.source-summary small { color: #607187; font-size: 11px; }
.source-summary.is-unavailable { border-color: #efd09d; background: #fff9ed; }
.source-summary.is-unavailable strong { color: #8a4b05; }

.asset-section {
  padding: 13px;
  border: 1px solid #dce4ed;
  border-radius: 12px;
  background: #fbfcfd;
}

.asset-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.asset-section-heading > strong { color: #22304a; font-size: 14px; }
.asset-section-heading > small { color: #748196; font-size: 10px; text-align: right; }
.asset-list { display: grid; gap: 7px; }

.asset-row,
.material-row {
  padding: 9px 10px;
  border: 1px solid #dce4ed;
  border-radius: 10px;
  background: #fff;
}

.asset-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.asset-row strong,
.asset-row small,
.material-row strong,
.material-row small { display: block; }
.asset-row small,
.material-row small { margin-top: 2px; color: #748196; font-size: 10px; }
.asset-row.is-pending { border-color: #edc46e; background: #fffaf0; }

.asset-add-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 9px;
}

.asset-add-grid > button { min-height: 38px; }
.asset-add-grid label { display: grid; gap: 4px; color: #53617a; font-size: 10px; font-weight: 800; }
.asset-add-grid .span-two { grid-column: 1 / -1; }

.asset-catalog-editor { margin-top: 10px; padding-top: 9px; border-top: 1px solid #e2e8ef; }
.asset-catalog-editor summary { color: #526075; font-size: 11px; font-weight: 850; cursor: pointer; }

.material-row-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.material-row > .button-secondary,
.material-row > .button-primary { margin-top: 9px; min-height: 36px; }
.material-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 6px; margin-top: 8px; }
.material-days label { display: grid; gap: 3px; color: #607087; font-size: 9px; font-weight: 800; }
.material-days .detail-input { min-height: 34px; padding: 0 7px; }
.material-search-box { margin-top: 10px; padding-top: 10px; border-top: 1px solid #e2e8ef; }
.material-result { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; padding: 8px 10px; border: 1px solid #d5e0ea; border-radius: 9px; background: #fff; text-align: left; }
.material-result:hover { border-color: var(--accent); background: #f1faf7; }
.material-result strong { font-size: 11px; }
.material-result small { color: #748196; font-size: 10px; }

.instruction-output { min-height: 260px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; }
.instruction-controls { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
.instruction-stale { margin: 0; padding: 8px 10px; border: 1px solid #edc46e; border-radius: 9px; color: #794306; background: #fff8e7; font-size: 11px; font-weight: 800; }
.asset-section-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.asset-section-actions small { color: #748196; }
.crm-result .catalog-row-main { align-items: flex-start; }
.field-message.is-warning,
.catalog-row-copy small.is-warning { color: #8a4b05; }

@media (max-width: 1280px) {
  .instruction-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asset-section-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
  .asset-section-heading > small { text-align: left; }
}

.button-danger,
.button-danger-quiet {
  border: 1px solid #d55a64;
  color: #a12d39;
  background: #fff;
}

.button-danger { background: #fff7f7; }
.button-danger-quiet { min-height: 36px; }

.button-danger:hover,
.button-danger-quiet:hover { background: #fff1f2; }

.picker-person.is-unavailable { opacity: .58; cursor: not-allowed; }

.conflict-resolution-actions button { white-space: normal; }

.catalog-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.catalog-row-copy {
  min-width: 0;
}

.catalog-row-copy strong,
.catalog-row-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-row-copy small {
  margin-top: 3px;
  color: #6b778c;
}

.catalog-row button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #cbd6e2;
  border-radius: 10px;
  background: #fff;
  color: #3c4a64;
}

.catalog-row .button-danger,
.catalog-row .button-danger-quiet { border-color: #d55a64; color: #a12d39; background: #fff7f7; }

.operator-labels {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.operator-label.operator-more { color: #526075; background: #edf1f5; }

.contractor-picker {
  min-width: 0;
  padding: 10px;
  border: 1px solid #d8e1eb;
  border-radius: 12px;
  background: #fbfcfd;
}

.contractor-picker-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}

.contractor-picker-tools .detail-input { min-height: 38px; }
.contractor-picker-tools span { color: #53617a; font-size: 11px; font-weight: 850; white-space: nowrap; }

.contractor-options {
  max-height: 190px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  overflow-y: auto;
  padding: 1px;
}

.contractor-option {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 9px;
  border: 1px solid #dce4ed;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}

.contractor-option:hover { border-color: #9fcbbb; background: #f5fbf9; }
.contractor-option:has(input:checked) { border-color: var(--accent); background: #edf9f5; box-shadow: 0 0 0 1px rgba(7, 154, 120, .08); }
.contractor-option:has(input:disabled:not(:checked)) { opacity: .5; cursor: not-allowed; }
.contractor-option input { margin: 2px 0 0; accent-color: var(--accent); }
.contractor-option span { min-width: 0; }
.contractor-option strong,
.contractor-option small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contractor-option strong { color: #263650; font-size: 12px; }
.contractor-option small { margin-top: 2px; color: #748196; font-size: 10px; }
.field-hint,
.field-message { display: block; margin: 8px 0 0; color: #68768b; font-size: 10px; line-height: 1.4; }
.field-message.is-error { color: #a12d39; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 500;
  min-width: 330px;
  max-width: 620px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  transform: translateX(-50%);
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 12px;
  color: #fff;
  background: #17223c;
  box-shadow: 0 18px 38px rgba(10, 19, 40, 0.26);
  font-size: 13px;
  font-weight: 750;
}

.toast[hidden] {
  display: none;
}

.toast button {
  border: 0;
  background: transparent;
  color: #65dec0;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

@media (max-width: 1320px) {
  .app-header {
    gap: 16px;
    padding: 0 22px;
  }

  .brand {
    min-width: 206px;
    font-size: 22px;
  }

  .demo-badge {
    display: none;
  }

  .planner-layout {
    grid-template-columns: 260px minmax(840px, 1fr);
  }

  .task-day-cell {
    gap: 4px;
    padding: 8px 6px;
  }

  .crew-person {
    width: 43px;
    flex-basis: 43px;
  }

  .crew-person .person-avatar {
    width: 37px;
    height: 37px;
    flex-basis: 37px;
  }
}

/* Seven-day editing and persistent crew-collision status. */
.week-board[data-view="week"] .week-days,
.week-board[data-view="week"] .day-columns {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.week-day.is-weekend {
  color: #68758a;
  background: #f1f4f7;
}

.week-day.is-selected {
  box-shadow: inset 0 -3px 0 #079a78;
}

.week-day.is-today.is-selected {
  box-shadow: inset 0 -3px 0 #05775c;
}

.task-day-cell.is-selected-day {
  background: color-mix(in srgb, var(--task-color) 9%, white);
}

.conflict-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr);
  gap: 10px;
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid #f0c36c;
  border-radius: 10px;
  background: #fffaf0;
  color: #5d4316;
  font-size: 10px;
}

.conflict-panel[hidden] {
  display: none;
}

.conflict-panel-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.conflict-panel-heading > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.conflict-panel-heading strong {
  color: #593b05;
  font-size: 11px;
}

.conflict-panel-heading small {
  color: #806a44;
  font-size: 8px;
  line-height: 1.35;
}

.conflict-panel-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #d48608;
  font-size: 13px;
  font-weight: 900;
}

.conflict-list {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.conflict-item {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border: 1px solid #f1d69c;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
}

.conflict-item > div {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.conflict-item strong,
.conflict-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conflict-item span {
  color: #745d35;
  font-size: 9px;
}

.conflict-item button {
  padding: 4px 7px;
  border: 1px solid #d8a649;
  border-radius: 6px;
  color: #6b4705;
  background: #fff7e5;
  font-size: 8px;
  font-weight: 800;
  cursor: pointer;
}

.conflict-item.is-accepted {
  border-color: #acd5c8;
  background: #f0faf7;
}

.conflict-item.is-accepted strong,
.conflict-item.is-accepted span {
  color: #286855;
}

.conflict-item.is-accepted button {
  border-color: #9acbbb;
  color: #286855;
  background: #e6f6f1;
}

.task-day-cell.has-conflict,
.overview-task-day.has-conflict {
  box-shadow: inset 0 0 0 2px #dc8700;
}

.task-day-cell.has-accepted-conflict,
.overview-task-day.has-accepted-conflict {
  box-shadow: inset 0 0 0 1px #3e9b7e;
}

.crew-person.has-conflict .person-avatar {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #dc8700;
}

.crew-person.has-accepted-conflict .person-avatar {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #3e9b7e;
}

.picker-person.has-conflict {
  border-color: #e1a235;
  background: #fff8e9;
}

.picker-person.has-accepted-conflict {
  border-color: #79b9a5;
  background: #eff9f6;
}

.is-drag-active .task-day-cell[data-drop-task] {
  transition: background 100ms ease, box-shadow 100ms ease;
}

@media (max-width: 1440px) {
  .week-board[data-view="week"] .week-day {
    gap: 3px;
    font-size: 11px;
  }

  .week-board[data-view="week"] .week-day small {
    display: none;
  }

  .week-board[data-view="week"] .crew-person {
    width: 42px;
    flex-basis: 42px;
  }

  .week-board[data-view="week"] .crew-person .person-name {
    max-width: 42px;
  }
}

@media (max-width: 1180px) {
  .conflict-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 820px) {
  .app-header {
    height: 68px;
  }

  .planner-layout {
    height: calc(100vh - 68px);
  }

  .week-lanes {
    min-height: 490px;
  }

  .task-bar {
    top: calc(15px + (var(--row) * 148px));
    height: 132px;
  }

  .task-header {
    height: 43px;
  }

  .resize-handle {
    top: 43px;
  }

  .task-days {
    height: calc(100% - 43px);
  }

  .interaction-legend {
    min-height: 48px;
  }
}

/* Compact timeline system: detail in week, overview in month and quarter. */
.timeline-help {
  min-height: 20px;
  margin: 0 0 7px;
  color: #66758b;
  font-size: 11px;
  line-height: 1.45;
}

.timeline-scroll {
  max-width: 100%;
  overflow-x: hidden;
  padding: 3px 2px 9px;
}

.week-board {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.week-board[data-view="week"] .week-days,
.week-board[data-view="week"] .day-columns {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.week-board[data-view="week"] .week-days {
  height: 40px;
}

.week-board[data-view="week"] .week-day {
  gap: 5px;
  font-size: 13px;
}

.week-board[data-view="week"] .week-lanes {
  overflow: clip;
}

.task-bar {
  left: calc(var(--start) * 100% / var(--days) + 6px);
  top: calc(10px + var(--row) * var(--row-height));
  width: calc(var(--span) * 100% / var(--days) - 12px);
  min-width: 0;
  height: var(--card-height);
  border-width: 1.5px;
  border-radius: 14px;
  box-shadow: 0 5px 12px color-mix(in srgb, var(--task-color) 12%, transparent);
}

.task-header {
  height: 35px;
  gap: 6px;
  padding: 0 9px 0 12px;
  border-radius: 12px 12px 0 0;
}

.task-heading-group {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-title {
  flex: 1 1 auto;
  font-size: 12px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.task-header .operator-label {
  padding: 2px 5px;
  font-size: 8px;
}

.task-menu-button {
  width: 22px;
  height: 22px;
  flex-basis: 22px;
  font-size: 10px;
}

.task-days {
  height: calc(100% - 35px);
  border-radius: 0 0 12px 12px;
}

.task-day-cell {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 4px;
  padding: 20px 5px 4px;
}

.compartment-date {
  position: absolute;
  top: 3px;
  left: 6px;
  right: 4px;
  overflow: hidden;
  color: #66758b;
  font-size: 8px;
  font-weight: 760;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crew-list {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 2px;
  overflow: hidden;
}

.crew-person {
  width: 50px;
  flex: 0 0 50px;
  gap: 1px;
}

.crew-person .person-avatar {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
  font-size: 8px;
}

.crew-person .person-name {
  max-width: 50px;
  padding: 1px 2px;
  border-radius: 5px;
  font-size: 7.5px;
}

.crew-more,
.add-person-button {
  width: 23px;
  min-width: 23px;
  height: 23px;
  flex-basis: 23px;
  font-size: 11px;
}

.crew-more {
  position: absolute;
  right: 4px;
  bottom: 30px;
  z-index: 4;
}

.resize-handle {
  top: 35px;
  bottom: 5px;
  width: 11px;
}

.resize-handle.start {
  left: -4px;
}

.resize-handle.end {
  right: -4px;
}

.resize-handle[hidden] {
  display: none;
}

.task-header:focus-within {
  outline: 2px solid var(--task-color);
}

.day-column.is-weekend {
  background-color: #f6f8fb;
}

/* Month and quarter share one continuous proportional axis. */
.week-board[data-view="month"] .week-days,
.week-board[data-view="month"] .day-columns,
.week-board[data-view="quarter"] .week-days,
.week-board[data-view="quarter"] .day-columns {
  display: grid;
  grid-template-columns: var(--label-width) repeat(var(--days), minmax(0, 1fr));
}

.week-board[data-view="month"] .week-days {
  height: 43px;
}

.overview-corner {
  position: sticky;
  left: 0;
  z-index: 5;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 10px;
  border-right: 1px solid #cbd6e2;
  background: #f4f7fa;
  color: #33415b;
  font-size: 10px;
}

.overview-corner small {
  color: #8792a3;
  font-size: 8px;
}

.month-day,
.quarter-tick {
  min-width: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid #e4e9ef;
  background: transparent;
  color: #5f6d82;
  cursor: pointer;
}

.month-day {
  display: grid;
  place-content: center;
  gap: 1px;
  font-size: 9px;
}

.month-day small {
  font-size: 7px;
  font-weight: 720;
  text-transform: uppercase;
}

.month-day strong {
  font-size: 10px;
}

.month-day.is-weekend,
.quarter-tick.is-weekend {
  background: #eef2f6;
  color: #7f8999;
}

.month-day.is-today {
  color: #05775c;
  background: #ddf5ee;
}

.month-day.is-week-start,
.quarter-tick.is-week-start {
  border-left: 1px solid #aebdce;
}

.month-day:hover,
.quarter-tick:hover {
  color: #05775c;
  background: #e8f7f2;
}

.week-board[data-view="month"] .week-lanes,
.week-board[data-view="quarter"] .week-lanes {
  min-height: 230px;
  overflow: hidden;
  background: #fbfcfd;
}

.week-board[data-view="month"] .day-columns,
.week-board[data-view="quarter"] .day-columns {
  pointer-events: none;
}

.overview-label-rail {
  border-right: 1px solid #cbd6e2;
  background: rgba(244, 247, 250, 0.84);
}

.overview-day-column {
  border-right: 1px solid #edf0f4;
}

.overview-day-column.is-weekend {
  background: rgba(230, 235, 241, 0.58);
}

.overview-day-column.is-week-start {
  border-left: 1px solid #b8c5d3;
}

.overview-day-column.is-month-start {
  border-left: 2px solid #8190a4;
}

.overview-day-column.is-today {
  background: rgba(7, 154, 120, 0.08);
}

.week-board[data-view="month"] .tasks-layer,
.week-board[data-view="quarter"] .tasks-layer {
  position: relative;
  z-index: 2;
  inset: auto;
  padding: 9px 0;
}

.overview-row {
  display: grid;
  grid-template-columns: var(--label-width) minmax(0, 1fr);
  align-items: stretch;
  border-bottom: 1px solid rgba(218, 226, 235, 0.7);
}

.week-board[data-view="month"] .overview-row {
  height: 48px;
}

.overview-task-meta {
  position: relative;
  z-index: 3;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  overflow: hidden;
  border: 0;
  border-right: 1px solid #cbd6e2;
  background: rgba(255, 255, 255, 0.92);
  text-align: left;
  cursor: pointer;
}

.overview-task-meta:hover {
  background: #f0faf7;
}

.overview-task-meta strong {
  min-width: 0;
  overflow: hidden;
  color: #192640;
  font-size: 10px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-task-meta .operator-label {
  padding: 2px 4px;
  font-size: 7px;
}

.week-board[data-view="month"] .overview-task-meta {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  gap: 2px;
}

.week-board[data-view="month"] .overview-task-meta .operator-label {
  justify-self: start;
}

.overview-track {
  position: relative;
  min-width: 0;
}

.overview-task-bar {
  position: absolute;
  left: calc(var(--start) * 100% / var(--days) + 1px);
  width: calc(var(--span) * 100% / var(--days) - 2px);
  min-width: 0;
  z-index: 4;
  border: 1.5px solid var(--task-color);
  background: color-mix(in srgb, var(--task-color) 11%, white);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--task-color) 14%, transparent);
  cursor: grab;
}

.month-task-bar {
  top: 7px;
  height: 34px;
  border-radius: 7px;
}

.overview-task-bar:hover,
.overview-task-bar.is-selected {
  z-index: 8;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--task-color) 18%, transparent), 0 3px 8px color-mix(in srgb, var(--task-color) 20%, transparent);
}

.overview-task-bar.is-dragging {
  opacity: 0.55;
}

.overview-task-days {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--span), minmax(0, 1fr));
  overflow: hidden;
  border-radius: inherit;
}

.overview-task-day {
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-right: 1px solid color-mix(in srgb, var(--task-color) 25%, white);
  color: color-mix(in srgb, var(--task-color) 80%, #17223c);
  background: rgba(255, 255, 255, 0.28);
  font-size: 8px;
  font-weight: 900;
  cursor: pointer;
}

.overview-task-day:last-child {
  border-right: 0;
}

.overview-task-day:hover,
.overview-task-day.is-drop-target {
  background: color-mix(in srgb, var(--task-color) 25%, white);
  box-shadow: inset 0 0 0 2px var(--task-color);
}

.overview-task-day span {
  min-width: 14px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.overview-task-day.is-empty {
  color: #9f3b3b;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.42) 0 4px, rgba(157,45,45,.06) 4px 7px);
}

.overview-task-bar .resize-handle {
  top: 4px;
  bottom: 4px;
  width: 7px;
  z-index: 9;
  border-radius: 5px;
}

.overview-task-bar .resize-handle.start {
  left: 0;
}

.overview-task-bar .resize-handle.end {
  right: 0;
}

/* Three-month overview. */
.week-board[data-view="quarter"] .week-days {
  height: 49px;
  grid-template-rows: 27px 22px;
}

.quarter-corner {
  grid-row: 1 / 3;
}

.quarter-month-band {
  grid-column: var(--column) / span var(--span);
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border-right: 2px solid #8796aa;
  border-left: 1px solid #aebaca;
  background: #edf2f7;
  color: #26344d;
  font-size: 9px;
  font-weight: 850;
}

.quarter-tick {
  grid-row: 2;
  font-size: 6px;
}

.quarter-tick.is-month-start {
  border-left: 2px solid #7d8da2;
}

.week-board[data-view="quarter"] .overview-row {
  height: 30px;
}

.week-board[data-view="quarter"] .overview-task-meta {
  padding-block: 2px;
}

.week-board[data-view="quarter"] .overview-task-meta strong {
  font-size: 9px;
}

.week-board[data-view="quarter"] .overview-task-meta .operator-label {
  padding: 1px 3px;
  font-size: 6px;
}

.quarter-task-bar {
  top: 6px;
  height: 18px;
  border-width: 1px;
  border-radius: 4px;
  cursor: default;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--task-color) 13%, transparent);
}

.quarter-segment {
  min-width: 0;
  border-right-color: color-mix(in srgb, var(--task-color) 18%, white);
}

.quarter-segment.is-empty {
  opacity: 0.58;
}

.board-view:has(.week-board[data-view="quarter"]) .interaction-legend {
  display: none;
}

.picker-person.is-assigned {
  color: #243148;
  border-color: #9cd4c5;
  background: #edf9f5;
  cursor: pointer;
}

.picker-person span:last-child {
  display: grid;
  gap: 2px;
}

.picker-person span:last-child small {
  color: #758197;
  font-size: 9px;
  font-weight: 650;
}

@media (max-width: 1440px) {
  .workspace {
    padding: 12px 12px 10px;
  }

  .board-toolbar {
    margin-bottom: 7px;
  }

  .date-range-button {
    min-width: 300px;
  }

  .date-range-button span {
    font-size: 15px;
  }

  .view-switch,
  .date-range-button,
  .icon-button {
    height: 42px;
  }

  .view-switch {
    grid-template-columns: repeat(3, minmax(92px, 1fr));
  }

  .view-switch button {
    min-width: 92px;
    padding-inline: 10px;
    font-size: 11px;
  }

  .icon-button {
    width: 42px;
  }

  .overview-task-meta {
    padding-inline: 6px;
  }
}

@media (max-width: 1320px) {
  .planner-layout {
    grid-template-columns: 238px minmax(0, 1fr);
  }

  .sidebar {
    padding-inline: 10px;
  }

  .date-range-button {
    min-width: 260px;
  }

  .task-day-cell {
    padding-inline: 4px;
  }

  .crew-person {
    width: 50px;
    flex-basis: 50px;
  }

  .crew-person .person-avatar {
    width: 31px;
    height: 31px;
    flex-basis: 31px;
  }

  .crew-person .person-name {
    max-width: 50px;
    font-size: 7.2px;
  }
}

/* Keep the editable week seven days after all compact-view overrides. */
.week-board[data-view="week"] .week-days,
.week-board[data-view="week"] .day-columns {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
