:root {
  --sidebar-left: 330px;
  --sidebar-right: 330px;
  --header-height: 86px;
  --slot-height: 84px;
  --task-height: 64px;
  --day-width: 160px;
  --day-min-width: 118px;
  --day-gap: 8px;
  --week-gap: 40px;
  --grid-line: #d8e0ea;
  --board-bg: #fbfcfe;
  --panel-bg: rgba(255, 255, 255, .94);
  --panel-dark: linear-gradient(180deg, #243244 0%, #1a2533 100%);
  --text-1: #17212b;
  --text-2: #6a7787;
  --pending: #f59e0b;
  --done: #16a34a;
  --limit: #dc2626;
  --reserved: #7c3aed;
  --shadow-1: 0 10px 28px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text-1);
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, .08), transparent 26%),
    linear-gradient(180deg, #f7fafe 0%, #eef4fb 100%);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.planner-shell { min-height: 100vh; }
.eyebrow {
  text-transform: uppercase;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  color: #2563eb;
  margin-bottom: .2rem;
}
.search-input { width: 240px; }
.filter-select { width: 180px; }
.planner-topbar,
.planner-board-wrap {
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
}
.planner-panel {
  background: var(--panel-dark);
  color: #edf2f7;
  backdrop-filter: blur(8px);
}
.planner-panel .card-header,
.planner-panel .card-body {
  background: transparent;
  color: inherit;
}
.planner-panel .text-secondary,
.planner-panel .small.text-secondary {
  color: rgba(226, 232, 240, .78) !important;
}
.planner-panel .badge.text-bg-secondary {
  background: rgba(255,255,255,.18) !important;
  color: #fff !important;
}
.planner-layout {
  display: grid;
  grid-template-columns: var(--sidebar-left) minmax(0, 1fr) var(--sidebar-right);
  gap: 1rem;
  align-items: start;
}
.planner-panel,
.planner-board-wrap { min-height: 78vh; }
.task-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  min-height: 220px;
}
.empty-state {
  min-height: 160px;
  border: 1px dashed #cfd8e3;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  background: rgba(255,255,255,.65);
  text-align: center;
}
.empty-state-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  margin: 0 auto .4rem;
  background: #eef2ff;
  color: #4338ca;
}

.board-scroller {
  overflow: auto;
  padding: 0 14px 14px;
}
.planner-board {
  position: relative;
  min-height: 300px;
}
.grid-header,
.grid-body,
.cards-layer {
  position: absolute;
  inset: 0 auto auto 0;
}
.grid-header { height: var(--header-height); }
.grid-body {
  top: var(--header-height);
}
.cards-layer {
  pointer-events: none;
}
.cards-layer .task-card { pointer-events: auto; }

.day-head,
.grid-cell {
  position: absolute;
  top: 0;
  width: var(--day-width);
}
 .day-head {
  height: var(--header-height);
  background: linear-gradient(180deg, #fdfefe 0%, #f3f7fd 100%);
  border: 1px solid var(--grid-line);
  border-radius: 16px 16px 0 0;
  padding: .7rem .85rem .55rem;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .05);
}
.day-head.week-end {
  box-shadow: inset -4px 0 0 #94a3b8, 10px 0 0 rgba(148, 163, 184, .12), 0 6px 16px rgba(15, 23, 42, .05);
}
.day-head__day {
  font-size: .92rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}
