/* Мотивация — visual system for configurable accrual algorithms. */

#motivationScreen {
  --mot-line: rgba(255, 255, 255, 0.09);
  --mot-line-strong: rgba(255, 255, 255, 0.15);
  --mot-panel: rgba(255, 255, 255, 0.04);
  --mot-panel-deep: rgba(6, 9, 8, 0.48);
  --mot-muted: var(--text-muted, #9da69e);
  --mot-ink: var(--text-strong, #f7faf6);
  --mot-lime: var(--ios-lime, #b8ff3d);
  padding-bottom: 3rem;
}

#motivationScreen .motivation-hero {
  align-items: end;
  margin-bottom: 1rem;
  padding: clamp(1rem, 2vw, 1.45rem);
  border: 1px solid var(--mot-line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 82% -20%, rgba(184, 255, 61, 0.11), transparent 34%),
    linear-gradient(150deg, rgba(255, 255, 255, 0.055), transparent 46%),
    rgba(8, 11, 10, 0.58);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  -webkit-backdrop-filter: blur(26px) saturate(135%);
  backdrop-filter: blur(26px) saturate(135%);
}

#motivationScreen .motivation-eyebrow,
#motivationScreen .motivation-section__step {
  color: var(--mot-lime);
  font-size: 0.66rem;
  letter-spacing: 0.13em;
}

#motivationScreen .motivation-hero .page-title {
  font-size: clamp(1.8rem, 1.45rem + 1.1vw, 2.65rem);
}

#motivationScreen .motivation-hero__lead {
  max-width: 44rem;
  font-size: 0.86rem;
}

#motivationScreen .motivation-toolbar {
  display: grid;
  grid-template-columns: minmax(11rem, 1fr) auto auto;
  gap: 0.45rem;
  padding: 0.45rem;
  border: 1px solid var(--mot-line);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.2);
}

#motivationScreen .motivation-month-field {
  min-width: 0;
}

#motivationScreen .motivation-month-field span {
  margin-left: 0.2rem;
}

#motivationScreen .motivation-month-field input {
  width: 100%;
  min-width: 0;
}

#motivationScreen .motivation-explainer {
  grid-template-columns: minmax(15rem, 0.75fr) minmax(0, 2fr);
  gap: 0.85rem;
  padding: 0.9rem;
  border-color: rgba(184, 255, 61, 0.14);
  border-radius: 21px;
  background:
    linear-gradient(135deg, rgba(184, 255, 61, 0.055), transparent 44%),
    rgba(255, 255, 255, 0.028);
}

#motivationScreen .motivation-explainer__intro {
  padding: 0.45rem;
}

#motivationScreen .motivation-flow {
  gap: 0.45rem;
}

#motivationScreen .motivation-flow li {
  position: relative;
  min-height: 5.5rem;
  padding: 0.75rem;
  border-color: rgba(255, 255, 255, 0.075);
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.16);
}

#motivationScreen .motivation-flow strong {
  color: var(--mot-ink);
}

#motivationScreen .motivation-section,
#motivationScreen .motivation-rules-card,
#motivationScreen .motivation-faq {
  border: 1px solid var(--mot-line);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.05), transparent 44%),
    rgba(9, 13, 11, 0.58);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#motivationScreen .motivation-section:hover,
#motivationScreen .motivation-rules-card:hover,
#motivationScreen .motivation-faq:hover {
  border-color: var(--mot-line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.05), transparent 44%),
    rgba(9, 13, 11, 0.58);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#motivationScreen .motivation-section__head {
  align-items: center;
}

#motivationScreen .motivation-total-card {
  position: relative;
  min-height: 7rem;
  overflow: hidden;
  border-color: rgba(184, 255, 61, 0.22);
  border-radius: 18px;
  background:
    radial-gradient(circle at 88% 10%, rgba(184, 255, 61, 0.13), transparent 36%),
    rgba(184, 255, 61, 0.045);
}

#motivationScreen .motivation-total-card strong {
  margin-top: auto;
  color: var(--mot-lime);
  font-size: clamp(1.7rem, 1.3rem + 1vw, 2.35rem);
}

#motivationScreen .motivation-plan-progress {
  border-color: var(--mot-line);
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.16);
}

#motivationScreen .motivation-plan-progress__track {
  height: 0.48rem;
  background: rgba(255, 255, 255, 0.075);
}

#motivationScreen .motivation-plan-progress__track span {
  background: linear-gradient(90deg, #8ed626, var(--mot-lime));
  box-shadow: 0 0 16px rgba(184, 255, 61, 0.18);
}

#motivationScreen .motivation-kpi-grid {
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--mot-line);
  border-radius: 17px;
  background: var(--mot-line);
}

