* {
  box-sizing: border-box;
}
:root {
  --border: #d7dce3;
  --soft: #f4f6f8;
  --text: #202631;
  --muted: #6f7782;
  --accent: #2f5d8a;
  --available: #188443;
  --unavailable: #bf2f2f;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f6f8;
  color: var(--text);
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.topbar {
  min-height: 72px;
  padding: 14px 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-weight: 700;
  font-size: 18px;
}
.account {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}
.month-navigation {
  display: flex;
  align-items: center;
  gap: 10px;
}
.month-navigation h1,
.admin-title {
  margin: 0;
  font-size: 22px;
  min-width: 190px;
  text-align: center;
}
.month-arrow {
  font-size: 32px;
  line-height: 1;
  padding: 2px 10px;
  border-radius: 7px;
}
.month-arrow:hover {
  text-decoration: none;
  background: var(--soft);
}
.page {
  padding: 20px;
  overflow-x: visible;
}
.legend {
  max-width: 100%;
  margin: 0 auto 12px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.available-mark {
  color: var(--available);
  font-weight: 700;
  font-size: 22px;
}
.unavailable-mark {
  color: var(--unavailable);
  font-weight: 700;
  font-size: 22px;
}
.muted {
  color: var(--muted);
}
.schedule-wrap {
  width: max-content;
  min-width: 100%;
  background: white;
  border: 1px solid var(--border);
}
.schedule-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}
.schedule-table th,
.schedule-table td {
  border: 1px solid var(--border);
}
.group-header th {
  background: #e9edf2;
  padding: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}
.names-header th {
  background: var(--soft);
}
.member-head,
.availability-td {
  width: 52px;
  min-width: 52px;
  max-width: 52px;
}
.member-head {
  height: 96px;
  padding: 0;
  vertical-align: bottom;
  position: relative;
  overflow: hidden;
}
.member-head span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: inline-block;
  white-space: nowrap;
  font-size: 12px;
  padding: 8px 0;
}
.activity-head,
.activity-cell {
  width: 250px;
  min-width: 250px;
  max-width: 250px;
}
.activity-head {
  padding: 8px;
  font-size: 12px;
}
.date-head,
.date-cell {
  width: 74px;
  min-width: 74px;
  max-width: 74px;
}
.date-head {
  background: #dde4eb !important;
}
.schedule-table tbody tr {
  height: 50px;
}
.availability-td {
  padding: 0;
  text-align: center;
}
.member-cell {
  width: 52px;
  height: 49px;
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  font-size: 26px;
  cursor: default;
}
.member-cell.editable {
  cursor: pointer;
}
.member-cell.editable:hover {
  background: #edf3f8;
}
.member-cell.available {
  color: var(--available);
  font-weight: 700;
}
.member-cell.unavailable {
  color: var(--unavailable);
  font-weight: 800;
  font-size: 30px;
}
.member-cell:disabled {
  opacity: 1;
}
.activity-cell {
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.25;
}
.evening-activity {
  text-align: right;
}
.morning-activity {
  text-align: left;
}
.activity-editable {
  cursor: text;
}
.activity-editable:hover {
  background: #f7f9fb;
}
.activity-input {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid #6d8fb0;
  border-radius: 5px;
  font: inherit;
  outline: none;
}
.date-cell {
  padding: 3px;
  text-align: center;
  background: #fbfbfc;
  border-left: 2px solid #9ba6b2 !important;
  border-right: 2px solid #9ba6b2 !important;
}
.day-number {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}
.weekday {
  margin-top: 3px;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
}
.schedule-table tbody tr.week-end td {
  border-bottom: 4px solid #8d96a2;
}
.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}
.login-card h1 {
  margin-top: 0;
}
.login-card form,
.user-form {
  display: grid;
  gap: 14px;
}
label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
input,
select {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #cdd3da;
  border-radius: 7px;
  background: white;
  font: inherit;
}
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 7px;
  border: 1px solid #cbd2da;
  background: white;
  cursor: pointer;
  font: inherit;
}
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.alert,
.success {
  padding: 10px 12px;
  border-radius: 7px;
  margin-bottom: 14px;
}
.alert {
  background: #fff0f0;
  color: #932222;
  border: 1px solid #efc6c6;
}
.success {
  background: #eef9f1;
  color: #236a38;
  border: 1px solid #cbe5d2;
}
.admin-page {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}
.panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 18px;
}
.panel h2 {
  margin-top: 0;
}
.user-form {
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  align-items: end;
}
.user-list {
  display: grid;
  gap: 10px;
}
.user-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 90px 110px 90px auto;
  gap: 10px;
  align-items: end;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
}
.checkbox input {
  width: auto;
}
@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .account {
    justify-content: center;
  }
  .month-navigation {
    justify-content: center;
  }
  .user-form,
  .user-row {
    grid-template-columns: 1fr 1fr;
  }
}

