/* Account area (library mamaney_theme/account), loaded by route name
   (AccountRoutes, mamaney_theme_preprocess_html()).

   1. The sign-in shell (templates/account/_signin-shell.html.twig): login
      and password-reset request. The brand, one centred card, the legal
      links under it. Brandbook pattern "Account form".
   2. The other signed-out steps (registration, one-time login, social
      registration completion, TFA code): the page column narrowed to a
      form's width (.mm-signin-page on <body>).
   3. The social sign-in button (templates/account/login-with.html.twig).
   4. Form sections: the field_group fieldsets (.mm-form-section) of the
      registration and profile forms.
   5. The date field (vendored flatpickr, mamaney_theme.info.yml).
   6. The member's account tabs (.mm-account-page on <body>): one column,
      the tab's content in a card.
   7. Profile edit: the password section, the phone state, the identity
      panel (templates/account/mamaney-identity-locked.html.twig).
   8. Extended profile wizard (templates/account/webform-progress*).
   9. Lists: connected accounts and invoices, stacked on a phone.
   10. Notification settings and this device's push switch.
   11. Two-factor authentication overview.

   The field language itself (.mm-field, .mm-label, .mm-input, .mm-hint,
   .mm-error, .mm-check) is global (css/components/fields.css). */

/* 1. Sign-in shell ---------------------------------------------------------- */

.mm-signin__header {
  display: flex;
  justify-content: center;
  padding: var(--mm-space-8) var(--mm-space-4) 0;
}

.mm-signin__main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: var(--mm-space-6) max(var(--mm-space-4), env(safe-area-inset-right, 0px)) var(--mm-space-14) max(var(--mm-space-4), env(safe-area-inset-left, 0px));
}

.mm-signin__main:focus {
  outline: none;
}

.mm-signin__card {
  display: flex;
  flex-direction: column;
  gap: var(--mm-space-4);
  padding: var(--mm-space-6) var(--mm-space-5);
}

/* The page title sits inside the card, as the card's own title. */
.mm-signin__card .mm-title--page {
  font-size: 25px;
}

/* The LT / EN switch (SigninLanguages) stays on the title's line: a long
   title wraps beside it instead. */
.mm-signin__card .mm-titlebar {
  flex-wrap: nowrap;
}

/* core's "Forgot your password?" link under the password field. */
.mm-signin__card .forgot-password-link a {
  color: var(--mm-primary);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--mm-underline);
  text-underline-offset: 3px;
}

.mm-signin__card .forgot-password-link a:hover {
  text-decoration-color: currentColor;
}

/* Terms and Privacy on the page ground under the card: reference links, not
   part of signing in. */
.mm-signin__legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--mm-space-2) var(--mm-space-6);
  padding-top: var(--mm-space-4);
  font-size: 14px;
}

.mm-signin__legal .mm-link {
  color: var(--mm-muted);
  font-weight: 400;
}

.mm-signin__legal .mm-link:hover {
  color: var(--mm-text);
}

@media (min-width: 768px) {
  .mm-signin__header {
    padding-top: var(--mm-space-14);
  }

  .mm-signin__card {
    padding: var(--mm-space-8);
  }
}

/* 2. Other signed-out steps ------------------------------------------------ */

.mm-signin-page .mm-page__main {
  max-width: 720px;
}

/* The form sits in a card, under the page title (brandbook "Account form").
   Not in the sign-in shell, whose card already holds the page. */
.mm-signin-page .mm-page__main .mm-page__content {
  padding: var(--mm-space-6) var(--mm-space-5);
  background: var(--mm-surface);
  border: 1px solid var(--mm-line);
  border-radius: var(--mm-radius-card);
}

/* A form with nothing to fill in (social registration once its sign-in
   expired: only the message above) leaves no empty card. */
.mm-signin-page .mm-page__main .mm-page__content:not(:has(.mm-field, .mm-action-row)) {
  display: none;
}

@media (min-width: 768px) {
  .mm-signin-page .mm-page__main .mm-page__content {
    padding: var(--mm-space-8);
  }
}

/* 3. Social sign-in button --------------------------------------------------
   Google's sign-in parts inside an .mm-btn--secondary frame: the G at 20 px
   before the label, the state layer under both. The four colours of the G
   are in the markup (Google's brand rule). */

.mm-signin__social {
  display: flex;
  flex-direction: column;
  gap: var(--mm-space-2);
}

.gsi-material-button {
  position: relative;
  width: 100%;
  overflow: hidden;
  user-select: none;
}

