:root {
    --app-bg: #f6f8fb;
    --surface: #ffffff;
    --surface-2: #f5f8ff;
    --ink: #1f2430;
    --muted: #6d7280;
    --line: rgba(31, 36, 48, 0.1);
    --brand: #ff6b4a;
    --brand-2: #6a72ff;
    --ok: #18a77a;
    --shadow: 0 18px 45px rgba(40, 36, 30, 0.12);
    --bottom-safe: 0px;
}

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.pwa-shell {
    margin: 0;
    position: fixed;
    inset: 0;
    width: 100%;
    min-height: 100dvh;
    height: 100dvh;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.92), rgba(246,248,251,0.96)),
        radial-gradient(circle at 12% 0%, rgba(255, 107, 74, 0.18), transparent 28%),
        radial-gradient(circle at 90% 8%, rgba(106, 114, 255, 0.16), transparent 26%);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: pan-y;
}

body.pwa-shell .floating-shop-buttons,
body.pwa-shell .floating-btn {
    display: none !important;
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-frame {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    height: 100dvh;
    max-width: 680px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.app-topbar {
    position: relative;
    flex: 0 0 auto;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 10px;
    background: rgba(246, 248, 251, 0.88);
    border-bottom: 1px solid rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(18px);
}

.brand-chip,
.wallet-chip,
.login-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 22px rgba(31, 36, 48, 0.08);
    padding: 6px 12px;
    font-weight: 750;
}

.app-back-button {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 22px rgba(31, 36, 48, 0.08);
    color: var(--ink);
    font-size: 1.22rem;
}

.app-topbar .brand-chip {
    min-width: 0;
    margin-right: auto;
}

.app-back-button + .brand-chip span {
    max-width: 112px;
}

@media (min-width: 390px) {
    .app-back-button + .brand-chip span {
        max-width: 150px;
    }
}

.brand-chip img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.brand-chip span {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wallet-chip,
.login-chip {
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #5a6276);
}

.app-main {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px 16px 58px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.app-hero,
.print-hero {
    padding: 26px 18px;
    border-radius: 28px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(31,36,48,0.7), rgba(31,36,48,0.2)),
        linear-gradient(135deg, #ff7b54 0%, #ffb15c 42%, #6977ff 100%);
    box-shadow: var(--shadow);
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.eyebrow {
    margin: 0 0 8px;
    color: inherit;
    opacity: 0.72;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.app-hero h1 {
    margin: 0;
    font-size: clamp(2rem, 13vw, 3.8rem);
    line-height: 0.95;
    letter-spacing: 0;
}

.app-hero p:not(.eyebrow) {
    margin: 14px 0 0;
    max-width: 360px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 1rem;
    line-height: 1.45;
}

.home-main {
    padding: 12px 14px 78px;
}

.home-shell {
    background:
        linear-gradient(180deg, rgba(248,250,255,0.96), rgba(241,245,249,0.98)),
        radial-gradient(circle at 10% 0%, rgba(255,107,74,0.18), transparent 28%),
        radial-gradient(circle at 90% 4%, rgba(29,185,168,0.14), transparent 26%),
        radial-gradient(circle at 50% 100%, rgba(106,114,255,0.14), transparent 32%);
}

.home-dashboard {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 14px;
    padding: 18px 18px 16px;
    border-radius: 28px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(18,24,38,0.74), rgba(18,24,38,0.34)),
        linear-gradient(135deg, #1fb9a8 0%, #4777f3 54%, #ff8a55 100%);
    box-shadow: 0 16px 34px rgba(31,36,48,0.14);
}

.home-dashboard h1 {
    margin: 0;
    font-size: 1.85rem;
    line-height: 1.02;
}

.home-dashboard p:not(.eyebrow) {
    max-width: 300px;
    margin: 8px 0 0;
    color: rgba(255,255,255,0.84);
    font-size: 0.9rem;
    line-height: 1.35;
}

.install-mini {
    display: grid;
    place-items: center;
    min-width: 58px;
    min-height: 58px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,0.38);
    border-radius: 20px;
    color: #fff;
    background: rgba(255,255,255,0.16);
    font-weight: 850;
}

.install-mini span {
    display: none;
}

.install-mini i {
    font-size: 1.25rem;
}

.home-service-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 0;
}

.home-service-card {
    position: relative;
    aspect-ratio: 1 / 1;
    min-height: 0;
    padding: 16px;
    border-radius: 26px;
    overflow: hidden;
    background: rgba(255,255,255,0.88);
    box-shadow: 0 12px 30px rgba(31,36,48,0.08);
}

.home-service-card::after {
    content: "";
    position: absolute;
    right: -28px;
    bottom: -34px;
    width: 96px;
    height: 96px;
    border-radius: 32px;
    background: rgba(255,255,255,0.18);
    transform: rotate(14deg);
}

.home-service-card i {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 19px;
    color: #fff;
    font-size: 1.45rem;
}

.home-service-card strong,
.home-service-card span {
    position: relative;
    z-index: 1;
    display: block;
}

.home-service-card strong {
    margin-top: 16px;
    color: var(--ink);
    font-size: 1.12rem;
    line-height: 1.08;
}

.home-service-card.primary strong {
    margin-top: 0;
    color: #fff;
    font-size: 1.45rem;
}

.home-service-card span {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.28;
}

.home-service-card.primary span {
    color: rgba(255,255,255,0.78);
    font-size: 0.88rem;
}

.home-service-card.print i { background: linear-gradient(135deg, #ff6b4a, #f7b955); }
.home-service-card.music i { background: linear-gradient(135deg, #111827, #6672ff); }
.home-service-card.ai i { background: linear-gradient(135deg, #20bca5, #2f90ff); }
.home-service-card.ai-chat i { background: linear-gradient(135deg, #2563eb, #8b5cf6); }
.home-service-card.shop i { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.home-service-card.wallet i { background: linear-gradient(135deg, #242a3a, #5a6276); }
.home-service-card.profile i { background: linear-gradient(135deg, #4b5563, #9ca3af); }

.wallet-shell {
    background:
        linear-gradient(180deg, rgba(248,250,255,0.96), rgba(241,245,249,0.98)),
        radial-gradient(circle at 10% 0%, rgba(36,42,58,0.16), transparent 28%),
        radial-gradient(circle at 92% 4%, rgba(255,107,74,0.16), transparent 26%);
}

.wallet-main {
    padding: 12px 14px 78px;
}

.wallet-balance-card {
    padding: 20px;
    border-radius: 28px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(18,24,38,0.82), rgba(18,24,38,0.28)),
        linear-gradient(135deg, #242a3a, #6672ff 58%, #ff8a55);
    box-shadow: var(--shadow);
}

.wallet-balance-card span,
.wallet-balance-card p {
    margin: 0;
    color: rgba(255,255,255,0.72);
    font-weight: 800;
}

.wallet-balance-card strong {
    display: block;
    margin-top: 8px;
    font-size: 2.55rem;
    line-height: 1;
}

.wallet-balance-card p {
    margin-top: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wallet-panel,
.wallet-history {
    margin-top: 14px;
    padding: 16px;
    border-radius: 26px;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 12px 30px rgba(31,36,48,0.08);
}

.wallet-panel-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.wallet-panel-title h1,
.wallet-panel-title h2 {
    margin: 0;
    color: var(--ink);
    font-size: 1.45rem;
    line-height: 1;
}

.wallet-panel-title > i {
    display: grid;
    place-items: center;
    min-width: 42px;
    height: 42px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #ff6b4a, #6672ff);
}

.wallet-form {
    display: grid;
    gap: 12px;
}

.amount-grid,
.method-grid {
    display: grid;
    gap: 8px;
}

.amount-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.amount-option,
.method-option span {
    display: grid;
    place-items: center;
    min-height: 52px;
    border: 1px solid rgba(31,36,48,0.1);
    border-radius: 16px;
    color: var(--ink);
    background: #f8f9ff;
    font-weight: 900;
}

.amount-option.active {
    border-color: #6672ff;
    background: #eef1ff;
    box-shadow: inset 0 0 0 1px rgba(102,114,255,0.26);
}

.wallet-input-label {
    display: grid;
    gap: 7px;
    color: var(--ink);
    font-weight: 850;
}

.wallet-input-label input {
    min-height: 52px;
    border: 1px solid rgba(31,36,48,0.1);
    border-radius: 16px;
    padding: 0 14px;
    background: #f8f9ff;
    color: var(--ink);
    outline: none;
    font-weight: 850;
}

.method-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.method-option span {
    grid-template-columns: 38px 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    justify-items: start;
    gap: 10px;
    min-height: 64px;
    padding: 8px 12px;
    place-items: initial;
    text-align: left;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.method-option b,
.method-option small {
    display: block;
    grid-column: 2;
    min-width: 0;
}

.method-option b {
    align-self: end;
    white-space: nowrap;
}

.method-option small {
    align-self: start;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 760;
}

.method-option span i {
    grid-row: 1 / 3;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #6672ff);
}

.method-option input:checked + span {
    border-color: #ff6b4a;
    background: linear-gradient(135deg, #fff1eb, #ffffff);
    color: #ff5b35;
    box-shadow: inset 0 0 0 1px rgba(255,107,74,0.24), 0 10px 20px rgba(255,107,74,0.12);
    transform: translateY(-1px);
}

.method-option input:checked + span small {
    color: #b84625;
}

.method-option input:checked + span i {
    background: linear-gradient(135deg, #ff6b4a, #ffae55);
}

.method-details {
    display: grid;
    gap: 8px;
}

.method-detail {
    display: none;
    padding: 13px;
    border: 1px solid rgba(31,36,48,0.1);
    border-radius: 18px;
    background: #f8f9ff;
}

.method-detail.active {
    display: grid;
    gap: 12px;
}

.method-detail-head {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 10px;
    align-items: center;
}

.method-detail-head > i {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 15px;
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #6672ff);
}

.method-detail-head strong,
.method-detail-head span {
    display: block;
}

.method-detail-head span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
    line-height: 1.32;
}

.payment-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.payment-badges span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    color: #242a3a;
    background: #fff;
    font-size: 0.74rem;
    font-weight: 850;
}

.commission-box {
    display: grid;
    gap: 7px;
    padding: 10px;
    border-radius: 14px;
    background: #fff;
}

.commission-box div,
.requisite-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.commission-box span,
.requisite-row > span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.commission-box strong {
    color: var(--ink);
}

.requisite-row {
    display: grid;
    grid-template-columns: minmax(92px, 1fr) auto;
    padding: 10px;
    border-radius: 14px;
    background: #fff;
}

.requisite-row button {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-height: 36px;
    border: 0;
    border-radius: 12px;
    color: var(--ink);
    background: #eef1ff;
    padding: 0 10px;
    font-weight: 900;
    white-space: nowrap;
}

.requisite-row button b {
    white-space: nowrap;
    font-size: 0.92rem;
    letter-spacing: 0;
}

.method-note,
.method-instruction {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.36;
}

.method-instruction {
    padding: 10px;
    border-radius: 14px;
    color: #075f49;
    background: #ddfff5;
}

.wallet-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 54px;
    border: 0;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #ff6b4a 52%, #ffae55);
    box-shadow: 0 14px 28px rgba(255,107,74,0.22);
    font-weight: 900;
}

.wallet-history-list {
    display: grid;
    gap: 8px;
}

.wallet-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-radius: 16px;
    background: #f8f9ff;
}

.wallet-history-item strong,
.wallet-history-item span {
    display: block;
}

.wallet-history-item span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
}

.wallet-history-item em {
    color: #20a68f;
    font-style: normal;
    font-weight: 900;
}

.wallet-history-actions {
    display: grid;
    justify-items: end;
    gap: 6px;
}

.wallet-history-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    color: #fff;
    background: #242a3a;
    font-size: 0.76rem;
    font-weight: 900;
}

.wallet-empty {
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 112px;
    border: 1px dashed rgba(31,36,48,0.18);
    border-radius: 18px;
    color: var(--muted);
    background: #f8f9ff;
    font-weight: 850;
    text-align: center;
}

.wallet-empty i {
    color: #6672ff;
    font-size: 1.35rem;
}

.wallet-app-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
    font-weight: 850;
}

.wallet-app-alert.error {
    color: #991b1b;
    background: #fee2e2;
}

.wallet-code-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
}

.wallet-code-modal.open {
    display: block;
}

.wallet-code-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17,24,39,0.68);
}

.wallet-code-panel {
    position: absolute;
    left: 50%;
    bottom: calc(74px + env(safe-area-inset-bottom));
    display: grid;
    gap: 12px;
    width: min(520px, calc(100% - 24px));
    max-height: calc(100dvh - 96px - env(safe-area-inset-bottom));
    overflow: auto;
    padding: 18px;
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(17,24,39,0.28);
    transform: translateX(-50%);
}

.wallet-code-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #20bca5, #6672ff);
}

.wallet-code-panel h2,
.wallet-code-panel p {
    margin: 0;
}

.wallet-code-panel h2 {
    color: var(--ink);
    font-size: 1.45rem;
    line-height: 1.05;
}

.wallet-code-text {
    color: var(--muted);
    font-weight: 760;
    line-height: 1.35;
}

.wallet-code-display,
.wallet-code-requisites,
.wallet-code-note {
    border-radius: 18px;
    background: #f8f9ff;
}

.wallet-code-display {
    display: grid;
    gap: 9px;
    padding: 14px;
    text-align: center;
}

.wallet-code-display span,
.wallet-code-requisites span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 850;
}

.wallet-code-display strong {
    color: var(--ink);
    font-size: 2.3rem;
    letter-spacing: 0.08em;
}

.wallet-code-display button,
.wallet-code-requisites button,
.wallet-code-done {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    border: 0;
    border-radius: 15px;
    font-weight: 900;
    text-decoration: none;
}

.wallet-code-display button {
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #6672ff);
}

.wallet-code-requisites {
    display: grid;
    gap: 8px;
    padding: 12px;
}

.wallet-code-requisites > div {
    display: grid;
    gap: 6px;
}

.wallet-code-requisites b {
    color: var(--ink);
    font-size: 1rem;
}

.wallet-code-requisites button {
    justify-content: space-between;
    color: var(--ink);
    background: #fff;
    padding: 0 12px;
}

.wallet-code-requisites button b {
    white-space: nowrap;
}

.wallet-code-requisites p {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 760;
}

.wallet-code-note {
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: center;
    gap: 8px;
    padding: 10px;
    color: #075f49;
    background: #ddfff5;
    font-size: 0.84rem;
    font-weight: 800;
}

.wallet-code-note i {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    color: #fff;
    background: #20bca5;
}

.wallet-code-done {
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #ff6b4a 52%, #ffae55);
}

.wallet-result-card {
    display: grid;
    justify-items: start;
    gap: 14px;
    margin-top: 16px;
    padding: 20px;
    border-radius: 28px;
    background: rgba(255,255,255,0.94);
    box-shadow: var(--shadow);
}

.wallet-result-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 22px;
    color: #fff;
    background: linear-gradient(135deg, #20bca5, #6672ff);
    font-size: 2rem;
}

.wallet-result-card.error .wallet-result-icon {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.wallet-result-card.pending .wallet-result-icon {
    background: linear-gradient(135deg, #f59e0b, #ff6b4a);
}

.wallet-result-card h1,
.wallet-result-card p {
    margin: 0;
}

.wallet-result-card h1 {
    color: var(--ink);
    font-size: 2rem;
    line-height: 1;
}

.wallet-result-card > p:not(.eyebrow) {
    color: var(--muted);
    font-weight: 760;
    line-height: 1.38;
}

.wallet-result-card > div:not(.wallet-result-icon) {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border-radius: 16px;
    background: #f8f9ff;
}

.wallet-result-card span {
    color: var(--muted);
    font-weight: 850;
}

.wallet-result-card strong {
    color: var(--ink);
}

.wallet-result-card a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 54px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #ff6b4a 52%, #ffae55);
    font-weight: 900;
    text-decoration: none;
}

.app-order-result,
.app-order-photos {
    margin-top: 16px;
    padding: 18px;
    border-radius: 28px;
    background: rgba(255,255,255,0.94);
    box-shadow: var(--shadow);
}

.app-order-result {
    display: grid;
    gap: 14px;
}

.app-order-icon {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    border-radius: 22px;
    color: #fff;
    background: linear-gradient(135deg, #ff6b4a, #ffae55);
    font-size: 1.95rem;
}

.app-order-result.paid .app-order-icon {
    background: linear-gradient(135deg, #20bca5, #6672ff);
}

.app-order-result h1,
.app-order-result p {
    margin: 0;
}

.app-order-result h1 {
    color: var(--ink);
    font-size: 2rem;
    line-height: 1;
}

.app-order-result > p:not(.eyebrow) {
    color: var(--muted);
    font-weight: 760;
    line-height: 1.36;
}

.app-order-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.app-order-stats div,
.app-order-total {
    padding: 11px;
    border-radius: 17px;
    background: #f8f9ff;
}

.app-order-stats span,
.app-order-total span {
    display: block;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 850;
}

.app-order-stats strong,
.app-order-total strong {
    display: block;
    margin-top: 4px;
    color: var(--ink);
    font-weight: 900;
}

.app-order-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.app-order-total strong {
    margin-top: 0;
    font-size: 1.35rem;
}

.app-order-pay {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 54px;
    border: 0;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #ff6b4a 52%, #ffae55);
    box-shadow: 0 14px 28px rgba(255,107,74,0.2);
    font-weight: 900;
    text-decoration: none;
}

.app-order-pay:disabled {
    opacity: 0.68;
}

.app-order-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 50px;
    border: 1px solid rgba(239,68,68,0.24);
    border-radius: 18px;
    color: #b91c1c;
    background: #fee2e2;
    font-weight: 900;
}

.app-order-delete:disabled {
    opacity: 0.68;
}

.app-order-photo-list {
    display: grid;
    gap: 10px;
}

.app-order-photo-list article {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 9px;
    border-radius: 18px;
    background: #f8f9ff;
}

.app-order-photo-list img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 14px;
    background: #eef1ff;
}

.app-order-photo-list strong,
.app-order-photo-list span {
    display: block;
}

.app-order-photo-list strong {
    color: var(--ink);
}

.app-order-photo-list span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 760;
}

.app-order-photo-list b {
    color: var(--ink);
    white-space: nowrap;
}

.profile-shell {
    background:
        linear-gradient(180deg, rgba(248,250,255,0.96), rgba(241,245,249,0.98)),
        radial-gradient(circle at 10% 0%, rgba(255,107,74,0.14), transparent 28%),
        radial-gradient(circle at 90% 4%, rgba(102,114,255,0.16), transparent 28%);
}

.profile-main {
    padding: 12px 14px 88px;
}

.profile-hero-card,
.profile-panel,
.profile-stats div,
.profile-notice {
    background: rgba(255,255,255,0.94);
    box-shadow: 0 12px 30px rgba(31,36,48,0.08);
}

.profile-hero-card {
    display: grid;
    grid-template-columns: 68px 1fr;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: 28px;
}

.profile-avatar {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    border-radius: 24px;
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #6672ff);
    font-size: 2rem;
}

.profile-hero-card h1,
.profile-panel-title h1,
.profile-panel-title h2 {
    margin: 0;
    color: var(--ink);
}

.profile-hero-card h1 {
    font-size: 1.55rem;
    line-height: 1;
}

.profile-hero-card span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-weight: 760;
    overflow-wrap: anywhere;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.profile-stats div {
    padding: 13px 10px;
    border-radius: 18px;
}

.profile-stats span,
.profile-referral span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 850;
}

.profile-stats strong,
.profile-referral strong {
    display: block;
    margin-top: 5px;
    color: var(--ink);
}

.profile-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 12px;
    border-radius: 18px;
    font-weight: 850;
}

.profile-notice.success {
    color: #075f49;
    background: #ddfff5;
}

.profile-notice.error {
    color: #991b1b;
    background: #fee2e2;
}

.profile-panel {
    display: grid;
    gap: 12px;
    margin-top: 16px;
    padding: 16px;
    border-radius: 26px;
}

.profile-panel-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.profile-panel-title > div {
    min-width: 0;
}

.profile-panel-title > i,
.profile-panel-title > a {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    max-width: 132px;
    height: 42px;
    padding: 0 13px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #6672ff);
    font-size: 0.82rem;
    font-weight: 900;
    line-height: 1.05;
    text-align: center;
    text-decoration: none;
    white-space: normal;
    overflow-wrap: anywhere;
}

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

.profile-action-grid a {
    display: grid;
    gap: 8px;
    min-height: 132px;
    padding: 14px;
    border-radius: 20px;
    color: var(--ink);
    background: #f8f9ff;
    text-decoration: none;
}

.profile-action-grid i {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #ff6b4a, #ffae55);
    font-size: 1.25rem;
}

.profile-action-grid strong,
.profile-action-grid span {
    display: block;
}

.profile-action-grid span {
    color: var(--muted);
    font-weight: 760;
}

.profile-promo-form {
    display: grid;
    gap: 8px;
}

.profile-promo-form input {
    min-height: 52px;
    border: 1px solid rgba(31,36,48,0.1);
    border-radius: 16px;
    padding: 0 14px;
    background: #f8f9ff;
    color: var(--ink);
    font-weight: 850;
}

.profile-promo-form button,
.profile-referral button {
    min-height: 50px;
    border: 0;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #6672ff);
    font-weight: 900;
}

.profile-referral {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.profile-referral div {
    padding: 12px;
    border-radius: 18px;
    background: #f8f9ff;
}

.profile-referral button {
    grid-column: 1 / -1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.profile-order-list,
.profile-print-order-list {
    display: grid;
    gap: 10px;
}

.profile-order-list a,
.profile-print-order-list article {
    border-radius: 18px;
    background: #f8f9ff;
}

.profile-order-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    color: var(--ink);
    text-decoration: none;
}

.profile-order-list strong,
.profile-order-list span,
.profile-print-order-list strong,
.profile-print-order-list span {
    display: block;
}

.profile-order-list span,
.profile-print-order-list span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 760;
}

.profile-order-list b {
    color: var(--ink);
    white-space: nowrap;
}

.profile-empty {
    margin: 0;
    color: var(--muted);
    font-weight: 760;
}

.profile-print-order-list article {
    display: grid;
    gap: 9px;
    padding: 12px;
}

.profile-print-order-list article > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
}

.profile-print-order-list article > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.profile-print-order-list em {
    padding: 5px 8px;
    border-radius: 999px;
    color: #8a4b00;
    background: #fff3c4;
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 900;
    white-space: nowrap;
}

.profile-print-order-list em.paid {
    color: #075f49;
    background: #ddfff5;
}

.profile-print-order-list button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: 0;
    border-radius: 15px;
    color: #b91c1c;
    background: #fee2e2;
    font-weight: 900;
}

.print-recent-orders {
    margin-top: 16px;
    padding: 16px;
    border-radius: 26px;
    background: rgba(255,255,255,0.94);
    box-shadow: 0 12px 30px rgba(31,36,48,0.08);
}

.print-recent-orders .section-title > a {
    display: grid;
    place-items: center;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #6672ff);
    font-weight: 900;
    text-decoration: none;
}

.recent-empty {
    margin: 0;
}

.print-recent-list {
    display: grid;
    gap: 10px;
}

.print-recent-list article {
    display: grid;
    gap: 9px;
    padding: 12px;
    border-radius: 18px;
    background: #f8f9ff;
}

.print-recent-list article > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
}

.print-recent-list strong,
.print-recent-list span {
    display: block;
}

.print-recent-list span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 760;
}

.print-recent-list b {
    color: var(--ink);
    white-space: nowrap;
}

.print-recent-list article > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.print-recent-list em {
    padding: 5px 8px;
    border-radius: 999px;
    color: #8a4b00;
    background: #fff3c4;
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 900;
    white-space: nowrap;
}

.print-recent-list em.paid {
    color: #075f49;
    background: #ddfff5;
}

.print-recent-list button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    border: 0;
    border-radius: 14px;
    color: #b91c1c;
    background: #fee2e2;
    padding: 0 12px;
    font-weight: 900;
}

.home-banner {
    display: grid;
    grid-template-columns: 1fr 48px;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 18px;
    border-radius: 26px;
    background: #111827;
    color: #fff;
    box-shadow: var(--shadow);
}

.home-banner h2,
.home-banner p {
    margin: 0;
}

.home-banner h2 {
    font-size: 1.35rem;
    line-height: 1.05;
}

.home-banner p:not(.eyebrow) {
    margin-top: 8px;
    color: rgba(255,255,255,0.72);
    line-height: 1.35;
}

.home-banner a {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 17px;
    color: #111827;
    background: #fff;
}

.print-main {
    padding: 12px 14px 58px;
}

.print-hero {
    min-height: 260px;
}

.print-hero h1 {
    margin: 0;
    font-size: clamp(2.2rem, 13vw, 3.45rem);
    line-height: 0.94;
}

.print-hero p:not(.eyebrow) {
    margin: 14px 0 0;
    color: rgba(255,255,255,0.9);
    line-height: 1.42;
}

.print-hero .primary-action {
    margin-top: 20px;
}

.hero-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.primary-action,
.ghost-action,
.upload-drop,
.order-bar button {
    appearance: none;
    border: 0;
    cursor: pointer;
}

.primary-action,
.ghost-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    border-radius: 16px;
    padding: 0 18px;
    font-weight: 850;
}

