/* Токены клиентского web-ЛК отделены от backend admin и совпадают с account UI-kit v0.1. */
:root {
  color-scheme: light;
  --account-canvas: #f4f8fb;
  --account-surface: #ffffff;
  --account-surface-soft: #edf4f8;
  --account-brand-soft: #e5f5fc;
  --account-text: #243746;
  --account-text-muted: #647887;
  --account-border: #d8e3ea;
  --account-brand: #0b78b8;
  --account-brand-hover: #09679d;
  --account-focus: rgba(11, 120, 184, 0.24);
  --account-success: #237052;
  --account-success-bg: #e9f6f0;
  --account-success-border: #cde9dc;
  --account-warning: #8a5a12;
  --account-warning-bg: #fff6e2;
  --account-warning-border: #f0dfb7;
  --account-danger: #b33d4a;
  --account-danger-hover: #962f3b;
  --account-danger-bg: #fdf0f2;
  --account-danger-border: #f1d2d7;
  --account-neutral: #526675;
  --account-neutral-bg: #edf3f6;
  --account-neutral-border: #dce6eb;
  --account-shadow: 0 10px 30px rgba(46, 75, 92, 0.05);
  --account-shadow-raised: 0 18px 48px rgba(46, 75, 92, 0.08);
  --account-auth-card-width: 440px;
  --radius-control: 12px;
  --radius-block: 14px;
  --radius-panel: 20px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--account-canvas);
}

.account-body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: var(--account-canvas);
  color: var(--account-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
summary,
a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--account-brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--account-brand-hover);
}

button:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid var(--account-focus);
  outline-offset: 3px;
}

h1,
h2,
h3,
p,
dl,
dd,
ul {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--account-text);
  font-weight: 500;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 12px;
  font-size: 36px;
  line-height: 1.18;
  text-wrap: balance;
}

h2 {
  margin-bottom: 8px;
  font-size: 24px;
  line-height: 1.3;
  text-wrap: balance;
}

h3 {
  margin-bottom: 6px;
  font-size: 18px;
  line-height: 1.4;
}

.skip-link {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--account-surface);
  color: var(--account-brand);
  box-shadow: var(--account-shadow-raised);
  transform: translateY(-140%);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* Header оставляет фирменную иконку главным визуальным акцентом и не наследует темную admin-шапку. */
.account-header {
  border-bottom: 1px solid rgba(216, 227, 234, 0.92);
  background: var(--account-surface);
}

.account-header__inner {
  display: flex;
  width: min(1120px, calc(100% - 40px));
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

.account-brand,
.auth-brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  color: var(--account-text);
  text-decoration: none;
}

.account-brand {
  flex: 0 0 auto;
  gap: 12px;
}

.account-brand:hover,
.auth-brand:hover {
  color: var(--account-text);
}

.account-brand__icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.account-brand__name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0;
}

.account-header__actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
}

.header-link {
  flex: 0 0 auto;
  font-size: 14px;
  text-decoration: none;
}

.account-logout {
  margin: 0;
}

.account-page {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

.account-page--auth {
  display: flex;
  min-height: calc(100vh - 75px);
  align-items: flex-start;
  justify-content: center;
  padding-top: 56px;
}

/*
  Панель действия последнего рабочего места раскрывается вниз поверх списка и не увеличивает высоту
  страницы, поэтому dashboard держит запас снизу, чтобы она не оказывалась за нижней границей экрана.
*/
.account-page--dashboard {
  padding-bottom: 180px;
}

.dashboard-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 8px 4px 0;
}

.dashboard-heading__meta {
  margin-bottom: 0;
  color: var(--account-text-muted);
  font-size: 14px;
}

.dashboard-heading__meta span {
  overflow-wrap: anywhere;
}

.account-section {
  margin-top: 24px;
  padding: 30px;
  border: 1px solid var(--account-border);
  border-radius: var(--radius-panel);
  background: var(--account-surface);
  box-shadow: var(--account-shadow);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 12px;
}

.section-heading p {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--account-text-muted);
  font-size: 14px;
}

