/*
  Shared application shell and page styles for the Stud.kz ID web views.
*/

@font-face {
    font-family: "Roboto";
    src: url("/static/fonts/roboto400_ce.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-color: #ffffff;
    --bg-accent: #f8fafc;
    --text-color: #111827;
    --muted-text: #6b7280;
    --accent-color: #72c02c;
    --accent-color-strong: #3f7416;
    --accent-color-hover: #64ad25;
    --accent-bg: #eef9e7;
    --card-bg: #ffffff;
    --card-bg-strong: #f8fafc;
    --border-color: #e5e7eb;
    --shadow-color: rgba(17, 24, 39, 0.12);
    --error-color: #b42318;
    --error-bg: #fef3f2;
    --success-color: #3f7416;
    --success-bg: #eef9e7;
    --btn-google-bg: #ffffff;
    --btn-google-border: #dadce0;
    --btn-google-text: #3c4043;
    --btn-apple-bg: #ffffff;
    --btn-apple-border: #d1d5db;
    --btn-apple-text: #111827;
    --btn-primary-text: #111827;
    --tabbar-bg: #ffffff;
    --tabbar-glass-bg: rgba(255, 255, 255, 0.82);
    --tabbar-glass-border: rgba(255, 255, 255, 0.55);
    --tabbar-icon-muted: #697386;
    --tabbar-active-bg: rgba(104, 200, 43, 0.14);
    --tabbar-shadow:
        0 18px 42px -24px rgba(17, 24, 39, 0.42),
        0 8px 20px -18px rgba(17, 24, 39, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text-color);
    background: linear-gradient(180deg, var(--bg-color) 0%, var(--bg-accent) 42%, var(--bg-accent) 100%);
    font-family: "Roboto", Arial, sans-serif;
    line-height: 20px;
    letter-spacing: 1px;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: var(--accent-color-strong);
}

body.layout-shell,
body.layout-centered {
    display: flex;
    justify-content: center;
}

body.layout-shell {
    align-items: flex-start;
    padding: 28px 0 32px;
}

body.layout-centered {
    align-items: center;
    padding: 24px 0;
}

body.has-tabbar {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    box-sizing: border-box;
}

.page-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 18px 44px -34px var(--shadow-color);
}

.hero-card {
    background:
        linear-gradient(140deg, rgba(114, 192, 44, 0.12), rgba(114, 192, 44, 0.02)),
        var(--card-bg);
}

.section-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-header,
.app-header,
.section-header {
    text-align: center;
}

.page-title-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.page-title-row h1 {
    grid-column: 2;
    min-width: 0;
    overflow-wrap: anywhere;
}

.page-title-row + p {
    margin: 12px 0 0;
}

.page-back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background-color: var(--card-bg-strong);
    color: var(--text-color);
    text-decoration: none;
    box-shadow: 0 12px 26px -22px var(--shadow-color);
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.page-back-button:hover,
.page-back-button:focus-visible {
    border-color: var(--accent-color);
    background-color: var(--accent-bg);
    color: var(--accent-color-strong);
    box-shadow: 0 14px 28px -22px rgba(79, 143, 29, 0.75);
    transform: translateY(-1px);
    outline: none;
}

.page-back-icon {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.app-header h2 {
    margin: 0;
}

.card-header {
    margin-bottom: 24px;
}

.card-header h1,
.card-header h2,
.section-title {
    margin: 0;
    color: var(--text-color);
    line-height: 1.2;
    letter-spacing: 0;
}

.card-header h1 {
    font-size: 28px;
}

.card-header h2,
.app-header h2 {
    font-size: 24px;
    line-height: 1.2;
}

.card-header p,
.section-header p,
.status-message,
.detail-card p {
    color: var(--muted-text);
    line-height: 1.5;
}

.detail-label {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--accent-color-strong);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.section-title {
    margin-bottom: 16px;
    font-size: 18px;
}

.app-grid,
.auth-providers,
.status-actions,
.action-group,
.identity-link-actions,
.identity-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-providers[hidden] {
    display: none;
}

.auth-card .status-actions[hidden],
.status-actions > [hidden] {
    display: none;
}

.quick-registration-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.quick-registration-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    text-align: center;
}

.app-card,
.detail-card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background-color: var(--card-bg-strong);
}

.app-card {
    display: flex;
    align-items: center;
    padding: 15px;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.app-card:hover,
.app-card:focus-visible,
.app-card.is-active {
    transform: translateY(-1px);
    border-color: var(--accent-color);
    background-color: var(--accent-bg);
    outline: none;
}

.app-logo img,
.app-logo-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 12px;
}

.app-logo-placeholder {
    background-color: var(--accent-color);
    color: var(--btn-primary-text);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
}

.app-info {
    margin-left: 15px;
}

.app-info h3 {
    margin: 0;
    font-size: 16px;
}

.root-home-card {
    gap: 18px;
}

.root-language-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.root-language-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0;
    text-align: center;
    text-decoration: none;
    background-color: var(--card-bg-strong);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.root-language-button:hover,
.root-language-button:focus-visible {
    border-color: var(--accent-color);
    background-color: var(--accent-bg);
    outline: none;
}

.root-home-header {
    margin-bottom: 0;
}

.root-home-header p {
    margin: 14px 0 0;
    letter-spacing: 0;
}

.root-legal-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--muted-text);
    font-size: 14px;
    letter-spacing: 0;
}

.root-legal-links a {
    color: var(--accent-color-strong);
    font-weight: 800;
    text-decoration: none;
}

.root-legal-links a:hover,
.root-legal-links a:focus-visible {
    text-decoration: underline;
}

.legal-page-card {
    gap: 14px;
    color: var(--text-color);
    letter-spacing: 0;
    text-align: left;
}

