.metric.group {
  grid-column: auto;
  padding: 0;
  border-left: 0;
}

.schedule-grid {
  grid-template-rows: 80px;
}

.schedule-grid .th,
.schedule-grid .metric-head {
  height: 80px;
  margin-bottom: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

.app-shell {
  width: 100%;
  height: 100vh;
  min-height: 0;
}

.sidebar {
  height: 100vh;
  min-height: 0;
}

main {
  width: auto;
  min-width: 0;
  flex: 1 1 auto;
  height: 100vh;
}

.topbar,
.subbar {
  width: 100%;
}

.topbar {
  gap: 24px;
}

.top-actions {
  margin-left: auto;
}

.subbar {
  overflow: hidden;
}

.week {
  left: 50%;
  transform: translateX(-50%);
}

.sub-actions {
  transform: none;
}

.workspace {
  position: relative;
  height: calc(100vh - 144px);
  min-height: 0;
  overflow: hidden;
}

/* Keep the fixed metrics rail opaque below the schedule as well. */
.workspace::after {
  content: "";
  position: absolute;
  z-index: 4;
  top: 0;
  right: 0;
  bottom: 0;
  width: 437px;
  background: #fff;
  pointer-events: none;
}

.turns {
  height: 100%;
  overflow: hidden;
}

.planning {
  width: auto;
  min-width: 0;
  flex: 1 1 auto;
  height: 100%;
  overflow: auto;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
  scrollbar-color: #aaa8b4 transparent;
  scrollbar-width: thin;
}

.schedule-grid {
  width: max-content;
  min-width: 100%;
  grid-template-columns: 176px repeat(6, minmax(200px, 1fr)) repeat(3, 145.67px);
}

.group,
.total,
.grand-total {
  grid-column: 1 / 8;
}

.group.barcelona,
.total.barcelona {
  background: #f0efff !important;
}

.group.madrid,
.total.madrid {
  background: #e8faf5 !important;
}

.metric.group,
.metric.total,
.metric.grand-total {
  grid-column: auto;
}

.metric-head,
.metric {
  position: sticky;
  z-index: 6;
  background-color: #fff;
}

.metric-cost {
  right: 291.34px;
}

.metric-hours {
  right: 145.67px;
}

.metric-balance {
  right: 0;
}

.metric-head {
  z-index: 7;
}

.metric-head.metric-cost {
  z-index: 11;
}

.metric.group,
.metric.total {
  background-color: inherit;
}

.brand {
  display: block;
  object-fit: contain;
  overflow: visible;
  border-radius: 0;
}

.more-menu {
  display: none;
}

.shift b {
  display: flex;
  align-items: center;
  gap: 5px;
}

.lock-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

@media (max-width: 1180px) {
  .published,
  .view-switch,
  .sub-actions {
    display: none;
  }

  .headline h1 {
    font-size: 26px;
  }
}

/* Typography follows the Figma text styles: Medium by default, Semibold only for totals. */
.primary,
.outline,
.tabs span,
.week,
.sub-actions button,
.turn-control,
.turn b,
.th b,
.metric-head,
.group,
.employee b,
.shift b,
.shift em,
.needs-toolbar button,
.need-head,
.need-label b {
  font-weight: 500;
}

.total,
.total.metric,
.grand-total,
.grand-total.metric {
  font-weight: 600;
}

.employee small,
.shift small,
.shift i,
.metric,
.rest,
.need-label small {
  font-weight: 400;
}

.subbar {
  gap: 16px;
}

.week {
  position: static;
  transform: none;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.week img {
  width: 16px;
  height: 16px;
}

.sub-actions {
  margin-left: 0;
  flex: 0 0 auto;
}

.sub-actions button,
.needs-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sub-actions button img,
.needs-toolbar button img {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.metric-head {
  position: sticky;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 16px 8px;
  overflow: visible;
}

.metric-head > span {
  line-height: 16px;
  white-space: nowrap;
}

.metrics-toolbar {
  position: absolute;
  top: 0;
  right: 0;
  width: 437px;
  height: 48px;
  display: flex;
  align-items: center;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #fff;
  z-index: 25;
}

.metrics-toolbar button {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px;
  border: 1px solid #cdcdcd;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: 500 14px/24px "Fira Sans", Arial, sans-serif;
  flex: 0 0 auto;
}

.metrics-toolbar button img,
.metrics-toolbar > img {
  width: 20px;
  height: 20px;
}

.toolbar-info {
  margin-left: 4px;
}

.toolbar-dots {
  margin-left: auto;
}

.planning {
  position: relative;
}

.metrics-divider {
  position: absolute;
  z-index: 20;
  top: 0;
  bottom: 0;
  right: 437px;
  width: 8px;
  background: #ebe9ff;
  pointer-events: none;
}

.metrics-handle {
  position: absolute;
  top: 554px;
  left: -4px;
  width: 16px;
  height: 40px;
  padding: 12px 0;
  border-radius: 999px;
  background: var(--violet);
}

.metrics-handle img {
  display: block;
  width: 16px;
  height: 16px;
}

.shift {
  height: 40px;
  padding: 0;
  text-align: left;
}

.shift b {
  position: absolute;
  top: 5px;
  left: 8px;
  right: 80px;
  justify-content: flex-start;
  gap: 8px;
  padding: 0;
}

.shift b:not(:has(.lock-icon)) {
  padding-left: 24px;
}

.shift small {
  position: absolute;
  left: 32px;
  bottom: 3px;
  display: block;
  padding: 0;
  text-align: left;
}

.shift em,
.shift i {
  text-align: right;
}

.shift em {
  font-size: 12px;
  line-height: 16px;
}

.needs-toolbar {
  position: sticky;
  left: 0;
  z-index: 15;
  width: calc(100vw - 661px);
  min-width: 776px;
  background: #f7f7f8;
  align-items: center;
}

.drag-note {
  font-weight: 400;
}

.schedule-grid > .name,
.schedule-grid > .employee {
  position: sticky;
  left: 0;
  z-index: 8;
  background-color: #fff;
}

.schedule-grid > .name {
  z-index: 10;
}

.schedule-grid > .group > span,
.schedule-grid > .total > span,
.schedule-grid > .grand-total > span {
  position: sticky;
  left: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  width: 176px;
  height: 48px;
  margin-top: -15px;
  margin-left: -16px;
  padding: 0 16px;
  background: inherit;
}

.schedule-grid > .group {
  border-left: 0;
}

.schedule-grid > .group > span {
  border-left: 6px solid var(--violet);
  padding-left: 10px;
  gap: 8px;
}

.schedule-grid > .group.madrid > span {
  border-left-color: #16d69a;
}

.main-group-chevron {
  display: block;
  width: 16px;
  height: 16px;
  min-width: 16px;
  max-width: 16px;
  min-height: 16px;
  max-height: 16px;
  flex: 0 0 16px;
  transform: rotate(0deg);
  transform-origin: center;
}

.main-group-chevron.is-collapsed {
  transform: rotate(-90deg);
}

.main-group-label {
  white-space: nowrap;
}

.needs-grid {
  width: max-content;
  grid-template-columns: 176px repeat(6, 200px);
}

.needs-grid > :nth-child(7n + 1) {
  position: sticky;
  left: 0;
  z-index: 6;
  background-color: #fff;
}

.needs-grid > .need-label:nth-child(7n + 1) {
  left: 4px;
  z-index: 7;
  box-shadow: -4px 0 #fff;
}

@media (max-width: 1180px) {
  .week {
    margin-left: auto;
  }
}

/* Figma states: overflow menu and group-order modal. */
[hidden] {
  display: none !important;
}

.more-menu-trigger {
  width: 20px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.more-menu-trigger img {
  width: 20px;
  height: 20px;
}

.more-menu {
  display: none;
  top: 60px;
  right: 24px;
  z-index: 40;
  width: 360px;
  height: 188px;
  padding: 8px;
  gap: 4px;
  flex-direction: column;
  border: 1px solid #e6e6e9;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.more-menu.is-open {
  display: flex;
}

.more-menu button {
  width: 100%;
  height: 40px;
  flex: 0 0 40px;
  padding: 8px;
  border: 0;
  border-radius: 4px;
  background: #fff;
  color: #55536b;
  display: flex;
  align-items: center;
  gap: 8px;
  font: 400 14px/16px "Fira Sans", Arial, sans-serif;
  text-align: left;
  cursor: pointer;
}

.more-menu button:hover {
  background: #f7f7f8;
}

.more-menu button img {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

.order-modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  background: rgba(13, 10, 44, 0.32);
}

.order-modal-layer.is-open {
  display: flex;
}

.order-modal {
  width: 480px;
  height: 682px;
  margin-top: 120px;
  padding: 24px 32px;
  border-radius: 8px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: 0 8px 24px rgba(13, 10, 44, 0.12);
}

.order-modal-heading {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
}

.order-modal-heading h2 {
  flex: 1;
  margin: 0;
  color: #0d0a2c;
  font-size: 28px;
  font-weight: 700;
  line-height: 28px;
}

.order-modal-close {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.order-modal-close img {
  width: 24px;
  height: 24px;
}

.order-modal-content {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.order-modal-elements {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.order-modal-help {
  height: 42px;
  margin: 0;
  color: #55536b;
  font-size: 14px;
  font-weight: 400;
  line-height: 21px;
}

.order-groups {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-group {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid #e6e6e9;
  border-radius: 8px;
  background: #f7f7f8;
  overflow: hidden;
}

.order-group:not(.is-open) {
  height: 48px;
}

.order-group:not(.is-open) .order-employees {
  display: none;
}

.order-group.is-open {
  height: 368px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-group-heading {
  width: calc(100% + 2px);
  margin-left: -1px;
  min-height: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.schedule-grid > .group > span,
.order-chevron {
  cursor: pointer;
}

.order-group-heading > img:first-child,
.order-chevron,
.employee-grip {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.order-chevron {
  display: block;
  min-width: 16px;
  max-width: 16px;
  min-height: 16px;
  max-height: 16px;
  object-fit: contain;
  transform: rotate(0deg);
  transform-origin: center;
}

.order-group.is-open .order-chevron {
  transform: rotate(180deg);
}

.group-bullet {
  width: 8px;
  height: 8px;
  margin-left: 0;
  margin-right: -8px;
  flex: 0 0 8px;
  border-radius: 50%;
}

.group-bullet.barcelona {
  background: #5b49fe;
}

.group-bullet.madrid {
  background: #0bcc8a;
}

.order-group-heading b {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  line-height: 21px;
}

.order-employees {
  width: calc(100% + 2px);
  margin-left: -1px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.order-employee {
  width: 100%;
  height: 48px;
  padding: 8px;
  border: 1px solid #e6e6e9;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
}

.employee-photo {
  width: 32px;
  height: 32px;
  margin-right: -8px;
  border-radius: 50%;
  object-fit: cover;
}

.order-employee b {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  line-height: 16px;
}

.order-group,
.order-employee {
  touch-action: none;
}

.order-group img,
.order-employee img {
  -webkit-user-drag: none;
  user-select: none;
}

.drag-source {
  display: none !important;
}

.drag-placeholder {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
}

.drag-overlay {
  position: fixed !important;
  z-index: 200;
  margin: 0 !important;
  pointer-events: none;
  cursor: grabbing;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

body.is-dragging,
body.is-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
}

.order-modal-actions {
  height: 48px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
}

.order-modal-actions button {
  height: 48px;
  padding: 12px 16px;
  border-radius: 4px;
  font: 500 14px/21px "Fira Sans", Arial, sans-serif;
  cursor: pointer;
}

.order-cancel {
  border: 1px solid #cdcdcd;
  background: #fff;
  color: #0d0a2c;
}

.order-save {
  border: 1px solid #5b49fe;
  background: #5b49fe;
  color: #fff;
}

@media (max-height: 850px) {
  .order-modal {
    margin-top: max(24px, calc((100vh - 682px) / 2));
  }
}