/* Кнопки сохраняют одну геометрию, а цвет обозначает смысл действия. */
.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--account-text);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.button:hover {
  color: var(--account-text);
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.button--primary {
  border-color: var(--account-brand);
  background: var(--account-brand);
  color: #fff;
}

.button--primary:hover:not(:disabled) {
  border-color: var(--account-brand-hover);
  background: var(--account-brand-hover);
  color: #fff;
}

.button--secondary {
  border-color: var(--account-border);
  background: var(--account-surface);
  color: var(--account-brand);
}

.button--secondary:hover {
  border-color: #b9cedb;
  background: var(--account-brand-soft);
  color: var(--account-brand-hover);
}

.button--quiet {
  min-height: 42px;
  padding-right: 10px;
  padding-left: 10px;
  color: var(--account-brand);
}

.button--quiet:hover {
  background: var(--account-brand-soft);
  color: var(--account-brand-hover);
}

.button--danger {
  border-color: var(--account-danger);
  background: var(--account-danger);
  color: #fff;
}

.button--danger:hover {
  border-color: var(--account-danger-hover);
  background: var(--account-danger-hover);
  color: #fff;
}

.button--compact {
  min-height: 40px;
  padding: 9px 13px;
  font-size: 14px;
}

.button--wide {
  width: 100%;
}

.button--large {
  min-height: 56px;
  gap: 10px;
  padding: 14px 22px;
  font-size: 16px;
}

.button__icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

.auth-card {
  display: grid;
  width: 100%;
  max-width: var(--account-auth-card-width);
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--account-border);
  border-radius: var(--radius-panel);
  background: var(--account-surface);
  box-shadow: var(--account-shadow);
}

.result-card {
  align-self: start;
}

.auth-brand {
  width: fit-content;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
}

.auth-brand img {
  width: 56px;
  height: 56px;
}

.auth-card__heading h1 {
  margin-bottom: 5px;
  font-size: 30px;
  line-height: 1.18;
}

.auth-card__heading p {
  margin-bottom: 0;
  color: var(--account-text-muted);
  font-size: 14px;
}

.account-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  align-content: start;
  gap: 8px;
}

.field label {
  color: var(--account-text);
  font-size: 14px;
  font-weight: 500;
}

.field--required label::after {
  color: var(--account-danger);
  content: " *";
}

