:root {
  color-scheme: light dark;
  --bg: #f4f1ea;
  --bg-accent: #e9e3d6;
  --surface: #fffdf8;
  --surface-2: #f8f4ea;
  --text: #1f2933;
  --muted: #64707d;
  --line: #ddd5c7;
  --brand: #1f6f5c;
  --brand-strong: #155445;
  --brand-soft: #dcefe8;
  --shadow: 0 18px 40px rgba(31, 41, 51, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --max: 1040px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121816;
    --bg-accent: #18211e;
    --surface: #1b2521;
    --surface-2: #202c27;
    --text: #eef3ef;
    --muted: #a6b3ac;
    --line: #304039;
    --brand: #79d2b7;
    --brand-strong: #a4e7d2;
    --brand-soft: #223b33;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 12% -10%, var(--brand-soft), transparent 60%),
    radial-gradient(900px 420px at 100% 0%, var(--bg-accent), transparent 55%),
    var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

.shell {
  width: min(100% - 32px, var(--max));
  margin: 0 auto;
  padding: 22px 0 40px;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 20px;
  line-height: 1;
}

.version {
  color: var(--muted);
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.main {
  flex: 1;
}

.hero {
  max-width: 720px;
  padding: 26px 0 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 7vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

h2 {
  margin: 0 0 8px;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.lead {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: clamp(17px, 2.2vw, 20px);
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  font-weight: 650;
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease;
}

.button:hover {
  background: var(--brand-strong);
  transform: translateY(-1px);
}

.button.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.button.ghost:hover {
  background: var(--surface);
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 10px 0 28px;
}

.card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow);
}

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

.card code,
.notice code {
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.card-kicker {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--brand-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card.narrow {
  max-width: 560px;
  margin: 24px auto;
}

.notice {
  padding: 22px;
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--brand-soft) 55%, transparent);
}

.notice ol {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.notice li + li {
  margin-top: 6px;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 28px;
  color: var(--muted);
  font-size: 13px;
}

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

.dot {
  opacity: 0.55;
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 22px, var(--max));
    padding-top: 16px;
  }

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

  .hero {
    padding-top: 16px;
  }

  .card {
    padding: 17px;
  }
}

/* ---------- Навигация и формы ---------- */

.topbar {
  flex-wrap: wrap;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 14px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 2px;
}

.nav a:hover {
  color: var(--text);
}

.nav-user {
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.inline-form {
  display: inline;
  margin: 0;
}

.link-button {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.link-button:hover {
  color: var(--text);
}

.link-button.danger {
  color: #b42318;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0 22px;
}

.page-head h1 {
  margin-bottom: 6px;
}

.page-head .actions {
  margin-top: 0;
}

.form {
  display: grid;
  gap: 14px;
}

.form.compact {
  gap: 10px;
  margin-top: 14px;
}

.form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.form input,
.form select,
.form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-weight: 400;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.form input[type="color"] {
  padding: 3px;
  height: 42px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form .checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}

.form .checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

.button.small {
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
}

.alert {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #f0b4ae;
  border-radius: 12px;
  background: #fff1ef;
  color: #7a271a;
  font-size: 14px;
}

.alert.success {
  border-color: #a6d9c8;
  background: #eaf7f1;
  color: #14532d;
}

.alert input {
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #a6d9c8;
  border-radius: 8px;
  background: #fff;
  color: #14532d;
  font: inherit;
}

@media (prefers-color-scheme: dark) {
  .alert {
    border-color: #6b2a24;
    background: #3a1d19;
    color: #fecaca;
  }
  .alert.success {
    border-color: #245c46;
    background: #163128;
    color: #bbf7d0;
  }
  .alert input {
    border-color: #245c46;
    background: #0f1f19;
    color: #bbf7d0;
  }
}

.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.plain-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.plain-list li:last-child {
  border-bottom: 0;
}

.plain-list .muted {
  margin-left: auto;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.small {
  font-size: 13px;
}

.pre-wrap {
  white-space: pre-wrap;
}

.danger-zone {
  margin-top: 18px;
  text-align: right;
}

.calendar {
  margin: 4px 0 30px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 14px;
}

.calendar.fc {
  --fc-border-color: var(--line);
  --fc-page-bg-color: var(--surface);
  --fc-neutral-bg-color: var(--surface-2);
  --fc-today-bg-color: var(--brand-soft);
  --fc-button-bg-color: var(--brand);
  --fc-button-border-color: var(--brand);
  --fc-button-hover-bg-color: var(--brand-strong);
  --fc-button-hover-border-color: var(--brand-strong);
  --fc-button-active-bg-color: var(--brand-strong);
  --fc-button-active-border-color: var(--brand-strong);
  --fc-event-bg-color: var(--brand);
  --fc-event-border-color: var(--brand);
  --fc-event-text-color: #fff;
}

.calendar.fc .fc-toolbar-title {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.calendar.fc .fc-button {
  border-radius: 8px;
  font-size: 13px;
  padding: 6px 10px;
}

.calendar.fc .fc-toolbar.fc-header-toolbar {
  margin-bottom: 12px;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar.fc .fc-daygrid-day-number {
  color: var(--muted);
  text-decoration: none;
}

@media (max-width: 720px) {
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .nav-user {
    border-left: 0;
    padding-left: 0;
    width: 100%;
  }

  .calendar {
    padding: 6px;
  }

  .calendar.fc .fc-toolbar-title {
    font-size: 15px;
  }

  .calendar.fc .fc-button {
    padding: 5px 8px;
    font-size: 12px;
  }
}

/* ---------- Правки под iPhone / iPad ---------- */

.brand-mark svg {
  display: block;
}

.calendar-controls {
  display: none;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
}

.calendar-controls label {
  color: var(--muted);
  font-size: 13px;
}

.calendar-controls select {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  font: inherit;
  font-size: 16px;
}

.form input,
.form select,
.form textarea {
  font-size: 16px;
}

.card.narrow .form {
  margin-top: 20px;
}

.card.narrow .form + .muted {
  margin-top: 18px;
}

.calendar.fc .fc-toolbar-title {
  white-space: nowrap;
}

.calendar.fc .fc-daygrid-event {
  font-size: 12.5px;
  white-space: normal;
}

.calendar.fc .fc-event-title {
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
}

@media (max-width: 720px) {
  .topbar {
    padding-bottom: 10px;
    gap: 8px;
  }

  .brand {
    font-size: 17px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .nav {
    width: 100%;
    flex-wrap: nowrap;
    gap: 16px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    font-size: 13.5px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a {
    padding: 4px 0;
    white-space: nowrap;
  }

  .nav-user {
    display: none;
  }

  .nav .inline-form {
    margin-left: auto;
    white-space: nowrap;
  }

  .page-head {
    padding-top: 8px;
  }
}

@media (max-width: 640px) {
  .calendar-controls {
    display: flex;
  }

  .calendar.fc .fc-toolbar.fc-header-toolbar {
    gap: 6px;
  }

  .calendar.fc .fc-toolbar-title {
    font-size: 15px;
  }

  .calendar.fc .fc-button {
    padding: 5px 8px;
    font-size: 12px;
  }

  .calendar.fc .fc-daygrid-event {
    font-size: 12px;
  }
}

.calendar.fc .fc-event-title {
  display: block;
  width: 100%;
  max-width: 100%;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis;
}

/* В месячной сетке время скрыто: оно есть в списке и на карточке события. */
.calendar.fc .fc-daygrid-event .fc-event-time {
  display: none !important;
}

@media (max-width: 720px) {
  .nav a,
  .nav .link-button {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
}

.main:has(> .card.narrow) {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card.narrow {
  width: 100%;
}

.card.narrow h1 {
  font-size: clamp(30px, 6vw, 44px);
}

.form input[type="color"] {
  max-width: 140px;
}

.form-section {
  display: grid;
  gap: 10px;
  margin: 4px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.form-section legend {
  padding: 0 6px;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.form .radio {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}

.form .radio input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.inline-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
  color: var(--muted);
  font-size: 13px;
}

.inline-select select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 6px 8px;
  font: inherit;
  font-size: 14px;
}