.gsi-material-button-state {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.gsi-material-button-content-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}

.gsi-material-button-icon {
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
}

.mm-btn .gsi-material-button-icon svg {
  display: block;
  width: 20px;
  height: 20px;
}

.gsi-material-button-contents {
  min-width: 0;
}

/* 4. Form sections ----------------------------------------------------------
   A field_group fieldset is a section: its legend a small caps label over a
   hairline, its fields a 12-column grid on wider screens. Widths follow the
   data: an address line takes the row, a postcode a quarter. */

.mm-form > .mm-form-section {
  padding-top: var(--mm-space-6);
  border-top: 1px solid var(--mm-line);
}

.mm-form > .mm-form-section:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.mm-form-section > .mm-fieldset__legend {
  margin-bottom: var(--mm-space-4);
}

.mm-form-section > .mm-fieldset__legend > .mm-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mm-muted);
}

/* field_group marks a section required; the fields say so themselves. */
.mm-form-section > .mm-fieldset__legend .form-required::after {
  content: none;
}

.mm-form-section > .mm-fieldset__body {
  gap: var(--mm-space-4);
}

/* A section whose fields the form prints after it (social registration's
   account section) shows only its legend. */
.mm-form-section > .mm-fieldset__body:not(:has(*)) {
  display: none;
}

.mm-form-section:has(> .mm-fieldset__body:not(:has(*))) > .mm-fieldset__legend {
  margin-bottom: 0;
}

/* The section's own note explains its fields, so it comes first. */
.mm-form-section > .mm-fieldset__body > .mm-hint {
  order: -1;
}

/* A line of context above the first section (social registration). */
.mm-form > .mm-form-intro {
  color: var(--mm-muted);
}

/* core's "Language settings" details in the account section holds one
   select; its box and summary only repeat the select's label. */
.mm-form-section .mm-details {
  border: 0;
  background: none;
}

.mm-form-section .mm-details > .mm-details__summary {
  display: none;
}

.mm-form-section .mm-details > .mm-details__body {
  padding: 0;
}

@media (min-width: 768px) {
  .mm-form-section > .mm-fieldset__body {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--mm-space-4);
  }

  .mm-form-section > .mm-fieldset__body > * {
    grid-column: span 6;
    min-width: 0;
  }

  .mm-form-section > .mm-fieldset__body > .mm-hint,
  .mm-form-section > .mm-fieldset__body > .field--name-mail,
  .mm-form-section > .mm-fieldset__body > .form-item-mail,
  .mm-form-section > .mm-fieldset__body > .field--name-field-address-line1,
  .mm-form-section > .mm-fieldset__body > .field--name-field-address-line2,
  .mm-form-section > .mm-fieldset__body > .field--name-field-terms,
  .mm-form-section > .mm-fieldset__body > .field--name-field-privacy,
  .mm-form-section > .mm-fieldset__body > .field--name-field-marketing,
  .mm-form-section > .mm-fieldset__body > .form-wrapper:not([class*="field--name-"]) {
    grid-column: 1 / -1;
  }

  .mm-form-section > .mm-fieldset__body > .field--name-field-address-city {
    grid-column: span 8;
  }

  .mm-form-section > .mm-fieldset__body > .field--name-field-address-zip {
    grid-column: span 4;
  }

  /* The country is a read-only value (Lithuania only); it takes its own row. */
  .mm-form-section > .mm-fieldset__body > .field--name-field-address-country {
    grid-column: 1 / -1;
  }
}

/* A read-only value is not an input: the value where the field would be. A
   read-only widget with no value (the country on registration) takes no
   row. */
.field--widget-readonly-field-widget :is(.field__item, .field__items) {
  line-height: 46px;
}

.field--widget-readonly-field-widget:not(:has(.field__item, .field__items)) {
  display: none;
}

/* The password pair (core's password_confirm, with user.js's strength meter
   and match message), stacked like every other field. */
.password-strength__meter {
  height: 6px;
  margin-top: var(--mm-space-2);
  border-radius: 3px;
  background: var(--mm-line);
  overflow: hidden;
}

.password-strength__indicator {
  height: 100%;
  background: var(--mm-danger);
}

.password-strength__indicator.is-fair {
  background: var(--mm-action);
}

.password-strength__indicator.is-good {
  background: var(--mm-primary);
}

.password-strength__indicator.is-strong {
  background: var(--mm-ready);
}