.day-head__date {
  font-size: .78rem;
  color: var(--text-2);
  margin-top: .1rem;
}
.day-head__cap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .4rem;
  font-size: .75rem;
  color: var(--text-2);
  margin-top: .45rem;
}
.day-head__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 24px;
  padding: 0 .5rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 800;
  background: #e8eef7;
  color: #334155;
}
.day-head__count.full { background: #fef3c7; color: #92400e; }
.day-head__count.over { background: #fee2e2; color: #b91c1c; }

.grid-cell {
  height: 100%;
  background: rgba(255,255,255,.78);
  border: 1px solid var(--grid-line);
  border-top: none;
  border-radius: 0 0 16px 16px;
}
.grid-cell.week-end {
  box-shadow: inset -4px 0 0 #94a3b8, 10px 0 0 rgba(148, 163, 184, .12);
}
.grid-cell.is-drop-target {
  background: rgba(37, 99, 235, .06);
}
.slot-line {
  position: absolute;
  left: 0;
  width: 100%;
  border-top: 1px dashed #dbe3ec;
}
.limit-line {
  position: absolute;
  left: 0;
  width: 100%;
  border-top: 2px solid var(--limit);
  z-index: 2;
}
.reserved-slot {
  position: absolute;
  left: 8px;
  right: 8px;
  height: calc(var(--task-height) + 8px);
  border: 1px dashed rgba(124, 58, 237, .65);
  background: rgba(124, 58, 237, .08);
  color: #5b21b6;
  border-radius: 14px;
  font-size: .74rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: .35rem;
}
.drop-highlight {
  position: absolute;
  border: 2px dashed #2563eb;
  background: rgba(37, 99, 235, .08);
  border-radius: 14px;
  pointer-events: none;
  z-index: 10;
}

.task-card {
  border: 1px solid rgba(15, 23, 42, .10);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-1);
  overflow: hidden;
  user-select: none;
}
.task-card--pending {
  background: linear-gradient(180deg, #fff3d4 0%, #ffe7ad 100%);
}
.task-card--done {
  background: linear-gradient(180deg, #dcfce7 0%, #bbf7d0 100%);
}
.task-card--timeline {
  position: absolute;
  height: var(--task-height);
}
.task-card.is-selected {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}
.task-card.is-dragging {
  opacity: .9;
  transform: rotate(-1deg);
}
.task-card__head {
  min-height: 30px;
  padding: .4rem .55rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  background: rgba(255,255,255,.55);
  border-bottom: 1px solid rgba(15, 23, 42, .10);
}
.task-card__ref {
  font-size: .78rem;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-card__color {
  flex: 0 0 34px;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, .18);
}
.task-card__body {
  padding: .45rem .55rem .5rem;
}
.task-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .5rem;
}
.task-card__check {
  margin-right: .45rem;
  margin-top: .08rem;
}
.task-card__client {
  font-size: .82rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.15;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.task-card__article {
  font-size: .76rem;
  color: #334155;
  margin-top: .2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-card__toolbar {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
}
.task-card__meta {
  margin-top: .28rem;
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .7rem;
  color: #334155;
}
.task-card__edit {
  border: 0;
  background: #e2e8f0;
  color: #1f2937;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.task-card__edit:hover { background: #cbd5e1; }


.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  color: #475569;
  background: rgba(255,255,255,.75);
  border: 1px solid #d8e0ea;
  border-radius: 999px;
  padding: .3rem .55rem;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.dot-pending { background: linear-gradient(180deg, #fff3d4 0%, #ffe7ad 100%); border: 1px solid rgba(15,23,42,.12); }
.dot-done { background: linear-gradient(180deg, #dcfce7 0%, #bbf7d0 100%); border: 1px solid rgba(15,23,42,.12); }
.dot-limit { background: var(--limit); }
.dot-reserved { background: var(--reserved); }

.plan-choice {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  border: 1px solid #d7deea;
  border-radius: 14px;
  padding: .85rem 1rem;
  cursor: pointer;
}
.plan-choice input { margin-top: .25rem; }
.kv-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: .65rem .9rem;
  margin: 0;
}
.kv-grid dt {
  font-weight: 700;
  color: #475569;
}
.kv-grid dd { margin: 0; }

@media (max-width: 1600px) {
  :root {
    --sidebar-left: 300px;
    --sidebar-right: 300px;
  }
}
@media (max-width: 1280px) {
  .planner-layout {
    grid-template-columns: 1fr;
  }
  .planner-panel,
  .planner-board-wrap { min-height: auto; }
}
@media (max-width: 640px) {
  .search-input,
  .filter-select { width: 100%; }
  .kv-grid {
    grid-template-columns: 1fr;
    gap: .25rem;
  }
}