.primary-action {
    color: #1f2430;
    background: #fff;
}

.ghost-action {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.notice-panel {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding: 14px;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(31, 36, 48, 0.08);
}

.notice-panel i {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    color: #fff;
    background: var(--brand);
}

.notice-panel strong,
.notice-panel p {
    margin: 0;
}

.notice-panel p {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.35;
}

.notice-panel a {
    color: var(--brand);
    font-weight: 800;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 16px 0;
}

.quick-card {
    display: grid;
    gap: 8px;
    place-items: center;
    min-height: 92px;
    padding: 12px 6px;
    border-radius: 22px;
    background: var(--surface);
    box-shadow: 0 10px 28px rgba(31, 36, 48, 0.08);
    color: var(--ink);
    font-weight: 750;
    font-size: 0.82rem;
}

.quick-card i {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 15px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-2), #8b62ff);
    font-size: 1.2rem;
}

.quick-card.accent-print i {
    background: linear-gradient(135deg, var(--brand), #ffb15c);
}

.print-workspace,
.rubric-list {
    margin-top: 16px;
    padding: 16px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--shadow);
}

.section-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-title h2 {
    margin: 0;
    font-size: 1.55rem;
    line-height: 1;
}

.section-title .eyebrow {
    color: var(--brand);
}