.password-strength__title,
.password-confirm-message,
.password-suggestions {
  margin-top: var(--mm-space-1);
  font-size: 14px;
  line-height: 1.45;
  color: var(--mm-muted);
}

.password-suggestions ul {
  margin: var(--mm-space-1) 0 0;
  padding-left: var(--mm-space-5);
}

/* Codes, postcodes and dates line up when their digits are one width. */
.field--name-field-personal-code .mm-input,
.field--name-field-address-zip .mm-input,
.field--name-field-phone .mm-input,
.field--name-field-birthday .mm-input,
.field--name-field-iban .mm-input {
  font-variant-numeric: tabular-nums;
}

/* 5. Date field --------------------------------------------------------------
   Birth date (element mamaney_date_parts): year, month and day typed into
   three number fields that sit in one bordered box, labels inside. The box
   takes the focus ring and the error border; the inputs inside are bare. The
   flatpickr rules below serve the remaining calendar fields. */

.mm-date-parts .mm-fieldset__body {
  display: flex;
  flex-direction: row;
  gap: 0;
  height: 58px;
  border: 1px solid var(--mm-field);
  border-radius: var(--mm-radius-field);
  background: var(--mm-surface);
  overflow: hidden;
}

/* The legend is the label: no extra gap, same line height as a field label,
   so the box starts level with the input beside it. */
.mm-date-parts > .mm-fieldset__legend {
  margin-bottom: 0;
  font-size: 15px;
  line-height: 1.5;
}

.mm-date-parts > .mm-fieldset__legend > .mm-label {
  line-height: inherit;
}

.mm-date-parts .mm-date-parts__part {
  flex: 1 1 0;
  justify-content: center;
  gap: 0;
  padding: 0 var(--mm-space-3);
  border-right: 1px solid var(--mm-line);
}

.mm-date-parts .mm-date-parts__part:last-child {
  border-right: 0;
}

.mm-date-parts .mm-date-parts__part:has(.mm-date-parts__year) {
  flex-grow: 1.4;
}

.mm-date-parts .mm-date-parts__part .mm-label {
  font-size: 12px;
  line-height: 1.2;
  color: var(--mm-muted);
}

.mm-date-parts .mm-date-parts__part .mm-input {
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 17px;
  line-height: 1.3;
}

.mm-date-parts .mm-date-parts__part .mm-input:focus,
.mm-date-parts .mm-date-parts__part .mm-input:focus-visible {
  border: 0;
  box-shadow: none;
}

.mm-date-parts .mm-fieldset__body:focus-within {
  border-color: var(--mm-primary);
  box-shadow: 0 0 0 1px var(--mm-primary), 0 0 0 4px var(--mm-primary-surface);
}

.mm-date-parts.form-item--error .mm-fieldset__body {
  border-color: var(--mm-danger);
  box-shadow: inset 0 0 0 1px var(--mm-danger);
}

.mm-date-parts.form-item--error .mm-fieldset__body:focus-within {
  box-shadow: inset 0 0 0 1px var(--mm-danger), 0 0 0 4px var(--mm-danger-surface);
}

.flatpickr-input[readonly] {
  cursor: pointer;
}

.flatpickr-calendar {
  font-family: var(--mm-sans);
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--mm-primary);
  border-color: var(--mm-primary);
  color: var(--mm-surface);
}

.flatpickr-day.today {
  border-color: var(--mm-primary);
}

.flatpickr-day:focus-visible {
  box-shadow: var(--mm-focus);
}

/* 6. Account tabs ------------------------------------------------------------
   Every /user/{user}/* page shares one column: title, tabs, then the tab's
   content in a card. */

.mm-account-page .mm-page__main {
  max-width: 848px;
}

.mm-account-page .mm-page__content:not(:has(.mm-card, .mm-confirm)) {
  padding: var(--mm-space-5) var(--mm-space-4);
  background: var(--mm-surface);
  border: 1px solid var(--mm-line);
  border-radius: var(--mm-radius-card);
}

/* A tab's lead-in paragraph sits in the card's muted voice. */
.mm-account-page .mm-form > p {
  color: var(--mm-muted);
}

/* A form's buttons close the card, over a hairline. */
.mm-account-page .mm-form .mm-action-row {
  margin-top: var(--mm-space-2);
  padding-top: var(--mm-space-5);
  border-top: 1px solid var(--mm-line);
}

@media (min-width: 768px) {
  .mm-account-page .mm-page__content:not(:has(.mm-card, .mm-confirm)) {
    padding: var(--mm-space-8);
  }
}

