/* Единый каркас авторизованных разделов. */
.account-workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.account-workspace-main {
  min-width: 0;
}

.account-sidebar {
  position: sticky;
  top: 90px;
  min-width: 0;
}

.account-sidebar-desktop {
  display: grid;
  gap: 18px;
  padding: 18px 14px;
  border: 1px solid rgba(139, 171, 217, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 8px 24px rgba(16, 41, 82, 0.035);
}

.account-sidebar-title {
  padding: 0 10px;
  color: #7186a2;
  font-family: "Inter", var(--font-ui);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-nav {
  display: grid;
  gap: 4px;
}

.account-nav-label {
  margin: 14px 10px 5px;
  color: #7b8fa8;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.account-nav-link {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 11px;
  color: #526a87;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.25;
  text-decoration: none;
  transition: color 0.16s ease, background-color 0.16s ease;
}

.account-nav-link svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-nav-link:hover {
  color: #244f80;
  background: rgba(226, 238, 253, 0.7);
}

.account-nav-link.is-active {
  color: #176edf;
  background: #e8f2ff;
}

.account-nav-link:focus-visible,
.account-sections-mobile > summary:focus-visible {
  outline: 3px solid rgba(49, 119, 213, 0.3);
  outline-offset: 2px;
}

.account-sections-mobile {
  display: none;
}

/* Широкими делаем только страницы, которым действительно нужна таблица. */
.account-workspace-main .pp-billing-layout,
.account-workspace-main .pp-ledger-layout {
  max-width: none;
}

/* Тарифы и пакеты: продуктовые карточки вместо широкой админской таблицы. */
.pp-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.pp-product-card {
  display: flex;
  min-width: 0;
  min-height: 260px;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  border: 1px solid rgba(139, 171, 217, 0.24);
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(83, 183, 255, 0.12), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f6f9fe 100%);
  box-shadow: 0 12px 28px rgba(16, 41, 82, 0.055);
}

.pp-product-head,
.pp-product-price {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.pp-product-title {
  margin: 0;
  color: #58708d;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.pp-product-voices {
  color: #17385f;
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  line-height: 1.08;
  font-variant-numeric: tabular-nums;
}

.pp-product-voices span {
  display: block;
  margin-top: 5px;
  color: #607792;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.pp-product-duration {
  color: #7186a2;
  font-size: 0.84rem;
}

.pp-product-price {
  margin-top: auto;
}

.pp-product-price strong {
  color: #18365b;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}

.pp-product-price > span:not(.pp-status-pill) {
  color: #7186a2;
  font-size: 0.8rem;
}

.pp-product-price .pp-status-pill {
  width: fit-content;
  margin-top: 2px;
}

.pp-product-action,
.pp-product-action .button {
  width: 100%;
}

.pp-product-notes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding-top: 2px;
}

.pp-form-panel .pp-product-notes .pp-hint {
  max-width: none;
}

.pp-product-notes .pp-hint:last-child {
  justify-self: start;
  max-width: none;
}

/* История операций: отдельная таблица без административного min-width. */
.pp-ledger-card {
  gap: 16px;
  padding: 10px 24px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 36px rgba(16, 41, 82, 0.07);
}

.pp-ledger-table-wrap {
  min-width: 0;
}

.pp-ledger-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  color: #18365b;
  font-size: 0.92rem;
}

.pp-ledger-table th,
.pp-ledger-table td {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(185, 205, 235, 0.42);
  text-align: left;
  vertical-align: middle;
}

.pp-ledger-table th {
  padding-top: 12px;
  padding-bottom: 11px;
  color: #657d9b;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.pp-ledger-table th:nth-child(1) {
  width: 25%;
}

.pp-ledger-table th:nth-child(2) {
  width: 39%;
}

.pp-ledger-table th:nth-child(3),
.pp-ledger-table th:nth-child(4) {
  width: 18%;
}

.pp-ledger-table tbody tr:last-child td {
  border-bottom: 0;
}

.pp-ledger-date,
.pp-ledger-delta {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pp-ledger-operation {
  overflow-wrap: anywhere;
  font-weight: 650;
}

.pp-ledger-delta {
  font-weight: 750;
}

.pp-ledger-delta.is-credit {
  color: #167551;
}

.pp-ledger-delta.is-debit {
  color: #9b4a3e;
}

.pp-ledger-source span {
  display: inline-flex;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 999px;
  color: #58708d;
  background: #f0f5fb;
  font-size: 0.78rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.pp-ledger-pagination {
  padding-top: 4px;
}

@media (max-width: 1120px) {
  .account-workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .account-sidebar {
    position: static;
  }

  .account-sidebar-desktop {
    display: none;
  }

  .account-sections-mobile {
    display: block;
    border: 1px solid rgba(139, 171, 217, 0.24);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 10px 28px rgba(16, 41, 82, 0.05);
  }

  .account-sections-mobile > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    padding: 10px 16px;
    list-style: none;
    color: #18365b;
    cursor: pointer;
  }

  .account-sections-mobile > summary::-webkit-details-marker {
    display: none;
  }

  .account-sections-mobile > summary span {
    display: grid;
    gap: 2px;
  }

  .account-sections-mobile > summary small {
    color: #7b8fa8;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }

  .account-sections-mobile > summary strong {
    font-size: 0.94rem;
  }

  .account-sections-mobile > summary > svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    stroke: #607792;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.16s ease;
  }

  .account-sections-mobile[open] > summary > svg {
    transform: rotate(180deg);
  }

  .account-sections-mobile > .account-nav {
    gap: 3px;
    padding: 0 8px 10px;
    border-top: 1px solid rgba(185, 205, 235, 0.34);
  }

  .account-sections-mobile .account-nav-label {
    margin-top: 12px;
  }
}

@media (max-width: 720px) {
  .pp-product-card {
    min-height: 0;
  }

  .pp-ledger-card {
    padding: 4px 18px 18px;
    border-radius: 20px;
  }

  .pp-ledger-table,
  .pp-ledger-table tbody {
    display: block;
  }

  .pp-ledger-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .pp-ledger-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "operation delta"
      "date source";
    gap: 8px 14px;
    padding: 16px 2px;
    border-bottom: 1px solid rgba(185, 205, 235, 0.42);
  }

  .pp-ledger-table tbody tr:last-child {
    border-bottom: 0;
  }

  .pp-ledger-table td {
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .pp-ledger-operation {
    grid-area: operation;
  }

  .pp-ledger-delta {
    grid-area: delta;
    text-align: right;
  }

  .pp-ledger-date {
    grid-area: date;
    align-self: center;
    color: #7186a2;
    font-size: 0.78rem;
  }

  .pp-ledger-source {
    grid-area: source;
    justify-self: end;
  }

  .pp-ledger-source span {
    padding: 2px 0;
    background: transparent;
    font-size: 0.75rem;
  }
}

@media (max-width: 420px) {
  .account-page {
    padding-top: 18px;
  }

  .account-workspace {
    gap: 16px;
  }

  .account-sections-mobile > summary {
    min-height: 58px;
    padding: 9px 13px;
  }

  .account-nav-link {
    min-height: 40px;
    font-size: 0.84rem;
  }

  .pp-ledger-table tr {
    grid-template-areas:
      "operation delta"
      "date date"
      "source source";
    gap: 7px 10px;
  }

  .pp-ledger-source {
    justify-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .account-nav-link,
  .account-sections-mobile > summary > svg {
    transition: none;
  }
}
