/* Saved profiles: the profile management pages (list / new / edit) and the
 * taxpayer-profile picker on the paperwork forms. Built on the shared tokens in
 * application.css — indigo accent, soft rounded surfaces. */

/* ===== Page shell (list / new / edit) ================================== */
/* The profiles UI lives inside the shared .main-content card, which supplies the
   white frame and padding — so this wrapper just holds the content. */
.profiles {
  min-width: 0;
}

/* Header + title + lead now use the shared .page-header / .page-title /
   .page-lead primitives (app/assets/stylesheets/application.css). */
.profiles__back {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

/* ===== Profile cards (list) =========================================== */
.profile-cards {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.profile-card__avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
}

.profile-card__body {
  flex: 1;
  min-width: 0;
}

.profile-card__name {
  font-weight: 800;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 3px;
}

.profile-card__meta {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
  word-break: break-word;
}

.profile-card__meta .mono {
  font-family: var(--mono);
  background: none;
  padding: 0;
  white-space: normal;
}

.profile-card__tag {
  flex-shrink: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--warn-text);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.profile-card__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.profile-card__edit {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--brand);
}

.profile-card__edit:hover {
  text-decoration: underline;
}

.profile-card__delete {
  padding: 0;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--danger);
  background: none;
  border: none;
  cursor: pointer;
}

.profile-card__delete:hover {
  text-decoration: underline;
}

/* ===== Empty state ==================================================== */
.profile-empty {
  margin-top: 24px;
  padding: 52px 32px;
  text-align: center;
  background: var(--surface);
  border: 2px dashed var(--border-dashed);
  border-radius: var(--radius-xl);
}

.profile-empty__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
}

.profile-empty__title {
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 6px;
}

.profile-empty__text {
  font-size: 14.5px;
  color: var(--muted);
  margin-bottom: 22px;
}

/* ===== Profile form (new / edit) ====================================== */
/* The .content-card supplies the white frame now, so the form is plain inside it. */
.profile-form {
  margin-top: 8px;
}

.profile-form__title {
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 20px;
}

.profile-form__errors {
  padding: 14px 16px;
  margin-bottom: 20px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: 11px;
  color: #96261d;
}

.profile-form__errors ul {
  margin: 0;
  padding-left: 18px;
}

/* Fields use the shared .field-grid / .field / .field__label primitives
   (application.css). */

.profile-form__upsell {
  margin-top: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

.profile-form__upsell code {
  font-family: var(--mono);
  font-size: 0.86em;
}

.profile-form__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.profile-form__note {
  font-size: 13px;
  color: var(--muted-2);
}

.profile-form__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== Taxpayer personal fields (paperwork forms) ===================== */
/* A flat section inside the wizard panel — same visual language as the "Загрузите
   отчёт брокера" section (a .wizard__title + .wizard__lead + controls), not a card,
   so the two steps read as one form. The inline fields fill the declaration; the
   profile <select> above them is an optional autofill shortcut. */
.pf {
  margin: 0;
}

/* Two sections — "pre-fill from a profile" and the manual fields — split by an
   "или заполните вручную" divider. */
/* Centred and flanked by rules, so it reads as a twin of the "или заполните
   вручную" divider below it. */
.pf-section__head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 10px;
}

.pf-section__head::before,
.pf-section__head::after,
.pf-or::before,
.pf-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.pf-section__title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-2);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pf-or {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* --- Optional "autofill from a saved profile" control ----------------- */
.pf-autofill__select {
  width: 100%;
  height: 46px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.pf-autofill__select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(61, 80, 224, 0.14);
}

.pf-autofill__empty {
  margin-bottom: 20px;
  font-size: 13.5px;
  color: var(--muted);
}

/* The inline fields use the shared .field-grid / .field / .field__label
   primitives (application.css). */

/* Stacked grids (JMBG row, then the secondary fields / blurred preview). */
.field-grid + .field-grid,
.field-grid + .pf-locked {
  margin-top: 16px;
}

/* --- Free tier: blurred field preview with the upsell floating on top --- */
.pf-locked {
  position: relative;
}

/* The example fields behind the glass: frosted, dimmed, non-interactive. Kept in
   the DOM (disabled) so the layout matches the full form exactly — the blur is
   purely visual; the server strip is what actually enforces the tier. */
.pf-locked__fields {
  filter: blur(4px);
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}

/* Behind the blur the disabled inputs should read as ordinary filled fields
   (not the "unavailable" dashed look), so the preview looks like real data. */
.pf-locked__fields input:disabled,
.pf-locked__fields select:disabled {
  background: var(--surface);
  border-style: solid;
  color: var(--muted);
}

.pf-locked__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* The upsell card sits above the frosted fields — legible on its own translucent
   surface, so it never fights the blur behind it. */
.pf-locked__text {
  max-width: 480px;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(2px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 18px 40px -18px rgba(14, 20, 36, 0.4);
}

.pf-locked__icon {
  margin-right: 4px;
}

.pf-locked__text code {
  font-family: var(--mono);
  font-size: 0.86em;
}

/* Not scoped to .pf — the same lock-up is reused for the blurred Проверка/Расчёт
   screens in the paperwork wizards, which sit outside the personal-fields form. */
.pf-locked__cta {
  color: var(--brand);
  font-weight: 700;
}

.pf-locked__cta:hover {
  text-decoration: underline;
}

/* Reassurance under the upsell: the free tier still gets its declaration, so the
   locked screens read as "less detail", not "blocked". */
.pf-locked__aside {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

/* ===== Responsive ===================================================== */
@media (max-width: 620px) {
  .page-header {
    flex-direction: column;
  }

  .profile-card {
    flex-wrap: wrap;
  }

  .profile-card__actions {
    width: 100%;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }
}
