:root {
  --bg: #f2ebe1;
  --ink: #1c2622;
  --muted: #5e6a64;
  --paper: #fffaf3;
  --line: #d8ccb8;
  --pine: #2c5649;
  --pine-2: #1f3f35;
  --clay: #b85c3d;
  --danger: #8f3232;
  --ok: #2c5649;
  --shadow: 0 18px 50px rgba(40, 32, 20, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #fff8ee, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #e4ddd0, transparent 45%),
    var(--bg);
  font: 16px/1.5 "Segoe UI", "PT Sans", system-ui, sans-serif;
}

h1,
h2 {
  font-family: Georgia, "Palatino Linotype", Palatino, serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.4em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}

h2 {
  font-size: 1.35rem;
}

.page {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

.page.narrow {
  width: min(460px, calc(100% - 32px));
  padding-top: 12vh;
}

.page.app {
  width: min(560px, calc(100% - 20px));
  padding: 16px 0 108px;
}

.page.app h1 {
  font-size: 1.7rem;
}

.page.app .hero {
  gap: 14px;
  margin-bottom: 16px;
}

.page.app .hero-photo {
  width: 72px;
  height: 90px;
  border-radius: 16px;
}

.page.app .dates {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 6px;
}

.page.app .chip {
  flex: 0 0 auto;
  min-width: 68px;
}

.page.app .chip.on .d {
  color: rgba(255, 250, 243, 0.82);
}

.client-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
}

.client-nav .tab {
  border: 1px solid var(--line);
  background: #fff;
}

.list-title {
  margin: 18px 0 4px;
  font-size: 0.95rem;
}

.hero {
  display: flex;
  gap: 22px;
  align-items: center;
  margin-bottom: 28px;
}

.hero-copy {
  min-width: 0;
}

.hero-photo {
  width: 128px;
  height: 160px;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #efe6d8;
  flex-shrink: 0;
}

.photo-editor {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin: 16px 0;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--clay);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
}

.lead,
.hint {
  color: var(--muted);
  margin: 0;
}

.telegram-book {
  margin: 16px 0 0;
}

.lead {
  max-width: 42em;
  font-size: 1.05rem;
}

.steps {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  color: var(--muted);
}

.steps li {
  margin: 0.4em 0;
}

.steps code {
  display: inline-block;
  margin: 0.15em 0;
  word-break: break-all;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.dates,
.slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.slot {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
}

.chip .d {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: capitalize;
}

.chip .n {
  font-weight: 650;
}

.chip.on,
.slot.on,
.tab.on {
  background: var(--pine);
  border-color: var(--pine);
  color: #fff;
}

.chip.empty {
  opacity: 0.45;
}

.slot {
  min-width: 92px;
}

.slot:disabled {
  opacity: 0.4;
  cursor: default;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
  font-size: 0.92rem;
}

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

input,
textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.btn {
  display: inline-block;
  border: 0;
  background: var(--pine);
  color: #fff;
  border-radius: 999px;
  padding: 11px 18px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn:hover {
  background: var(--pine-2);
}

.btn.ghost {
  background: transparent;
  color: var(--pine);
  border: 1px solid var(--line);
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 650;
}

.badge.paid {
  background: #e4efe8;
  color: var(--pine);
}

.badge.wait {
  background: #f4e4d8;
  color: var(--clay);
}

.badge.fail {
  background: #f3e0e0;
  color: var(--danger);
}

.badge.skip {
  background: #eee8de;
  color: var(--muted);
}

.log-filters label {
  margin: 0;
  min-width: 180px;
  flex: 1;
}

.log-row {
  padding: 12px 0;
  border-bottom: 1px solid #efe6d8;
}

.log-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: space-between;
}

.log-text {
  margin: 8px 0 0;
  white-space: pre-wrap;
  font: inherit;
  color: var(--ink);
}

.pay-box {
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: #fff;
}

.pay-box p {
  margin: 0 0 8px;
}

.pay-qr {
  width: 180px;
  height: 180px;
  display: block;
  margin: 8px 0 12px;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  border: 1px solid var(--line);
}

.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.cal-wd {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 0 6px;
}

.cal-day {
  position: relative;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  min-height: 48px;
  padding: 8px 4px 10px;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
}

.cal-day:hover {
  border-color: var(--pine);
}

.cal-day.on {
  background: #e4efe8;
  border-color: var(--pine);
}

.cal-day.today .cal-n {
  color: var(--clay);
  font-weight: 700;
}

.cal-day.has .cal-dot {
  display: block;
}

.cal-day.blocked {
  background: #f4e4d8;
}

.cal-day.blocked .cal-dot {
  display: block;
  background: var(--muted);
}

.cal-day.empty {
  visibility: hidden;
  pointer-events: none;
}

.cal-n {
  display: block;
  text-align: center;
}

.cal-dot {
  display: none;
  width: 7px;
  height: 7px;
  margin: 6px auto 0;
  border-radius: 50%;
  background: var(--clay);
}

.cal-count {
  display: block;
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 2px;
}

.error {
  color: var(--danger);
  min-height: 1.2em;
}

.ok {
  color: var(--ok);
  min-height: 1.2em;
}

.hidden {
  display: none !important;
}

.admin-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 243, 0.86);
  position: sticky;
  top: 0;
  z-index: 5;
}

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.admin-main {
  width: min(1100px, calc(100% - 32px));
  margin: 24px auto 64px;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: 1.2fr 0.8fr;
}

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

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