.photo-count {
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    color: var(--muted);
    background: #f3f1ec;
    font-size: 0.82rem;
    font-weight: 800;
}

.upload-drop {
    display: grid;
    place-items: center;
    gap: 6px;
    width: 100%;
    min-height: 150px;
    border-radius: 24px;
    border: 2px dashed rgba(255, 107, 74, 0.48);
    color: var(--ink);
    background: var(--surface-2);
}

.upload-drop i {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), #ffb15c);
    font-size: 1.65rem;
}

.upload-drop span {
    color: var(--muted);
    font-size: 0.9rem;
}

.photo-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.empty-state {
    margin: 14px 0 0;
    color: var(--muted);
    text-align: center;
    font-size: 0.92rem;
}

.photo-item {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    padding: 10px;
}

.photo-thumb {
    position: relative;
    width: 88px;
    height: 116px;
    border-radius: 16px;
    overflow: hidden;
    background: #ece8df;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-status {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 6px;
    min-height: 22px;
    border-radius: 999px;
    color: #fff;
    background: rgba(31, 36, 48, 0.75);
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    font-weight: 800;
}

.photo-status.ready {
    background: var(--ok);
}

.photo-controls {
    min-width: 0;
}

.photo-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.field {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.field label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
}

.field select,
.field input {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8f6f2;
    padding: 0 9px;
    color: var(--ink);
}

.photo-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.retouch-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 999px;
    background: #f8f6f2;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 750;
}

.remove-photo {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 12px;
    color: #c83333;
    background: #fff0ef;
}

.rubric-list {
    display: grid;
    gap: 8px;
}

.rubric-list .section-title {
    margin-bottom: 6px;
}

.rubric-list a {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 8px 10px;
    border-radius: 17px;
    background: #fff;
    border: 1px solid var(--line);
    font-weight: 780;
}

.rubric-list i {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-2), #8b62ff);
}

.rubric-list b {
    display: grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    color: #fff;
    background: var(--brand);
    font-size: 0.75rem;
}

.order-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-radius: 20px;
    background: rgba(31, 36, 48, 0.94);
    box-shadow: 0 14px 30px rgba(31, 36, 48, 0.18);
    color: #fff;
}

.order-summary-top {
    margin-bottom: 14px;
}

.order-summary-bottom {
    margin-top: 14px;
}

.order-summary[hidden] {
    display: none !important;
}

.order-summary span {
    display: block;
    color: rgba(255,255,255,0.66);
    font-size: 0.76rem;
    font-weight: 750;
}

.order-summary strong {
    display: block;
    margin-top: 2px;
    font-size: 1.3rem;
}

.order-summary button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    border-radius: 16px;
    padding: 0 15px;
    background: linear-gradient(135deg, var(--brand), #ffb15c);
    color: #fff;
    font-weight: 850;
}

.order-summary button:disabled {
    opacity: 0.6;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 30;
    width: min(680px, 100%);
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.92);
    border-top: 1px solid rgba(31, 36, 48, 0.08);
    backdrop-filter: blur(18px);
}

.bottom-nav a {
    display: grid;
    gap: 3px;
    place-items: center;
    min-height: 50px;
    border-radius: 14px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 780;
}

.bottom-nav i {
    font-size: 1.18rem;
}