.legal-page-card > div {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.legal-page-card h1,
.legal-page-card h2,
.legal-page-card h3 {
    margin: 0 0 8px;
    color: var(--text-color);
    font-size: 22px;
    line-height: 1.25;
    letter-spacing: 0;
}

.legal-page-card p,
.legal-page-card li {
    color: var(--text-color);
    line-height: 1.55;
    letter-spacing: 0;
}

.legal-page-card p {
    margin: 0;
}

.legal-page-card ol,
.legal-page-card ul {
    margin: 4px 0 0;
    padding-left: 22px;
}

.legal-page-card li {
    margin: 0 0 10px;
}

.legal-empty-state .card-header {
    margin-bottom: 0;
}

.not-found-card {
    text-align: center;
}

.not-found-card .card-header {
    margin-bottom: 0;
}

.not-found-card .card-header p {
    margin: 12px 0 0;
}

.not-found-code {
    margin: 0;
    color: var(--accent-color-strong);
    font-size: 56px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
}

.not-found-links {
    display: grid;
    gap: 10px;
    text-align: left;
}

.not-found-link {
    display: grid;
    gap: 4px;
    min-height: 68px;
    box-sizing: border-box;
    padding: 13px 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background-color: var(--card-bg-strong);
    color: var(--text-color);
    text-decoration: none;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.18s ease;
}

.not-found-link:hover,
.not-found-link:focus-visible {
    border-color: var(--accent-color);
    background-color: var(--accent-bg);
    outline: none;
    transform: translateY(-1px);
}

.not-found-link-main {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0;
}

.not-found-link-sub {
    color: var(--muted-text);
    font-size: 13px;
    line-height: 1.35;
    letter-spacing: 0;
}

@media (min-width: 380px) {
    .root-language-buttons {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.detail-grid {
    display: grid;
    gap: 14px;
}

.detail-card {
    padding: 18px;
}

.detail-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
}

.detail-card-accent {
    background:
        linear-gradient(140deg, rgba(114, 192, 44, 0.12), rgba(114, 192, 44, 0.03)),
        var(--accent-bg);
}

.balance-actions-section .section-header {
    text-align: left;
}

.balance-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.balance-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.balance-account {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background-color: var(--card-bg-strong);
}

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

.balance-account-main h2 {
    margin: 0 0 6px;
    font-size: 17px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.balance-account-main p,
.balance-amount span {
    margin: 0;
    color: var(--muted-text);
    font-size: 13px;
    line-height: 1.35;
}

.balance-account-main span {
    color: var(--text-color);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.balance-amount {
    flex: 0 0 auto;
    min-width: 110px;
    text-align: right;
}

.balance-amount strong {
    display: block;
    margin-top: 4px;
    font-size: 19px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.balance-status {
    margin-bottom: 0;
}

.balance-status.is-error {
    color: var(--error-color);
}

.top-up-section {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.top-up-header-block {
    padding: 18px;
    text-align: center;
}

.top-up-header-block h1 {
    margin: 0;
    color: var(--text-color);
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: 0;
}

.top-up-card,
.top-up-message-block {
    padding: 18px;
}

.top-up-message-block {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.top-up-status {
    margin: 0;
}

.top-up-status.is-error {
    color: var(--error-color);
}

.top-up-status.is-success {
    color: var(--success-color);
}

.top-up-kaspi-block {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background:
        linear-gradient(135deg, rgba(220, 38, 38, 0.05), rgba(203, 166, 89, 0.08)),
        var(--card-bg);
}

.top-up-kaspi-main {
    align-self: flex-end;
    width: 100%;
    min-width: 0;
    gap: 10px;
    border: 1px solid #b58d3e;
    background-color: #cba659;
    color: #ffffff;
    box-shadow: 0 14px 28px -22px rgba(107, 78, 27, 0.88);
}

.top-up-kaspi-main:hover,
.top-up-kaspi-main:focus-visible {
    border-color: #9b7530;
    background-color: #b99141;
    color: #ffffff;
    box-shadow: 0 16px 30px -22px rgba(107, 78, 27, 0.92);
}

.top-up-kaspi-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
}

.top-up-kaspi-label {
    font-size: 16px;
    font-weight: 800;
}

.top-up-kaspi-label-desktop {
    display: none;
}

.top-up-action-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.top-up-kaspi-red {
    border: 1px solid #cf3528;
    background-color: #dc2626;
    color: #ffffff;
    box-shadow: 0 12px 24px -20px rgba(177, 36, 25, 0.9);
}

.top-up-kaspi-red:hover,
.top-up-kaspi-red:focus-visible {
    border-color: #b91c1c;
    background-color: #b91c1c;
    color: #ffffff;
    box-shadow: 0 14px 28px -20px rgba(177, 36, 25, 0.95);
}

.top-up-kaspi-installment {
    border: 1px solid #cf3528;
    background-color: #ffffff;
    color: #b42318;
}

.top-up-kaspi-installment:hover,
.top-up-kaspi-installment:focus-visible {
    border-color: #b91c1c;
    background-color: #fff7f6;
    color: #9f1c14;
}

.top-up-user-id {
    margin: 0;
    color: var(--muted-text);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.top-up-user-id span {
    display: inline-block;
    margin-left: 4px;
    padding: 4px 10px;
    border-radius: 10px;
    background-color: #fef3c7;
    color: var(--text-color);
    font-weight: 800;
}

.top-up-halyk-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(0, 134, 105, 0.08), rgba(0, 134, 105, 0.02)),
        var(--card-bg);
}

.top-up-tiptop-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px;
    border: 1px solid #d8c6fb;
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(14, 165, 233, 0.05)),
        var(--card-bg);
}

.top-up-tiptop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.top-up-tiptop-logo {
    display: flex;
    min-width: 136px;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border: 1px solid #d8c6fb;
    border-radius: 12px;
    background-color: #ffffff;
    color: #5b21b6;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0;
}

.top-up-tiptop-status {
    margin: -4px 0 0;
    font-size: 14px;
}

.top-up-tiptop-status.is-error {
    color: var(--error-color);
}

.top-up-tiptop-status.is-success {
    color: var(--success-color);
}

.top-up-tiptop-button {
    gap: 9px;
    border: 1px solid #6d28d9;
    background-color: #7c3aed;
    color: #ffffff;
    box-shadow: 0 12px 24px -20px rgba(109, 40, 217, 0.9);
}

.top-up-tiptop-button:hover,
.top-up-tiptop-button:focus-visible {
    border-color: #5b21b6;
    background-color: #6d28d9;
    color: #ffffff;
    box-shadow: 0 14px 28px -20px rgba(91, 33, 182, 0.95);
}

.top-up-tiptop-new-card-button {
    gap: 9px;
    border: 1px solid #c7d2fe;
    background-color: #ffffff;
    color: #5b21b6;
}

.top-up-tiptop-new-card-button:hover,
.top-up-tiptop-new-card-button:focus-visible {
    border-color: #7c3aed;
    background-color: #f5f3ff;
    color: #5b21b6;
}

.top-up-tiptop-new-card-button .top-up-halyk-spinner {
    border-color: rgba(124, 58, 237, 0.24);
    border-top-color: #7c3aed;
}

.top-up-halyk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.top-up-halyk-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 108px;
    height: 52px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: #ffffff;
}

.top-up-halyk-logo img {
    width: 84px;
    max-height: 34px;
}

.top-up-halyk-chip {
    width: 46px;
    height: 32px;
    flex: 0 0 auto;
}

.top-up-halyk-amount-group {
    gap: 10px;
}

.top-up-halyk-amount-field {
    position: relative;
}

.top-up-halyk-amount-input {
    padding-right: 64px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0;
}

.top-up-halyk-amount-field span {
    position: absolute;
    top: 50%;
    right: 16px;
    color: var(--muted-text);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    transform: translateY(-50%);
}

.top-up-halyk-saved {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.top-up-halyk-saved[hidden],
.top-up-halyk-actions .provider-btn[hidden] {
    display: none;
}

.top-up-halyk-saved-title {
    color: var(--text-color);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: 0;
}

.top-up-halyk-card-empty {
    margin: 0;
    color: var(--muted-text);
    font-size: 13px;
    line-height: 1.45;
    letter-spacing: 0;
}

.top-up-halyk-card-list {
    display: grid;
    gap: 9px;
}

.top-up-halyk-card-option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: #ffffff;
    cursor: pointer;
}

.top-up-halyk-card-choice {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
    cursor: pointer;
}

.top-up-halyk-card-option:has(input:checked) {
    border-color: #008669;
    background-color: #f1fbf8;
}

.top-up-halyk-card-option.is-disabled {
    cursor: default;
}

.top-up-halyk-card-option.is-disabled .top-up-halyk-card-choice {
    cursor: not-allowed;
    opacity: 0.58;
}

.top-up-tiptop-card-option:has(input:checked) {
    border-color: #7c3aed;
    background-color: #f5f3ff;
}

.top-up-halyk-card-option input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #008669;
}

.top-up-tiptop-card-option input {
    accent-color: #7c3aed;
}

.top-up-tiptop-card-marker {
    width: 18px;
    height: 18px;
    border: 2px solid #4b7bec;
    border-radius: 50%;
    background-color: #ffffff;
    box-shadow: inset 0 0 0 4px #ffffff;
}

.top-up-tiptop-card-option .top-up-tiptop-card-marker {
    background-color: #4b7bec;
}

.top-up-card-delete-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    background-color: transparent;
    color: #94a3b8;
    cursor: pointer;
}

.top-up-card-delete-button:hover,
.top-up-card-delete-button:focus-visible {
    border-color: #fecaca;
    background-color: #fef2f2;
    color: #b91c1c;
}

.top-up-card-delete-button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.top-up-card-delete-button.is-loading {
    border-color: #fecaca;
    background-color: #fef2f2;
    color: #b91c1c;
}

.top-up-card-delete-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.top-up-card-delete-spinner {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    border: 2px solid rgba(185, 28, 28, 0.24);
    border-top-color: #b91c1c;
    border-radius: 999px;
    animation: top-up-spin 0.85s linear infinite;
}

.top-up-halyk-card-details {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.top-up-halyk-card-mask {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text-color);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 0;
}

.top-up-halyk-card-meta {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--muted-text);
    font-size: 12px;
    line-height: 1.35;
    letter-spacing: 0;
    text-transform: uppercase;
}

.top-up-halyk-status {
    margin: -4px 0 0;
    font-size: 14px;
}

.top-up-halyk-status.is-error {
    color: var(--error-color);
}

.top-up-halyk-status.is-success {
    color: var(--success-color);
}

.top-up-halyk-balance-link {
    align-self: flex-start;
    color: var(--accent-color-strong);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: 0;
    text-decoration: none;
}

.top-up-halyk-balance-link:hover,
.top-up-halyk-balance-link:focus-visible {
    text-decoration: underline;
}

.top-up-halyk-actions {
    display: grid;
    gap: 10px;
}

.top-up-halyk-button {
    gap: 9px;
    border: 1px solid #00775e;
    background-color: #008669;
    color: #ffffff;
    box-shadow: 0 12px 24px -20px rgba(0, 119, 94, 0.9);
}

