:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #18202a;
  --muted: #667085;
  --line: #d7dce3;
  --line-strong: #bac3cf;
  --office: #b7e4c7;
  --office-strong: #2f8f55;
  --remote: #fff0a6;
  --remote-strong: #b28400;
  --away: #ffc5c5;
  --away-strong: #bc3030;
  --empty: #f1f3f6;
  --focus: #2563eb;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid #1f2937;
  border-radius: 6px;
  color: white;
  background: #1f2937;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  background: #111827;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

.secondary-button {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line-strong);
}

.secondary-button:hover {
  background: #eef2f7;
}

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.topbar-actions,
.controls,
.employee-tools,
.status-palette {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.controls {
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

input,
select,
textarea {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: white;
  padding: 8px 10px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.status-button {
  color: #111827;
  border-color: transparent;
  min-width: 108px;
}

.status-button.active {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22);
  border-color: var(--focus);
}

.status-office {
  background: var(--office);
}

.status-office:hover {
  background: #9ed8b2;
}

.status-remote {
  background: var(--remote);
}

.status-remote:hover {
  background: #ffe580;
}

.status-away {
  background: var(--away);
}

.status-away:hover {
  background: #ffadad;
}

.status-empty {
  background: var(--empty);
}

.status-empty:hover {
  background: #e4e8ee;
}

.copied-option {
  min-height: 40px;
  border-radius: 6px;
  color: white;
  background: #2563eb;
  border-color: #2563eb;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copied-option:hover {
  background: #1d4ed8;
}

.copied-option.active {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.24);
  border-color: #0f172a;
}

.selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

#selectionLabel {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.planner-wrap {
  overflow: auto;
  max-height: calc(100vh - 240px);
  min-height: 500px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.planner-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.planner-table th,
.planner-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.planner-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 36px;
  background: #eef2f7;
  color: #344054;
  font-size: 0.76rem;
  text-align: left;
  padding: 6px;
}

.planner-table th:first-child,
.date-cell {
  position: sticky;
  left: 0;
  z-index: 3;
}

.planner-table th:first-child {
  z-index: 4;
  width: 96px;
}

.employee-head {
  min-width: 118px;
}

.employee-head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.remove-employee {
  width: 24px;
  min-height: 24px;
  padding: 0;
  color: #667085;
  background: transparent;
  border-color: transparent;
  border-radius: 6px;
}

.remove-employee:hover {
  color: #bc3030;
  background: rgba(188, 48, 48, 0.08);
}

.date-cell {
  width: 96px;
  background: #f8fafc;
  padding: 5px 7px;
  vertical-align: top;
}

.date-day {
  display: block;
  font-weight: 760;
  font-size: 0.84rem;
}

.date-weekday {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.weekend .date-cell {
  background: #e8edf3;
}

.planning-cell {
  height: 42px;
  min-width: 118px;
  padding: 0;
  vertical-align: stretch;
}

.cell-button {
  display: grid;
  align-content: start;
  gap: 2px;
  width: 100%;
  min-height: 42px;
  height: 100%;
  padding: 5px 6px;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: var(--empty);
  text-align: left;
}

.cell-button:hover {
  filter: brightness(0.98);
}

.cell-button.office {
  background: var(--office);
  border-left: 3px solid var(--office-strong);
}

.cell-button.remote {
  background: var(--remote);
  border-left: 3px solid var(--remote-strong);
}

.cell-button.away {
  background: var(--away);
  border-left: 3px solid var(--away-strong);
}

.cell-button.empty {
  background: var(--empty);
  border-left: 3px solid transparent;
}

.cell-button.selected {
  box-shadow: inset 0 0 0 2px var(--focus);
}

.weekend .cell-button {
  background-image: linear-gradient(rgba(42, 53, 71, 0.045), rgba(42, 53, 71, 0.045));
}

.cell-status {
  font-size: 0.66rem;
  font-weight: 780;
  color: #344054;
}

.cell-note {
  min-height: 1em;
  overflow: hidden;
  color: #1f2937;
  font-size: 0.72rem;
  line-height: 1.15;
  word-break: break-word;
}

.cell-dialog {
  width: min(460px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.cell-dialog::backdrop {
  background: rgba(15, 23, 42, 0.32);
}

.cell-dialog form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.cell-dialog header,
.cell-dialog menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.cell-dialog h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0;
}

.icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  font-size: 1.5rem;
  line-height: 1;
}

.icon-button:hover {
  color: var(--ink);
  background: #eef2f7;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 14px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .controls,
  .selection-bar {
    align-items: stretch;
  }

  .selection-bar {
    flex-direction: column;
  }

  .selection-actions {
    width: 100%;
  }

  .selection-actions button {
    flex: 1 1 130px;
  }

  .topbar-actions > *,
  .employee-tools > *,
  .status-button {
    flex: 1 1 150px;
  }

  .planner-wrap {
    max-height: calc(100vh - 395px);
  }
}

@media (max-width: 520px) {
  .planner-table th:first-child,
  .date-cell {
    width: 82px;
  }

  .planning-cell,
  .employee-head {
    min-width: 104px;
  }
}