.bottom-nav a.active {
    color: var(--brand);
    background: #fff1eb;
}

.toast-stack {
    position: fixed;
    left: 50%;
    bottom: 104px;
    z-index: 60;
    width: min(640px, calc(100% - 28px));
    transform: translateX(-50%);
    display: grid;
    gap: 8px;
    pointer-events: none;
}

.app-toast {
    padding: 12px 14px;
    border-radius: 16px;
    color: #fff;
    background: rgba(31, 36, 48, 0.94);
    box-shadow: 0 14px 32px rgba(31, 36, 48, 0.2);
    font-weight: 740;
}

.app-account-list {
    display: grid;
    gap: 12px;
}

.app-account-card,
.app-empty-card {
    border: 1px solid rgba(31, 36, 48, 0.08);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 14px 32px rgba(31, 36, 48, 0.08);
}

.app-account-card {
    padding: 14px;
}

.app-account-card.is-highlighted {
    border-color: rgba(102, 126, 234, 0.62);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12), 0 14px 32px rgba(31, 36, 48, 0.08);
}

.app-account-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.app-account-card-head strong {
    display: block;
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.18;
}

.app-account-card-head span,
.app-account-meta span,
.app-account-muted {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 720;
}

.app-account-card-head em {
    flex: 0 0 auto;
    max-width: 42%;
    padding: 7px 10px;
    border-radius: 999px;
    background: #f1f4fb;
    color: #3d4b6d;
    font-size: 0.74rem;
    font-style: normal;
    font-weight: 850;
    text-align: center;
}

.app-account-card-head em.status-paid,
.app-account-card-head em.status-delivered {
    background: #e8fff5;
    color: #0f8c58;
}

.app-account-card-head em.status-cancelled {
    background: #fff0ef;
    color: #c83333;
}

.app-account-card-head em.status-processing,
.app-account-card-head em.status-shipped {
    background: #fff6df;
    color: #9a6400;
}

.app-account-meta {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.app-account-meta span {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.app-account-meta i {
    flex: 0 0 auto;
    color: var(--brand-2);
}

.app-order-items {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding: 10px;
    border-radius: 16px;
    background: #f7f8fb;
}

.app-order-items div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 760;
}

.app-order-items span {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--ink);
}

.app-order-items b {
    color: var(--muted);
    font-size: 0.76rem;
}

.app-empty-card {
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 210px;
    padding: 24px 18px;
    text-align: center;
}

.app-empty-card i {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-size: 1.65rem;
}

.app-empty-card strong {
    color: var(--ink);
    font-size: 1.1rem;
}

.app-empty-card span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 720;
}

.app-empty-card a,
.app-account-actions a,
.app-account-actions button,
.app-account-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    border: 0;
    border-radius: 15px;
    padding: 0 14px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-size: 0.86rem;
    font-weight: 850;
}

.app-account-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.app-account-actions a,
.app-account-actions button {
    flex: 1 1 130px;
}

.app-account-muted {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
}

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

.app-account-form label {
    display: grid;
    gap: 7px;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 840;
}

.app-account-form input {
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0 14px;
    background: #f8f9fc;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 740;
}

.app-account-form button {
    min-height: 54px;
    margin-top: 4px;
}

.app-load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 50px;
    margin-top: 12px;
    border: 0;
    border-radius: 17px;
    background: linear-gradient(135deg, #242a3a, #6672ff);
    color: #fff;
    font-weight: 850;
}

.app-load-more:disabled {
    opacity: 0.65;
}

.app-receipt-viewer {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 14px;
    padding: calc(env(safe-area-inset-top) + 18px) 16px calc(env(safe-area-inset-bottom) + 24px);
    background: rgba(15, 19, 31, 0.92);
}

.app-receipt-viewer[hidden] {
    display: none;
}

.app-receipt-viewer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    min-height: 0;
}

.app-receipt-viewer a {
    justify-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    border-radius: 16px;
    padding: 0 18px;
    background: #fff;
    color: var(--ink);
    font-weight: 850;
}

.app-receipt-close {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 14px);
    right: 14px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink);
    font-size: 1.4rem;
}

@media (min-width: 760px) {
    .app-frame {
        border-left: 1px solid rgba(31, 36, 48, 0.08);
        border-right: 1px solid rgba(31, 36, 48, 0.08);
        background: rgba(255, 255, 255, 0.24);
    }

    .home-service-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .home-service-card i {
        margin: 0 auto;
    }

    .home-service-card strong {
        margin-top: 14px;
    }
}

@media (max-width: 390px) {
    .app-main {
        padding-left: 12px;
        padding-right: 12px;
    }

    .quick-grid {
        gap: 8px;
    }

    .quick-card {
        min-height: 84px;
        font-size: 0.74rem;
    }

    .home-main,
    .print-main {
        padding-left: 12px;
        padding-right: 12px;
    }

    .home-dashboard {
        padding: 16px;
    }

    .home-dashboard h1 {
        font-size: 1.62rem;
    }

    .home-service-card {
        padding: 14px;
    }

    .amount-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .method-option span {
        min-height: 60px;
    }

    .method-option b {
        white-space: normal;
    }

    .requisite-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .requisite-row button {
        justify-content: space-between;
        width: 100%;
    }

    .photo-item {
        grid-template-columns: 78px 1fr;
    }

    .photo-thumb {
        width: 78px;
        height: 108px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}

.home-service-card.ai-upload i {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
}

.ai-upload-main {
    padding-bottom: 82px;
}

.app-ai-upload-hero,
.app-ai-upload-panel {
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 14px 34px rgba(31, 36, 48, 0.09);
}

.app-ai-upload-hero {
    padding: 22px;
    color: #fff;
    background: linear-gradient(135deg, #8b5cf6, #14b8a6 52%, #f97316);
}

.app-ai-upload-hero h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1;
}

.app-ai-upload-hero > div,
.app-ai-category-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.app-ai-upload-hero span,
.app-ai-category-scroll a,
.app-ai-category-scroll button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    font-weight: 850;
}

.app-ai-upload-hero span {
    background: rgba(255,255,255,0.18);
}

.app-ai-category-scroll a,
.app-ai-category-scroll button {
    border: 0;
    background: #f2f4fb;
    color: var(--ink);
    font-size: 0.82rem;
    font-family: inherit;
}

.app-ai-category-scroll a.active,
.app-ai-category-scroll button.active {
    color: #fff;
    background: linear-gradient(135deg, #8b5cf6, #14b8a6);
}

.app-ai-upload-panel {
    display: grid;
    gap: 14px;
    margin-top: 14px;
    padding: 16px;
}

.app-ai-theme-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.app-ai-theme-grid a,
.app-ai-theme-grid button {
    display: grid;
    gap: 8px;
    min-height: 138px;
    padding: 14px;
    border: 1px solid rgba(31,36,48,0.08);
    border-radius: 20px;
    background: #f8f9ff;
    color: var(--ink);
    font: inherit;
    text-align: left;
}

.app-ai-theme-grid a.active,
.app-ai-theme-grid button.active {
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #6672ff);
}

.app-ai-theme-grid i {
    font-size: 1.6rem;
}

.app-ai-theme-grid span {
    align-self: end;
    opacity: 0.76;
    font-weight: 850;
}

.app-ai-option,
.app-ai-radio-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 16px;
    background: #f7f8fc;
    font-weight: 780;
}

.app-ai-radio-group {
    display: grid;
    gap: 8px;
}

.app-ai-textarea,
.app-ai-input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f8f9fc;
    color: var(--ink);
    font: inherit;
    font-weight: 720;
    padding: 12px;
}

.app-ai-textarea {
    min-height: 96px;
    resize: vertical;
}

.app-ai-upload-drop {
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 180px;
    border: 2px dashed rgba(106, 114, 255, 0.45);
    border-radius: 22px;
    background: #f8f9ff;
    text-align: center;
}

.app-ai-upload-drop i {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #8b5cf6, #14b8a6);
    font-size: 1.7rem;
}

.app-ai-upload-drop input {
    display: none;
}

.app-ai-crop,
.app-ai-job-list,
.app-ai-result-images {
    display: grid;
    gap: 10px;
}

.app-ai-crop[hidden],
.app-ai-preview[hidden],
.app-ai-textarea[hidden],
.app-ai-input[hidden],
.app-ai-result-loading[hidden],
.app-ai-result-images[hidden],
.app-ai-result-error[hidden] {
    display: none;
}

.app-ai-crop img {
    max-width: 100%;
    max-height: 56vh;
    border-radius: 18px;
}

.app-ai-crop > div,
.app-ai-submit-grid,
.app-ai-result-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.app-ai-crop button,
.app-ai-submit-grid button,
.app-ai-wallet-link,
.app-ai-consent button,
.app-ai-result-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    border: 0;
    border-radius: 16px;
    padding: 0 12px;
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #6672ff);
    font-weight: 850;
}

.app-ai-submit-grid button:first-child {
    background: linear-gradient(135deg, #16a34a, #22c55e);
}

.app-ai-submit-grid button:disabled,
.app-ai-consent button:disabled {
    opacity: 0.5;
}

.app-ai-preview {
    display: grid;
    grid-template-columns: 82px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px;
    border-radius: 18px;
    background: #f8f9fc;
}

.app-ai-preview img {
    width: 82px;
    height: 82px;
    object-fit: cover;
    border-radius: 14px;
}

.app-ai-preview button {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 14px;
    color: #fff;
    background: #6672ff;
}

.app-ai-consent p {
    margin: 0;
    color: var(--muted);
    font-weight: 690;
    line-height: 1.45;
}

.app-ai-consent label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--ink);
    font-weight: 780;
}

.app-ai-job-card,
.app-ai-job-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-radius: 18px;
    background: #f8f9fc;
}

.app-ai-job-card {
    padding: 8px;
}

.app-ai-job-link {
    flex: 1 1 auto;
    min-width: 0;
    padding: 4px !important;
    background: transparent !important;
}

.app-ai-delete-job,
.app-ai-result-delete {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    border: 0;
    border-radius: 15px;
    color: #b42318;
    background: #fff0ef;
    font-weight: 900;
}