.day-card {
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 12px;
}

.day-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 8px;
}

.day-card h3 {
  margin: 0;
  font-size: 1rem;
}

.day-head .hint {
  margin: 0;
  text-align: right;
}

.time-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.time-check {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 10px;
  background: #fff;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.time-check span {
  min-width: 3.2rem;
}

.time-check:has(input:checked) {
  background: var(--pine);
  border-color: var(--pine);
  color: #fff;
}

.time-check input {
  margin: 0;
  accent-color: var(--pine);
}

.nobreak-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 12px;
}

.nobreak-check {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 8px 12px;
  background: #fff;
  cursor: pointer;
}

.nobreak-check:has(input:checked) {
  border-style: solid;
  border-color: var(--clay);
  background: #f8efe8;
}

.nobreak-check input {
  margin-top: 3px;
  accent-color: var(--clay);
}

.inline-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
}

.week-copy {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.week-copy .time-check span {
  min-width: 0;
}

.window-row,
.list-row,
.journal-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #efe6d8;
}

.inline-form,
.row,
.day-add {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.inline-form input {
  margin: 0;
}

.list {
  margin-top: 8px;
}

.urls {
  padding-left: 18px;
}

.urls li {
  margin: 6px 0;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  width: min(420px, 92vw);
  background: var(--paper);
}

#bookDialog {
  width: min(480px, 94vw);
}

.client-pick {
  max-height: 168px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin: 0 0 8px;
}

.client-pick:empty {
  display: none;
}

.client-choice {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 8px 12px;
  cursor: pointer;
  color: inherit;
}

.client-choice:last-child {
  border-bottom: 0;
}

.client-choice:hover,
.client-choice.on {
  background: #efe6d8;
}

.client-choice .hint {
  font-size: 0.85rem;
}

#moveDialog {
  width: min(560px, 94vw);
}

dialog::backdrop {
  background: rgba(28, 38, 34, 0.35);
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0;
  margin: 16px 0 0;
}

code {
  background: #efe6d8;
  padding: 1px 6px;
  border-radius: 6px;
}

.people-call {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 8px;
}

.people-call-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid #efe6d8;
}

.people-call-via {
  min-width: 180px;
}

.call-body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #1c2622;
}

.call-page {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #fffaf3;
}

.call-bar,
.call-actions {
  flex: none;
}

.call-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
}

.call-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #111;
}

.remote-slot,
.local-slot {
  position: absolute;
}

.remote-slot {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
}

.local-slot {
  right: 16px;
  bottom: 16px;
  z-index: 2;
  width: 240px;
  height: 135px;
  overflow: hidden;
  border-radius: 12px;
  border: 2px solid #fffaf3;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  background: #000;
}

.remote-slot video,
.local-slot video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
}

.remote-slot video {
  object-fit: contain;
}

.local-slot video {
  object-fit: cover;
}

.resize-handle {
  position: absolute;
  z-index: 3;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 250, 243, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  cursor: nwse-resize;
  touch-action: none;
}

.resize-handle::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-right: 2px solid #1c2622;
  border-bottom: 2px solid #1c2622;
}

#remoteResize {
  left: 8px;
  bottom: 8px;
  cursor: nesw-resize;
}

#localResize {
  left: 6px;
  top: 6px;
}

#localResize::before {
  border: 0;
  border-left: 2px solid #1c2622;
  border-top: 2px solid #1c2622;
}

.call-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 16px;
}

.call-page .error {
  flex: none;
  margin: 0;
  padding: 0 20px;
}

.call-page .error:empty {
  display: none;
}

@media (max-width: 860px) {
  .admin-bar,
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
    flex-wrap: wrap;
  }

  .page {
    padding-top: 28px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
}
