:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --line: #d8e1ec;
  --text: #1f2937;
  --muted: #64748b;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --danger: #b42318;
  --warn: #a15c07;
  --soft: #eef6f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

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

button {
  min-height: 36px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 7px 12px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: var(--primary-strong);
}

button:disabled {
  border-color: var(--line);
  background: #e5e7eb;
  color: var(--muted);
  cursor: not-allowed;
}

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

button.danger {
  border-color: var(--danger);
  background: #fff;
  color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 74px;
  resize: vertical;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 18px;
}

.main {
  padding: 18px;
}

.topbar,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

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

h1 {
  font-size: 20px;
}

h2 {
  font-size: 16px;
}

h3 {
  font-size: 14px;
}

.muted {
  color: var(--muted);
}

.row {
  display: flex;
  align-items: end;
  gap: 10px;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  padding: 14px;
}

.specialist-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.specialist-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.specialist-item.active {
  border-color: var(--primary);
  background: var(--soft);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tabs button {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.tabs button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.calendar-head,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(86px, 1fr));
  gap: 8px;
}

.calendar-head {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.day-cell {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  text-align: left;
  color: var(--text);
}

.day-cell.outside {
  opacity: 0.45;
}

.day-cell.has-time {
  border-color: var(--primary);
  background: var(--soft);
}

.day-number {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
}

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

.services {
  display: grid;
  gap: 8px;
}

.service-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 120px auto;
  gap: 8px;
  align-items: end;
}

.status {
  min-height: 24px;
  margin-top: 10px;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.status.warn {
  color: var(--warn);
}

.status.ok {
  color: var(--primary);
}

.booking-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}

.slot-grid button {
  background: #fff;
  color: var(--primary);
}

.slot-grid button.active {
  background: var(--primary);
  color: #fff;
}

.summary-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.summary-list div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.summary-list span {
  display: block;
  margin-top: 4px;
}

.sync-result {
  margin-top: 16px;
}

.resource-picker {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .calendar-head,
  .calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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