@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --text: #1c1c22;
  --muted: #7a7873;
  --line: #e7e4dd;
  --line-strong: #d9d5cb;

  --plum: #7f2e52;
  --rose: #e94f7e;
  --pink: #ffd7e4;
  --coral: #ff8d6d;
  --amber: #ffb65c;

  --success: #1d8a5f;
  --warning: #925f00;
  --error: #d64545;

  --shadow: 0 20px 40px -24px rgba(28, 28, 34, 0.18);
  --radius: 20px;

  --panel-border: #ffd8e5;
  --plum-soft: #fdeef2;
  --plum-border: #f4c8d9;
  --service-info-panel-bg: #fff8fb;
  --panel-right-bottom: #fff7fb;
  --track-bg: #ece9e2;
  --hover-pink: #ffd4e5;
  --btn-secondary-hover: #fff6fa;
  --input-disabled-bg: #fbf2f7;
  --header-bg: rgba(255, 255, 255, 0.92);

  --success-soft: #e8f7ef;
  --success-strong: #14805c;
  --success-border: rgba(29, 138, 95, 0.4);
  --success-node-bg: #f3fcf8;

  --warning-soft: #fff7ea;
  --warning-border: rgba(255, 182, 92, 0.75);
  --loading-border: rgba(255, 182, 92, 0.8);

  --error-soft: #fff1f1;
  --error-border: rgba(214, 69, 69, 0.5);

  --result-soft: #fff2e2;
  --result-text: #8a5a10;
  --today-text: #951b4a;

  --result-pulse-strong: rgba(251, 176, 88, 0.35);
  --result-pulse-medium: rgba(251, 176, 88, 0.25);
  --result-pulse-soft: rgba(251, 176, 88, 0.18);

  --focus-ring: rgba(233, 79, 126, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.page {
  padding: 16px 16px 40px;
}

.container {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
  align-items: start;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 0 4px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--panel-border);
  box-shadow: 0 14px 30px -22px rgba(28, 28, 34, 0.22);
}

.service-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.service-header-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.page-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.service-info-btn {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--plum-soft);
  border: 1px solid var(--plum-border);
  color: var(--plum);
}

.service-info-btn:hover,
.service-info-btn:focus-visible {
  background: var(--pink);
}

.service-info-btn svg {
  width: 16px;
  height: 16px;
}

.service-info-panel {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--service-info-panel-bg);
  border: 1px solid var(--panel-border);
}

.service-info-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--plum);
}

.service-info-note {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.service-info-panel ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.today-line {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--plum);
  font-weight: 700;
  font-size: 12.5px;
  box-shadow: none;
  white-space: nowrap;
}

.card {
  background: var(--card);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card-title {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--muted);
}

.panel {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--rose), var(--coral));
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 5fr);
}

.panel-col {
  padding: 22px;
  min-width: 0;
}

.panel-left {
  border-right: 1px solid var(--panel-border);
  display: grid;
  align-content: start;
}

.panel-right {
  display: grid;
  align-content: start;
  gap: 14px;
  background: linear-gradient(180deg, var(--card), var(--panel-right-bottom));
}

.input-group {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.input-group > label {
  font-weight: 800;
}

.date-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

input[type="date"] {
  width: 100%;
  min-height: 44px;
  border-radius: 8px;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  color: var(--text);
  padding: 0 12px;
}

input[type="date"]:focus {
  outline: none;
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(233, 79, 126, 0.12);
}

input[type="date"]:disabled {
  background: var(--input-disabled-bg);
  color: var(--muted);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.75;
}

.weekday-badge {
  min-width: auto;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--plum-soft);
  color: var(--plum);
  font-weight: 700;
  font-size: 12px;
  text-align: center;
}

.weekday-badge:empty {
  display: none;
}

.error-text {
  color: var(--error);
  font-size: 13px;
  font-weight: 800;
}

.helper-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.checkbox-control {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.checkbox-control input {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  accent-color: var(--muted);
}

.checkbox-control span {
  line-height: 1.4;
}

.warning-text {
  padding: 0;
  margin: 6px 0 0 22px;
  border-radius: 0;
  background: none;
  border: none;
  color: var(--warning);
  font-size: 11px;
  line-height: 1.45;
  opacity: 0.85;
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 14px;
}

.btn-primary,
.btn-secondary {
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  min-height: 48px;
  padding: 13px 18px;
  border: 1.5px solid transparent;
  transition:
    transform 0.18s ease,
    opacity 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.btn-primary {
  background: linear-gradient(
    90deg,
    var(--plum),
    var(--rose) 45%,
    var(--coral) 75%,
    var(--amber)
  );
  background-origin: border-box;
  background-repeat: no-repeat;
  color: var(--card);
  border-color: var(--plum);
  box-shadow: 0 10px 20px -10px rgba(127, 46, 82, 0.45);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px -8px rgba(127, 46, 82, 0.5);
}

.btn-primary:disabled {
  opacity: 0.65;
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--btn-secondary-hover);
}

.mode-info {
  min-height: 20px;
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 12.5px;
  margin-bottom: 14px;
}

.request-card {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
}

.request-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
}