.field input,
.field select {
  width: 100%;
  height: 52px;
  padding: 12px 14px;
  border: 1px solid #cbd9e2;
  border-radius: var(--radius-control);
  background: var(--account-surface);
  color: var(--account-text);
  font-size: 16px;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

/* select переиспользует те же токены и радиус, что и input: мастер счета —
   первый account-шаблон с выпадающими списками, отдельного компонента под них нет. */
.field select {
  cursor: pointer;
  appearance: auto;
}

.field input:hover:not(:disabled),
.field select:hover:not(:disabled) {
  border-color: #a9bfcd;
}

.field input:focus,
.field select:focus {
  border-color: var(--account-brand);
  box-shadow: 0 0 0 4px var(--account-focus);
  outline: 0;
}

.field input:disabled,
.field input[readonly],
.field select:disabled {
  border-color: var(--account-border);
  background: var(--account-surface-soft);
  color: var(--account-text-muted);
  cursor: not-allowed;
}

.field--error input {
  border-color: var(--account-danger);
  box-shadow: 0 0 0 3px rgba(179, 61, 74, 0.12);
}

.field--error input:focus {
  box-shadow: 0 0 0 4px rgba(179, 61, 74, 0.16);
}

.field__help,
.field__error {
  margin-bottom: 0;
  font-size: 13px;
  line-height: 1.45;
}

.field__help {
  color: var(--account-text-muted);
}

.field__error {
  color: var(--account-danger);
}

/* Отсчет до повторной отправки кода стоит под широкой кнопкой и относится именно к ней,
   поэтому центрируется и прижимается ближе обычного шага формы. */
.auth-resend-hint {
  margin-top: -8px;
  text-align: center;
}

.form-alert,
.account-flash {
  padding: 13px 16px;
  border: 1px solid;
  border-radius: var(--radius-block);
  font-size: 14px;
}

.form-alert--danger {
  border-color: var(--account-danger-border);
  background: var(--account-danger-bg);
  color: var(--account-danger);
}

.account-flash {
  margin-bottom: 20px;
}

.account-flash--success {
  border-color: var(--account-success-border);
  background: var(--account-success-bg);
  color: var(--account-success);
}

.auth-card__links {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
}

.auth-card__links--single {
  justify-content: center;
}

.auth-card__links a {
  text-decoration-line: underline;
  text-decoration-style: dashed;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.auth-card__links a:hover {
  text-decoration: none;
}

.status-badge {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.status-badge--success {
  border-color: var(--account-success-border);
  background: var(--account-success-bg);
  color: var(--account-success);
}

.status-badge--info {
  border-color: #c5e5f3;
  background: var(--account-brand-soft);
  color: #176b98;
}

.status-badge--warning {
  border-color: var(--account-warning-border);
  background: var(--account-warning-bg);
  color: var(--account-warning);
}

.status-badge--danger {
  border-color: var(--account-danger-border);
  background: var(--account-danger-bg);
  color: var(--account-danger);
}

.status-badge--neutral {
  border-color: var(--account-neutral-border);
  background: var(--account-neutral-bg);
  color: var(--account-neutral);
}

.account-alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding: 17px 18px;
  border: 1px solid;
  border-radius: 16px;
}

.account-alert--compact {
  margin-bottom: 16px;
}

.account-alert__mark {
  width: 10px;
  height: 10px;
  align-self: start;
  margin-top: 8px;
  border-radius: 50%;
}

.account-alert__content h2,
.account-alert__content h3,
.account-alert__content p {
  margin-bottom: 0;
}

.account-alert__content p {
  color: var(--account-text-muted);
  font-size: 14px;
}

.account-alert--info {
  border-color: #c9e5f1;
  background: #f1f9fd;
}

.account-alert--info .account-alert__mark {
  background: var(--account-brand);
}

.account-alert--warning {
  border-color: var(--account-warning-border);
  background: var(--account-warning-bg);
}

.account-alert--warning .account-alert__mark {
  background: #c28a2f;
}

.account-alert--danger {
  border-color: var(--account-danger-border);
  background: var(--account-danger-bg);
}

.account-alert--danger .account-alert__mark {
  background: var(--account-danger);
}

.extension-install-prompt {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin: -8px 0 24px;
  text-align: center;
}

.extension-install-prompt p {
  margin-bottom: 0;
  color: var(--account-text-muted);
}

.extension-install-prompt__button {
  min-width: min(100%, 300px);
}

.summary-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--account-border);
  border-radius: 18px;
  background: var(--account-surface);
}

.summary-item {
  min-width: 0;
  padding: 22px;
  border-left: 1px solid var(--account-border);
}

.summary-item:first-of-type {
  border-left: 0;
}

.summary-item__topline {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 17px;
}

.summary-item__label {
  color: var(--account-text-muted);
  font-size: 13px;
  font-weight: 500;
}

.summary-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
}

.summary-item p {
  margin: 3px 0 11px;
  color: var(--account-text-muted);
  font-size: 14px;
}

.summary-item__meta {
  color: var(--account-text-muted);
  font-size: 13px;
}

.summary-item__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 12px 0 0;
  padding: 0;
  color: var(--account-text-muted);
  font-size: 13px;
  list-style: none;
}

.summary-item__list li::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--account-border);
  vertical-align: 2px;
}

.technical-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px !important;
}

.workplaces__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.workplaces__heading p {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--account-text-muted);
  font-size: 14px;
}

.workplaces__counter {
  padding-top: 4px;
  color: var(--account-text-muted);
  font-size: 14px;
  white-space: nowrap;
}

.workplace-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workplace-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--account-border);
  border-radius: 16px;
  background: var(--account-surface);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.workplace-item:hover {
  border-color: #c0d3df;
  box-shadow: 0 8px 24px rgba(46, 75, 92, 0.045);
}

.workplace-meta {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) 100px minmax(150px, 1fr);
  gap: 18px;
  margin-bottom: 0;
}

.workplace-meta div {
  min-width: 0;
}

