:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1d2630;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #2f6f73;
  --accent-dark: #24565a;
  --accent-soft: #eef6f7;
  --blue: #315f9c;
  --yes: #55a76a;
  --maybe: #d39a32;
  --no: #eef1f5;
  --danger: #b8453f;
  --shadow: 0 1px 3px rgba(20, 30, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.45;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 30px 32px 22px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.back-link {
  display: inline-block;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 10px;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  letter-spacing: 0;
  line-height: 1.05;
}

.mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.view-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid #cfe2e4;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 800;
}

.purpose {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 820px;
  font-size: 16px;
}

.status-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 170px;
  align-items: flex-end;
}

.status-panel span {
  background: #eef6f7;
  border: 1px solid #cfe2e4;
  color: var(--accent-dark);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.layout {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px 32px 44px;
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(520px, 1.4fr);
  gap: 20px;
}

.layout > * {
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 20px;
  min-width: 0;
}

.form-panel,
.shared-panel,
.coordinator-panel,
.request-panel,
.mode-panel,
.docs-panel {
  grid-column: span 2;
}

body[data-view="respond"] .request-panel,
body[data-view="respond"] .coordinator-panel,
body[data-view="respond"] .docs-panel {
  display: none;
}

.setup-only,
.respond-only {
  display: none;
}

body[data-view="setup"] .setup-only.mode-copy,
body[data-view="respond"] .respond-only.mode-copy {
  display: flex;
}

body[data-view="setup"] .setup-only.workflow-strip,
body[data-view="respond"] .respond-only.workflow-strip {
  display: grid;
}

body[data-view="setup"] .setup-only:not(.mode-copy):not(.workflow-strip),
body[data-view="respond"] .respond-only:not(.mode-copy):not(.workflow-strip) {
  display: block;
}

body[data-view="respond"] .layout {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1120px;
}

body[data-view="respond"] .mode-panel,
body[data-view="respond"] .meeting-panel,
body[data-view="respond"] .form-panel,
body[data-view="respond"] .results-panel,
body[data-view="respond"] .shared-panel {
  grid-column: 1;
}

.mode-panel {
  display: grid;
  gap: 16px;
  border-color: #cfe2e4;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfb 100%);
}

.mode-copy {
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.mode-copy strong {
  font-size: 18px;
}

.mode-copy span {
  color: var(--muted);
  font-size: 15px;
}

.workflow-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

body[data-view="respond"] .workflow-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workflow-strip div {
  border: 1px solid #d8e3e5;
  background: #ffffff;
  border-radius: 8px;
  padding: 11px 12px;
}

.workflow-strip strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.workflow-strip span {
  color: var(--muted);
  font-size: 13px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-heading span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.details-grid {
  display: grid;
  gap: 10px;
}

.detail-item {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f4;
}

.detail-item:last-child {
  border-bottom: 0;
}

.detail-item strong {
  color: var(--muted);
  font-size: 13px;
}

.notice {
  margin-top: 16px;
  background: #f3f7f2;
  border-left: 4px solid var(--yes);
  padding: 12px 14px;
  border-radius: 0 6px 6px 0;
  color: #334337;
  font-size: 14px;
}

.help-box {
  border: 1px solid #d8e3e5;
  border-radius: 8px;
  background: #f8fbfb;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.compact-help {
  background: #fbfcfd;
}

.help-box summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 750;
}

.help-box p {
  margin: 8px 0 0;
  color: #46535f;
  font-size: 14px;
}

.tip {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-left: 4px;
  border: 1px solid #bfd4d7;
  border-radius: 50%;
  color: var(--accent-dark);
  background: #eef6f7;
  font-size: 12px;
  font-weight: 800;
  cursor: help;
  position: relative;
}

.tip:hover::after,
.tip:focus::after {
  content: attr(aria-label);
  position: absolute;
  z-index: 20;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  width: min(280px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  padding: 9px 10px;
  border: 1px solid #cfd6e1;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
}

.tip.tip-align-left:hover::after,
.tip.tip-align-left:focus::after {
  left: 0;
  right: auto;
  transform: none;
}

.tip.tip-align-right:hover::after,
.tip.tip-align-right:focus::after {
  left: auto;
  right: 0;
  transform: none;
}

form {
  display: grid;
  gap: 18px;
}

.form-grid,
.decision-grid,
.request-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.primary-fields {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.request-grid {
  grid-template-columns: minmax(180px, 0.6fr) minmax(260px, 1fr) minmax(180px, 0.6fr);
  align-items: start;
}

.request-grid .full-label {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.full-label {
  display: grid;
  gap: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd6e1;
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  background: #fff;
}

input[readonly] {
  background: #f8fafc;
  color: #475467;
}

textarea {
  resize: vertical;
}

.copy-output {
  margin-top: 10px;
  background: #fbfcfd;
  border-style: dashed;
  color: #344054;
  font-size: 13px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(47, 111, 115, 0.18);
  border-color: var(--accent);
}

.grid-intro,
.actions-row,
.grid-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.grid-toolbar {
  justify-content: flex-start;
  gap: 10px;
  margin-top: -4px;
}

.grid-toolbar button {
  min-height: 38px;
  padding: 8px 12px;
}

.grid-intro p,
.small-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.submit-status {
  min-height: 20px;
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.submit-status.ok {
  color: #2c7040;
}

.submit-status.warn {
  color: #9a640f;
}

.legend {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 4px;
  border-radius: 3px;
  vertical-align: -1px;
}

.legend .yes {
  background: var(--yes);
}

.legend .maybe {
  background: var(--maybe);
}

.availability-grid {
  display: grid;
  grid-template-columns: 120px repeat(4, minmax(110px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  width: 100%;
  min-width: 0;
}

.grid-cell,
.grid-head,
.grid-date {
  min-height: 48px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  font-size: 13px;
  text-align: center;
}

.grid-head,
.grid-date {
  background: #f8fafc;
  font-weight: 700;
  color: #344054;
}

.grid-control {
  appearance: none;
  width: 100%;
  border-top: 0;
  border-left: 0;
  border-radius: 0;
  cursor: pointer;
}

.grid-control:hover {
  background: #eef6f7;
  color: var(--accent-dark);
}

.grid-cell {
  cursor: pointer;
  background: #fff;
  color: transparent;
  user-select: none;
}

.grid-cell:hover {
  background: #f0f5f5;
}

.grid-cell.state-y {
  background: #dff1e4;
  color: #245b32;
}

.grid-cell.state-m {
  background: #fff2d9;
  color: #7a510c;
}

.privacy-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 500;
  color: var(--ink);
}

.privacy-row input {
  width: auto;
  margin-top: 3px;
}

button {
  appearance: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

button,
.button-link {
  min-height: 42px;
}

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

button.secondary {
  background: #fff;
  color: var(--accent);
}

button.secondary:hover {
  background: #edf6f7;
}

button:disabled,
button:disabled:hover {
  border-color: #cfd6e1;
  background: #eef1f5;
  color: #8a94a6;
  cursor: not-allowed;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--blue);
  color: var(--blue);
  background: #fff;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 700;
  text-decoration: none;
}

.button-link:hover {
  background: #eef4ff;
}

.best-times {
  display: grid;
  gap: 10px;
}

.slot-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  width: 100%;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  text-align: left;
  padding: 12px;
  border-radius: 8px;
}

.slot-card:hover {
  background: #f8fbfb;
}

.slot-card.readonly-slot-card,
.slot-card.readonly-slot-card:hover {
  cursor: default;
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
  opacity: 1;
}

.slot-card-time {
  font-weight: 750;
}

.slot-card-score {
  color: var(--accent-dark);
  font-weight: 750;
}

.slot-card-people {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 9px 10px;
  font-size: 13px;
  vertical-align: top;
}

th {
  background: #f8fafc;
  text-align: left;
  white-space: nowrap;
}

td.slot-y {
  background: #dff1e4;
  color: #245b32;
  font-weight: 750;
  text-align: center;
}

td.slot-m {
  background: #fff2d9;
  color: #7a510c;
  font-weight: 750;
  text-align: center;
}

td.slot-n {
  background: #f7f8fa;
  color: #98a2b3;
  text-align: center;
}

.empty-state,
.empty-table-cell {
  color: var(--muted);
  background: #fbfcfd;
  border: 1px dashed #cfd6e1;
  border-radius: 8px;
  padding: 14px;
  margin: 0;
  font-size: 14px;
}

.empty-table-cell {
  border-radius: 0;
  text-align: center;
}

.docs-panel ul {
  margin: 0;
  padding-left: 20px;
  color: #344054;
}

.docs-panel li + li {
  margin-top: 8px;
}

.meeting-links {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.meeting-link {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  text-decoration: none;
}

.meeting-link strong {
  flex: 0 0 auto;
}

.meeting-link span {
  overflow-wrap: anywhere;
  text-align: right;
}

.meeting-link span {
  color: var(--muted);
  font-size: 13px;
}

.meeting-link:hover {
  background: #f8fbfb;
}

.integration-preview {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.integration-preview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.integration-preview-card strong {
  display: block;
  margin-bottom: 6px;
}

.integration-preview-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.folded-controls {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 14px;
  background: #fbfcfd;
}

.folded-controls summary {
  cursor: pointer;
  font-weight: 750;
  color: #344054;
}

.folded-controls label,
.folded-controls .decision-grid,
.folded-controls .form-grid,
.folded-controls .table-wrap,
.folded-controls .small-note {
  margin-top: 12px;
}

.optional-details {
  margin-top: 0;
}

.shared-fold {
  margin-top: 0;
}

.request-actions {
  margin-top: 14px;
}

@media (max-width: 980px) {
  .topbar,
  .layout {
    padding-left: 18px;
    padding-right: 18px;
  }

  .topbar {
    flex-direction: column;
  }

  .status-panel {
    flex-direction: row;
    align-items: flex-start;
  }

  .layout,
  .form-panel,
  .shared-panel,
  .coordinator-panel,
  .request-panel,
  .mode-panel,
  .docs-panel {
    grid-template-columns: 1fr;
    grid-column: span 1;
    min-width: 0;
  }

  .form-grid,
  .primary-fields,
  .decision-grid,
  .request-grid {
    grid-template-columns: 1fr;
  }

  .workflow-strip,
  body[data-view="setup"] .workflow-strip,
  body[data-view="respond"] .workflow-strip {
    grid-template-columns: 1fr;
  }

  .grid-intro,
  .actions-row,
  .grid-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .integration-preview {
    grid-template-columns: 1fr;
  }

  .availability-grid {
    overflow-x: auto;
  }
}