.request-badge[data-state="success"] {
  background: var(--success-soft);
  color: var(--success-strong);
}

.request-badge[data-state="warning"] {
  background: var(--warning-soft);
  color: var(--warning);
}

.request-badge[data-state="error"] {
  background: var(--error-soft);
  color: var(--error);
}

.request-field {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
}

.request-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.request-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.request-value {
  font-size: 14.5px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.request-hint {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
  margin-bottom: 14px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  color: var(--text);
}

.icon-btn:hover:not(:disabled) {
  background: var(--hover-pink);
}

.icon-btn:disabled {
  opacity: 0.45;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn.copied {
  background: var(--success-soft);
  color: var(--success-strong);
}

.copy-request-btn {
  width: 100%;
  border-radius: 8px;
  background: var(--text);
  color: var(--card);
  font-weight: 700;
  padding: 12px 18px;
}

.copy-request-btn:hover:not(:disabled) {
  opacity: 0.92;
}

.copy-request-btn:disabled {
  opacity: 0.5;
}

.copy-request-btn.copied {
  background: var(--success);
}

.calendar-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.calendar-header h3,
.calendar-title {
  margin: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
}

.calendar-nav {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
}

.calendar-nav:hover:not(:disabled) {
  background: var(--hover-pink);
}

.calendar {
  width: 100%;
  border-collapse: separate;
  border-spacing: 6px;
  table-layout: fixed;
}

.calendar th {
  padding: 8px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.calendar td {
  position: relative;
  height: 42px;
  text-align: center;
  vertical-align: middle;
  font-weight: 600;
  border-radius: 10px;
  background: var(--card);
}

.calendar td.weekend {
  background: var(--bg);
  color: var(--muted);
}

.calendar td.today {
  border: 1.5px solid var(--rose);
  background: var(--plum-soft);
  color: var(--today-text);
  font-weight: 800;
}

.calendar td.result-date {
  position: relative;
  z-index: 2;
  background: var(--result-soft);
  color: var(--result-text);
  border: 1.5px solid var(--amber);
  font-weight: 800;
  animation: resultPulse 2s ease-out;
}

@keyframes resultPulse {
  0% {
    transform: scale(1.15);
    box-shadow: 0 0 0 8px var(--result-pulse-strong);
  }

  25% {
    transform: scale(1.12);
    box-shadow: 0 0 0 5px var(--result-pulse-medium);
  }

  75% {
    transform: scale(1.05);
    box-shadow: 0 0 0 3px var(--result-pulse-soft);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(251, 176, 88, 0);
  }
}

.calendar td.visit-date::after {
  content: "";
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--plum);
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 0;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.today {
  background: var(--rose);
}

.legend-dot.weekend {
  background: var(--muted);
  opacity: 0.4;
}

.legend-dot.result {
  background: var(--amber);
}

.legend-dot.visit {
  background: var(--plum);
}

.how-to {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 16px;
}

.how-to h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.how-to ol {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.tooltip-btn {
  position: relative;
}

.tooltip-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--card);
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.tooltip-btn:hover::after,
.tooltip-btn:focus-visible::after {
  opacity: 1;
  transition-delay: 1s;
}

.icon-spin {
  animation: iconSpin 0.9s linear infinite;
  transform-origin: center;
}

@keyframes iconSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    transform: scale(0.96);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

@media (max-width: 900px) {
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .panel-left {
    border-right: 0;
    border-bottom: 1px solid var(--panel-border);
  }
}

@media (max-width: 560px) {
  .page {
    padding: 12px 12px 28px;
  }

  .page-header {
    padding: 10px 12px;
    border-radius: 16px;
  }

  .service-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .page-header h1 {
    font-size: 20px;
  }

  .card {
    padding: 18px;
    border-radius: 22px;
  }

  .panel-col {
    padding: 16px;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .calendar td {
    height: 40px;
  }

  .request-value {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* =============================== */
/* Степпер                         */
/* =============================== */
.steps-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.steps-header .card-title {
  margin: 0;
}

.btn-small {
  min-height: 34px;
  padding: 6px 14px;
  font-size: 13px;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.step {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  padding-bottom: 14px;
}

.step:last-child {
  padding-bottom: 0;
}

.step:last-child .step-line {
  display: none;
}

.step-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.step-number {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  transition: all 0.2s ease;
}

.step-number svg {
  width: 16px;
  height: 16px;
}

.step-line {
  width: 2px;
  flex: 1;
  min-height: 14px;
  border-radius: 999px;
  background: var(--line);
  transition: background 0.2s ease;
}

.step-card {
  padding: 16px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--card);
  opacity: 0.55;
  transition:
    opacity 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    padding 0.2s ease;
}

.step-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  margin: 0 0 4px;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.step-head:disabled {
  cursor: not-allowed;
}

.step.is-active .step-head {
  cursor: default;
}

.step.is-collapsed .step-head {
  margin-bottom: 0;
}

.step.is-collapsed .step-card {
  padding: 12px 16px;
}

.step-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.step-head-right {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.step-summary {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-summary.is-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.step-summary:empty {
  display: none;
}

.step:not(.is-done) .step-summary {
  display: none;
}

.step-chevron {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.step-chevron svg {
  width: 14px;
  height: 14px;
}

.step.is-collapsed .step-chevron {
  transform: rotate(-90deg);
}

.step:not(.is-done) .step-chevron {
  visibility: hidden;
}

.step-body {
  display: grid;
}

.step.is-collapsed .step-body {
  display: none;
}

.step-desc {
  margin: 0 0 12px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--muted);
}

.step-content {
  opacity: 0.65;
}

.step.is-done .step-content {
  opacity: 0.9;
}

.step.is-active .step-card {
  opacity: 1;
  border-color: rgba(233, 79, 126, 0.55);
  box-shadow: 0 14px 28px -20px rgba(127, 46, 82, 0.35);
}

.step.is-active .step-title {
  color: var(--text);
  font-weight: 800;
}

.step.is-active .step-desc {
  color: var(--text);
  font-weight: 700;
}

.step.is-active .step-content {
  opacity: 1;
}

.step.is-active .step-number {
  background: linear-gradient(135deg, var(--rose), var(--coral));
  border-color: transparent;
  color: var(--card);
  box-shadow: 0 8px 16px -8px rgba(233, 79, 126, 0.6);
}

.step.is-done .step-card {
  opacity: 0.78;
}

.step.is-done .step-title {
  color: var(--text);
}

.step.is-done .step-number {
  background: var(--success-soft);
  border-color: var(--success-border);
  color: var(--success);
}

.step.is-done .step-line {
  background: rgba(29, 138, 95, 0.35);
}

.step:not(.is-active) .step-content {
  pointer-events: none;
}

.step.is-locked .step-content {
  pointer-events: none;
}

.field-label {
  font-weight: 800;
  margin: 0 0 8px;
  display: block;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-icon:empty {
  display: none;
}

.btn-icon {
  display: grid;
  place-items: center;
}

.request-badge.is-success {
  background: var(--success-soft);
  color: var(--success-strong);
}

.request-badge.is-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.request-badge.is-error {
  background: var(--error-soft);
  color: var(--error);
}

.step-helper {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* AUTH PAGE */
.auth-container {
  max-width: 480px;
}

.auth-panel {
  padding: 22px;
}

.auth-panel .card-title {
  margin-bottom: 18px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form .input-group {
  margin-bottom: 0;
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
  width: 100%;
  min-height: 44px;
  border-radius: 8px;
  border: 1.5px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}

.auth-form input[type="text"]:focus,
.auth-form input[type="password"]:focus {
  outline: none;
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(233, 79, 126, 0.12);
}

.auth-form .error-text {
  margin-top: 6px;
}

.auth-form .helper-text {
  margin: 0;
}

.auth-message {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.auth-message.is-error {
  border-color: rgba(214, 69, 69, 0.35);
  background: #fff1f1;
  color: var(--error);
}

.auth-message.is-info {
  border-color: #f4c8d9;
  background: #fff8fb;
  color: var(--plum);
}

.auth-actions {
  display: grid;
  margin-top: 4px;
}

.auth-actions .btn-primary {
  width: 100%;
}

@media (max-width: 560px) {
  .auth-panel {
    padding: 18px;
  }
}

/* Кнопка выхода в шапке */
#logoutBtn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 14px;
  font-size: 13px;
}