:root {
  --bg: #f5f3ef;
  --card: #fffdf9;
  --ink: #1f2d2a;
  --accent: #256a5a;
  --warn: #8b1e1e;
  --line: #d8d2c5;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at 10% 10%, #faf6ea, var(--bg));
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}
header {
  padding: 18px;
  background: linear-gradient(120deg, #f4e6ca, #cde2d9);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brand-block {
  display: flex;
  align-items: center;
}
.brand-logo {
  display: block;
  height: 62px;
  width: auto;
  max-width: min(100%, 520px);
  object-fit: contain;
}
.top-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
header h1 { margin: 0 0 4px; }
header p { margin: 0; }
.nav-btn {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #1c5648;
  text-decoration: none;
  color: #fff;
  background: #256a5a;
  font-weight: 600;
}
.nav-btn.active {
  background: #173f35;
}
.top-nav button.nav-btn {
  border: 1px solid #1c5648;
  background: #256a5a;
  color: #fff;
  padding: 10px 14px;
}
main { padding: 12px; max-width: 1200px; margin: 0 auto; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}
.grid { display: grid; gap: 8px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
input, select, button {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #b6b1a5;
  font-size: 14px;
}
textarea {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #b6b1a5;
  font-size: 14px;
  font-family: inherit;
  margin: 8px 0;
}
button {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
}
button.secondary { background: #6b6a67; }
button.warn { background: var(--warn); }
.list { display: grid; gap: 6px; margin-top: 8px; }
.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}
.hidden { display: none; }
.hint { color: #555; font-size: 12px; }
.role-skill, .template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.template-grid {
  grid-template-columns: 1fr;
}
.template-matrix-wrap {
  overflow-x: auto;
}
.template-matrix {
  table-layout: fixed;
  width: 100%;
  min-width: 1080px;
}
.template-matrix th:first-child,
.template-matrix td:first-child {
  width: 180px;
}
.template-matrix th {
  text-align: center;
}
.template-matrix .tmpl-role {
  background: #f9f6ef;
  position: sticky;
  left: 0;
  z-index: 1;
}
.template-matrix .tmpl-cell {
  vertical-align: top;
  min-height: 88px;
  background: #fffdf8;
}
.tmpl-shift-chip {
  border-radius: 8px;
  border: 1px solid #d8d2c5;
  background: #f4efe3;
  padding: 5px 6px;
  margin: 4px 0;
}
.tmpl-shift-chip.period-am {
  background: linear-gradient(160deg, #ffe38a, #f4c94e);
}
.tmpl-shift-chip.period-pm {
  background: linear-gradient(160deg, #9fd0ff, #5ca8ef);
}
.tmpl-shift-chip.role-am-host-1 {
  background: linear-gradient(160deg, #cdeec8, #a8df9f);
}
.tmpl-shift-chip.role-am-host-2 {
  background: linear-gradient(160deg, #e6d8ff, #cdb5ff);
}
.tmpl-shift-chip.role-pm-host-1 {
  background: linear-gradient(160deg, #ffd6e8, #ffb3d6);
}
.tmpl-shift-chip.role-pm-host-2 {
  background: linear-gradient(160deg, #ffe3bf, #ffc47c);
}
.tmpl-chip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tmpl-chip-title {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 0;
}
.tmpl-skill-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
}
.tmpl-skill-inline input[type="number"] {
  width: 46px;
  min-width: 46px;
  padding: 3px 4px;
  font-size: 11px;
}
.tmpl-chip-row {
  display: grid;
  gap: 6px;
  align-items: end;
  margin-top: 3px;
}
.tmpl-chip-times {
  grid-template-columns: 1fr;
}
.tmpl-chip-row label {
  font-size: 10px;
  display: grid;
  gap: 2px;
}
.tmpl-chip-row input[type="time"] {
  width: 100%;
  min-width: 0;
  padding: 3px 4px;
  font-size: 11px;
  height: 28px;
}
.template-calendar {
  display: grid;
  grid-template-columns: 1fr;
}
.calendar-day {
  min-width: 0;
}
.calendar-day h4 {
  margin: 0 0 8px;
}
.day-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.day-tab {
  background: #ece7dc;
  color: #224038;
  border: 1px solid #c7c1b5;
}
.day-tab.active {
  background: #256a5a;
  color: #fff;
}
.day-timeline {
  position: relative;
  height: min(72vh, 760px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(to bottom, rgba(37, 106, 90, 0.05) 1px, transparent 1px) 0 0 / 100% 43.75px,
    #fffef9;
  overflow: hidden;
}
.day-lane-canvas {
  position: relative;
  height: 100%;
  width: 100%;
}
.calendar-hour-mark {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed rgba(90, 90, 90, 0.25);
  pointer-events: none;
}
.calendar-hour-mark span {
  position: absolute;
  top: -8px;
  left: 4px;
  font-size: 10px;
  color: #6b6b6b;
  background: rgba(255, 255, 255, 0.75);
  padding: 0 3px;
}
.shift-box {
  position: absolute;
  padding: 8px;
  background: linear-gradient(160deg, #2e7d6a, #245c4f);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  overflow: hidden;
  touch-action: none;
}
.shift-box.dragging {
  box-shadow: 0 0 0 2px #f4e6ca;
}
.shift-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
}
.shift-time {
  font-size: 11px;
  margin: 2px 0 4px;
}
.shift-skill-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}
.shift-skill-label input {
  width: 64px;
  padding: 3px 4px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #d2e7e0;
}
.role-skill-item .skill-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.employee-card {
  padding: 10px;
}
.employee-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.employee-editor {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: grid;
  gap: 8px;
}
.employee-edit-split {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 10px;
  align-items: start;
}
.employee-role-col h4,
.employee-avail-col h4 {
  margin: 0 0 6px;
  font-size: 13px;
}
.employee-role-list {
  grid-template-columns: 1fr;
}
.employee-role-list .role-skill-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
}
.hidden,
.employee-editor.hidden {
  display: none !important;
}
.availability { display: grid; gap: 4px; margin-top: 8px; }
.warn { color: var(--warn); font-weight: 600; }
button.warn { color: #fff; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.table th, .table td {
  border: 1px solid var(--line);
  padding: 4px;
  text-align: left;
}
.schedule-grid th:first-child,
.schedule-grid td:first-child {
  min-width: 180px;
}
.sched-cell {
  vertical-align: top;
  min-height: 70px;
  background: #fffdf8;
  text-align: center;
}
.sched-cell.sched-cell-unavailable {
  background: #e6e9ed;
}
.sched-cell.sched-cell-timeoff {
  background: #cfd5dc;
}
.sched-cell.sched-cell-am-unavailable {
  background:
    linear-gradient(to bottom right, transparent calc(50% - 0.6px), #98a2ad calc(50% - 0.6px), #98a2ad calc(50% + 0.6px), transparent calc(50% + 0.6px)),
    linear-gradient(to bottom right, #e6e9ed 0 50%, transparent 50% 100%),
    #fffdf8;
}
.sched-cell.sched-cell-pm-unavailable {
  background:
    linear-gradient(to bottom right, transparent calc(50% - 0.6px), #98a2ad calc(50% - 0.6px), #98a2ad calc(50% + 0.6px), transparent calc(50% + 0.6px)),
    linear-gradient(to bottom right, transparent 0 50%, #e6e9ed 50% 100%),
    #fffdf8;
}
.sched-cell.drag-over {
  outline: 2px dashed #256a5a;
  outline-offset: -2px;
  background: #eef8f4 !important;
}
.shift-chip {
  color: #1f2d2a;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  padding: 6px;
  margin: 4px 0;
  cursor: grab;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
  width: calc(100% - 6px);
  max-width: 100%;
}
.shift-chip.period-am {
  background: linear-gradient(160deg, #ffe38a, #f4c94e);
}
.shift-chip.period-pm {
  background: linear-gradient(160deg, #9fd0ff, #5ca8ef);
}
.shift-chip.role-am-host-1 {
  background: linear-gradient(160deg, #cdeec8, #a8df9f);
}
.shift-chip.role-am-host-2 {
  background: linear-gradient(160deg, #e6d8ff, #cdb5ff);
}
.shift-chip.role-pm-host-1 {
  background: linear-gradient(160deg, #ffd6e8, #ffb3d6);
}
.shift-chip.role-pm-host-2 {
  background: linear-gradient(160deg, #ffe3bf, #ffc47c);
}
.shift-chip.unfilled {
  background: linear-gradient(160deg, #8b1e1e, #6f1717);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.shift-chip.dragging {
  opacity: 0.65;
}
.chip-role {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center !important;
  width: 100%;
  display: block;
  margin: 0 auto;
}
.chip-time {
  font-size: 11px;
  opacity: 0.95;
  text-align: center !important;
  width: 100%;
  display: block;
  margin: 0 auto;
}
.tbd-row td {
  background: #fff4f0;
}
.tbd-row td:first-child {
  color: #8b1e1e;
}
.warnings-bottom {
  margin-top: 10px;
}
.lock-calendar th:first-child,
.lock-calendar td:first-child {
  min-width: 180px;
}
.lock-calendar td {
  vertical-align: top;
  min-height: 58px;
  background: #fffdf8;
}
.lock-pill {
  background: #efe9db;
  border: 1px solid #d8d2c5;
  border-radius: 8px;
  padding: 4px 6px;
  margin: 3px 0;
  font-size: 11px;
  line-height: 1.2;
}
.lock-pill-btn {
  width: 100%;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 10px;
  background: #efefe8;
  margin-right: 4px;
}
.saved-badge {
  display: inline-block;
  color: #147a2f;
  font-weight: 700;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 25, 23, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}
.modal-card {
  width: min(700px, 100%);
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
}
.modal-card h3 {
  margin: 0 0 6px;
}
.modal-card textarea {
  margin-top: 6px;
}

@media (max-width: 800px) {
  .employee-edit-split {
    grid-template-columns: 1fr;
  }
  .brand-logo {
    height: 46px;
    max-width: min(100%, 360px);
  }
  .template-calendar {
    grid-template-columns: 1fr;
  }
  .day-timeline { height: min(64vh, 640px); }
}