#motivationScreen .motivation-kpi {
  min-height: 5.8rem;
  border: 0;
  border-radius: 0;
  background: rgba(10, 14, 12, 0.9);
}

#motivationScreen .motivation-kpi strong {
  color: var(--mot-ink);
  font-size: 1.05rem;
}

#motivationScreen .motivation-employee-card {
  border-color: var(--mot-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.032);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

#motivationScreen .motivation-employee-card:hover {
  border-color: var(--mot-line-strong);
  background: rgba(255, 255, 255, 0.045);
}

#motivationScreen .motivation-accrual {
  border-color: var(--mot-line);
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.15);
}

#motivationScreen .motivation-accrual__formula {
  margin: 0.5rem 0 0;
  padding: 0.55rem 0.65rem;
  border-left: 2px solid rgba(184, 255, 61, 0.34);
  border-radius: 0 9px 9px 0;
  color: var(--mot-muted);
  background: rgba(184, 255, 61, 0.045);
  font-size: 0.7rem;
  line-height: 1.45;
}

#motivationScreen .motivation-setup-callout,
#motivationScreen .motivation-effective-note {
  border-radius: 15px;
}

#motivationScreen .motivation-setup-callout--paused {
  border-color: rgba(255, 173, 83, 0.23);
  background: rgba(255, 173, 83, 0.06);
}

/* Rule builder */

#motivationScreen .motivation-rules-card {
  padding: 1rem;
}

#motivationScreen .motivation-rule-activation {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

#motivationScreen .motivation-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--mot-line);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.16);
  cursor: pointer;
}

#motivationScreen .motivation-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

#motivationScreen .motivation-switch > span {
  position: relative;
  width: 2.25rem;
  height: 1.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

#motivationScreen .motivation-switch > span::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.3rem - 4px);
  height: calc(1.3rem - 4px);
  border-radius: 50%;
  background: #f1f4ef;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  content: "";
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

#motivationScreen .motivation-switch input:checked + span {
  background: var(--mot-lime);
}

#motivationScreen .motivation-switch input:checked + span::after {
  transform: translateX(0.95rem);
}

#motivationScreen .motivation-switch input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(184, 255, 61, 0.22);
}

#motivationScreen .motivation-switch b {
  color: var(--mot-ink);
  font-size: 0.72rem;
  font-weight: 650;
}

#motivationScreen .motivation-rule-layout {
  grid-template-columns: minmax(0, 1.72fr) minmax(18rem, 0.72fr);
  gap: 0.85rem;
}

#motivationScreen .motivation-algorithms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

#motivationScreen .motivation-algorithm-card {
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--mot-line);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#motivationScreen .motivation-algorithm-card--base {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.75fr);
  align-items: center;
  gap: 1rem;
}

#motivationScreen .motivation-algorithm-card[data-mot-algorithm="plan"] {
  grid-column: 1 / -1;
}

#motivationScreen .motivation-algorithm-card__head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

#motivationScreen .motivation-algorithm-card--base .motivation-algorithm-card__head {
  margin-bottom: 0;
}

#motivationScreen .motivation-algorithm-card__num {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border: 1px solid rgba(184, 255, 61, 0.22);
  border-radius: 9px;
  color: var(--mot-lime);
  background: rgba(184, 255, 61, 0.08);
  font-size: 0.68rem;
  font-weight: 800;
}

#motivationScreen .motivation-algorithm-card__head h4 {
  margin: 0;
  color: var(--mot-ink);
  font-size: 0.92rem;
  letter-spacing: -0.01em;
}

#motivationScreen .motivation-algorithm-card__head p {
  margin: 0.2rem 0 0;
  color: var(--mot-muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

#motivationScreen .motivation-algorithm-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.65rem;
}

#motivationScreen .motivation-field {
  gap: 0.3rem;
}

#motivationScreen .motivation-field__label {
  color: var(--mot-muted);
  font-size: 0.68rem;
  letter-spacing: 0.025em;
}

#motivationScreen .motivation-field .input {
  min-height: 44px;
  border-color: rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(4, 7, 6, 0.42);
}

#motivationScreen .motivation-field small {
  min-height: 2.6em;
  color: var(--mot-muted);
  font-size: 0.65rem;
}

#motivationScreen .motivation-field--compact small {
  min-height: auto;
}

#motivationScreen .motivation-subhead--rules {
  margin-top: 0.8rem;
  border-top-color: rgba(255, 255, 255, 0.07);
}

#motivationScreen .motivation-tier-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 2.5rem;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
  padding: 0.6rem;
  border-color: rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

#motivationScreen .motivation-tier-remove {
  border-radius: 11px;
}

