:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #64717b;
  --line: #d8dee4;
  --line-strong: #aeb8c2;
  --accent: #116d6e;
  --accent-strong: #0b5556;
  --accent-soft: #dff1ef;
  --warn: #a34322;
  --warn-soft: #f8e8df;
  --weekend: #2f5c9c;
  --weekend-soft: #e4eefc;
  --weekday: #34513d;
  --weekday-soft: #e3f1e7;
  --shadow: 0 10px 28px rgba(23, 32, 38, 0.08);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
}

button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 650;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

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

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-panel h1,
.app-header h1,
.panel-heading h2,
.edit-dialog h2 {
  margin: 0;
}

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

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.month-picker {
  width: 180px;
}

.icon-button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #fff;
  color: var(--ink);
  border-color: var(--line-strong);
  font-size: 1.35rem;
}

.ghost-button {
  background: #fff;
  color: var(--ink);
  border-color: var(--line-strong);
}

.danger-button {
  background: var(--warn);
  border-color: var(--warn);
}

.segmented {
  display: inline-flex;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  overflow: hidden;
}

.segmented button {
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--ink);
}

.segmented button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-line,
.message-line {
  min-height: 22px;
  margin: 10px 2px;
  color: var(--muted);
}

.message-line.error,
.error {
  color: var(--warn);
}

.content-grid {
  display: grid;
  gap: 14px;
  align-items: start;
}

.schedule-surface {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.schedule-surface {
  min-width: 0;
  overflow: clip;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.weekday-header,
.calendar-day {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.weekday-header {
  min-height: 36px;
  display: grid;
  place-items: center;
  background: #edf1f3;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.calendar-day {
  min-width: 0;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  padding: 8px;
  background: #fff;
  cursor: pointer;
}

.calendar-day.outside-month {
  background: #f0f2f4;
}

.day-number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  font-weight: 800;
}

.manager-line {
  width: fit-content;
  min-height: 0;
  margin-bottom: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-align: left;
}

.manager-line:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.pto-line {
  margin-top: auto;
  padding-top: 6px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.assignment-chip {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  display: grid;
  margin-bottom: 6px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  align-items: center;
}

.assignment-chip span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.assignment-chip .chip-meta {
  color: var(--muted);
  font-size: 0.7rem;
}

.assignment-chip.weekday {
  border-color: #b8d7c0;
  background: var(--weekday-soft);
}

.assignment-chip.weekend-fri-sat,
.assignment-chip.weekend-sun-mon {
  border-color: #bfd1eb;
  background: var(--weekend-soft);
}

.assignment-chip.traded {
  border-color: #cfb6e8;
  background: #f1eafa;
}

.original-tech {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.coverage-arrow {
  margin: 0 5px;
  color: var(--muted);
}

.coverage-tech {
  color: var(--ink);
}

.lock-mark {
  color: var(--warn);
  font-weight: 900;
}

.list-view {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #edf1f3;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

td button {
  min-height: 30px;
}

.side-panel {
  display: grid;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.settings-section {
  display: grid;
  min-width: 0;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.settings-section:not([open]) {
  gap: 0;
}

.settings-section > summary {
  cursor: pointer;
  list-style: none;
}

.settings-section > summary::-webkit-details-marker {
  display: none;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-heading::after {
  content: "+";
  width: 30px;
  height: 30px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
  font-weight: 900;
}

.settings-section[open] > .panel-heading::after {
  content: "-";
}

.panel-heading h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 8px;
  align-items: end;
}

.roster-list,
.pto-list {
  display: grid;
  gap: 8px;
}

.roster-list {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.roster-item,
.pto-item {
  display: grid;
  min-width: 0;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
}

.roster-item {
  min-height: 52px;
  align-items: center;
}

.inactive-item {
  background: #f0f2f4;
}

.roster-row,
.pto-item {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.active-toggle {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.active-toggle input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.roster-row strong,
.pto-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tech-name-button {
  min-width: 0;
  min-height: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.tech-name-button:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.pto-item div:first-child {
  display: grid;
  gap: 2px;
}

.pto-item span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.pto-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 8px;
}

.empty-state {
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  background: #fafbfc;
  font-size: 0.9rem;
}

.inactive {
  color: var(--muted);
}

.mini-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.pto-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(180px, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.edit-dialog {
  width: min(520px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.edit-dialog::backdrop {
  background: rgba(23, 32, 38, 0.35);
}

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

.edit-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.edit-meta {
  margin: 0;
  color: var(--muted);
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.checkbox-line input {
  width: 18px;
  height: 18px;
}

.dialog-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
}

.split-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
}

.print-page {
  background: #fff;
}

.print-sheet {
  width: min(1000px, 100%);
  margin: 0 auto;
  padding: 28px;
}

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

  .pto-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .app-header {
    align-items: start;
    flex-direction: column;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar > * {
    flex: 1 1 auto;
  }

  .calendar {
    grid-template-columns: 1fr;
  }

  .weekday-header {
    display: none;
  }

  .calendar-day {
    min-height: auto;
  }

  .calendar-day.outside-month {
    display: none;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .settings-section {
    padding: 12px;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .pto-form {
    grid-template-columns: 1fr;
  }

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

@media print {
  body:not(.print-page) .app-header,
  body:not(.print-page) .toolbar,
  body:not(.print-page) .side-panel,
  body:not(.print-page) .message-line,
  body:not(.print-page) .status-line {
    display: none;
  }

  body,
  .schedule-surface,
  .print-sheet {
    box-shadow: none;
    border: 0;
    background: #fff;
  }

  button {
    display: none;
  }
}
