:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --ink: #171717;
  --muted: #6f6f68;
  --line: #d8d8d0;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --soft: #eef4f2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.1;
}

h2 {
  font-size: 15px;
}

h3 {
  font-size: 14px;
}

p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.top-actions,
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: 6px;
  height: 36px;
  padding: 0 12px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button.secondary {
  background: #334155;
}

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

.shell {
  padding: 18px 28px 36px;
}

.workspace {
  max-width: 1480px;
  margin: 0 auto;
}

.tabs {
  margin-bottom: 16px;
}

.tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.tab.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
  animation: enter 180ms ease-out;
}

@keyframes enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
  gap: 16px;
  margin-bottom: 16px;
}

.columns.wide-left {
  grid-template-columns: minmax(480px, 0.78fr) minmax(0, 1fr);
}

.pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
}

.pane-head {
  min-height: 48px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.calendar-head {
  align-items: flex-start;
}

.metric {
  min-width: 28px;
  height: 24px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.list {
  padding: 8px;
}

.row {
  padding: 12px 10px;
  border-bottom: 1px solid #ededE7;
}

.row:last-child {
  border-bottom: 0;
}

.row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.chip {
  background: #f1f5f4;
  border: 1px solid #dce7e4;
  color: #164e45;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
}

.form-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

label.inline {
  grid-template-columns: 18px 1fr;
  align-items: center;
  color: var(--ink);
}

input, select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 9px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.form-grid button {
  grid-column: 1 / -1;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.fact {
  background: #fafaf8;
  border: 1px solid #e8e8df;
  border-radius: 6px;
  padding: 9px;
  font-size: 12px;
}

.options .row {
  cursor: pointer;
}

.options .row:hover {
  background: #fafdfc;
}

.assignment {
  border-left: 2px solid var(--accent);
  padding-left: 10px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.calendar-toolbar {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(180px, 240px) repeat(3, max-content);
  gap: 10px;
  align-items: end;
  border-bottom: 1px solid var(--line);
}

.time-ruler {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 10px 16px 0;
  color: var(--muted);
  font-size: 11px;
}

.time-ruler span {
  min-width: 0;
}

.calendar-list {
  display: grid;
  gap: 0;
}

.calendar-provider {
  padding: 14px 16px 16px;
  border-bottom: 1px solid #ededE7;
  min-width: 0;
}

.calendar-provider:last-child {
  border-bottom: 0;
}

.calendar-provider-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  min-width: 0;
}

.timeline {
  position: relative;
  height: 42px;
  border: 1px solid #e3e7df;
  border-radius: 6px;
  background:
    repeating-linear-gradient(
      90deg,
      #fbfbf8 0,
      #fbfbf8 calc(10% - 1px),
      #ecefe8 calc(10% - 1px),
      #ecefe8 10%
    );
  overflow: hidden;
}

.timeline-empty {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.booking-block {
  position: absolute;
  top: 5px;
  bottom: 5px;
  min-width: 34px;
  border-radius: 5px;
  background: var(--accent);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 0 8px;
  overflow: hidden;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.2);
}

.booking-block strong,
.booking-block span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}

.booking-block strong {
  font-size: 11px;
}

.booking-block span {
  font-size: 10px;
  opacity: 0.9;
}

.calendar-bookings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.calendar-booking {
  border-left: 2px solid var(--accent);
  padding-left: 9px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.calendar-booking strong,
.calendar-booking span {
  display: block;
  overflow-wrap: anywhere;
}

.calendar-booking.muted {
  border-color: var(--line);
}

.steps {
  padding: 14px;
}

.step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #ededE7;
}

.step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.formula {
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #115e59;
  background: #edf7f5;
  padding: 8px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
}

@media (max-width: 980px) {
  .topbar,
  .columns,
  .columns.wide-left {
    grid-template-columns: 1fr;
    display: grid;
  }

  .top-actions {
    justify-content: start;
  }

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

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

  .time-ruler {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 4px;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 16px;
  }

  .shell {
    padding: 14px 12px 28px;
  }

  .calendar-provider {
    padding: 12px;
  }

  .booking-block {
    padding: 0 5px;
  }
}
