:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #17201c;
  --muted: #5f6c66;
  --line: #d7dfda;
  --green: #187a50;
  --green-strong: #0f623f;
  --mint: #dff0e8;
  --blue: #234b68;
  --amber: #926812;
  --red: #b3261e;
  --shadow: 0 14px 34px rgba(28, 44, 36, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

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

button {
  cursor: pointer;
}

.app-header {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 160px;
  align-items: center;
  gap: 24px;
  padding: 16px 24px;
  background: linear-gradient(180deg, #eef7f1, #dbeee4);
  border-bottom: 1px solid var(--line);
}

.brand-lockup,
.header-side {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-lockup {
  min-width: 0;
}

.header-side {
  justify-content: flex-end;
}

.title-block {
  min-width: 0;
  text-align: center;
}

.brand-logo {
  display: block;
  object-fit: contain;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  filter: drop-shadow(0 3px 8px rgba(28, 44, 36, 0.08));
}

.company-logo {
  width: 210px;
  height: 102px;
}

.developer-logo {
  width: 150px;
  height: 88px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1;
}

h2 {
  font-size: 17px;
  margin-bottom: 12px;
}

.header-actions,
.settings-actions,
.week-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.app-shell {
  display: block;
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px;
}

.planner-panel,
.settings-panel section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.planner-panel {
  min-width: 0;
  padding: 14px;
}

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

.settings-panel section {
  padding: 16px;
}

.week-toolbar {
  margin-bottom: 12px;
}

.week-picker,
.setting-grid,
.person-list,
.team-card {
  display: grid;
  gap: 8px;
}

.week-picker label,
.setting-grid label,
.person-list label,
.team-card label,
.notes-row label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfb;
  color: var(--ink);
  padding: 10px 11px;
  min-height: 42px;
}

textarea {
  resize: vertical;
  line-height: 1.35;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(24, 122, 80, 0.22);
  outline-offset: 2px;
}

input:disabled {
  background: #eef2ef;
  color: var(--muted);
}

.week-title {
  margin-left: auto;
  font-weight: 800;
  color: var(--blue);
  text-align: right;
}

.week-title span,
.week-title small {
  display: block;
}

.week-title span {
  font-size: 24px;
}

.week-title small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.square-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.icon-button,
.primary,
.ghost-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
}

.icon-button span:first-child {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--green-strong);
  font-size: 12px;
}

.primary {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.ghost-button {
  background: #ffffff;
  color: var(--green-strong);
}

.shift-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.summary-item {
  min-height: 94px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: var(--radius);
  background: #fbfcfb;
  padding: 12px;
}

.summary-item:nth-child(2) {
  border-left-color: var(--blue);
}

.summary-item:nth-child(3) {
  border-left-color: var(--amber);
}

.summary-item:nth-child(4) {
  border-left-color: var(--red);
}

.summary-item:nth-child(5) {
  border-left-color: #6c4ea2;
}

.summary-item:nth-child(6) {
  border-left-color: #157f8f;
}

.summary-item strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green-strong);
  font-size: 12px;
  text-transform: uppercase;
}

.summary-item p {
  margin: 0;
  line-height: 1.32;
  font-size: 13px;
  font-weight: 700;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 6px 0 10px;
}

.section-heading p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.section-heading h2 {
  font-size: 21px;
}

.section-heading span {
  border: 1px solid #ecd79f;
  border-radius: 999px;
  background: #fff7df;
  color: #76530d;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.bottom-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.share-action {
  display: none;
}

.schedule-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
  background: #ffffff;
}

.mobile-label {
  display: none;
}

.schedule-table th,
.schedule-table td {
  border: 1px solid #26312b;
  vertical-align: middle;
}

.schedule-table th {
  background: #ffffff;
  padding: 10px 8px;
  color: #0d261a;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.schedule-table .time-head th {
  background: #dcefe3;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
}

.schedule-table td {
  height: 36px;
  padding: 0;
}

.employee-row {
  background: #ffffff;
}

.employee-row.alternate {
  background: #d8ecdd;
}

.employee-row.role-lavaggio .employee-name strong {
  color: #009add;
}

.employee-row.role-jolly .employee-name strong {
  color: #ad1d2a;
}

.employee-name {
  width: 230px;
  padding: 4px 6px;
  text-align: left;
}

.employee-name strong,
.employee-name span {
  display: block;
}

.employee-name strong {
  color: #17201c;
  font-size: 12px;
  font-weight: 900;
}

.employee-name span {
  margin-top: 1px;
  color: #77837d;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.matrix-mark {
  display: grid;
  place-items: center;
  width: 100%;
  height: 36px;
  border: 0;
  background: transparent;
  color: #00af45;
  font-size: 29px;
  font-weight: 900;
  line-height: 1;
}

.matrix-mark:disabled {
  cursor: text;
  opacity: 0.45;
}

.matrix-mark.changed {
  background: #fff4ca;
}

.matrix-mark:not(.active)::after {
  content: "";
  width: 18px;
  height: 18px;
  border: 1px dashed transparent;
}