.activity-cell {
  white-space: pre-line;
}
.schedule-table thead {
  position: sticky;
  top: 72px; /* height of your sticky .topbar */
  z-index: 20;
}

.availability-td {
  position: relative;
}
/*
|--------------------------------------------------------------------------
| Availability context menu
|--------------------------------------------------------------------------
*/

.cell-options-menu {
  position: fixed;
  z-index: 1000;

  width: 210px;

  padding: 6px;

  background: #fff;

  border: 1px solid #cfd5dc;
  border-radius: 9px;

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);

  font-size: 13px;
}

.cell-options-menu[hidden] {
  display: none;
}

.cell-options-title {
  padding: 7px 9px 8px;

  font-size: 11px;
  font-weight: 700;

  color: var(--muted);

  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cell-options-item {
  width: 100%;

  display: flex;
  align-items: center;

  gap: 8px;

  padding: 8px 9px;

  border: 0;
  border-radius: 6px;

  background: transparent;

  color: var(--text);

  text-align: left;

  font: inherit;

  cursor: pointer;
}

.cell-options-item:hover:not(:disabled) {
  background: var(--soft);
}

.cell-options-item:disabled {
  opacity: 0.4;
  cursor: default;
}

.cell-options-item.danger {
  color: #a52b2b;
}

.cell-options-check {
  width: 16px;

  font-weight: 700;

  text-align: center;
}

.cell-options-separator {
  height: 1px;

  margin: 5px 4px;

  background: var(--border);
}

.member-cell.uncertain {
  font-size: 22px;
}

.current-user-column {
  background: #edf5ff;
}

.member-head.current-user-column {
  background: #dcecff;
  font-weight: 700;
}

/* keep highlight when hovering editable cells */
.current-user-column .member-cell.editable:hover {
  background: #dfeeff;
}

/*
|--------------------------------------------------------------------------
| View / Edit mode
|--------------------------------------------------------------------------
*/

.edit-mode-toggle {
  white-space: nowrap;
}

/*
| Default = viewing.
*/

body:not(.editing-mode) .member-cell.editable {
  cursor: default;
}

body:not(.editing-mode) .member-cell.editable:hover {
  background: transparent;
}

body:not(.editing-mode) .activity-editable {
  cursor: default;
}

body:not(.editing-mode) .activity-editable:hover {
  background: transparent;
}

/*
| Editing mode.
*/

body.editing-mode .member-cell.editable {
  cursor: pointer;
}

body.editing-mode .member-cell.editable:hover {
  background: #edf3f8;
}

body.editing-mode .activity-editable {
  cursor: text;
}

body.editing-mode .activity-editable:hover {
  background: #f7f9fb;
}

/*
|--------------------------------------------------------------------------
| Make it visually obvious that editing is enabled
|--------------------------------------------------------------------------
*/

body.editing-mode .edit-mode-toggle {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

body.editing-mode .schedule-wrap {
  outline: 2px solid rgba(47, 93, 138, 0.18);
  outline-offset: 2px;
}

.birthday-cell,
.name-day-cell {
  position: relative;
}

.birthday-cell::after {
  content: "🎂";
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 12px;
  pointer-events: none;
}

.name-day-cell::before {
  content: "🌼";
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 12px;
  pointer-events: none;
}

/*
|--------------------------------------------------------------------------
| Floating activity editor
|--------------------------------------------------------------------------
*/

.activity-editor-overlay {
  position: fixed;
  z-index: 10000;

  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 24px;

  background: rgba(21, 29, 38, 0.35);
  backdrop-filter: blur(2px);
}

.activity-editor-overlay[hidden] {
  display: none;
}

.activity-editor-dialog {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);

  display: flex;
  flex-direction: column;

  overflow: hidden;

  border: 1px solid #cbd3dc;
  border-radius: 12px;

  background: #fff;

  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

/*
|--------------------------------------------------------------------------
| Header
|--------------------------------------------------------------------------
*/

.activity-editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 20px;

  padding: 18px 20px 14px;

  border-bottom: 1px solid #e1e5e9;
}

.activity-editor-title {
  font-size: 18px;
  font-weight: 750;
}

.activity-editor-meta {
  margin-top: 3px;

  color: #6d7782;

  font-size: 12px;
}

.activity-editor-close {
  width: 34px;
  height: 34px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  border: 0;
  border-radius: 7px;

  background: transparent;

  color: #56616c;

  font-size: 25px;
  line-height: 1;

  cursor: pointer;
}

.activity-editor-close:hover {
  background: #f0f2f4;
}

/*
|--------------------------------------------------------------------------
| Body
|--------------------------------------------------------------------------
*/

.activity-editor-body {
  padding: 20px;
}

.activity-editor-label {
  display: block;

  font-size: 13px;
  font-weight: 700;
}

.activity-editor-textarea {
  width: 100%;
  min-height: 160px;

  box-sizing: border-box;

  margin-top: 7px;

  padding: 12px 14px;

  resize: vertical;

  border: 1px solid #bbc5cf;
  border-radius: 8px;

  background: #fff;

  color: #252c34;

  font: inherit;
  font-size: 15px;
  line-height: 1.5;
}

.activity-editor-textarea:focus {
  outline: 3px solid rgba(47, 102, 150, 0.15);

  border-color: #467aa8;
}

.activity-editor-help {
  margin-top: 10px;

  color: #7a848e;

  font-size: 11px;
  line-height: 1.5;
}

/*
|--------------------------------------------------------------------------
| Footer
|--------------------------------------------------------------------------
*/

.activity-editor-footer {
  display: flex;
  justify-content: flex-end;

  gap: 8px;

  padding: 14px 20px;

  border-top: 1px solid #e1e5e9;

  background: #f7f8fa;
}

.activity-editor-save {
  background: #32689a;
  color: #fff;
}

.activity-editor-save:hover {
  background: #285a87;
}

.activity-editor-save:disabled {
  opacity: 0.55;
  cursor: wait;
}

/*
|--------------------------------------------------------------------------
| Calendar cursor while editing
|--------------------------------------------------------------------------
*/

body.editing-mode .activity-editable {
  cursor: pointer;
}

/*
|--------------------------------------------------------------------------
| Mobile
|--------------------------------------------------------------------------
*/

@media (max-width: 600px) {
  .activity-editor-overlay {
    padding: 12px;
  }

  .activity-editor-dialog {
    width: 100%;
  }

  .activity-editor-textarea {
    min-height: 190px;

    font-size: 16px;
  }

  .activity-editor-footer {
    flex-direction: column-reverse;
  }

  .activity-editor-footer .button {
    width: 100%;
    min-height: 44px;
  }
}

.activity-editor-toolbar {
  display: flex;
  align-items: center;

  gap: 5px;

  margin-bottom: 8px;
}

.activity-editor-tool {
  min-width: 34px;
  height: 32px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 9px;

  border: 1px solid #c5ccd4;
  border-radius: 5px;

  background: #f7f8fa;
  color: #303841;

  font-size: 13px;

  cursor: pointer;
}

.activity-editor-tool:hover {
  background: #eceff2;
}

.activity-editor-toolbar-separator {
  width: 1px;
  height: 22px;

  margin: 0 3px;

  background: #d6dbe0;
}

.activity-editor-clear-format {
  width: auto;

  color: #68727c;

  font-size: 11px;
}

.activity-rich-editor {
  width: 100%;
  min-height: 180px;
  max-height: 45vh;

  box-sizing: border-box;

  overflow-y: auto;

  padding: 14px 16px;

  border: 1px solid #bbc5cf;
  border-radius: 8px;

  background: #fff;

  color: #252c34;

  font-size: 15px;
  line-height: 1.55;

  white-space: pre-wrap;

  cursor: text;
}

.activity-rich-editor:focus {
  outline: 3px solid rgba(47, 102, 150, 0.15);

  border-color: #467aa8;
}

.activity-rich-editor strong {
  font-weight: 800;
}

.activity-rich-editor em {
  font-style: italic;
}

.desktop-paper-point-number {
  line-height: 1px !important;
}
