:root {
  /* Palette (Figma) */
  --c-white:        #FFFFFF;
  --c-black:        #000000;
  --c-neutral-50:   #FAFAFA;
  --c-neutral-200:  #E5E5E5;
  --c-neutral-500:  #737373;
  --c-neutral-900:  #171717;
  --c-neutral-950:  #0A0A0A;
  --c-slate-100:    #F1F5F9;
  --c-slate-300:    #CCD8E8;
  --c-sky-100:      #E0F2FE;
  --c-sky-300-50:   rgba(125, 211, 252, 0.5);
  --c-sky-500:      #0EA5E9;
  --c-sky-950:      #082F49;
  --c-blue-600:     #2673DD;

  /* Semantic tokens */
  --bg:            var(--c-neutral-50);
  --card:          var(--c-white);
  --border:        var(--c-neutral-200);
  --border-strong: var(--c-slate-300);
  --text:          var(--c-neutral-950);
  --heading:       var(--c-neutral-900);
  --muted:         var(--c-neutral-500);
  --placeholder:   var(--c-neutral-500);
  --field-bg:      var(--c-slate-100);
  --primary:       var(--c-sky-500);
  --primary-hover: var(--c-sky-950);
  --primary-soft:  var(--c-sky-100);
  --link:          var(--c-blue-600);
  --focus-ring:    var(--c-sky-300-50);

  --radius: 6px;
  --shadow: 0 1px 2px rgba(10, 10, 10, 0.04);

  /* Typography */
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", Times, serif;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
}

html, body { font-family: var(--font-sans); }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
}

.page__header {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.page__title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: var(--fw-semibold);
  margin: 0;
}

/* User pill — в стиле основной .card */
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  min-width: 320px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.user-pill__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-sky-100), var(--primary-soft)) center/cover no-repeat;
  color: var(--primary-hover);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3px;
  flex: 0 0 40px;
  overflow: hidden;
  outline: 1px solid var(--border);
}

.user-pill__meta { line-height: 1.25; min-width: 0; }
.user-pill__caption {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 1px;
}
.user-pill__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.user-pill__pos {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 28px;
}

.divider {
  background: var(--border);
  width: 1px;
}

.col { min-width: 0; }

/* Section title */
.section-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--heading);
}
.section-title.no-margin { margin: 0; }

/* Field */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
.select input {
  width: 100%;
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color .15s, background .15s;
}
input[type="date"],
input[type="time"] {
  cursor: pointer;
  min-height: 32px;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: opacity(.55);
  transition: filter .15s;
}
input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="time"]:hover::-webkit-calendar-picker-indicator {
  filter: opacity(1);
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
.select input:focus {
  border-color: var(--primary);
  background: var(--c-white);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

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

/* Select */
.select { position: relative; }
.select input { padding-right: 28px; cursor: pointer; }
.select__chev {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-75%) rotate(45deg);
  pointer-events: none;
}

.select.with-action input { padding-right: 60px; }
.select.with-action .select__chev { right: 38px; }

.icon-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }

.icon-btn--standalone {
  position: static;
  transform: none;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  background: var(--c-sky-100);
  border-color: var(--c-sky-100);
  color: var(--primary);
}
.icon-btn--standalone:hover {
  background: var(--c-sky-100);
  border-color: var(--primary);
  color: var(--primary-hover);
}

.link {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px dashed var(--link);
}
.link:hover { color: var(--primary-hover); border-color: var(--primary-hover); }

/* Rows */
.row { display: flex; gap: 12px; }
.row.two > * { flex: 1; min-width: 0; }
.row.tight { gap: 8px; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.center { align-items: center; }

/* Input with icon */
.input.with-icon {
  position: relative;
}
.input.with-icon input { padding-right: 30px; }
.input.with-icon .ico {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: inline-flex;
}

/* Hint */
.hint {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.hint.right { text-align: right; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.btn--ghost {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn--ghost:hover { border-color: var(--primary); color: var(--primary); }

.btn--primary {
  background: var(--primary);
  color: #fff;
  padding: 8px 14px;
  font-size: 13px;
}
.btn--primary:hover { background: var(--primary-hover); }

.actions { display: flex; gap: 8px; }

/* Dropzone */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 14px;
  background: #fafbfc;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.dropzone:hover,
.dropzone.is-drag {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.submit-row { margin-top: 14px; }

/* Success overlay */
.success {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: successFadeIn .25s ease-out both;
}
.success[hidden] { display: none; }

.success__card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(10, 10, 10, .25);
  padding: 32px 36px;
  text-align: center;
  max-width: 380px;
  width: calc(100% - 32px);
  animation: successPop .45s cubic-bezier(.2, .9, .35, 1.25) both;
}

.success__check {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
}
.success__circle {
  stroke: var(--primary);
  stroke-dasharray: 176;
  stroke-dashoffset: 176;
  animation: successDraw .55s cubic-bezier(.5, 0, .3, 1) .1s forwards;
}
.success__tick {
  stroke: var(--primary);
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: successDraw .35s cubic-bezier(.5, 0, .3, 1) .55s forwards;
}

/* Sparkles вокруг чека */
.success__sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  top: 50%;
  left: 50%;
  opacity: 0;
  animation: successSparkle .9s cubic-bezier(.2, .8, .3, 1) .55s forwards;
}
.success__sparkle.s1 { --tx:  50px; --ty: -30px; background: var(--c-sky-500);  width: 7px; height: 7px; }
.success__sparkle.s2 { --tx: -50px; --ty: -25px; background: var(--c-blue-600); }
.success__sparkle.s3 { --tx:  45px; --ty:  35px; background: var(--c-sky-500);  width: 5px; height: 5px; }
.success__sparkle.s4 { --tx: -55px; --ty:  30px; background: var(--c-blue-600); width: 8px; height: 8px; }
.success__sparkle.s5 { --tx:   0px; --ty: -55px; background: var(--c-sky-500);  width: 6px; height: 6px; }
.success__sparkle.s6 { --tx:   5px; --ty:  55px; background: var(--c-blue-600); width: 5px; height: 5px; }

.success__title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--heading);
}
.success__sub {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--muted);
}