#motivationScreen .motivation-preview {
  top: 0.75rem;
  padding: 0.9rem;
  border-color: rgba(184, 255, 61, 0.19);
  border-radius: 18px;
  background:
    radial-gradient(circle at 90% 0%, rgba(184, 255, 61, 0.11), transparent 30%),
    rgba(8, 12, 10, 0.86);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#motivationScreen .motivation-preview__formula {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.35rem 0.65rem;
  margin-top: 0.7rem;
  padding: 0.7rem;
  border: 1px solid var(--mot-line);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.16);
}

#motivationScreen .motivation-preview__formula span {
  color: var(--mot-muted);
  font-size: 0.65rem;
}

#motivationScreen .motivation-preview__formula strong {
  min-width: 0;
  color: var(--mot-ink);
  font-size: 0.66rem;
  text-align: right;
}

#motivationScreen .motivation-preview__example {
  border-bottom-color: rgba(255, 255, 255, 0.075);
}

#motivationScreen .motivation-preview__example > b {
  color: var(--mot-lime);
}

#motivationScreen .motivation-rule-actions {
  position: sticky;
  z-index: 2;
  bottom: 0;
  margin: 0.85rem -1rem -1rem;
  padding: 0.8rem 1rem calc(0.8rem + env(safe-area-inset-bottom, 0px));
  border-top-color: rgba(255, 255, 255, 0.075);
  border-radius: 0 0 22px 22px;
  background: rgba(8, 11, 10, 0.88);
  box-shadow: 0 -14px 30px rgba(0, 0, 0, 0.16);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  backdrop-filter: blur(22px) saturate(130%);
}

#motivationScreen .motivation-rule-actions #btnSaveMotivationRules {
  min-width: 12rem;
}

@media (max-width: 1180px) {
  #motivationScreen .motivation-rule-layout {
    grid-template-columns: 1fr;
  }

  #motivationScreen .motivation-preview {
    position: static;
    display: grid;
    grid-template-columns: 0.7fr 1fr 1fr;
    gap: 0.75rem;
  }

  #motivationScreen .motivation-preview > .motivation-section__step,
  #motivationScreen .motivation-preview > h4,
  #motivationScreen .motivation-preview > .motivation-preview__disclaimer {
    grid-column: 1 / -1;
  }

  #motivationScreen .motivation-preview__formula {
    margin-top: 0;
  }

  #motivationScreen .motivation-preview__example {
    padding: 0.6rem;
    border: 1px solid var(--mot-line);
    border-radius: 13px;
  }
}

@media (max-width: 860px) {
  #motivationScreen .motivation-hero {
    align-items: stretch;
    flex-direction: column;
  }

  #motivationScreen .motivation-toolbar {
    width: 100%;
  }

  #motivationScreen .motivation-explainer {
    grid-template-columns: 1fr;
  }

  #motivationScreen .motivation-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #motivationScreen .motivation-rule-activation {
    align-items: flex-end;
    flex-direction: column;
  }

  #motivationScreen .motivation-algorithms {
    grid-template-columns: 1fr;
  }

  #motivationScreen .motivation-algorithm-card,
  #motivationScreen .motivation-algorithm-card--base,
  #motivationScreen .motivation-algorithm-card[data-mot-algorithm="plan"] {
    grid-column: 1;
  }

  #motivationScreen .motivation-algorithm-card--base {
    grid-template-columns: 1fr;
  }

  #motivationScreen .motivation-preview {
    grid-template-columns: 1fr;
  }

  #motivationScreen .motivation-preview > * {
    grid-column: 1 !important;
  }
}

@media (max-width: 560px) {
  #motivationScreen .motivation-hero {
    padding: 0.85rem;
    border-radius: 19px;
  }

  #motivationScreen .motivation-toolbar,
  #motivationScreen .motivation-algorithm-fields,
  #motivationScreen .motivation-kpi-grid {
    grid-template-columns: 1fr;
  }

  #motivationScreen .motivation-section__head,
  #motivationScreen .motivation-rule-activation {
    align-items: stretch;
  }

  #motivationScreen .motivation-switch {
    justify-content: space-between;
  }

  #motivationScreen .motivation-tier-row {
    grid-template-columns: 1fr 2.5rem;
  }

  #motivationScreen .motivation-tier-row .motivation-field:first-child {
    grid-column: 1 / -1;
  }

  #motivationScreen .motivation-rule-actions {
    align-items: stretch;
    flex-direction: column;
  }

  #motivationScreen .motivation-rule-actions #btnSaveMotivationRules {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  #motivationScreen .motivation-switch > span::after {
    transition: none;
  }
}