.app-ai-result-delete {
    width: auto;
    padding: 0 14px;
    color: #fff;
    background: linear-gradient(135deg, #ef4444, #b42318);
}

.app-ai-job-list span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 720;
}

.app-ai-job-list em {
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    background: #eef1fb;
    color: #3d4b6d;
    font-style: normal;
    font-size: 0.76rem;
    font-weight: 850;
}

.app-ai-job-list em.success {
    background: #e8fff5;
    color: #0f8c58;
}

.app-ai-job-list em.failed {
    background: #fff0ef;
    color: #c83333;
}

.app-ai-result-state {
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 230px;
    text-align: center;
}

.app-ai-result-state > i {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 26px;
    color: #fff;
    background: linear-gradient(135deg, #8b5cf6, #14b8a6);
    font-size: 2rem;
    animation: appAiPulse 1.5s ease-in-out infinite;
}

.app-ai-result-state.success > i {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    animation: none;
}

.app-ai-result-state.failed > i {
    background: linear-gradient(135deg, #dc2626, #fb7185);
    animation: none;
}

@keyframes appAiPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.94); opacity: 0.72; }
}

.app-ai-result-state h1 {
    margin: 0;
    font-size: 1.8rem;
}

.app-ai-result-state span {
    color: var(--muted);
    font-weight: 720;
}

.app-ai-result-loading {
    display: grid;
    place-items: center;
    gap: 10px;
    padding: 22px 16px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(20,184,166,0.12), rgba(99,102,241,0.12));
    color: var(--ink);
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(31,36,48,0.06);
}

.app-ai-result-loading i {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 20px;
    color: #fff;
    background: linear-gradient(135deg, #14b8a6, #6366f1);
    font-size: 1.75rem;
    animation: appAiSpin 1.05s linear infinite;
}

.app-ai-result-loading strong {
    font-size: 1.05rem;
    font-weight: 900;
}

.app-ai-result-loading span {
    max-width: 280px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 720;
    line-height: 1.35;
}

@keyframes appAiSpin {
    to { transform: rotate(360deg); }
}

.app-ai-result-images div {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-weight: 850;
}

.app-ai-result-images img {
    width: 100%;
    border-radius: 20px;
    background: #f8f9fc;
}

.app-ai-result-error {
    padding: 12px;
    border-radius: 16px;
    background: #fff0ef;
    color: #c83333;
    font-weight: 780;
}

/* AI upload app polish */
.ai-upload-shell {
    background:
        linear-gradient(180deg, rgba(248,250,255,0.97), rgba(243,247,250,0.99)),
        radial-gradient(circle at 12% 0%, rgba(20,184,166,0.16), transparent 26%),
        radial-gradient(circle at 92% 8%, rgba(236,72,153,0.14), transparent 24%);
}

.ai-upload-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 14px 84px;
}

.app-ai-upload-hero {
    order: 0;
    position: relative;
    min-height: 216px;
    overflow: hidden;
    padding: 22px;
    border-radius: 30px;
    color: #fff;
    background:
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.26), transparent 22%),
        linear-gradient(135deg, #172033 0%, #235f6d 48%, #8f4b6f 100%);
    box-shadow: 0 20px 44px rgba(23, 32, 51, 0.2);
}

.app-ai-upload-hero::after {
    content: '';
    position: absolute;
    left: -18%;
    right: -12%;
    bottom: -42%;
    height: 58%;
    border-radius: 50%;
    background: rgba(255,255,255,0.16);
}

.app-ai-hero-copy {
    position: relative;
    z-index: 2;
    max-width: 78%;
}

.app-ai-hero-copy h1 {
    margin: 0;
    font-size: 2.15rem;
    line-height: 0.98;
}

.app-ai-hero-copy p:not(.eyebrow) {
    margin: 12px 0 0;
    color: rgba(255,255,255,0.82);
    font-size: 0.93rem;
    line-height: 1.35;
    font-weight: 650;
}

.app-ai-hero-orb {
    position: absolute;
    right: 18px;
    top: 28px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 74px;
    height: 74px;
    border-radius: 24px;
    background: linear-gradient(135deg, #2dd4bf, #818cf8);
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.26);
    transform: rotate(8deg);
}

.app-ai-hero-orb i {
    font-size: 2rem;
}

.app-ai-hero-chips {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    z-index: 2;
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.app-ai-hero-chips span {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 13px;
    border-radius: 999px;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.28);
    color: #fff;
    font-weight: 850;
}

.app-ai-flow {
    order: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.app-ai-flow div {
    display: grid;
    place-items: center;
    gap: 5px;
    min-height: 72px;
    border-radius: 20px;
    background: rgba(255,255,255,0.88);
    box-shadow: 0 10px 24px rgba(31,36,48,0.07);
    color: var(--ink);
    font-size: 0.76rem;
    font-weight: 850;
}

.app-ai-flow i {
    color: #14b8a6;
    font-size: 1.25rem;
}

.app-ai-categories { order: 2; }
.app-ai-themes { order: 3; }
.app-ai-examples { order: 4; }
.app-ai-create-card { order: 5; border: 1px solid rgba(20,184,166,0.18); }
.app-ai-consent { order: 6; }
.app-ai-history { order: 7; }

.app-ai-upload-panel {
    margin-top: 0;
    border-radius: 26px;
    box-shadow: 0 14px 34px rgba(31,36,48,0.08);
}

.app-ai-upload-drop {
    min-height: 210px;
    border: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.9), rgba(248,250,252,0.94)),
        radial-gradient(circle at 50% 0%, rgba(20,184,166,0.14), transparent 42%);
    box-shadow: inset 0 0 0 2px rgba(20,184,166,0.22);
}

.app-ai-upload-drop strong {
    color: var(--ink);
    font-size: 1.2rem;
}

.app-ai-upload-drop span {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 720;
}

.app-ai-upload-drop i {
    width: 68px;
    height: 68px;
    border-radius: 24px;
    background: linear-gradient(135deg, #14b8a6, #818cf8);
}

.app-ai-category-scroll {
    padding-bottom: 4px;
}

.app-ai-category-scroll a,
.app-ai-category-scroll button {
    min-height: 42px;
    background: #f6f7fb;
    box-shadow: inset 0 0 0 1px rgba(31,36,48,0.06);
    -webkit-touch-callout: none;
    user-select: none;
}

.app-ai-category-scroll a.active,
.app-ai-category-scroll button.active {
    background: linear-gradient(135deg, #172033, #235f6d);
}

.app-ai-theme-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
}

.app-ai-theme-grid a,
.app-ai-theme-grid button {
    flex: 0 0 168px;
    min-height: 152px;
    scroll-snap-align: start;
    border: 0;
    background:
        linear-gradient(180deg, #ffffff, #f7f9fc);
    box-shadow: inset 0 0 0 1px rgba(31,36,48,0.07), 0 12px 24px rgba(31,36,48,0.06);
    -webkit-touch-callout: none;
    user-select: none;
}

.app-ai-theme-grid a.active,
.app-ai-theme-grid button.active {
    background:
        radial-gradient(circle at 85% 14%, rgba(255,255,255,0.22), transparent 24%),
        linear-gradient(135deg, #172033, #235f6d 58%, #8f4b6f);
}

.app-ai-theme-grid i {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #14b8a6, #818cf8);
}

.app-ai-theme-grid a.active i,
.app-ai-theme-grid button.active i {
    background: rgba(255,255,255,0.18);
}

.app-ai-option,
.app-ai-radio-group label {
    background: #f8fafc;
    box-shadow: inset 0 0 0 1px rgba(31,36,48,0.06);
}

.app-ai-submit-grid {
    position: static;
    grid-template-columns: 1fr;
    padding-top: 4px;
}

.app-ai-submit-grid:has(button + button) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-ai-submit-grid button,
.app-ai-wallet-link {
    min-height: 56px;
    box-shadow: 0 16px 30px rgba(31,36,48,0.16);
}

.app-ai-submit-grid button:last-child {
    background: linear-gradient(135deg, #14b8a6, #6366f1);
}

.app-ai-preview {
    box-shadow: inset 0 0 0 1px rgba(31,36,48,0.06);
}

.app-ai-job-card,
.app-ai-job-list a {
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(31,36,48,0.06);
}

/* AI upload app v41 */
.ai-upload-shell .app-topbar {
    backdrop-filter: blur(18px);
}

.ai-upload-main {
    gap: 14px;
    padding: 10px 14px calc(78px + env(safe-area-inset-bottom));
}

.app-ai-upload-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: center;
    min-height: 118px;
    padding: 16px;
    border-radius: 26px;
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,250,252,0.98));
    border: 1px solid rgba(20,184,166,0.18);
    box-shadow: 0 14px 34px rgba(31,36,48,0.08);
}

.app-ai-upload-hero::before {
    content: none;
}

.app-ai-upload-hero::after {
    content: none;
}

.app-ai-upload-hero .app-ai-hero-copy {
    display: block;
    overflow: visible;
    min-width: 0;
    max-width: none;
}

.app-ai-hero-copy h1 {
    max-width: none;
    margin: 0;
    color: var(--ink);
    font-size: 1.46rem;
    line-height: 1.08;
    letter-spacing: 0;
}

.app-ai-hero-copy p:not(.eyebrow) {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.32;
}

.app-ai-upload-hero .app-ai-hero-orb {
    display: none;
}

.app-ai-hero-orb i {
    font-size: 1.42rem;
}

.app-ai-upload-hero .app-ai-hero-chips {
    grid-column: 1 / -1;
    position: static;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.app-ai-hero-chips span {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: #eef7f5;
    border: 1px solid rgba(20,184,166,0.18);
    color: #16756d;
    font-size: 0.82rem;
    font-weight: 850;
    backdrop-filter: none;
}

.app-ai-hero-chips span:first-child {
    max-width: none;
}

.app-ai-flow {
    gap: 10px;
}

.app-ai-flow div {
    min-height: 66px;
    border: 1px solid rgba(20,184,166,0.12);
    background: rgba(255,255,255,0.94);
}

.app-ai-flow div:nth-child(2) i {
    color: #6366f1;
}

.app-ai-flow div:nth-child(3) i {
    color: #f97316;
}

.app-ai-upload-panel {
    border: 1px solid rgba(31,36,48,0.06);
    background: rgba(255,255,255,0.96);
}

.app-ai-create-card {
    padding: 18px;
    border: 1px solid rgba(20,184,166,0.2);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,250,250,0.98));
}