/* 7. Profile edit ----------------------------------------------------------- */

/* "Change password" is the one details in the account section that opens:
   it keeps its box and summary (section 4 strips them from the language
   details). The summary's own chevron repeats .mm-details__icon. */
.mm-form-section .mm-password-section {
  display: block;
  border: 1px solid var(--mm-line);
}

.mm-form-section .mm-password-section > .mm-details__summary {
  display: flex;
}

.mm-form-section .mm-password-section > .mm-details__body {
  padding: 0 var(--mm-space-4) var(--mm-space-4);
}

.mm-password-section__chevron {
  display: none;
}

/* core's collapse.js adds an empty span.summary to each summary, which
   would split the summary's space between label and icon. */
.mm-account-page .mm-details__summary > .summary:empty {
  display: none;
}

/* The "Account deletion" link (AccountDeletionLink) closes the form, apart
   from its buttons. */
.mm-account-deletion {
  margin-top: var(--mm-space-6);
}

/* The phone's state (PhoneState) drops below the input: a status tag and,
   while unverified, the button to verify it. */
.mm-field__affix:has(.mm-account__phone-state) {
  flex-wrap: wrap;
}

.mm-field__affix > .mm-field__suffix:has(.mm-account__phone-state) {
  flex-basis: 100%;
}

.mm-account__phone-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--mm-space-3);
}

.mm-account__phone-state .mm-btn {
  min-height: 36px;
  padding: 0 var(--mm-space-3);
  font-size: 14px;
}

.phone-field--unverified .mm-input {
  border-color: var(--mm-action);
}

/* The verified identity: read-only values in a panel on the page ground,
   the lock note under them. */
.mm-account__identity {
  display: flex;
  flex-direction: column;
  gap: var(--mm-space-3);
  padding: var(--mm-space-4);
  background: var(--mm-page);
  border: 1px solid var(--mm-line);
  border-radius: var(--mm-radius-card);
}

.mm-account__identity-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--mm-space-2);
}

.mm-account__identity-title {
  font-size: 16px;
  font-weight: 600;
}

.mm-account__identity-note {
  display: flex;
  align-items: flex-start;
  gap: var(--mm-space-2);
}

.mm-account__lock-icon {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  margin-top: 3px;
}

/* 8. Extended profile wizard -------------------------------------------------
   The step bar and head (brandbook "Progress") replace webform's tracker;
   the step's fieldset legend repeats the head's name, so only a screen
   reader hears it. */

.mm-account__progress {
  margin-bottom: var(--mm-space-6);
}

.mm-account__progress ~ .webform-type-fieldset > .mm-fieldset__body {
  display: flex;
  flex-direction: column;
  gap: var(--mm-space-4);
}

.mm-account__progress ~ .webform-type-fieldset {
  margin-bottom: var(--mm-space-6);
}

.mm-account__progress ~ .webform-type-fieldset > .mm-fieldset__legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 9. Lists ------------------------------------------------------------------
   Connected accounts and invoices: a table on a wider screen; on a phone
   each row a block of its cells, the actions last. */

.mm-account__ops {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--mm-space-2);
}

.mm-account__download {
  display: inline-flex;
  align-items: center;
  gap: var(--mm-space-1);
}

.mm-account__download-icon {
  width: 16px;
  height: 16px;
}

/* On a phone a row is a block of two columns: its cells pair up (date and
   number, type and amount; status and network), the actions take the last
   line. From 768px it is the table again. */
.mm-table.mm-account__list,
.mm-account__list tbody {
  display: block;
}

.mm-account__list thead {
  display: none;
}

.mm-account__list tr {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--mm-space-1) var(--mm-space-3);
  padding: var(--mm-space-3) 0;
  border-bottom: 1px solid var(--mm-line);
}

.mm-account__list tr:last-child {
  border-bottom: 0;
}

.mm-table.mm-account__list td {
  height: auto;
  padding: 0;
  border: 0;
}

.mm-table.mm-account__list td:nth-child(even) {
  text-align: right;
}

/* Below 768px the cells are separate boxes in the row's grid, so
   tables.css's row hover would paint them as patches (a tapped row keeps
   its hover on a phone). */
@media (max-width: 767.98px) {
  .mm-table.mm-account__list tbody tr:hover td {
    background: none;
  }
}

.mm-table.mm-account__list td.act {
  grid-column: 1 / -1;
  padding-top: var(--mm-space-1);
  text-align: left;
}