.workplace-meta dt {
  color: var(--account-text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.workplace-meta dd {
  overflow: hidden;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workplace-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.action-disclosure {
  position: relative;
}

.action-disclosure[open] > summary {
  background: var(--account-brand-soft);
  color: var(--account-brand-hover);
}

.action-disclosure--danger[open] > summary {
  background: var(--account-danger-bg);
  color: var(--account-danger-hover);
}

.action-disclosure > summary {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 8px 9px;
  border: 0;
  border-radius: 10px;
  color: var(--account-brand);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  list-style: none;
  user-select: none;
}

.action-disclosure > summary::-webkit-details-marker {
  display: none;
}

.action-disclosure > summary:hover {
  background: var(--account-brand-soft);
  color: var(--account-brand-hover);
}

.action-disclosure--danger > summary {
  color: var(--account-danger);
}

.action-disclosure--danger > summary:hover {
  background: var(--account-danger-bg);
  color: var(--account-danger-hover);
}

/*
  Панель действия раскрывается поверх карточки, а не внутри строки. Раньше она была обычным блоком
  с min-width 520px внутри узкой колонки действий и растягивала карточку шире соседних, сжимая
  название и метаданные. Абсолютное позиционирование оставляет геометрию списка неизменной.
*/
.action-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 3;
  display: grid;
  width: 320px;
  max-width: calc(100vw - 48px);
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-block);
  box-shadow: 0 18px 40px rgba(46, 75, 92, 0.16);
  text-align: left;
}

.action-panel--rename {
  border: 1px solid var(--account-border);
  background: var(--account-surface);
}

.action-panel--rename .field {
  min-width: 0;
}

.action-panel--rename input {
  height: 46px;
}

.action-panel--danger {
  border: 1px solid var(--account-danger-border);
  background: var(--account-danger-bg);
}

.action-panel--danger strong {
  font-weight: 500;
}

.action-panel--danger p {
  margin-bottom: 0;
  color: var(--account-text-muted);
  font-size: 13px;
}

.action-panel__buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--account-border);
  border-radius: 16px;
  background: var(--account-surface-soft);
}

.empty-state p {
  margin-bottom: 0;
  color: var(--account-text-muted);
}

/*
  Блок оплаты dashboard и совместимый экран /account/billing: состав текущего счета и история.
  Контейнеры и статусы переиспользуют существующие токены и .status-badge; новые правила нужны
  только для строк счета и карточек истории — под них в системе еще нет готового компонента.
*/
.invoice-lines {
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
}

.invoice-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--account-border);
}

.invoice-line:last-child {
  border-bottom: 0;
}

.invoice-line__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.invoice-line__quantity {
  flex: 0 0 auto;
  color: var(--account-text-muted);
  font-size: 13px;
}

.invoice-line__total {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}

.invoice-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 4px 0 20px;
  padding-top: 16px;
  border-top: 1px solid var(--account-border);
}

.invoice-total span {
  color: var(--account-text-muted);
  font-size: 14px;
}

.invoice-total strong {
  font-size: 17px;
  font-weight: 600;
}

/* Возврат в кабинет стоит вплотную к блоку счета, а не отбивается как отдельная секция. */
.invoice-back {
  margin: 12px 0 0;
}

/* Действие оплаты и пояснение под ним образуют единый правый край блока счета. */
.invoice-actions {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
}

.invoice-actions form,
.invoice-actions .field__help {
  margin: 0;
}

.invoice-actions .field__help {
  text-align: right;
}

/* Список актуальных счетов на главной: строка-карточка с переходом на страницу оплаты.
   Повторяет геометрию рабочего места, чтобы разделы кабинета читались одинаково. */
.invoice-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.invoice-list__item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border: 1px solid var(--account-border);
  border-radius: 16px;
  background: var(--account-surface);
}