.app-ai-create-card form {
    display: grid;
    gap: 12px;
}

.app-ai-create-card .profile-panel-title {
    align-items: center;
}

.app-ai-create-card .profile-panel-title h2,
.app-ai-themes .profile-panel-title h2,
.app-ai-history .profile-panel-title h2 {
    font-size: 1.28rem;
}

.app-ai-upload-drop {
    min-height: 196px;
    border-radius: 24px;
    background:
        radial-gradient(circle at 50% 16%, rgba(20,184,166,0.16), transparent 36%),
        linear-gradient(180deg, #ffffff, #f4f7fb);
}

.app-ai-upload-drop:active {
    transform: scale(0.99);
}

.app-ai-category-scroll a,
.app-ai-category-scroll button,
.app-ai-theme-grid a,
.app-ai-theme-grid button {
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.app-ai-category-scroll a:active,
.app-ai-category-scroll button:active,
.app-ai-theme-grid a:active,
.app-ai-theme-grid button:active {
    transform: scale(0.97);
}

.app-ai-theme-grid {
    margin-right: -16px;
    padding-right: 16px;
}

.app-ai-theme-grid a,
.app-ai-theme-grid button {
    flex-basis: 158px;
    border-radius: 22px;
}

.app-ai-theme-grid strong {
    line-height: 1.16;
}

.app-ai-theme-grid a.active,
.app-ai-theme-grid button.active {
    box-shadow: 0 16px 30px rgba(35,95,109,0.22);
}

.ai-upload-main.is-loading {
    opacity: 0.72;
    pointer-events: none;
}

.app-ai-examples {
    overflow: hidden;
}

.app-ai-examples:empty,
.app-ai-examples[hidden] {
    display: none;
}

.app-ai-examples-body {
    min-height: 0;
}

.app-ai-examples-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 12px;
    border-radius: 18px;
    background: #f6f8fc;
    color: var(--muted);
    font-weight: 820;
}

.app-ai-examples-loading i {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #14b8a6, #6366f1);
}

.app-ai-example-strip {
    display: flex;
    gap: 12px;
    margin-right: -16px;
    padding: 2px 16px 4px 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
}

.app-ai-example-strip.single {
    display: block;
    margin-right: 0;
    padding-right: 0;
    overflow: visible;
}

.app-ai-example-card {
    flex: 0 0 254px;
    display: grid;
    gap: 10px;
    scroll-snap-align: start;
}

.app-ai-example-strip.single .app-ai-example-card {
    width: 100%;
}

.app-ai-example-card strong {
    color: var(--ink);
    font-size: 0.92rem;
    line-height: 1.2;
}

.app-ai-example-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    min-height: 138px;
    border: 0;
    border-radius: 22px;
    padding: 8px;
    background: linear-gradient(135deg, rgba(20,184,166,0.12), rgba(99,102,241,0.13));
    box-shadow: inset 0 0 0 1px rgba(31,36,48,0.06);
}

.app-ai-example-strip.single .app-ai-example-pair {
    min-height: 176px;
}

.app-ai-example-pair span {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: #eef2f7;
}

.app-ai-example-pair b {
    position: absolute;
    left: 7px;
    top: 7px;
    z-index: 2;
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(17,24,39,0.72);
    color: #fff;
    font-size: 0.66rem;
}

.app-ai-example-pair img {
    width: 100%;
    height: 126px;
    object-fit: cover;
    display: block;
}

.app-ai-example-strip.single .app-ai-example-pair img {
    height: 168px;
}

.app-ai-examples-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 70px;
    padding: 12px;
    border-radius: 18px;
    background: #f6f8fc;
    color: var(--muted);
    font-weight: 820;
}

.app-ai-examples-empty i {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 15px;
    color: #fff;
    background: linear-gradient(135deg, #14b8a6, #6366f1);
}

.app-ai-example-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    align-items: flex-end;
    padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
    background: rgba(15,23,42,0.62);
}

.app-ai-example-modal.open {
    display: flex;
}

.app-ai-example-modal-card {
    width: min(680px, 100%);
    margin: 0 auto;
    max-height: 88dvh;
    overflow-y: auto;
    border-radius: 28px;
    padding: 16px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(15,23,42,0.32);
}

.app-ai-example-modal-card h2 {
    margin: 4px 48px 14px 2px;
    color: var(--ink);
    font-size: 1.2rem;
}

.app-ai-example-modal-close {
    float: right;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 14px;
    color: #fff;
    background: #111827;
}

.app-ai-example-modal-images {
    display: grid;
    gap: 12px;
}

.app-ai-example-modal-images figure {
    margin: 0;
}

.app-ai-example-modal-images figcaption {
    margin-bottom: 6px;
    color: var(--muted);
    font-weight: 850;
}

.app-ai-example-modal-images img {
    width: 100%;
    max-height: 58dvh;
    object-fit: contain;
    border-radius: 20px;
    background: #f4f6fb;
}

.app-ai-option,
.app-ai-radio-group label {
    border-radius: 18px;
}

.app-ai-radio-group {
    gap: 10px;
}

.app-ai-input,
.app-ai-textarea {
    min-height: 56px;
    margin: 2px 0 8px;
}

.app-ai-input::placeholder,
.app-ai-textarea::placeholder {
    color: #8b93a3;
    opacity: 1;
}

.app-ai-crop {
    position: relative;
    padding-bottom: 0;
}

.app-ai-crop > div {
    position: static;
    z-index: 1;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.app-ai-submit-grid button,
.app-ai-wallet-link {
    border-radius: 18px;
}

.app-ai-preview {
    border-radius: 22px;
    background: #fff;
}

.app-ai-job-card,
.app-ai-job-list a {
    border-radius: 20px;
}

@media (max-width: 380px) {
    .app-ai-hero-copy h1 {
        font-size: 1.68rem;
    }

    .app-ai-hero-copy {
        max-width: 76%;
    }

    .app-ai-theme-grid a,
    .app-ai-theme-grid button {
        flex-basis: 146px;
    }
}

/* AI upload rebuild v51 */
.ai-upload-shell {
    background:
        linear-gradient(180deg, #f8fafc 0%, #eef4f7 100%),
        radial-gradient(circle at 14% 4%, rgba(20,184,166,0.12), transparent 28%),
        radial-gradient(circle at 88% 14%, rgba(99,102,241,0.10), transparent 30%);
}

.ai-upload-main {
    gap: 12px;
    padding: 10px 14px calc(76px + env(safe-area-inset-bottom, 0px));
}

.ai-upload-shell .app-topbar {
    background: rgba(248,250,252,0.9);
    border-bottom: 1px solid rgba(31,36,48,0.04);
}

.ai-upload-shell .app-ai-upload-hero {
    min-height: auto;
    padding: 16px;
    border-radius: 24px;
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,252,252,0.98));
    border: 1px solid rgba(20,184,166,0.18);
    box-shadow: 0 12px 28px rgba(31,36,48,0.07);
}

.ai-upload-shell .app-ai-hero-copy h1 {
    font-size: 1.34rem;
    line-height: 1.12;
}

.ai-upload-shell .app-ai-hero-copy p:not(.eyebrow) {
    max-width: none;
    margin-top: 7px;
    color: #667085;
}

.ai-upload-shell .app-ai-flow {
    gap: 8px;
}

.ai-upload-shell .app-ai-flow div {
    min-height: 56px;
    border-radius: 18px;
    box-shadow: 0 8px 18px rgba(31,36,48,0.05);
}

.ai-upload-shell .app-ai-upload-panel {
    padding: 15px;
    border-radius: 24px;
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(31,36,48,0.05);
    box-shadow: 0 12px 28px rgba(31,36,48,0.07);
}

.ai-upload-shell .profile-panel-title h2 {
    font-size: 1.26rem;
    line-height: 1.12;
}

.ai-upload-shell .app-ai-theme-grid {
    gap: 10px;
    margin-right: -15px;
    padding-right: 15px;
}

