/* ==========================================================================
   Create deal page — cabinet shell + form
   ========================================================================== */

/* ---------- head ---------- */
.deal-head__title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.deal-head__sub {
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 560px;
}

@keyframes dealRise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}
.deal-form-card { animation: dealRise 0.6s var(--ease-out) both; }
.deal-aside { animation: dealRise 0.6s 0.1s var(--ease-out) both; }
.deal-form-card.is-shake { animation: dealShake 0.45s var(--ease); }
@keyframes dealShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}

/* ---------- layout ---------- */
.deal-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  margin-top: 0;
  align-items: start;
}
.deal-grid > * { min-width: 0; }
@media (min-width: 1100px) {
  .deal-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
}

/* ---------- form card ---------- */
.deal-form-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: clamp(20px, 3.5vw, 40px);
  display: grid;
  gap: clamp(24px, 3.5vw, 36px);
}
.deal-form-card__head { display: grid; gap: 6px; }
.deal-form-card__title {
  font-size: clamp(22px, 2.8vw, 28px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.deal-form-card__intro {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

/* reset native fieldset chrome */
.deal-section {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.deal-section__title {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--olive-deep);
  padding: 0;
}

/* fields */
.dfield { display: grid; gap: 8px; }
.dfield + .dfield { margin-top: 18px; }
.drow .dfield + .dfield { margin-top: 0; }
.dfield__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.dfield__label em {
  font-style: normal;
  color: var(--danger);
}
.dfield__counter {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.25s;
}
.dfield__counter.is-max { color: var(--danger); }

.dinput,
.dtextarea {
  width: 100%;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line);
  background: var(--white);
  font-size: 16px;
  font-weight: 500;
  transition: border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}
.dinput {
  height: 54px;
  padding: 0 18px;
}
.dtextarea {
  min-height: 130px;
  padding: 15px 18px;
  resize: none;
  overflow: hidden;
  line-height: 1.5;
}
.dinput::placeholder, .dtextarea::placeholder { color: #b4b4bb; font-weight: 400; }
.dinput:focus, .dtextarea:focus {
  outline: none;
  border-color: var(--olive);
  box-shadow: 0 0 0 4px rgba(130, 170, 60, 0.14);
}
.dinput.has-error, .dtextarea.has-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(229, 83, 60, 0.1);
}
.dfield__error {
  display: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--danger);
}
.dfield__error.is-visible { display: block; }
.dfield__hint { font-size: 12.5px; color: var(--muted); }
.dfield__caption {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

/* date + amount + currency row */
.drow {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 640px) {
  .drow { grid-template-columns: 1fr 1fr; }
}
.dinput--date { color: var(--ink); }
.dinput--date:invalid { color: var(--muted); }

.amount-field { position: relative; }
.amount-field__input { padding-right: 82px; font-family: var(--mono); }
.amount-field__coin {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  pointer-events: none;
}

.dselect-wrap { position: relative; }
.dselect {
  width: 100%;
  height: 54px;
  padding: 0 48px 0 18px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line);
  background: var(--white);
  font-size: 16px;
  font-weight: 500;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.25s;
}
.dselect:hover { border-color: var(--ink); }
.dselect-wrap .chevron {
  position: absolute;
  right: 16px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

/* file attach */
.file-drop {
  margin-top: 18px;
  border: 1.5px dashed rgba(12, 12, 13, 0.28);
  border-radius: var(--r-md);
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  transition: border-color 0.3s var(--ease-out), background-color 0.3s var(--ease-out);
  cursor: pointer;
}
.file-drop:hover, .file-drop.is-over {
  border-color: var(--ink);
  background: var(--surface);
}
.file-drop__icon {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--lime);
  color: var(--ink);
  display: grid;
  place-items: center;
}
.file-drop__icon svg { width: 22px; height: 22px; }
.file-drop__text { display: grid; gap: 2px; }
.file-drop__text b { font-size: 15px; font-weight: 600; }
.file-drop__text span { font-size: 13px; color: var(--muted); }

.file-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px 9px 14px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 500;
  animation: chipIn 0.3s var(--ease-out);
}
@keyframes chipIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
.file-chip__size {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}
.file-chip__remove {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: background-color 0.2s, color 0.2s;
}
.file-chip__remove:hover { background: rgba(229, 83, 60, 0.12); color: var(--danger); }
.file-chip__remove svg { width: 13px; height: 13px; }