.invoice-list__number {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-list__meta {
  flex: 0 0 auto;
  color: var(--account-text-muted);
  font-size: 14px;
}

.invoice-list__total {
  flex: 0 0 auto;
  min-width: 90px;
  font-size: 15px;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}

.invoice-list__action {
  flex: 0 0 auto;
}

@media (max-width: 920px) {
  .workplace-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .workplace-meta {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .workplace-actions {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 720px) {
  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 22px;
  }

  .account-header__inner {
    width: min(100% - 40px, 1120px);
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 14px 0 12px;
  }

  .account-brand__icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .account-header__actions {
    width: 100%;
    justify-content: flex-start;
    gap: 12px;
  }

  .account-logout {
    margin-left: auto;
  }

  .account-page {
    width: min(100% - 40px, 1120px);
    padding: 34px 0 60px;
  }

  .account-page--auth {
    min-height: auto;
    justify-content: center;
  }

  .dashboard-heading,
  .section-heading,
  .workplaces__heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .account-section {
    padding: 20px;
    border-radius: 18px;
  }

  .account-alert {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .account-alert > .button {
    grid-column: 2;
    width: fit-content;
  }

  .summary-panel {
    grid-template-columns: 1fr;
  }

  .summary-item {
    border-top: 1px solid var(--account-border);
    border-left: 0;
  }

  .summary-item:first-of-type {
    border-top: 0;
  }

  .workplace-item {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .workplace-meta {
    grid-column: auto;
    grid-row: auto;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .workplace-meta dd {
    white-space: normal;
  }

  .workplace-actions {
    grid-column: auto;
    grid-row: auto;
    justify-content: flex-start;
    padding-top: 4px;
    border-top: 1px solid var(--account-border);
  }

  .action-disclosure > summary {
    min-height: 44px;
  }

  /* На узком экране карточка уже одноколоночная, поэтому панель возвращается в поток под действия. */
  .action-disclosure[open] {
    width: 100%;
    flex-basis: 100%;
  }

  .action-panel {
    position: static;
    width: auto;
    max-width: none;
    margin-top: 8px;
    box-shadow: none;
  }

  .action-panel__buttons {
    align-items: stretch;
    flex-direction: column;
  }

  .action-panel__buttons .button {
    width: 100%;
  }

  .auth-card {
    width: 100%;
    padding: 22px;
  }

  /* На узком экране номер счета получает свою строку, а бейдж и сумма остаются на второй. */
  .invoice-list__item {
    flex-wrap: wrap;
  }

  .invoice-list__number {
    flex: 1 1 100%;
    overflow: visible;
    white-space: normal;
  }

  .invoice-list__action {
    flex: 1 1 100%;
    text-align: center;
  }
}

@media (max-width: 460px) {
  .auth-card__links {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .auth-card__links--single {
    align-items: center;
  }

  .status-badge {
    white-space: normal;
  }

  .extension-install-prompt__button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Сетка периодов продления: три равные карточки на desktop, одна колонка на мобильном. */
.renewal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.renewal-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--account-border);
  border-radius: 14px;
  background: var(--account-surface);
}

.renewal-card__title {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
}

.renewal-card__price {
  font-size: 24px;
  font-weight: 500;
  line-height: 1.3;
}

.renewal-card__action {
  margin-top: 8px;
  justify-content: center;
}

.renewal-note {
  margin: 16px 0 0;
  color: var(--account-text-muted);
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .renewal-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Мастер счета: период и опции карточками, итог отдельной секцией. */

/* Та же сетка, что и у карточек продления на главной: три равные колонки, одна на мобильном.
   Строка grid растягивает карточки по самой высокой, поэтому высота у всех трех одинаковая
   даже когда выгода есть не у каждого периода. */
.renewal-durations {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.renewal-duration {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--account-border);
  border-radius: 14px;
  background: var(--account-surface);
  cursor: pointer;
}

.renewal-duration:hover {
  border-color: var(--account-brand);
}

/* Выбранный период подсвечивается очень светлой зеленой подложкой. Серверный класс —
   основной источник состояния (изменение поля перезагружает страницу пересчетом),
   :has() дублирует его для мгновенной реакции до перезагрузки. */
.renewal-duration--selected,
.renewal-duration:has(.renewal-duration__mark:checked) {
  border-color: var(--account-success-border);
  background: var(--account-success-bg);
}

/* Индикатор выбора: выглядит как очень крупный чекбокс в правом верхнем углу, но это
   настоящий radio — выбор взаимоисключающий и работает стрелками с клавиатуры. */
.renewal-duration__mark {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 2px solid var(--account-border);
  border-radius: 12px;
  background: var(--account-surface);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.renewal-duration__mark:checked {
  border-color: var(--account-success);
  background-color: var(--account-success);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4 10-10'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 26px 26px;
}

.renewal-duration__mark:focus-visible {
  outline: none;
  border-color: var(--account-brand);
  box-shadow: 0 0 0 4px var(--account-focus);
}

/* Отступ справа держит заголовок и цену вне зоны индикатора выбора. */
.renewal-duration__title {
  padding-right: 56px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
}

/* Цена базового доступа у варианта периода: без нее выбор отличается по цене
   только после пересчета «Итога», а без JavaScript — вовсе не отличается. */
.renewal-duration__price {
  font-size: 24px;
  font-weight: 500;
  line-height: 1.3;
}

/* Выгода стоит на месте кнопки карточки с главной и прижата к низу, чтобы цена
   оставалась на одной линии во всех трех карточках. */
.renewal-duration__benefit {
  margin-top: auto;
  padding-top: 8px;
  color: var(--account-success);
  font-size: 14px;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .renewal-durations {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Опции — те же равные карточки, что и периоды, но внутри оставляют нативные checkbox
   и select. Это сохраняет привычную семантику каждого параметра, не превращая их в
   декоративные кнопки. */
.renewal-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.renewal-option {
  display: flex;
  min-width: 0;
  min-height: 190px;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--account-border);
  border-radius: 14px;
  background: var(--account-surface);
}

.renewal-option:not(.renewal-option--disabled):hover {
  border-color: var(--account-brand);
}

/* Пакеты не существуют без включенных ИИ-подсказок. Карточка не только выглядит
   неактивной, но и не принимает pointer-события: нельзя случайно изменить quota
   до включения базовой опции. */
.renewal-option--disabled {
  background: var(--account-surface-soft);
  color: var(--account-text-muted);
  pointer-events: none;
}

.renewal-option--disabled .renewal-option__label {
  color: var(--account-text-muted);
}

/* Только ИИ-подсказки включаются и выключаются, поэтому их выбранное состояние
   подсвечивается так же, как и выбранный период. */
.renewal-option--selected,
.renewal-option--toggle:has(.renewal-option__mark:checked) {
  border-color: var(--account-success-border);
  background: var(--account-success-bg);
}

.renewal-option__label {
  color: var(--account-text);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
}

.renewal-option--toggle .renewal-option__label {
  position: relative;
  display: block;
  min-height: 40px;
  padding-right: 56px;
  cursor: pointer;
}

.renewal-option__mark {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 2px solid var(--account-border);
  border-radius: 12px;
  background: var(--account-surface);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.renewal-option__mark:checked {
  border-color: var(--account-success);
  background-color: var(--account-success);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4 10-10'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 26px 26px;
}

.renewal-option__mark:focus-visible {
  outline: none;
  border-color: var(--account-brand);
  box-shadow: 0 0 0 4px var(--account-focus);
}

.renewal-option__select {
  width: 100%;
  height: 52px;
  padding: 12px 14px;
  border: 1px solid #cbd9e2;
  border-radius: var(--radius-control);
  background: var(--account-surface);
  color: var(--account-text);
  font-size: 16px;
  cursor: pointer;
  appearance: auto;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

.renewal-option__select:hover:not(:disabled) {
  border-color: #a9bfcd;
}

.renewal-option__select:focus {
  border-color: var(--account-brand);
  box-shadow: 0 0 0 4px var(--account-focus);
  outline: 0;
}

.renewal-option__select:disabled {
  border-color: var(--account-border);
  background: var(--account-surface-soft);
  color: var(--account-text-muted);
  cursor: not-allowed;
}

.renewal-option__help {
  margin: auto 0 0;
  color: var(--account-text-muted);
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .renewal-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .renewal-option {
    min-height: 0;
  }
}

.renewal-summary {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Колонки расчета и суммы фиксированной ширины. Каждая строка — собственный grid,
   поэтому auto-колонки вставали бы по своей ширине и расчет уезжал бы от строки к строке. */
.renewal-summary__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px 130px;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--account-border);
}

.renewal-summary__quantity {
  color: var(--account-text-muted);
}

.renewal-summary__total {
  text-align: right;
}

.renewal-summary__access {
  margin: 16px 0 0;
  color: var(--account-text-muted);
}

.renewal-summary__grand {
  margin: 8px 0 20px;
  font-size: 24px;
  line-height: 1.3;
}

@media (max-width: 760px) {
  .renewal-summary__item {
    grid-template-columns: minmax(0, 1fr) auto;
  }


  /* На узком экране расчет переносится под название строки: 200px колонка там уже
     не помещается рядом с суммой. */
  .renewal-summary__quantity {
    grid-column: 1 / -1;
  }
}