.mm-account__list .mm-account__ops {
  justify-content: flex-start;
}

.mm-table.mm-account__list td.mm-table__empty {
  grid-column: 1 / -1;
  padding: var(--mm-space-2) 0;
  color: var(--mm-muted);
  text-align: left;
}

@media (min-width: 768px) {
  .mm-table.mm-account__list {
    display: table;
  }

  .mm-account__list thead {
    display: table-header-group;
  }

  .mm-account__list tbody {
    display: table-row-group;
  }

  .mm-account__list tr,
  .mm-account__list tr:last-child {
    display: table-row;
    padding: 0;
    border-bottom: 0;
  }

  /* tables.css's cell: 56 px rows, light rules. */
  .mm-table.mm-account__list td {
    height: 56px;
    padding: var(--mm-space-2) var(--mm-space-3);
    border-bottom: 1px solid var(--mm-line);
  }

  .mm-table.mm-account__list td:nth-child(even) {
    text-align: left;
  }

  .mm-table.mm-account__list td.num,
  .mm-table.mm-account__list td.act {
    padding-top: var(--mm-space-2);
    text-align: right;
  }

  .mm-account__list .mm-account__ops {
    justify-content: flex-end;
  }

  .mm-table.mm-account__list td.mm-table__empty {
    padding: var(--mm-space-2) var(--mm-space-3);
  }
}

/* 10. Notification settings --------------------------------------------------
   Events down the side, a narrow centred column per channel. The module's
   own sheet (notification-settings.css) is off (mamaney_theme.info.yml). */

.mamaney-user-notification-settings .mm-table :is(th, td):not(:first-child) {
  width: 48px;
  padding-left: var(--mm-space-1);
  padding-right: var(--mm-space-1);
  white-space: normal;
  text-align: center;
}

.mamaney-user-notification-settings .mm-table :is(th, td):first-child {
  padding-left: 0;
}

.mamaney-user-notification-settings .mm-table td .mm-field {
  margin: 0;
}

.mamaney-user-notification-settings .mm-table td .mm-check {
  justify-content: center;
}

/* The event's name is its row's label (the error summary names the row by
   it), set in body text like the rest of the table. */
.mamaney-user-notification-settings .mm-table td .mm-label {
  font-size: inherit;
  font-weight: 400;
}

/* This device's push switch (mamaney_pwa push-settings.js fills it): a
   panel above the table, its status line muted. */
.mm-form > .mamaney-push-device {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--mm-space-2);
  padding: var(--mm-space-4);
  background: var(--mm-page);
  border: 1px solid var(--mm-line);
  border-radius: var(--mm-radius-card);
}

.mamaney-push-device > h2 {
  font-size: 16px;
  font-weight: 600;
}

.mamaney-push-device__body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--mm-space-2) var(--mm-space-4);
}

.mamaney-push-device__status {
  flex: 1 1 14em;
  color: var(--mm-muted);
}

@media (min-width: 768px) {
  .mamaney-user-notification-settings .mm-table :is(th, td):not(:first-child) {
    width: 88px;
    padding-left: var(--mm-space-3);
    padding-right: var(--mm-space-3);
  }

  .mamaney-user-notification-settings .mm-table th:not(:first-child) {
    white-space: nowrap;
  }

  .mamaney-user-notification-settings .mm-table :is(th, td):first-child {
    padding-left: var(--mm-space-3);
  }
}

/* 11. Two-factor authentication ----------------------------------------------
   The overview's "Verification methods" details is a section label over
   the methods (it still folds); each method's link is a secondary button
   (mamaney_theme_form_tfa_base_overview_alter()). */

[data-drupal-selector="tfa-base-overview"] > .mm-details {
  border: 0;
  background: none;
}

[data-drupal-selector="tfa-base-overview"] > .mm-details > .mm-details__summary {
  min-height: 0;
  padding: var(--mm-space-4) 0 var(--mm-space-2);
  border-top: 1px solid var(--mm-line);
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mm-muted);
}

[data-drupal-selector="tfa-base-overview"] > .mm-details > .mm-details__body {
  gap: var(--mm-space-2);
  padding: 0;
}

[data-drupal-selector="tfa-base-overview"] .mm-details__body h2 {
  font-size: 17px;
  font-weight: 600;
}

[data-drupal-selector="tfa-base-overview"] .mm-details__body ul {
  margin: var(--mm-space-2) 0 0;
  padding: 0;
  list-style: none;
}