@keyframes successFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes successPop {
  0%   { transform: translateY(8px) scale(.96); opacity: 0; }
  100% { transform: translateY(0) scale(1);     opacity: 1; }
}
@keyframes successDraw { to { stroke-dashoffset: 0; } }
@keyframes successSparkle {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  60%  { opacity: 1; transform: translate(calc(-50% + var(--tx) * .9), calc(-50% + var(--ty) * .9)) scale(1.1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(.6); }
}

/* Tom Select — тема под наш дизайн */
.ts-wrapper {
  font-family: var(--font-sans);
  font-size: 13px;
}
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 32px 6px 10px;
  min-height: 32px;
  box-shadow: none;
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.ts-wrapper.single .ts-control input,
.ts-wrapper.multi .ts-control input {
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.ts-wrapper.single .ts-control input::placeholder,
.ts-wrapper.multi .ts-control input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}
.ts-wrapper.focus .ts-control,
.ts-wrapper.single.input-active .ts-control {
  border-color: var(--primary);
  background: var(--c-white);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
/* Кастомная стрелка */
.ts-wrapper:not(.disabled) .ts-control::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-75%) rotate(45deg);
  pointer-events: none;
  transition: transform .15s, border-color .15s;
}
.ts-wrapper.dropdown-active .ts-control::after {
  transform: translateY(-25%) rotate(-135deg);
  border-color: var(--primary);
}
.ts-wrapper.single .ts-control .item {
  color: var(--text);
}

/* Dropdown */
.ts-dropdown {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(10, 10, 10, .12);
  margin-top: 4px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text);
  padding: 4px;
}
.ts-dropdown .option {
  border-radius: 4px;
  padding: 7px 10px;
  color: var(--text);
}
.ts-dropdown .option:hover,
.ts-dropdown .active {
  background: var(--c-slate-100);
  color: var(--text);
}
.ts-dropdown .option.selected,
.ts-dropdown .active.selected {
  background: var(--primary-soft);
  color: var(--primary-hover);
}
.ts-dropdown .create {
  padding: 7px 10px;
  border-radius: 4px;
  color: var(--primary);
  font-style: normal;
}
.ts-dropdown .create.active,
.ts-dropdown .create:hover {
  background: var(--primary-soft);
}
.ts-dropdown .no-results {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}
.ts-dropdown .optgroup-header {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 6px 10px;
  background: transparent;
}

/* Air Datepicker — кастомная тема под наш дизайн */
.air-datepicker {
  --adp-font-family: var(--font-sans);
  --adp-font-size: 13px;
  --adp-width: 260px;
  --adp-z-index: 1000;
  --adp-padding: 4px;
  --adp-border-radius: var(--radius);
  --adp-border-color: var(--border);
  --adp-border-color-inner: var(--border);
  --adp-background-color: var(--card);
  --adp-background-color-hover: var(--c-slate-100);
  --adp-background-color-active: var(--primary-soft);
  --adp-background-color-in-range: var(--primary-soft);
  --adp-background-color-in-range-focused: var(--primary-soft);
  --adp-background-color-selected-other-month-focused: var(--primary);
  --adp-background-color-selected-other-month: var(--primary);
  --adp-color: var(--text);
  --adp-color-secondary: var(--muted);
  --adp-color-current-date: var(--primary);
  --adp-color-other-month: var(--c-neutral-200);
  --adp-color-other-month-hover: var(--muted);
  --adp-color-disabled: var(--c-neutral-200);
  --adp-color-disabled-in-range: var(--muted);
  --adp-cell-background-color-selected: var(--primary);
  --adp-cell-background-color-selected-hover: var(--primary-hover);
  --adp-cell-border-radius: 4px;
  --adp-day-name-color: var(--muted);
  --adp-day-name-color-hover: var(--primary);
  --adp-nav-color-secondary: var(--muted);
  --adp-nav-action-size: 28px;
  --adp-nav-arrow-color: var(--muted);
  --adp-btn-height: 28px;
  --adp-btn-color: var(--primary);
  --adp-btn-color-hover: var(--primary-hover);
  --adp-btn-border-radius: 4px;
  --adp-btn-background-color-hover: var(--c-slate-100);
  --adp-btn-background-color-active: var(--primary-soft);
  --adp-time-track-color: var(--c-neutral-200);
  --adp-time-track-color-hover: var(--c-slate-300);
  --adp-time-thumb-color: var(--primary);
  --adp-time-padding-inner: 8px;
  --adp-accent-color: var(--primary);

  box-shadow: 0 8px 24px rgba(10, 10, 10, .12);
}

/* Responsive */
@media (max-width: 960px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .divider { display: none; }
}
