:root {
  --bg: #eef1f5;
  --ink: #101828;
  --muted: #667085;
  --panel: #fff;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --line: #d7dde7;
  --row: 26px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-header {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #d7dce3;
  display: flex;
  justify-content: space-between;
  min-height: 62px;
  padding: 8px 14px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-lockup,
.header-main {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  display: block;
  height: 42px;
  object-fit: contain;
  width: 42px;
}

.brand-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.brand-company {
  color: #0a4c8e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 2px;
  text-transform: uppercase;
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  color: #063a73;
  font-size: clamp(21px, 2vw, 28px);
  line-height: 1;
}

h2 {
  font-size: 22px;
}

.header-actions,
.split-actions,
.month-nav {
  align-items: center;
  display: flex;
  gap: 6px;
}

.icon-button,
.nav-button {
  align-items: center;
  background: #fff;
  border: 1px solid #aeb6c2;
  color: #111827;
  cursor: pointer;
  display: inline-flex;
  height: 40px;
  justify-content: center;
  min-width: 40px;
}

.text-button {
  align-items: center;
  background: #fff;
  border: 1px solid #aeb6c2;
  color: #111827;
  display: inline-flex;
  font-weight: 700;
  min-height: 40px;
  padding: 7px 12px;
}

.month-nav {
  margin-right: 6px;
}

.icon-button {
  font-size: 22px;
  line-height: 1;
  width: 40px;
}

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

.icon-button:hover,
.nav-button:hover,
button:hover {
  border-color: var(--accent);
}

.icon-button.primary:hover {
  background: var(--accent-dark);
}

.board-shell {
  padding: 8px 14px 14px;
}

.sheet-frame {
  background: #fff;
  border: 1px solid #c8ced8;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  overflow: auto;
  width: 100%;
}

.calendar-board {
  border-collapse: separate;
  border-spacing: 0 3px;
  color: #111827;
  min-width: 1120px;
  table-layout: fixed;
  width: 100%;
}

.calendar-board col.week {
  width: 40px;
}

.calendar-board col.tech {
  width: 55px;
}

.calendar-board col.day {
  width: 140px;
}

.calendar-board col.note {
  width: 325px;
}

.calendar-board th,
.calendar-board td {
  height: var(--row);
  overflow: hidden;
  padding: 2px 7px;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.calendar-board th {
  background: #172033;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  height: 31px;
  text-align: center;
  text-transform: uppercase;
}

.calendar-board th:last-child {
  text-align: left;
}

.calendar-board th:first-child,
.calendar-board th:nth-child(2),
.manage-grid th:first-child,
.manage-grid th:nth-child(2) {
  padding-left: 2px;
  padding-right: 2px;
}

.calendar-board th:first-child {
  font-size: 11px;
}

.calendar-board th:first-child {
  border-radius: 8px 0 0 0;
}

.calendar-board th:last-child {
  border-radius: 0 8px 0 0;
}

.calendar-board tbody tr.tech-row td {
  background: var(--row-bg);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.72);
}

.calendar-board tbody tr.week-start td {
  border-top: 2px solid #172033;
}

.calendar-board .week-date {
  background: #fff !important;
  color: #111827;
  font-size: 18px;
  font-weight: 800;
  padding-left: 2px;
  padding-right: 2px;
  text-align: center;
}

.calendar-board .tech-name {
  border-left: 7px solid var(--row-accent);
  color: #111827;
  font-size: 15px;
  font-weight: 800;
  padding-left: 4px;
  padding-right: 3px;
}

.calendar-board .assignment-cell {
  border-left: 1px solid rgba(15, 23, 42, 0.09);
  cursor: pointer;
  text-align: left;
}

.calendar-board .assignment-cell:hover {
  filter: brightness(0.97);
}

.calendar-board .assignment-cell.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.calendar-board .assignment-cell.out {
  background: #e7e9ee !important;
}

.calendar-board .assignment-cell.holiday {
  background: #d8dce3 !important;
  color: #374151;
}

.calendar-board .assignment-cell.outside-month {
  opacity: 0.66;
}

.cell-assignment {
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-note {
  color: #4b5563;
  font-size: 10.5px;
  line-height: 1;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-board .note-cell {
  background: #fff !important;
  border-left: 1px solid var(--line);
  color: #334155;
  font-size: 11.5px;
  line-height: 1.15;
  padding: 5px 7px;
  text-align: left;
  white-space: nowrap;
}

.calendar-board .note-cell.empty-note {
  color: transparent;
}

.calendar-board .empty-muted .cell-assignment {
  color: transparent;
}

.tech-tone-0 {
  --row-bg: #edf5ff;
  --row-accent: #2563eb;
}

.tech-tone-1 {
  --row-bg: #eefbf4;
  --row-accent: #168057;
}

.tech-tone-2 {
  --row-bg: #fff7df;
  --row-accent: #c77700;
}

.tech-tone-3 {
  --row-bg: #f5f1ff;
  --row-accent: #7c3aed;
}

.tech-tone-4 {
  --row-bg: #fff1f3;
  --row-accent: #d12f5f;
}

.tech-tone-5 {
  --row-bg: #eafafa;
  --row-accent: #08828a;
}

.settings-drawer {
  background: var(--panel);
  border-left: 1px solid #c8ced8;
  bottom: 0;
  box-shadow: -18px 0 40px rgba(15, 23, 42, 0.14);
  max-width: 440px;
  overflow-y: auto;
  padding: 18px;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateX(105%);
  transition: transform 160ms ease;
  width: min(440px, 100vw);
  z-index: 30;
}

.settings-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

.drawer-section {
  border-top: 1px solid #d8dde6;
  display: grid;
  gap: 10px;
  padding: 16px 0;
}

.drawer-section.quiet {
  color: var(--muted);
}

.drawer-section label,
.section-title {
  color: #111827;
  font-size: 14px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 72px 1fr;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid #aeb6c2;
  color: #111827;
  min-height: 38px;
  padding: 7px 8px;
  width: 100%;
}

textarea {
  line-height: 1.35;
  min-height: 72px;
  resize: vertical;
}

button {
  background: #fff;
  border: 1px solid #aeb6c2;
  color: #111827;
  cursor: pointer;
  min-height: 38px;
  padding: 7px 12px;
}

#saveAssignmentButton,
#saveWorkersButton,
#saveNoteButton,
#setHolidayButton,
#copyCellButton {
  background: #111827;
  border-color: #111827;
  color: #fff;
}

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

a {
  color: var(--accent-dark);
  font-weight: 700;
}

a.icon-button {
  color: #111827;
}

a.icon-button.primary {
  color: #fff;
}

.manage-page {
  background: #f5f6f8;
}

.save-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  min-width: 90px;
  text-align: right;
}

.manage-page.is-locked .save-status {
  color: #b42318;
}

.manage-page:not(.is-locked) .save-status {
  color: #168057;
}

.manage-shell {
  display: grid;
  gap: 12px;
  padding: 12px 14px 18px;
}

.pin-panel {
  align-items: center;
  backdrop-filter: blur(6px);
  background: rgba(238, 241, 245, 0.74);
  bottom: 0;
  display: flex;
  justify-content: space-between;
  left: 0;
  padding: 20px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 50;
}

.pin-panel.hidden {
  display: none;
}

.pin-card {
  background: #fff;
  border: 1px solid #cfd6e2;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
  display: grid;
  gap: 14px;
  margin: auto;
  max-width: 420px;
  padding: 18px;
  width: min(420px, calc(100vw - 32px));
}

.pin-help {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
  margin: 6px 0 0;
}

.pin-row,
.toolbar-group {
  align-items: center;
  display: flex;
  gap: 8px;
}

.pin-row input {
  max-width: 160px;
}

.manage-page.is-locked .manage-toolbar,
.manage-page.is-locked .manage-layout {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.manage-toolbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.manage-layout {
  align-items: start;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 300px;
}

.manage-grid-wrap {
  background: #fff;
  border: 1px solid #c8ced8;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  overflow: auto;
}

.manage-grid {
  border-collapse: separate;
  border-spacing: 0 3px;
  min-width: 1160px;
  table-layout: fixed;
  width: 100%;
}

.manage-grid col.week {
  width: 40px;
}

.manage-grid col.tech {
  width: 55px;
}

.manage-grid col.day {
  width: 148px;
}

.manage-grid col.note {
  width: 325px;
}

.manage-grid th,
.manage-grid td {
  padding: 4px 6px;
  vertical-align: top;
}

.manage-grid th {
  background: #172033;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.manage-grid th:last-child {
  text-align: left;
}

.manage-grid th:first-child {
  border-radius: 8px 0 0 0;
}

.manage-grid th:last-child {
  border-radius: 0 8px 0 0;
}

.manage-grid tbody tr.tech-row td {
  background: var(--row-bg);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.manage-grid tbody tr.week-start td {
  border-top: 2px solid #172033;
}

.manage-grid .week-date {
  background: #fff !important;
  font-size: 15px;
  font-weight: 800;
  padding-left: 2px;
  padding-right: 2px;
  text-align: center;
  vertical-align: middle;
}

.manage-grid .tech-name {
  border-left: 7px solid var(--row-accent);
  font-size: 13px;
  font-weight: 800;
  padding-left: 4px;
  padding-right: 3px;
  vertical-align: middle;
}

.manage-cell {
  border-left: 1px solid rgba(15, 23, 42, 0.08);
}

.manage-cell.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.manage-cell.holiday {
  background: #d8dce3 !important;
}

.manage-cell input {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(111, 122, 141, 0.32);
  min-height: 28px;
  padding: 4px 6px;
}

.manage-cell .note-input {
  font-size: 12px;
  margin-top: 4px;
}

.manage-tech-note textarea {
  font-size: 12px;
  line-height: 1.25;
  min-height: 58px;
  resize: vertical;
}

.manage-side {
  display: grid;
  gap: 12px;
}

.side-panel {
  background: #fff;
  border: 1px solid #c8ced8;
  border-radius: 8px;
  display: grid;
  gap: 9px;
  padding: 12px;
}

.side-panel h2 {
  font-size: 18px;
}

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

.worker-row {
  border: 1px solid #d8dde6;
  border-left: 7px solid var(--worker-color);
  display: grid;
  gap: 7px;
  grid-template-columns: 42px minmax(0, 1fr) 34px;
  padding: 8px;
}

.worker-color-input {
  border: 0;
  cursor: pointer;
  height: 34px;
  min-height: 34px;
  padding: 0;
}

.worker-name-input {
  min-height: 34px;
}

.icon-mini {
  align-items: center;
  display: inline-flex;
  font-size: 20px;
  height: 34px;
  justify-content: center;
  min-height: 34px;
  min-width: 34px;
  padding: 0;
}

.icon-mini.danger {
  color: #b42318;
}

.worker-swatches {
  display: grid;
  gap: 5px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(8, 1fr);
}

.color-swatch {
  border: 1px solid rgba(15, 23, 42, 0.2);
  cursor: pointer;
  height: 20px;
  min-height: 20px;
  padding: 0;
}

.worker-error {
  color: #b42318;
  font-size: 13px;
  font-weight: 700;
  min-height: 18px;
}

.selection-summary {
  background: #f1f5f9;
  border: 1px solid #d7dde7;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  padding: 8px;
}

.scrim {
  background: rgba(17, 24, 39, 0.32);
  bottom: 0;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 20;
}

@media (min-width: 1500px) and (min-height: 900px) {
  :root {
    --row: 29px;
  }

  .calendar-board th {
    height: 34px;
  }

  .cell-assignment {
    font-size: 16px;
  }
}

@media (max-height: 850px) {
  :root {
    --row: 20px;
  }

  .app-header {
    min-height: 54px;
    padding-bottom: 6px;
    padding-top: 6px;
  }

  .brand-logo {
    height: 38px;
    width: 38px;
  }

  .brand-company {
    font-size: 11px;
  }

  h1 {
    font-size: 21px;
  }

  .board-shell {
    padding: 6px 10px 10px;
  }

  .calendar-board {
    border-spacing: 0 1px;
  }

  .calendar-board th {
    height: 26px;
  }

  .cell-assignment,
  .calendar-board .tech-name {
    font-size: 12.5px;
  }

  .calendar-board .week-date {
    font-size: 14px;
  }

  .cell-note {
    display: none;
  }
}

@media (max-width: 760px) {
  .app-header {
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
  }

  .board-shell {
    padding: 8px;
  }

  .calendar-board {
    min-width: 1040px;
  }

  .manage-layout {
    grid-template-columns: 1fr;
  }

  .manage-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media print {
  .app-header,
  .settings-drawer,
  .scrim {
    display: none;
  }

  .board-shell {
    padding: 0;
  }

  .sheet-frame {
    border: 0;
    box-shadow: none;
    overflow: visible;
  }

  .calendar-board {
    min-width: 0;
  }
}