.ai-upload-shell .app-ai-theme-grid button {
    position: relative;
    flex-basis: 206px;
    min-height: 242px;
    padding: 10px;
    border-radius: 20px;
    overflow: hidden;
    color: #101828;
    background:
        linear-gradient(180deg, #ffffff, #f8fafc);
    border-top: 3px solid #14b8a6;
}

.ai-upload-shell .app-ai-theme-grid button.active {
    background:
        linear-gradient(180deg, #fff7ed, #ffffff);
    border: 2px solid #14b8a6;
    border-top-width: 3px;
    color: #101828;
    box-shadow: 0 0 0 3px rgba(20,184,166,0.16), 0 14px 30px rgba(31,36,48,0.08);
}

.ai-upload-shell .app-ai-theme-grid button:nth-child(4n + 1) {
    border-top-color: #7c3aed;
}

.ai-upload-shell .app-ai-theme-grid button:nth-child(4n + 2) {
    border-top-color: #f97316;
}

.ai-upload-shell .app-ai-theme-grid button:nth-child(4n + 3) {
    border-top-color: #65a30d;
}

.ai-upload-shell .app-ai-theme-grid button:nth-child(4n + 4) {
    border-top-color: #0ea5e9;
}

.ai-upload-shell .app-ai-theme-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    min-height: 110px;
    margin: -2px -2px 8px;
    padding: 7px;
    border-radius: 17px;
    background: #0b1020;
}

.ai-upload-shell .app-ai-theme-preview span {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(255,255,255,0.12);
}

.ai-upload-shell .app-ai-theme-preview b {
    position: absolute;
    left: 6px;
    top: 6px;
    z-index: 2;
    padding: 3px 7px;
    border-radius: 999px;
    color: #fff;
    background: rgba(15,23,42,0.72);
    font-size: 0.62rem;
}

.ai-upload-shell .app-ai-theme-preview span:last-child b {
    background: rgba(22,101,52,0.82);
}

.ai-upload-shell .app-ai-theme-preview img {
    display: block;
    width: 100%;
    height: 104px;
    object-fit: cover;
}

.ai-upload-shell .app-ai-theme-grid button > i {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
}

.ai-upload-shell .app-ai-theme-grid button strong {
    display: block;
    min-height: 42px;
    font-size: 1rem;
    line-height: 1.14;
}

.ai-upload-shell .app-ai-theme-price {
    align-self: auto;
    justify-self: start;
    display: inline-flex;
    min-height: 34px;
    margin-top: 8px;
    padding: 0 13px;
    border-radius: 999px;
    align-items: center;
    color: #fff;
    background: linear-gradient(135deg, #f97316, #c2410c);
    box-shadow: 0 10px 22px rgba(249,115,22,0.22);
    opacity: 1;
    font-weight: 900;
}

.ai-upload-shell .app-ai-theme-example-link {
    align-self: end;
    justify-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    margin: 8px -2px -2px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    opacity: 1;
    font-size: 0.78rem;
    font-weight: 900;
}

.ai-upload-shell .app-ai-theme-example-link i {
    display: inline-block;
    width: auto;
    height: auto;
    margin: 0;
    border-radius: 0;
    color: inherit;
    background: transparent;
    font-size: 0.95rem;
}

.ai-upload-shell .app-ai-examples {
    padding: 0;
    overflow: hidden;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.ai-upload-shell .app-ai-examples .profile-panel-title {
    padding: 0 4px;
    margin-bottom: 8px;
}

.ai-upload-shell .app-ai-example-strip {
    gap: 10px;
    margin-right: -14px;
    padding-right: 14px;
}

.ai-upload-shell .app-ai-example-card {
    flex-basis: 286px;
    padding: 10px;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(31,36,48,0.07);
}

.ai-upload-shell .app-ai-example-strip.single .app-ai-example-card {
    width: 100%;
}

.ai-upload-shell .app-ai-example-pair {
    min-height: 0;
    padding: 0;
    gap: 8px;
    border-radius: 18px;
    background: transparent;
    box-shadow: none;
}

.ai-upload-shell .app-ai-example-pair span {
    border-radius: 16px;
}

.ai-upload-shell .app-ai-example-pair img {
    height: 132px;
}

.ai-upload-shell .app-ai-example-strip.single .app-ai-example-pair img {
    height: 158px;
}

.ai-upload-shell .app-ai-create-card {
    border-color: rgba(20,184,166,0.2);
}

.ai-upload-shell .app-ai-upload-drop {
    min-height: 180px;
}

.bottom-nav {
    bottom: 0 !important;
    height: 64px !important;
    min-height: 64px !important;
    padding: 5px 8px 4px !important;
    align-items: end;
    overflow: visible;
}

.bottom-nav a {
    min-height: 54px;
    transform: none !important;
}

.pwa-build-version {
    position: absolute;
    left: auto;
    right: 8px;
    top: -15px;
    bottom: auto;
    z-index: 2;
    transform: none;
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(255,255,255,0.86);
    color: rgba(31,36,48,0.42);
    font-size: 0.62rem;
    font-weight: 800;
    pointer-events: none;
}

/* AI upload fixes v60 */
.ai-upload-shell .app-topbar {
    gap: 8px;
    padding-left: 12px;
    padding-right: 12px;
}

.ai-upload-shell .app-back-button {
    width: 38px;
    height: 38px;
}

.ai-upload-shell .app-back-button + .brand-chip {
    flex: 1 1 auto;
    justify-content: center;
    max-width: none;
    min-width: 0;
    margin-right: 0;
    padding: 6px 10px;
}

.ai-upload-shell .app-back-button + .brand-chip span {
    max-width: none;
    font-size: clamp(0.92rem, 3.8vw, 1.08rem);
    line-height: 1;
    letter-spacing: 0;
}

.ai-upload-shell .wallet-chip {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 6px 10px;
}

.ai-upload-shell .app-ai-theme-example-link {
    cursor: pointer;
    touch-action: manipulation;
}

.ai-upload-shell .app-ai-theme-example-link:active {
    transform: translateY(1px) scale(0.99);
}

.app-ai-gallery-modal .app-ai-gallery-card {
    width: min(94vw, 560px);
    max-height: min(82dvh, 760px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.app-ai-gallery-modal {
    align-items: center;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
}

.app-ai-gallery-modal .app-ai-gallery-card {
    transform: translateY(-3dvh);
}

.app-ai-gallery-modal .app-ai-gallery-card h2 {
    margin: -4px 42px 0 0;
    font-size: 1.35rem;
    line-height: 1.12;
}

.app-ai-gallery-list {
    display: grid;
    gap: 12px;
    overflow-y: auto;
    padding-right: 2px;
    -webkit-overflow-scrolling: touch;
}

.app-ai-gallery-item {
    padding: 10px;
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border: 1px solid rgba(31,36,48,0.08);
}

.app-ai-gallery-item h3 {
    margin: 0 0 9px;
    color: #101828;
    font-size: 1rem;
    line-height: 1.18;
}

.app-ai-gallery-item .app-ai-example-pair {
    min-height: 0;
    padding: 0;
    gap: 8px;
    background: transparent;
    box-shadow: none;
}

.app-ai-gallery-item .app-ai-example-pair span {
    aspect-ratio: 3 / 4;
}

.app-ai-gallery-item .app-ai-example-pair img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* AI upload carousel rebuild v60 */
.ai-upload-shell .app-ai-upload-hero,
.ai-upload-shell .app-ai-flow {
    display: none !important;
}

.ai-upload-shell .app-ai-theme-grid {
    display: flex;
    gap: 14px;
    margin: 0 -15px;
    padding: 2px 15px 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 15px;
    -webkit-overflow-scrolling: touch;
}

.ai-upload-shell .app-ai-theme-grid::-webkit-scrollbar {
    display: none;
}

.ai-upload-shell .app-ai-theme-grid button {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 0 0 calc(100% - 8px);
    min-height: 560px;
    padding: 16px;
    scroll-snap-align: center;
    scroll-snap-stop: always;
}

.ai-upload-shell .app-ai-theme-favorite {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid rgba(245,158,11,0.45);
    box-shadow: 0 8px 18px rgba(180,83,9,0.12);
    transition: transform 0.16s ease, background 0.16s ease;
}

.ai-upload-shell .app-ai-theme-favorite::before {
    content: "★";
    position: absolute;
    left: 50%;
    top: 50%;
    color: #b45309;
    font-family: Arial, sans-serif;
    font-size: 1.82rem;
    font-weight: 900;
    line-height: 1;
    transform: translate(-50%, -51%);
}

.ai-upload-shell .app-ai-theme-favorite:active {
    transform: scale(0.94);
}

.ai-upload-shell .app-ai-theme-grid button.is-favorite .app-ai-theme-favorite {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    border-color: transparent;
    box-shadow: 0 10px 22px rgba(249,115,22,0.28);
}

.ai-upload-shell .app-ai-theme-grid button.is-favorite .app-ai-theme-favorite::before {
    color: #fff;
}

.ai-upload-shell .app-ai-favorites-filter {
    display: inline-flex;
    align-items: center;
    margin-top: 12px;
}

.ai-upload-shell .app-ai-favorites-filter input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ai-upload-shell .app-ai-favorites-filter span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    color: #475467;
    background: #f4f6fb;
    border: 1px solid rgba(31,36,48,0.08);
    font-size: 0.88rem;
    font-weight: 900;
}

.ai-upload-shell .app-ai-favorites-filter input:checked + span {
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    border-color: transparent;
    box-shadow: 0 10px 22px rgba(249,115,22,0.22);
}

.ai-upload-shell .app-ai-theme-preview {
    align-self: stretch;
    width: 100%;
    box-sizing: border-box;
    min-height: 282px;
    max-height: none !important;
    margin: -4px 0 14px;
    padding: 9px;
}

.ai-upload-shell .app-ai-theme-preview img {
    height: 264px !important;
    object-fit: contain !important;
    background: rgba(255,255,255,0.08);
}

.ai-upload-shell .app-ai-theme-grid button > i {
    width: 72px;
    height: 72px;
    margin-bottom: 18px;
    font-size: 2rem;
}

.ai-upload-shell .app-ai-theme-grid button strong {
    min-height: auto;
    font-size: 1.2rem;
    line-height: 1.08;
}

.ai-upload-shell .app-ai-theme-description {
    display: block;
    margin-top: 8px;
    color: #667085;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.28;
    text-align: left;
    display: -webkit-box;
    max-height: 3.58em;
    overflow: hidden;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.ai-upload-shell .app-ai-theme-price {
    min-height: 42px;
    margin-top: 0;
    padding: 0 18px;
    font-size: 1.05rem;
}

.ai-upload-shell .app-ai-theme-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    margin-top: 14px;
}

.ai-upload-shell .app-ai-theme-bottom {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: auto;
}

.ai-upload-shell .app-ai-theme-count {
    flex: 0 0 auto;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 999px;
    color: #475467;
    background: rgba(248,250,252,0.92);
    border: 1px solid rgba(31,36,48,0.08);
    font-size: 0.82rem;
    font-weight: 900;
    white-space: nowrap;
}

.ai-upload-shell .app-ai-theme-example-link {
    align-self: stretch;
    width: 100%;
    min-height: 46px;
    margin-top: 0;
    margin-bottom: 0;
    border-radius: 16px;
    font-size: 0.92rem;
    white-space: nowrap;
}

.ai-upload-shell .app-ai-theme-controls {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 2px;
}

@media (min-width: 769px) {
    .ai-upload-shell .app-ai-theme-controls {
        display: flex;
    }
}

.ai-upload-shell .app-ai-theme-controls button {
    display: grid;
    place-items: center;
    width: 48px;
    height: 42px;
    border: 0;
    border-radius: 16px;
    color: #101828;
    background: #fff;
    box-shadow: 0 10px 24px rgba(31,36,48,0.1);
    font-size: 1.1rem;
}

.ai-upload-shell .app-ai-theme-controls [data-theme-home] {
    width: 56px;
    color: #fff;
    background: linear-gradient(135deg, #14b8a6, #6366f1);
}

.ai-upload-shell .app-ai-theme-controls button:active {
    transform: translateY(1px) scale(0.98);
}

.ai-chat-shell {
    background:
        linear-gradient(180deg, rgba(248,250,255,0.96), rgba(241,245,249,0.98)),
        radial-gradient(circle at 8% 0%, rgba(37,99,235,0.16), transparent 30%),
        radial-gradient(circle at 96% 8%, rgba(139,92,246,0.16), transparent 28%);
}

.ai-chat-main {
    display: grid;
    gap: 14px;
    padding: 12px 14px 92px;
}

.ai-chat-model-panel {
    padding: 10px;
}

.ai-chat-quick-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 10px;
}

.ai-chat-model-picker {
    min-width: 0;
    position: relative;
}

.ai-chat-model-picker summary {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 8px;
    min-height: 58px;
    padding: 8px 12px 8px 8px;
    border-radius: 20px;
    color: var(--ink);
    background: #f7f8fc;
    border: 1px solid rgba(31,36,48,0.08);
    list-style: none;
    cursor: pointer;
}

.ai-chat-model-picker summary .ai-chat-model-icon {
    grid-area: auto;
    width: 38px;
    height: 38px;
    margin-bottom: 0;
    border-radius: 14px;
}

.ai-chat-model-picker summary::-webkit-details-marker {
    display: none;
}

.ai-chat-model-picker summary small,
.ai-chat-model-picker summary strong {
    display: block;
    min-width: 0;
}

.ai-chat-model-picker summary > span:not(.ai-chat-model-icon) {
    display: block;
    min-width: 0;
    width: 100%;
}

.ai-chat-model-picker summary small {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ai-chat-model-picker summary strong {
    margin-top: 2px;
    font-size: 0.96rem;
    line-height: 1.15;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ai-chat-model-picker summary > .bi-chevron-down {
    color: #707786;
    transition: transform 0.18s ease;
}

.ai-chat-model-picker[open] summary > .bi-chevron-down {
    transform: rotate(180deg);
}

.ai-chat-new-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 112px;
    min-height: 58px;
    padding: 0 14px;
    border: 0;
    border-radius: 20px;
    color: #fff;
    background: linear-gradient(135deg, #20bca5, #6672ff);
    box-shadow: 0 12px 22px rgba(80,100,230,0.22);
    font-weight: 850;
}

.ai-chat-control-card,
.ai-chat-window {
    padding: 16px;
    border-radius: 24px;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(31,36,48,0.08);
    box-shadow: 0 16px 36px rgba(31,36,48,0.08);
}

.ai-chat-control-card .profile-panel-title,
.ai-chat-window-title {
    margin-bottom: 12px;
}

.ai-chat-icon-button,
.ai-chat-mini-action,
.ai-chat-composer button,
.ai-chat-message-actions button {
    border: 0;
    cursor: pointer;
}

.ai-chat-icon-button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #20bca5, #6672ff);
    box-shadow: 0 12px 22px rgba(80,100,230,0.22);
    font-size: 1.05rem;
}

.ai-chat-model-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.ai-chat-model-picker .ai-chat-model-grid {
    grid-template-columns: 1fr;
    max-height: min(42dvh, 340px);
    overflow-y: auto;
    margin-top: 10px;
    padding-right: 2px;
}

.ai-chat-model-card {
    min-width: 0;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-areas:
        "icon title"
        "icon input"
        "icon output";
    column-gap: 10px;
    align-items: center;
    padding: 10px;
    border-radius: 20px;
    border: 1px solid rgba(31,36,48,0.08);
    background: #f7f8fc;
    text-align: left;
    color: var(--ink);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.ai-chat-model-card.active {
    border-color: rgba(102,114,255,0.65);
    background: #fff;
    box-shadow: 0 12px 24px rgba(102,114,255,0.16);
    transform: translateY(-1px);
}

.ai-chat-model-card .ai-chat-model-icon {
    grid-area: icon;
}

.ai-chat-model-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 15px;
    color: #fff;
    margin-bottom: 10px;
}

.ai-chat-model-card strong,
.ai-chat-model-card small {
    display: block;
    min-width: 0;
}

.ai-chat-model-card strong {
    grid-area: title;
    font-size: 0.95rem;
    line-height: 1.15;
}

.ai-chat-model-card small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.25;
}

.ai-chat-model-card small:nth-of-type(1) {
    grid-area: input;
}

.ai-chat-model-card small:nth-of-type(2) {
    grid-area: output;
}

.ai-chat-history-card {
    padding-bottom: 12px;
}

.ai-chat-conversations {
    display: grid;
    gap: 9px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 2px;
}

.ai-chat-conversation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px 38px;
    gap: 7px;
    align-items: center;
    padding: 7px;
    border-radius: 18px;
    border: 1px solid rgba(31,36,48,0.08);
    background: #f8f9fd;
}

.ai-chat-conversation.active {
    border-color: rgba(32,188,165,0.5);
    background: #fff;
}

.ai-chat-conversation-open {
    min-width: 0;
    padding: 4px;
    border: 0;
    background: transparent;
    text-align: left;
    color: inherit;
}

.ai-chat-conversation-open strong,
.ai-chat-conversation-open span {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ai-chat-conversation-open strong {
    font-size: 0.9rem;
    line-height: 1.2;
}

.ai-chat-conversation-open span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.72rem;
}

.ai-chat-mini-action {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    color: #5f6675;
    background: #fff;
}

.ai-chat-mini-action.danger {
    color: #b4232f;
    background: #fff0f1;
}

.ai-chat-window {
    display: grid;
    grid-template-rows: auto minmax(360px, 1fr);
    min-height: 480px;
}

.ai-chat-messages {
    min-height: 0;
    max-height: min(62dvh, 620px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 2px 2px 4px;
}

.ai-chat-empty,
.ai-chat-empty-small {
    display: grid;
    place-items: center;
    text-align: center;
    gap: 8px;
    min-height: 170px;
    color: var(--muted);
    border: 1px dashed rgba(31,36,48,0.14);
    border-radius: 20px;
    background: #f8f9fd;
    padding: 18px;
}

.ai-chat-empty i {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #20bca5, #6672ff);
    font-size: 1.5rem;
}

.ai-chat-empty strong {
    color: var(--ink);
    font-size: 1.1rem;
}

.ai-chat-empty-small {
    min-height: 72px;
    font-weight: 750;
}

.ai-chat-message {
    display: grid;
    gap: 6px;
    max-width: 92%;
}

.ai-chat-message.user {
    align-self: flex-end;
}

.ai-chat-message.assistant {
    align-self: flex-start;
}

.ai-chat-message-body {
    border-radius: 22px;
    padding: 12px 14px;
    box-shadow: 0 10px 22px rgba(31,36,48,0.08);
}

.ai-chat-message.user .ai-chat-message-body {
    color: #fff;
    background: linear-gradient(135deg, #242a3a, #6672ff);
    border-bottom-right-radius: 8px;
}

.ai-chat-message.assistant .ai-chat-message-body {
    color: var(--ink);
    background: #fff;
    border: 1px solid rgba(31,36,48,0.08);
    border-bottom-left-radius: 8px;
}

.ai-chat-message-body p {
    margin: 0;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
}

.ai-chat-message-body pre {
    overflow-x: auto;
    margin: 8px 0;
    padding: 10px;
    border-radius: 12px;
    color: #e5e7eb;
    background: #111827;
}

.ai-chat-message-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.72rem;
    padding: 0 4px;
}

.ai-chat-message.user .ai-chat-message-actions {
    justify-content: flex-end;
}

.ai-chat-message-actions button {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    color: #606879;
    background: #f3f5fa;
}

.ai-chat-composer {
    position: sticky;
    bottom: 0;
    z-index: 8;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px;
    gap: 10px;
    padding: 10px;
    border-radius: 24px;
    background: rgba(255,255,255,0.94);
    border: 1px solid rgba(31,36,48,0.08);
    box-shadow: 0 16px 34px rgba(31,36,48,0.12);
}

.ai-chat-composer textarea {
    width: 100%;
    min-height: 52px;
    max-height: 140px;
    resize: none;
    border: 0;
    outline: 0;
    border-radius: 18px;
    padding: 15px 14px;
    background: #f5f7fb;
    color: var(--ink);
    font-weight: 650;
    line-height: 1.35;
}

.ai-chat-composer button {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #20bca5, #6672ff);
    box-shadow: 0 14px 24px rgba(80,100,230,0.24);
    font-size: 1.05rem;
}

.ai-chat-composer button:disabled {
    opacity: 0.72;
}

.ai-chat-loader,
.ai-chat-send-loader {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid rgba(102,114,255,0.18);
    border-top-color: #6672ff;
    animation: aiChatSpin 0.82s linear infinite;
}

.ai-chat-send-loader {
    width: 20px;
    height: 20px;
    border-color: rgba(255,255,255,0.35);
    border-top-color: #fff;
}

@keyframes aiChatSpin {
    to { transform: rotate(360deg); }
}

body > .app-toast {
    position: fixed;
    left: 50%;
    bottom: 104px;
    z-index: 100;
    width: min(560px, calc(100% - 28px));
    transform: translate(-50%, 14px);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

body > .app-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 760px) {
    .ai-chat-quick-row {
        grid-template-columns: minmax(0, 1fr) 54px;
    }

    .ai-chat-new-button {
        min-width: 54px;
        width: 54px;
        padding: 0;
    }

    .ai-chat-new-button span {
        display: none;
    }
}

@media (max-width: 420px) {
    .ai-chat-main {
        padding-left: 12px;
        padding-right: 12px;
    }

    .ai-chat-model-grid {
        grid-template-columns: 1fr;
    }

    .ai-chat-window {
        min-height: 430px;
        grid-template-rows: auto minmax(300px, 1fr);
    }

    .ai-chat-message {
        max-width: 96%;
    }
}