.matrix-mark:not(.active):hover::after {
  border-color: #b9c7be;
  background: #f8fbf9;
}

.custom-name-cell {
  padding: 0;
}

.custom-name-input {
  width: 100%;
  height: 36px;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 7px;
  font-size: 12px;
  font-weight: 900;
}

.custom-name-input::placeholder {
  color: #89958f;
  font-weight: 700;
}

.custom-name-label {
  display: none;
  padding: 4px 6px;
  font-size: 11px;
  font-weight: 900;
}

.share-mode {
  background: #ffffff;
}

.share-mode .app-shell {
  max-width: 1260px;
  margin: 0 auto;
}

.share-mode .settings-panel,
.share-mode .notes-row,
.share-mode .week-picker {
  display: none;
}

.share-mode .week-toolbar button {
  display: none;
}

.share-mode .share-action {
  display: inline-flex;
}

.share-mode .planner-panel {
  box-shadow: none;
}

.share-mode .shift-summary {
  display: none;
}

.share-mode .employee-row:not(.has-assignment) {
  display: none;
}

.share-mode .employee-name span {
  display: none;
}

.share-mode .employee-name strong {
  font-size: 11px;
}

.share-mode .schedule-table td {
  height: 30px;
}

.share-mode .matrix-mark {
  height: 30px;
  font-size: 25px;
}

.share-mode #addEmployeeBtn {
  display: none;
}

.share-mode #shareModeBtn {
  background: #ffffff;
  border-color: var(--line);
  color: var(--green-strong);
}

.share-mode .table-actions {
  justify-content: flex-end;
}

.share-mode .custom-name-input {
  display: none;
}

.share-mode .custom-name-label {
  display: block;
}

.notes-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 14px;
  align-items: end;
}

.notes-row label,
.notes-row textarea {
  grid-column: 1 / -1;
}

.notes-row button {
  justify-self: end;
}

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

.person-list {
  gap: 10px;
}

.team-editor {
  display: grid;
  gap: 10px;
}

.team-card {
  border: 1px solid var(--line);
  padding: 12px;
  background: #fbfcfb;
}

.team-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--blue);
  font-weight: 800;
}

.team-card select {
  min-height: 38px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 8px;
}

.helper-text {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.rotation-week {
  border-left: 4px solid var(--green);
  background: #fbfcfb;
  padding: 10px 12px;
}

.rotation-week strong {
  display: block;
  margin-bottom: 7px;
  color: var(--blue);
}

.rotation-week p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

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

  .shift-summary {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 680px) {
  .app-header {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: center;
    padding: 14px;
  }

  .brand-lockup {
    grid-column: 1;
    grid-row: 1;
    width: auto;
  }

  .title-block {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .header-side {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    justify-content: flex-end;
  }

  .company-logo {
    width: 142px;
    height: 74px;
  }

  .developer-logo {
    width: 108px;
    height: 66px;
  }

  .app-shell {
    padding: 8px 6px;
  }

  .planner-panel,
  .settings-panel section {
    padding: 8px 6px;
  }

  .shift-summary {
    grid-template-columns: 1fr;
  }

  .week-title {
    width: 100%;
    margin-left: 0;
  }

  .notes-row {
    grid-template-columns: 1fr;
  }

  .notes-row button {
    justify-self: stretch;
  }

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

  .bottom-actions {
    justify-content: stretch;
  }

  .bottom-actions button,
  .table-actions > button {
    width: 100%;
    justify-content: center;
  }

  .table-wrap {
    width: 100%;
    overflow-x: hidden;
  }

  .schedule-table {
    min-width: 0;
  }

  .schedule-table th:first-child,
  .schedule-table td:first-child {
    width: 35%;
  }

  .schedule-table th {
    padding: 7px 2px;
    font-size: 9px;
    line-height: 1.05;
    overflow-wrap: anywhere;
  }

  .schedule-table .time-head th {
    padding: 5px 1px;
    font-size: 8px;
    line-height: 1;
  }

  .desktop-label {
    display: none;
  }

  .mobile-label {
    display: inline;
  }

  .schedule-table td,
  .matrix-mark {
    height: 40px;
  }

  .employee-name {
    padding: 3px 4px;
  }

  .employee-name strong {
    font-size: 10px;
    line-height: 1.05;
    overflow-wrap: anywhere;
  }

  .matrix-mark {
    min-width: 0;
    padding: 0;
    font-size: 25px;
    touch-action: manipulation;
  }

  .matrix-mark:not(.active)::after {
    width: 15px;
    height: 15px;
  }

  .custom-name-input {
    height: 40px;
    min-height: 40px;
    padding: 0 4px;
    font-size: 10px;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .app-header,
  .settings-panel,
  .week-toolbar button,
  .header-actions,
  .notes-row button {
    display: none;
  }

  .app-shell {
    display: block;
    padding: 0;
  }

  .planner-panel {
    border: 0;
    box-shadow: none;
  }

  .table-wrap {
    overflow: visible;
  }

  .person-select {
    display: none;
  }

  .print-name {
    display: inline;
  }
}