.top-up-halyk-button:hover,
.top-up-halyk-button:focus-visible {
    border-color: #006b54;
    background-color: #00775e;
    color: #ffffff;
    box-shadow: 0 14px 28px -20px rgba(0, 107, 84, 0.95);
}

.top-up-halyk-new-card-button {
    gap: 9px;
    border: 1px solid #cbd5e1;
    background-color: #ffffff;
    color: #0f513f;
}

.top-up-halyk-new-card-button:hover,
.top-up-halyk-new-card-button:focus-visible {
    border-color: #008669;
    background-color: #f1fbf8;
    color: #006b54;
}

.top-up-halyk-pay-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.top-up-halyk-spinner {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    border-radius: 999px;
    animation: top-up-spin 0.85s linear infinite;
}

@keyframes top-up-spin {
    to {
        transform: rotate(360deg);
    }
}

.top-up-kaspi-block [data-kaspi-pay-url]:focus-visible,
.top-up-kaspi-installment:focus-visible,
.top-up-modal-card a:focus-visible,
.top-up-modal-close:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.modal-overlay.top-up-modal-overlay {
    padding: 16px;
    background-color: rgba(17, 24, 39, 0.48);
    animation: none;
}

.modal-card.top-up-modal-card {
    max-width: 440px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    text-align: center;
    animation: none;
}

.top-up-modal-close-row {
    display: flex;
    justify-content: flex-end;
    margin: -8px -6px 8px 0;
}

.top-up-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 999px;
    background-color: transparent;
    cursor: pointer;
}

.top-up-modal-close:hover {
    border-color: var(--border-color);
    background-color: var(--card-bg-strong);
}

.top-up-modal-close-icon {
    width: 20px;
    height: 20px;
}

.top-up-modal-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 14px;
}

.top-up-modal-card .section-title {
    margin-bottom: 16px;
    overflow-wrap: anywhere;
}