/* ---------- summary card ---------- */
.deal-aside {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 86px;
}
@media (max-width: 1099px) {
  .deal-aside { position: static; }
}

.summary {
  background: var(--ink);
  color: var(--white);
  border-radius: var(--r-xl);
  padding: clamp(20px, 3vw, 30px);
  position: relative;
  overflow: hidden;
}
.summary::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -70px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 32px solid var(--lime);
  opacity: 0.12;
  pointer-events: none;
}
.summary__title {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lime);
}
.summary__rows { margin-top: 18px; display: grid; gap: 4px; position: relative; }
.summary__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-dark);
}
.summary__row span { font-size: 14px; color: rgba(255, 255, 255, 0.65); }
.summary__row b {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.summary__row--total { border-bottom: 0; padding-top: 14px; }
.summary__row--total span { color: rgba(255, 255, 255, 0.85); font-weight: 500; }
.summary__row--total b { color: var(--lime); font-size: 19px; }

.summary__payer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-dark);
}
.summary__payer > span { font-size: 14px; color: rgba(255, 255, 255, 0.65); }
.summary__payer select {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  background: var(--lime) no-repeat right 10px center / 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 8 5 5 5-5' fill='none' stroke='%230c0c0d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 8px 34px 8px 14px;
  cursor: pointer;
  appearance: none;
  transition: box-shadow 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}
.summary__payer select:hover,
.summary__payer select:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(210, 250, 50, 0.25);
}

.summary__agree { margin-top: 20px; position: relative; }
.summary__agree .checkbox__text { color: rgba(255, 255, 255, 0.65); font-size: 13px; }
.summary__agree .checkbox__text a { color: var(--white); border-bottom-color: var(--line-dark); }
.summary__agree .checkbox__box { background: transparent; border-color: var(--line-dark); }
.summary__agree .checkbox input:checked + .checkbox__box { background: var(--lime); border-color: var(--lime); }

.summary__note {
  position: relative;
  margin-top: 16px;
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.45);
}
.summary__actions { position: relative; display: grid; gap: 10px; margin-top: 20px; }
.summary__actions .btn--wide { width: 100%; }
.summary__cancel {
  text-align: center;
  font-size: 14.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  padding: 10px;
  transition: color 0.25s;
}
.summary__cancel:hover { color: var(--white); }

/* tips card */
.tips {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: clamp(20px, 3vw, 30px);
}
.tips__title { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.tips__lead {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.tips__list { margin-top: 16px; display: grid; gap: 10px; }
.tips__list li {
  position: relative;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.tips__list li::before {
  content: "–";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--olive-deep);
}
.tips__note {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(210, 250, 50, 0.35);
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* success */
.deal-success {
  display: none;
  background: var(--white);
  border-radius: var(--r-xl);
  padding: clamp(32px, 6vw, 72px);
  text-align: center;
}
.deal-success.is-visible { display: block; animation: dealRise 0.6s var(--ease-out); }
.deal-success__icon {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--lime);
  display: grid;
  place-items: center;
  color: var(--ink);
}
.deal-success__icon svg { width: 34px; height: 34px; }
.deal-success__title {
  margin-top: 20px;
  font-size: clamp(24px, 3.5vw, 32px);
  font-weight: 700;
  letter-spacing: -0.025em;
}
.deal-success__text {
  margin-top: 10px;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 460px;
  margin-inline: auto;
}
.deal-success__link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 14px 22px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1.5px dashed rgba(12, 12, 13, 0.3);
  font-family: var(--mono);
  font-size: 14.5px;
  font-weight: 600;
}
.deal-success__link svg { width: 16px; height: 16px; color: var(--muted); }
.deal-success__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 26px;
}

@media (prefers-reduced-motion: reduce) {
  .deal-form-card, .deal-aside, .deal-success, .file-chip { animation: none; }
}