.top-up-modal-copy {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.top-up-modal-copy p {
    margin: 0;
    color: var(--muted-text);
    font-size: 15px;
    line-height: 1.5;
}

.top-up-modal-actions {
    justify-content: flex-end;
}

.top-up-modal-actions .provider-btn {
    width: auto;
    max-width: 100%;
}

@media (min-width: 481px) {
    .top-up-action-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .top-up-halyk-actions.has-saved-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .top-up-section {
        gap: 20px;
    }

    .top-up-card {
        padding: 20px;
    }

    .top-up-kaspi-main {
        width: auto;
        min-width: 210px;
    }

    .top-up-kaspi-label-mobile {
        display: none;
    }

    .top-up-kaspi-label-desktop {
        display: inline;
    }
}

.transactions-section {
    max-width: 620px;
    margin: 0 auto;
}

.transactions-status {
    margin-bottom: 0;
}

.transactions-status.is-error {
    color: var(--error-color);
}

.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.transaction-item {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background-color: var(--card-bg-strong);
}

.transaction-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.transaction-main {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
}

.transaction-main strong {
    font-size: 17px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.transaction-main time,
.transaction-amount span,
.transaction-entries dt span {
    color: var(--muted-text);
    font-size: 13px;
    line-height: 1.35;
}

.transaction-amount {
    flex: 0 0 auto;
    min-width: 96px;
    text-align: right;
}

.transaction-amount strong {
    display: block;
    margin-bottom: 4px;
    font-size: 19px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.transaction-entries {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.transaction-entries div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.transaction-entries dt,
.transaction-entries dd {
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
}

.transaction-entries dt {
    color: var(--text-color);
    overflow-wrap: anywhere;
}

.transaction-entries dd {
    flex: 0 0 auto;
    font-weight: 700;
    text-align: right;
}

.withdrawal-section {
    max-width: 620px;
    margin: 0 auto;
}

.withdrawal-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 22px;
    padding: 18px 20px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background-color: var(--card-bg-strong);
}

.withdrawal-summary span {
    color: var(--muted-text);
    font-size: 14px;
    font-weight: 700;
}

.withdrawal-summary strong {
    color: var(--text-color);
    font-size: 26px;
    line-height: 1.1;
    text-align: right;
    overflow-wrap: anywhere;
}

.withdrawal-form {
    margin-top: 0;
}

.withdrawal-metadata-field[hidden] {
    display: none;
}

.withdrawal-error-state {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.withdrawal-error-state .status-message {
    margin-bottom: 0;
}

.withdrawal-error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.withdrawal-error-actions .provider-btn {
    width: auto;
    min-width: 150px;
    flex: 1 1 150px;
}

.withdrawal-status.is-success {
    color: var(--success-color);
}

.withdrawal-status.is-error {
    color: var(--error-color);
}

.withdrawal-history {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--border-color);
}

.withdrawal-history-header {
    margin-bottom: 12px;
}

.withdrawal-history-header h2 {
    margin: 0;
    color: var(--text-color);
    font-size: 18px;
    line-height: 1.25;
}

.withdrawal-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.withdrawal-history-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
}

.withdrawal-history-item:last-child {
    border-bottom: 0;
}

.withdrawal-history-main {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.withdrawal-history-main strong {
    color: var(--text-color);
    font-size: 18px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.withdrawal-history-main span,
.withdrawal-history-main time {
    color: var(--muted-text);
    font-size: 13px;
    line-height: 1.3;
}

.withdrawal-history-state {
    display: flex;
    min-width: 104px;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    text-align: right;
}

.withdrawal-history-state small {
    color: var(--muted-text);
    font-size: 12px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.withdrawal-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-bg-strong);
    color: var(--muted-text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.1;
}

.withdrawal-status-badge.is-succeeded {
    background-color: var(--success-bg);
    color: var(--success-color);
}

.withdrawal-status-badge.is-failed,
.withdrawal-status-badge.is-rejected,
.withdrawal-status-badge.is-cancelled {
    background-color: var(--error-bg);
    color: var(--error-color);
}

.subscription-section .card-header {
    margin-bottom: 0;
}

.subscriptions-toggle {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    border-radius: 8px;
    cursor: pointer;
    list-style: none;
}

.subscriptions-toggle::-webkit-details-marker {
    display: none;
}

.subscriptions-toggle:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 4px;
}

.subscriptions-toggle .section-title {
    grid-column: 2;
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.subscriptions-toggle-icon {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.subscriptions-disclosure[open] .subscriptions-toggle-icon {
    transform: rotate(180deg);
}

.subscriptions-disclosure > .plans-list {
    margin-top: 20px;
}

.subscription-status {
    margin-bottom: 0;
}

.subscription-status.is-error {
    color: var(--error-color);
}

.subscription-status.is-success {
    color: var(--success-color);
}

.subscription-success-actions {
    justify-content: flex-end;
}

.current-plan-card,
.plan-card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background-color: var(--card-bg-strong);
}

.current-plan-card {
    padding: 18px;
}

.current-plan-card.is-active {
    background:
        linear-gradient(140deg, rgba(114, 192, 44, 0.12), rgba(114, 192, 44, 0.03)),
        var(--accent-bg);
}

.current-plan-card strong {
    display: block;
    margin-bottom: 12px;
    font-size: 18px;
    line-height: 1.2;
}

.subscription-facts {
    display: grid;
    gap: 10px;
    margin: 0;
}

.subscription-facts div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.subscription-facts dt,
.subscription-facts dd {
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
}

.subscription-facts dt {
    color: var(--muted-text);
}

.subscription-facts dd {
    text-align: right;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.plans-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.plan-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
}

.page-stack > .plan-card {
    align-self: stretch;
    width: 100%;
    box-sizing: border-box;
}

.plan-card.is-active {
    border-color: var(--accent-color);
    background:
        linear-gradient(140deg, rgba(114, 192, 44, 0.12), rgba(114, 192, 44, 0.03)),
        var(--accent-bg);
}

.plan-card-head,
.plan-title-block,
.plan-price-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.plan-card-head,
.plan-price-row {
    justify-content: space-between;
}

.plan-title-block {
    min-width: 0;
}

.plan-icon {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background-color: var(--accent-color-strong);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
}

.plan-icon img {
    display: block;
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.plan-title-block h2 {
    margin: 0 0 4px;
    font-size: 18px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.plan-title-block p,
.plan-empty {
    margin: 0;
    color: var(--muted-text);
    font-size: 13px;
    line-height: 1.4;
}

.plan-badge {
    flex: 0 0 auto;
    padding: 6px 9px;
    border-radius: 999px;
    background-color: var(--success-bg);
    color: var(--success-color);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.plan-price-row strong {
    font-size: 24px;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.subscription-offers .plan-price-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
}

.subscription-offers .plan-duration {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    color: var(--text-color);
    font-family: Arial, "Nimbus Sans", sans-serif;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: normal;
    white-space: nowrap;
}

.subscription-offers .plan-duration-label {
    font-weight: 400;
}

.subscription-offers .plan-duration-value {
    font-weight: 600;
}

.subscription-offers .plan-duration svg {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (min-width: 768px) {
    .subscription-offers .plan-duration {
        font-size: 18px;
    }
}

.plan-promotion {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
}

.plan-promotion-prices {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
}

.plan-regular-price {
    color: var(--muted-text);
    font-size: 15px;
    line-height: 1.2;
}

.plan-promotion-countdown {
    margin: 0;
    color: var(--muted-text);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
}

.plan-promotion-countdown time {
    font-variant-numeric: tabular-nums;
}

.plan-benefits {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.plan-benefits + .plan-benefits {
    margin-top: -2px;
}

.plan-benefits li {
    position: relative;
    padding-left: 18px;
    color: var(--muted-text);
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.plan-benefits-highlight li {
    color: var(--text-color);
    font-size: 14px;
    font-weight: 650;
}

.plan-benefits li::before {
    content: "";
    position: absolute;
    top: 0.62em;
    left: 2px;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background-color: var(--accent-color);
}

.plan-benefits-secondary li::before {
    background-color: var(--border-color);
}

.plan-entitlement-description {
    display: block;
}

.plan-entitlement-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.plan-entitlement-title {
    color: var(--text-color);
    font-size: 14px;
}

.plan-entitlement-value {
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--text-color);
    font-weight: 700;
    text-align: right;
}

.plan-entitlement-description {
    margin-top: 2px;
}

.plan-gift-credit {
    padding: 12px 14px;
    border: 1px solid rgba(114, 192, 44, 0.45);
    border-radius: 12px;
    background-color: rgba(114, 192, 44, 0.08);
}

.plan-gift-credit-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-color);
    font-size: 14px;
}

.plan-gift-credit-row strong {
    margin-left: auto;
    color: var(--accent-color-strong);
    text-align: right;
}

.plan-gift-credit p {
    margin: 4px 0 0;
    color: var(--muted-text);
    font-size: 13px;
    line-height: 1.4;
}

.auth-signup-gift {
    box-sizing: border-box;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(114, 192, 44, 0.45);
    border-radius: 12px;
    background-color: rgba(114, 192, 44, 0.08);
    color: var(--text-color);
    text-align: left;
}

.auth-signup-gift-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.auth-signup-gift-icon {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    color: var(--accent-color-strong);
}

.auth-signup-gift-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

.auth-signup-gift-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    line-height: 1.4;
}

.auth-signup-gift-provider {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.auth-signup-gift-provider-icon {
    flex-shrink: 0;
    display: block;
    width: 16px;
    min-width: 16px;
    max-width: 16px;
    height: 16px;
    min-height: 16px;
    max-height: 16px;
}

.auth-signup-gift-amount {
    margin-left: auto;
    color: var(--accent-color-strong);
    font-size: 16px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.auth-signup-gift-note {
    margin: 8px 0 0;
    color: var(--muted-text);
    font-size: 13px;
    line-height: 1.4;
}

.plan-card form {
    margin: 0;
}

.purchase-assets-page .card-header {
    margin-bottom: 0;
}

.purchase-assets-status {
    margin-bottom: 0;
}

.purchase-assets-status.is-error {
    color: var(--error-color);
}

.purchase-assets-detail-grid,
.purchase-assets-state-grid {
    display: grid;
    gap: 10px;
}

.purchase-assets-detail-row,
.purchase-assets-state-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.purchase-assets-detail-row:last-child,
.purchase-assets-state-row:last-child {
    border-bottom: 0;
}

.purchase-assets-detail-row span,
.purchase-assets-state-row span {
    color: var(--muted-text);
    font-size: 13px;
    line-height: 1.35;
}

.purchase-assets-detail-row strong,
.purchase-assets-state-row strong {
    min-width: 0;
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.35;
    text-align: right;
    overflow-wrap: anywhere;
}

.purchase-assets-detail-row .purchase-assets-inline-action {
    display: inline-flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
    font-weight: 500;
}

.purchase-assets-muted-value,
.purchase-assets-inline-separator {
    color: var(--muted-text);
}

.purchase-assets-inline-action a {
    color: var(--accent-color-strong);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.purchase-assets-inline-action a:hover {
    color: var(--accent-color-hover);
    text-decoration: underline;
}

.purchase-assets-state-grid {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background-color: var(--card-bg-strong);
}

.purchase-assets-form {
    margin: 0;
}

.purchase-assets-faq-list {
    display: grid;
    gap: 10px;
}

.purchase-assets-faq-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-bg-strong);
    overflow: hidden;
}

.purchase-assets-faq-question {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    list-style: none;
    padding: 14px 16px;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.purchase-assets-faq-question::marker {
    content: "";
}

.purchase-assets-faq-question::-webkit-details-marker {
    display: none;
}

.purchase-assets-faq-question-text {
    min-width: 0;
}

.purchase-assets-faq-question::after {
    content: "+";
    flex: 0 0 auto;
    color: var(--muted-text);
    font-weight: 600;
}

.purchase-assets-faq-item[open] .purchase-assets-faq-question::after {
    content: "-";
}

.purchase-assets-faq-answer {
    display: grid;
    gap: 12px;
    padding: 10px 16px 18px;
    color: #374151;
    font-size: 15px;
    line-height: 1.65;
}

.purchase-assets-faq-answer p {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.purchase-assets-faq-extra {
    color: var(--text-color);
}

.purchase-assets-result-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.purchase-assets-result-card h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: 0;
}

.friends-page {
    padding-bottom: 8px;
}

.friends-card .card-header {
    margin-bottom: 0;
}

.friends-header p {
    margin: 12px 0 0;
    letter-spacing: 0;
}

.friends-info-box {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background-color: var(--card-bg-strong);
}

.friends-info-box h2 {
    margin: 0 0 12px;
    color: var(--text-color);
    font-size: 16px;
    line-height: 1.25;
    letter-spacing: 0;
}

.friends-info-list {
    display: grid;
    gap: 10px;
}

.friends-info-list p {
    margin: 0;
    color: var(--muted-text);
    font-size: 13px;
    line-height: 1.45;
    letter-spacing: 0;
}

.friends-rewards-card {
    gap: 18px;
}

.friends-rewards-header h2,
.friends-reward-activity h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 18px;
    line-height: 1.25;
    letter-spacing: 0;
}

.friends-rewards-header p {
    margin: 8px 0 0;
    color: var(--muted-text);
    font-size: 14px;
    line-height: 1.5;
}

.friends-reward-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
}

.friends-reward-summary-item {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background-color: var(--card-bg-strong);
}

.friends-reward-summary-item.is-pending {
    border-color: rgba(114, 192, 44, 0.32);
    background-color: rgba(114, 192, 44, 0.08);
}

.friends-reward-summary-item span {
    color: var(--muted-text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
}

.friends-reward-summary-item strong {
    color: var(--text-color);
    font-size: 21px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.friends-reward-activity {
    display: grid;
    gap: 12px;
}

.friends-reward-list {
    display: grid;
    gap: 10px;
}

.friends-reward-item {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background-color: var(--card-bg-strong);
}

.friends-reward-item-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.friends-reward-item-main > div {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.friends-reward-item-main strong {
    color: var(--text-color);
    font-size: 18px;
    line-height: 1.2;
}

.friends-reward-item-main > div > span,
.friends-reward-item > p,
.friends-reward-dates {
    color: var(--muted-text);
    font-size: 12px;
    line-height: 1.4;
}

.friends-reward-item > p {
    margin: 0;
}

.friends-reward-status {
    flex: 0 0 auto;
    padding: 6px 9px;
    border-radius: 999px;
    background-color: rgba(107, 114, 128, 0.12);
    color: var(--muted-text);
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.friends-reward-status.is-pending {
    background-color: rgba(245, 158, 11, 0.14);
    color: #92400e;
}

.friends-reward-status.is-credited {
    background-color: rgba(114, 192, 44, 0.14);
    color: #3f7217;
}

.friends-reward-status.is-adjusted,
.friends-reward-status.is-cancelled,
.friends-reward-status.is-reversed,
.friends-reward-status.is-ineligible {
    background-color: rgba(220, 38, 38, 0.1);
    color: #991b1b;
}

.friends-reward-dates {
    display: grid;
    gap: 8px;
    margin: 0;
}

.friends-reward-dates > div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
}

.friends-reward-dates dt {
    font-weight: 800;
}

.friends-reward-dates dd {
    margin: 0;
    color: var(--text-color);
    text-align: right;
}

.friends-rewards-error,
.friends-rewards-empty {
    margin: 0;
    padding: 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.45;
}

.friends-rewards-error {
    background-color: rgba(220, 38, 38, 0.08);
    color: var(--error-color);
}

.friends-rewards-empty {
    background-color: var(--card-bg-strong);
    color: var(--muted-text);
}

.friends-count-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 16px;
}

.friends-count-copy {
    min-width: 0;
}

.friends-count-eyebrow {
    display: block;
    margin-bottom: 8px;
    color: var(--accent-color-strong);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.friends-count-copy h2 {
    margin: 0;
    color: var(--text-color);
    font-size: 18px;
    line-height: 1.25;
    letter-spacing: 0;
}

.friends-count-copy p {
    margin: 8px 0 0;
    color: var(--muted-text);
    font-size: 14px;
    line-height: 1.5;
}

.friends-count-metric {
    display: flex;
    min-height: 96px;
    box-sizing: border-box;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border: 1px solid rgba(114, 192, 44, 0.22);
    border-radius: 16px;
    background:
        linear-gradient(145deg, rgba(114, 192, 44, 0.14), rgba(255, 255, 255, 0.9)),
        var(--accent-bg);
    text-align: center;
}

.friends-count-metric strong {
    color: var(--text-color);
    font-size: 34px;
    line-height: 1;
    letter-spacing: 0;
}

.friends-count-metric span {
    color: var(--muted-text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
}

.friends-count-status {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--error-color);
    font-size: 13px;
    line-height: 1.4;
}

.friends-share-card {
    gap: 16px;
}

.friends-share-copy h2 {
    margin: 0;
    color: var(--text-color);
    font-size: 18px;
    line-height: 1.25;
    letter-spacing: 0;
}

.friends-share-copy p {
    margin: 8px 0 0;
    color: var(--muted-text);
    font-size: 14px;
    line-height: 1.5;
}

.friends-invite-link-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 4px;
    border: 1px solid rgba(114, 192, 44, 0.32);
    border-radius: 16px;
    background-color: var(--card-bg-strong);
}

.friends-invite-link-field {
    width: 100%;
    min-width: 0;
    height: 44px;
    box-sizing: border-box;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    outline: none;
    background: transparent;
    color: var(--text-color);
    font: inherit;
    font-size: 14px;
    line-height: 44px;
    letter-spacing: 0;
    text-overflow: ellipsis;
}

.friends-invite-link-field::placeholder {
    color: var(--muted-text);
    opacity: 1;
}

.friends-invite-link-field:focus {
    box-shadow: inset 0 0 0 2px rgba(114, 192, 44, 0.28);
}

.friends-copy-icon-button {
    display: inline-grid;
    width: 44px;
    height: 44px;
    box-sizing: border-box;
    place-items: center;
    border: 0;
    border-radius: 12px;
    background-color: var(--accent-color);
    color: #ffffff;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.friends-copy-icon-button:hover {
    background-color: var(--accent-color-strong);
    box-shadow: 0 10px 24px rgba(114, 192, 44, 0.24);
}

.friends-copy-icon-button:focus-visible {
    outline: 3px solid rgba(114, 192, 44, 0.3);
    outline-offset: 2px;
}

.friends-copy-icon-button:active {
    transform: translateY(1px);
}

.friends-copy-icon-button:disabled {
    cursor: not-allowed;
    opacity: 0.68;
    box-shadow: none;
}

.friends-copy-icon-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.friends-share-invite-button {
    display: none;
    width: fit-content;
    max-width: 100%;
    min-height: 40px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: #ffffff;
    color: var(--text-color);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0;
    text-align: center;
    margin-left: auto;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.friends-share-invite-button:hover,
.friends-share-invite-button:focus-visible {
    border-color: var(--accent-color);
    background-color: var(--accent-bg);
    outline: none;
    transform: translateY(-1px);
}

.friends-share-invite-button:focus-visible {
    box-shadow: 0 0 0 3px rgba(114, 192, 44, 0.2);
}

.friends-share-invite-button:active {
    transform: translateY(0);
}

.friends-share-invite-button:disabled {
    cursor: not-allowed;
    opacity: 0.68;
    transform: none;
}

.friends-share-invite-button svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.friends-share-invite-button span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.friends-withdraw-card {
    gap: 10px;
}

.friends-action-stack {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: end;
    gap: 10px;
}

.friends-action-stack .provider-btn {
    gap: 10px;
}

.friends-copy-status {
    min-height: 18px;
    color: var(--accent-color-strong);
    font-size: 13px;
    font-weight: 800;
    line-height: 18px;
    text-align: left;
}

.friends-copy-status.is-error {
    color: var(--error-color);
}

.friends-button-icon {
    display: inline-grid;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    place-items: center;
    border-radius: 999px;
    background-color: rgba(17, 24, 39, 0.08);
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
}

.friends-button-icon svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (min-width: 380px) {
    .friends-count-section {
        grid-template-columns: minmax(0, 1fr) minmax(120px, 0.45fr);
        align-items: center;
    }
}

@media (min-width: 560px) {
    .friends-reward-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .friends-share-invite-button {
        display: inline-flex;
    }
}

.auth-app-logo {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    margin-bottom: 15px;
}

.restored-user-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 2px 0 0;
    padding: 0;
}

.restored-user-panel[hidden] {
    display: none;
}

.restored-user-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.provider-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 13px 14px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.provider-btn:hover,
.provider-btn:focus-visible {
    transform: translateY(-1px);
    outline: none;
}

.provider-btn:disabled,
.provider-btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-google {
    background-color: var(--btn-google-bg);
    border: 1px solid var(--btn-google-border);
    color: var(--btn-google-text);
}

.btn-google:hover,
.btn-google:focus-visible,
.btn-apple:hover,
.btn-apple:focus-visible {
    background-color: var(--card-bg-strong);
    border-color: #c7ccd4;
}

.btn-google .btn-icon {
    font-weight: 700;
    margin-right: 10px;
}

.btn-apple {
    background-color: var(--btn-apple-bg);
    border: 1px solid var(--btn-apple-border);
    color: var(--btn-apple-text);
}

.btn-apple .btn-icon {
    font-weight: 700;
    margin-right: 10px;
}

.btn-email {
    background-color: var(--card-bg-strong);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    text-decoration: none;
}

.btn-email:hover,
.btn-email:focus-visible {
    border-color: var(--accent-color);
    background-color: var(--accent-bg);
    text-decoration: none;
}

.btn-email .btn-icon {
    font-size: 18px;
    margin-right: 10px;
}

.auth-btn__icon {
    flex-shrink: 0;
    display: block;
    width: 20px;
    min-width: 20px;
    max-width: 20px;
    height: 20px;
    min-height: 20px;
    max-height: 20px;
    margin-right: 12px;
}

.auth-legal-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted-text);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.auth-legal-links a {
    color: var(--accent-color-strong);
    font-weight: 700;
    text-decoration: none;
}

.auth-legal-links a:hover,
.auth-legal-links a:focus-visible {
    text-decoration: underline;
    outline: none;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    margin-left: 4px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 15px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(114, 192, 44, 0.2);
    background-color: #ffffff;
}

.form-control::placeholder {
    color: var(--muted-text);
    opacity: 0.7;
}

select.form-control {
    cursor: pointer;
}

.auth-links {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--muted-text);
}

.auth-links a {
    color: var(--accent-color-strong);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-links a:hover,
.auth-links a:focus-visible {
    color: var(--accent-color-strong);
    text-decoration: underline;
}

.btn-block {
    width: 100%;
    margin-top: 8px;
    padding: 15px;
    font-size: 16px;
}

.btn-primary {
    background-color: var(--accent-color);
    border: 1px solid var(--accent-color);
    color: var(--btn-primary-text);
    text-decoration: none;
    box-shadow: 0 12px 24px -20px rgba(114, 192, 44, 0.9);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background-color: var(--accent-color-hover);
    border-color: var(--accent-color-strong);
    color: var(--btn-primary-text);
    box-shadow: 0 14px 28px -20px rgba(79, 143, 29, 0.9);
}

.btn-muted {
    padding: 10px 12px;
    background-color: var(--card-bg-strong);
    border: 1px solid var(--border-color);
    color: var(--muted-text);
    font-size: 14px;
}

.btn-muted:hover,
.btn-muted:focus-visible {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.restored-user-actions .btn-muted {
    align-self: center;
    width: auto;
    border-radius: 12px;
    font-size: 13px;
}

.btn-logout {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.btn-logout:hover,
.btn-logout:focus-visible {
    background-color: #fef3c7;
    border-color: #facc15;
}

.btn-secondary {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    text-decoration: none;
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
    border-color: var(--accent-color);
    background-color: var(--accent-bg);
}

.btn-default {
    background-color: var(--card-bg-strong);
    border: 1px solid var(--border-color);
    color: var(--muted-text);
}

.identity-link-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.identity-status {
    color: var(--muted-text);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.identity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background-color: var(--card-bg-strong);
}

.identity-details {
    min-width: 0;
}

.identity-details strong,
.identity-details span {
    display: block;
}

.identity-details strong {
    margin-bottom: 4px;
    font-size: 15px;
}

.identity-details span {
    color: var(--muted-text);
    font-size: 13px;
    line-height: 1.4;
}

.identity-unlink-button {
    flex: 0 0 auto;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: #ffffff;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.identity-unlink-button:hover,
.identity-unlink-button:focus-visible {
    border-color: var(--accent-color);
    background-color: var(--accent-bg);
    outline: none;
}

.identity-unlink-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.profile-info-section {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 42px;
}

.profile-info-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.profile-avatar-wrap {
    flex: 0 0 56px;
}

.profile-avatar {
    appearance: none;
    -webkit-appearance: none;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 0;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--card-bg-strong);
    color: var(--accent-color-strong);
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar:hover,
.profile-avatar:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(114, 192, 44, 0.22);
    transform: translateY(-1px);
}

.profile-avatar:disabled {
    cursor: wait;
    opacity: 0.72;
    transform: none;
}

.profile-edit-button {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--card-bg);
    color: var(--accent-color-strong);
    box-shadow: 0 10px 22px -14px var(--shadow-color);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.profile-edit-button:hover,
.profile-edit-button:focus-visible {
    outline: none;
    border-color: var(--accent-color);
    background-color: var(--card-bg-strong);
    transform: translateY(-1px);
}

.profile-edit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.profile-edit-icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.profile-edit-icon-cancel,
.profile-info-section.is-profile-editing .profile-edit-icon-edit {
    display: none;
}

.profile-info-section.is-profile-editing .profile-edit-icon-cancel {
    display: block;
}

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

.profile-heading .section-title {
    margin-bottom: 6px;
}

.profile-heading strong {
    display: block;
    overflow-wrap: anywhere;
}

.profile-heading strong {
    font-size: 17px;
}

.profile-heading > .nickname-status {
    margin-top: 6px;
}

.profile-info-control {
    overflow: visible;
    white-space: normal;
}

.profile-info-list {
    display: grid;
    gap: 6px;
    margin: 0;
}

.profile-info-row {
    display: grid;
    grid-template-columns: minmax(104px, 0.42fr) minmax(0, 1fr);
    gap: 12px;
    padding: 11px 0;
    border-top: 1px solid var(--border-color);
}

.profile-info-row:first-child {
    padding-bottom: 4px;
}

.profile-info-row:last-child {
    padding-bottom: 4px;
}

.profile-info-row dt {
    color: var(--muted-text);
    font-size: 13px;
    font-weight: 700;
}

.profile-info-row dd {
    margin: 0;
    min-width: 0;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.profile-info-row .profile-info-control {
    white-space: normal;
}

.profile-info-row a {
    color: var(--accent-color-strong);
    font-weight: 600;
    text-decoration: none;
}

.profile-info-row a:hover,
.profile-info-row a:focus-visible {
    text-decoration: underline;
    outline: none;
}

.profile-value-label {
    display: inline-block;
    color: var(--text-color);
    font-weight: 600;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.profile-value-label:hover,
.profile-value-label:focus-visible {
    color: var(--accent-color-strong);
    outline: none;
    text-decoration: underline;
}

.profile-info-control > .profile-edit-form {
    display: none;
}

.profile-info-control.is-field-editing > .profile-value-label {
    display: none;
}

.profile-info-control.is-field-editing > .profile-edit-form {
    display: grid;
}

.nickname-inline-form {
    gap: 6px;
    margin-top: 0;
    max-width: 360px;
}

.nickname-inline-control {
    display: flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background-color: var(--card-bg);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.nickname-inline-control:focus-within,
.nickname-inline-form.is-editing .nickname-inline-control {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(114, 192, 44, 0.2);
}

.nickname-inline-form.is-editing .nickname-inline-control {
    cursor: text;
}

.nickname-prefix {
    flex: 0 0 auto;
    padding-left: 12px;
    color: var(--muted-text);
    font-size: 14px;
    font-weight: 700;
}

.nickname-inline-input {
    flex: 1;
    min-width: 0;
    width: auto;
    padding: 9px 8px;
    border: 0;
    border-radius: 0;
    background-color: transparent;
    color: var(--text-color);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

#display-name-inline-control .nickname-inline-input {
    padding-left: 12px;
}

.nickname-inline-input:focus {
    border-color: transparent;
    background-color: transparent;
    box-shadow: none;
}

.nickname-inline-form.is-editing .nickname-inline-input {
    cursor: text;
}

.nickname-edit-button {
    align-self: stretch;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-left: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--muted-text);
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.nickname-edit-button svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nickname-edit-button:hover,
.nickname-edit-button:focus-visible {
    outline: none;
    color: var(--accent-color-strong);
    background-color: var(--card-bg-strong);
}

.nickname-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition: max-height 0.22s ease, opacity 0.18s ease, transform 0.18s ease, padding-top 0.18s ease;
}

.nickname-inline-form.is-editing .nickname-actions {
    max-height: 42px;
    opacity: 1;
    padding-top: 2px;
    pointer-events: auto;
    transform: translateY(0);
}

.nickname-action-button {
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.nickname-cancel-button {
    background-color: var(--card-bg);
    color: var(--text-color);
}

.nickname-cancel-button:hover,
.nickname-cancel-button:focus-visible {
    outline: none;
    border-color: var(--accent-color);
    background-color: var(--card-bg-strong);
}

.nickname-save-button {
    border: 0;
    background-color: var(--accent-color);
    color: var(--btn-primary-text);
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.nickname-save-button:hover,
.nickname-save-button:focus-visible {
    outline: none;
    background-color: var(--accent-color-hover);
}

.nickname-save-button:disabled {
    background-color: var(--accent-color);
    opacity: 0.55;
    cursor: not-allowed;
}

.nickname-action-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.nickname-save-button:disabled:hover,
.nickname-save-button:disabled:focus-visible {
    background-color: var(--accent-color);
}

.avatar-form {
    display: grid;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.profile-avatar-form {
    width: min(180px, 100%);
    gap: 8px;
    margin-top: 8px;
    padding-top: 0;
    border-top: 0;
}

.profile-avatar-form[hidden],
.profile-info-section:not(.is-profile-editing) .profile-avatar-form {
    display: none;
}

.profile-avatar-form .provider-btn {
    min-height: 36px;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13px;
}

.avatar-file-input {
    display: none;
}

.avatar-actions {
    display: flex;
    gap: 10px;
}

.nickname-status {
    color: var(--muted-text);
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.nickname-status.is-error {
    color: var(--error-color);
}

.nickname-status.is-success {
    color: var(--success-color);
}

.account-deletion-warning {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(183, 56, 42, 0.28);
    border-radius: 16px;
    background-color: var(--error-bg);
    color: var(--error-color);
}

.account-deletion-warning .section-title,
.account-deletion-warning p {
    color: inherit;
}

.account-deletion-warning .section-title {
    margin-bottom: 8px;
}

.account-deletion-warning p {
    margin: 0;
    line-height: 1.5;
}

.deletion-warning-meta {
    display: grid;
    gap: 6px;
    margin-top: 12px;
    font-size: 14px;
}

.deletion-warning-meta strong {
    font-size: 15px;
}

.error-message,
.profile-feedback {
    padding: 12px 14px;
    border-radius: 16px;
    margin-bottom: 18px;
    font-size: 14px;
    text-align: center;
    border: 1px solid transparent;
}

.error-message,
.profile-feedback.is-error {
    background-color: var(--error-bg);
    color: var(--error-color);
}

.profile-feedback.is-success {
    background-color: var(--success-bg);
    color: var(--success-color);
    border-color: rgba(29, 109, 40, 0.16);
}

.status-card {
    text-align: center;
}

.status-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--border-color);
    font-size: 20px;
    font-weight: 700;
}

.status-message {
    margin: 0 0 20px;
    line-height: 1.5;
}

.status-debug {
    margin: 0 0 18px;
    padding: 12px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--card-bg-strong);
    color: var(--muted-text);
    font-size: 12px;
    line-height: 1.4;
    text-align: left;
    white-space: pre-wrap;
}

.status-card[data-state="success"] .status-icon {
    background-color: var(--success-bg);
    color: var(--success-color);
}

.status-card[data-state="error"] .status-icon {
    background-color: var(--error-bg);
    color: var(--error-color);
}

.tabbar {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom) + 10px);
    transform: translateX(-50%);
    z-index: 900;
    width: min(calc(100% - 28px), 640px);
    min-height: 72px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 8px;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: 32px;
    background-color: var(--tabbar-bg);
    box-shadow: var(--tabbar-shadow);
    isolation: isolate;
    overflow: hidden;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

@media (max-width: 720px) {
    @supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
        .tabbar {
            border-color: var(--tabbar-glass-border);
            background-color: var(--tabbar-glass-bg);
            -webkit-backdrop-filter: blur(20px) saturate(180%);
            backdrop-filter: blur(20px) saturate(180%);
        }
    }
}

.tabbar-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    gap: 5px;
    min-width: 0;
    min-height: 56px;
    max-height: 60px;
    padding: 7px 4px 6px;
    border-radius: 24px;
    color: var(--tabbar-icon-muted);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition:
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        color 0.2s ease,
        transform 0.18s ease;
}

.tabbar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
}

.tabbar-icon svg {
    display: block;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tabbar-label {
    max-width: 100%;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tabbar-link:hover,
.tabbar-link:focus-visible {
    color: var(--text-color);
    background-color: rgba(255, 255, 255, 0.54);
    outline: none;
}

.tabbar-link:focus-visible {
    box-shadow: 0 0 0 2px rgba(114, 192, 44, 0.32);
}

.tabbar-link:active {
    transform: scale(0.98);
}

.tabbar-link.is-active {
    color: var(--accent-color-strong);
    background-color: var(--tabbar-active-bg);
    box-shadow:
        inset 0 0 0 1px rgba(114, 192, 44, 0.11),
        inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

@media (prefers-reduced-transparency: reduce) {
    .tabbar {
        border-color: rgba(209, 213, 219, 0.9);
        background-color: rgba(255, 255, 255, 0.97);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .tabbar-link:hover,
    .tabbar-link:focus-visible {
        background-color: var(--card-bg-strong);
    }
}

@supports selector(body:has(input:focus)) {
    @media (max-width: 720px) {
        body.has-tabbar:has(input:focus, textarea:focus, select:focus, [contenteditable="true"]:focus) .tabbar {
            opacity: 0;
            pointer-events: none;
            transform: translateX(-50%) translateY(24px) scale(0.98);
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .tabbar,
    .tabbar-link {
        transition: none;
    }

    .tabbar-link:active {
        transform: none;
    }
}

@supports selector(body:has(input:focus)) {
    @media (prefers-reduced-motion: reduce) and (max-width: 720px) {
        body.has-tabbar:has(input:focus, textarea:focus, select:focus, [contenteditable="true"]:focus) .tabbar {
            transform: translateX(-50%) translateY(24px);
        }
    }
}

@media (max-width: 360px) {
    .tabbar {
        width: min(calc(100% - 24px), 640px);
        min-height: 68px;
        padding: 7px;
        border-radius: 30px;
    }

    .tabbar-link {
        min-height: 54px;
        padding-left: 2px;
        padding-right: 2px;
        font-size: 10px;
    }

    .tabbar-icon,
    .tabbar-icon svg {
        width: 21px;
        height: 21px;
    }
}

@media (max-width: 480px) {
    body.layout-shell,
    body.layout-centered {
        padding-top: 12px;
    }

    .container {
        padding: 14px;
    }

    .card {
        padding: 24px 18px;
        border-radius: 16px;
    }

    .identity-link-actions {
        grid-template-columns: 1fr;
    }

    .profile-info-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .balance-account {
        align-items: flex-start;
        flex-direction: column;
    }

    .balance-amount {
        min-width: 0;
        text-align: left;
    }

    .transaction-row,
    .transaction-entries div {
        align-items: flex-start;
        flex-direction: column;
    }

    .transaction-amount {
        min-width: 0;
        text-align: left;
    }

    .transaction-entries dd {
        text-align: left;
    }

    .withdrawal-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .withdrawal-summary strong {
        text-align: left;
    }

    .withdrawal-history-item {
        flex-direction: column;
        gap: 10px;
    }

    .withdrawal-history-state {
        min-width: 0;
        align-items: flex-start;
        text-align: left;
    }

    .subscription-facts div,
    .purchase-assets-detail-row,
    .purchase-assets-state-row,
    .plan-card-head,
    .plan-price-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .subscription-facts dd,
    .purchase-assets-detail-row strong,
    .purchase-assets-state-row strong {
        text-align: left;
    }

    .plan-badge {
        align-self: flex-start;
    }

    .page-stack > .plan-card {
        padding-left: 16px;
        padding-right: 16px;
    }

}

.btn-danger {
    background-color: transparent;
    border: 1px solid var(--error-color);
    color: var(--error-color);
    text-decoration: none;
}

.btn-danger:hover,
.btn-danger:focus-visible {
    background-color: var(--error-bg);
}

.btn-danger-solid {
    background-color: var(--error-color);
    border: 1px solid var(--error-color);
    color: #ffffff;
    text-decoration: none;
}

.btn-danger-solid:hover,
.btn-danger-solid:focus-visible {
    opacity: 0.9;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(17, 24, 39, 0.24);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-card {
    width: 100%;
    max-width: 360px;
    box-sizing: border-box;
    animation: slideUp 0.2s ease;
}

.modal-message {
    color: var(--muted-text);
    line-height: 1.5;
    margin: 0;
}

.modal-actions {
    display: flex;
    gap: 14px;
    margin-top: 24px;
}

body.is-page-blocked {
    overflow: hidden;
}

.page-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: rgba(248, 250, 252, 0.82);
    backdrop-filter: blur(4px);
}

.page-loading-overlay[hidden] {
    display: none;
}

.page-loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: min(100%, 240px);
    padding: 22px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background-color: var(--card-bg);
    box-shadow: 0 18px 44px -34px var(--shadow-color);
    box-sizing: border-box;
}

.page-loading-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 999px;
    animation: loading-spin 0.85s linear infinite;
}

.page-loading-text {
    color: var(--text-color);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

.language-switcher {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-bottom: 12px;
}

.language-switcher-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--muted-text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    text-transform: uppercase;
    background-color: var(--card-bg);
}

.language-switcher-link.is-active {
    border-color: var(--accent-color);
    color: var(--text-color);
    background-color: var(--accent-bg);
}

.language-switcher-flag,
.language-selector-flag {
    line-height: 1;
}

.continue-purchase-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 10px;
    margin: 0 0 14px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background-color: var(--card-bg);
    box-shadow: 0 12px 30px -28px var(--shadow-color);
}

.continue-purchase-title {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.continue-purchase-actions {
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
}

.continue-purchase-action {
    width: auto;
    flex: 0 1 auto;
    min-width: 0;
    min-height: 34px;
    padding: 8px 12px;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.continue-purchase-action-chip {
    border-color: #72c02c;
    border-radius: 12px;
    color: var(--accent-color-strong);
    background-color: #ffffff;
    font-size: 13px;
}

.continue-purchase-action-primary {
    --btn-primary-text: #ffffff;
    border-radius: 12px;
    font-size: 13px;
    box-shadow: 0 10px 20px -18px rgba(114, 192, 44, 0.9);
}

.purchase-assets-result-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.purchase-assets-result-actions form {
    display: flex;
    justify-content: flex-end;
    margin: 0;
}

.purchase-assets-result-actions .provider-btn {
    width: auto;
}

@media (max-width: 420px) {
    .purchase-assets-result-actions {
        flex-direction: column;
        align-items: flex-end;
    }
}

@media (max-width: 360px) {
    .continue-purchase-actions {
        flex-basis: 100%;
        justify-content: flex-start;
    }
}

.language-selector-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.language-selector-card h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
}

.language-selector-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.language-selector-option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    padding: 0 16px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    color: var(--text-color);
    font-weight: 800;
    text-decoration: none;
    background-color: var(--card-bg-strong);
}

.language-selector-option:hover,
.language-selector-option:focus-visible {
    border-color: var(--accent-color);
    background-color: var(--accent-bg);
    outline: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes loading-spin {
    to { transform: rotate(360deg); }
}

.credits-page {
    font-family: "Roboto", Arial, sans-serif;
}

.credits-page .section-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
}

.credits-summary .page-title-row p,
.credits-page .credit-purchase-confirm-body p {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 1px;
}

.credits-balance-grid,
.credit-bundle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.credits-balance-grid {
    grid-template-columns: minmax(0, 1fr);
}

.credits-balance-card,
.credit-bundle-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--card-bg);
}

.credits-balance-card {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
    gap: 8px;
    white-space: nowrap;
}

.credit-bundle-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 10px 16px;
}

.credit-bundle-amount,
.credit-bundle-price {
    white-space: nowrap;
}

.credit-bundle-price {
    text-align: right;
}

.credit-bundle-price-promo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 5px 8px;
}

.credit-bundle-price-promo strong {
    color: #4f8f1c;
}

.credit-bundle-base-price {
    color: var(--muted-text);
}

.credit-bundle-promo-badge {
    padding: 3px 7px;
    color: #315611;
    background: #e7f6dc;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
}

.credit-bundle-card > form {
    grid-column: 1 / -1;
}

.credit-bundle-card.is-selected {
    border-color: #72c02c;
    box-shadow: 0 0 0 2px rgb(114 192 44 / 15%);
}

.credits-balance-card strong,
.credit-bundle-credits,
.credit-bundle-price,
.credits-history-row strong {
    color: var(--text-color);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 1px;
}

.credit-bundle-eyebrow,
.credits-history-row span,
.credits-balance-card span,
.credits-balance-card small {
    color: var(--muted-text);
}

.credit-bundle-card span,
.credits-history-row span,
.credits-balance-card span,
.credits-balance-card small {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    letter-spacing: 1px;
}

.credits-page .provider-btn,
.credits-balance-card a {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 1px;
}

.credit-purchase-confirm summary {
    cursor: pointer;
    list-style: none;
    text-align: center;
}

.credit-purchase-confirm summary::-webkit-details-marker {
    display: none;
}

.credit-purchase-confirm-body {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.credits-history-list {
    display: grid;
    gap: 10px;
}

.credits-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.credits-history-row:last-child {
    border-bottom: 0;
}

.credits-history-row > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.credits-history-row > div:last-child {
    text-align: right;
}

@media (max-width: 560px) {
    .credits-history-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .credits-history-row > div:last-child {
        text-align: left;
    }
}

/* Full-page Google authentication recovery. */
.google-redirect [hidden] { display: none; }
.google-redirect-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.google-redirect-actions .provider-btn { width: auto; max-width: 100%; text-align: right; }
@media (min-width: 600px) {
    .google-redirect-actions { flex-direction: row; justify-content: flex-end; flex-wrap: wrap; }
}

/* Sign-in progress. One indeterminate ring (loading-spin) marks every wait
   between sign-in hops: status cards, busy buttons, and /auth while Firebase
   boots or a Google return is completed. The slow hint is revealed by CSS
   alone so it still appears when the page script itself is what stalled. */
.status-card[data-state="loading"] .status-icon,
.auth-progress-ring {
    box-sizing: border-box;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-color);
    background-color: transparent;
    color: transparent;
    font-size: 0;
    animation: loading-spin 0.85s linear infinite;
}

.auth-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin: 8px 0 4px;
    text-align: center;
}

.auth-progress[hidden] {
    display: none;
}

.auth-progress-ring {
    width: 44px;
    height: 44px;
    border-radius: 999px;
}

.auth-progress-text {
    margin: 0;
    font-weight: 600;
}

.provider-btn[aria-busy="true"],
.btn[aria-busy="true"] {
    opacity: 0.85;
    cursor: progress;
}

.provider-btn[aria-busy="true"]::after,
.btn[aria-busy="true"]::after,
html:not([data-auth-state="error"]) .auth-providers[inert] .provider-btn[data-provider-code]::after {
    content: "";
    display: inline-block;
    flex-shrink: 0;
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    vertical-align: -3px;
    border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
    border-top-color: currentColor;
    border-radius: 999px;
    animation: loading-spin 0.7s linear infinite;
}

/* Firebase usually boots from cache; only show the boot ring if it lingers. */
html:not([data-auth-state="error"]) .auth-providers[inert] .provider-btn[data-provider-code]::after {
    animation: loading-spin 0.7s linear infinite, auth-progress-reveal 0.2s ease 0.4s both;
}

.auth-slow-hint {
    margin: 0 0 16px;
    color: var(--muted-text);
    font-size: 14px;
    line-height: 1.45;
    animation: auth-progress-reveal 0.3s ease 8s both;
}

.status-card:not([data-state="loading"]) .auth-slow-hint {
    display: none;
}

@keyframes auth-progress-reveal {
    from { opacity: 0; visibility: hidden; }
    to { opacity: 1; visibility: visible; }
}

@media (prefers-reduced-motion: reduce) {
    .status-card[data-state="loading"] .status-icon,
    .auth-progress-ring,
    .provider-btn[aria-busy="true"]::after,
    .btn[aria-busy="true"]::after {
        animation-duration: 1.6s;
    }

    html:not([data-auth-state="error"]) .auth-providers[inert] .provider-btn[data-provider-code]::after {
        animation: loading-spin 1.6s linear infinite;
    }
}

/* Top-up retry and continuation actions remain reachable on narrow screens. */
[data-top-up-page] .top-up-ledger-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }
[data-top-up-page] [data-top-up-expired][hidden],
[data-top-up-page] [data-top-up-ledger-actions][hidden] { display: none; }
[data-top-up-page] [data-top-up-expired-actions] { align-items: flex-end; }
[data-top-up-page] [data-top-up-expired-actions] .provider-btn { width: auto; max-width: 100%; }

/* Persistent balance emphasis; purchase feedback never changes layout size. */
.credits-page .credits-balance-card {
    position: relative;
    padding: 20px;
    gap: 12px;
    flex-wrap: wrap;
    white-space: normal;
    background: rgba(114, 192, 44, 0.08);
    border-color: rgba(114, 192, 44, 0.35);
}

.credits-page .credits-balance-card::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    box-shadow: 0 0 0 4px rgba(114, 192, 44, 0.22);
    opacity: 0;
    pointer-events: none;
}

.credits-page .credits-purchase-success {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--success-color);
    line-height: 1.5;
}

.credits-page .credits-purchase-success p {
    margin: 0;
}

.credits-page .credits-success-check {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.credits-page .credits-success-announcement {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.credits-page.is-purchase-complete .credits-balance-card::after {
    animation: credits-balance-pulse 800ms cubic-bezier(0.23, 1, 0.32, 1) 1;
}

.credits-page.is-purchase-complete .credits-success-check path {
    animation: credits-check-draw 250ms ease-out 1;
}

@keyframes credits-balance-pulse {
    0%, 100% { opacity: 0; }
    35% { opacity: 1; }
}

@keyframes credits-check-draw {
    from { stroke-dasharray: 1; stroke-dashoffset: 1; }
    to { stroke-dasharray: 1; stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .credits-page.is-purchase-complete .credits-balance-card::after,
    .credits-page.is-purchase-complete .credits-success-check path {
        animation: none;
    }
}

/* Keep the complete period label readable inside nested cards on small screens. */
@media (max-width: 374px) {
    .subscription-offers {
        padding-left: 6px;
        padding-right: 6px;
    }

    .subscription-offers .plan-card {
        padding-left: 6px;
        padding-right: 6px;
    }
}
