/* v0.8 UX polish: stable SVG flags, stronger responsive layout, and clearer store/admin UI */
:root {
    --sd-surface: rgba(255,255,255,.78);
    --sd-surface-strong: rgba(255,255,255,.92);
    --sd-ring: 0 0 0 4px rgba(91,142,234,.18);
}

html { scroll-behavior: smooth; }
body { overflow-x: hidden; }
body.menu-open { overflow: hidden; }

.topbar {
    position: sticky;
    top: 12px;
    z-index: 80;
    flex-wrap: wrap;
    isolation: isolate;
}
.topbar::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255,255,255,.35), rgba(255,255,255,.08));
    z-index: -1;
}
.brand { min-width: 0; }
.brand span:not(.brand-mark) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { align-items: center; flex-wrap: wrap; }
.icon-btn.mobile-menu { border: 0; background: rgba(255,255,255,.7); }

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(255,255,255,.58);
    border: 1px solid rgba(255,255,255,.72);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 10px 26px rgba(35,58,92,.08);
}
.lang-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 6px 11px 6px 7px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #315278;
    font-weight: 900;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease, color .18s ease;
    outline: none;
}
.lang-pill:hover,
.lang-pill.active,
.lang-pill:focus-visible {
    transform: translateY(-1px);
    color: #214469;
    background: linear-gradient(135deg, #ffffff, #eef7ff);
    box-shadow: 0 10px 22px rgba(45,98,196,.17);
}
.lang-pill.active::after {
    content: "";
    position: absolute;
    right: 8px;
    bottom: 5px;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #25b981;
    box-shadow: 0 0 0 2px #fff;
}
.flag-icon {
    width: 28px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 0 0 1px rgba(42,64,95,.1), 0 5px 14px rgba(35,58,92,.12);
    background: #fff;
}
.flag-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lang-text { display: inline-grid; gap: 0; line-height: 1.05; text-align: left; }
.lang-text strong { font-size: 12px; letter-spacing: .6px; }
.lang-text small { font-size: 10px; font-weight: 800; color: rgba(49,82,120,.58); text-transform: none; letter-spacing: 0; }
.flag-big {
    width: 72px;
    height: 54px;
    border-radius: 16px;
    box-shadow: 0 0 0 1px rgba(42,64,95,.1), 0 14px 30px rgba(35,58,92,.16);
}
.language-card {
    min-height: 168px;
    position: relative;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.language-card::before {
    content: "";
    position: absolute;
    inset: -35% auto auto -25%;
    width: 150px;
    height: 150px;
    border-radius: 999px;
    background: rgba(91,142,234,.12);
}
.language-card:hover,
.language-card.active,
.language-card:focus-visible {
    transform: translateY(-3px);
    border-color: rgba(45,98,196,.48);
    box-shadow: 0 24px 56px rgba(45,98,196,.18);
    outline: none;
}
.language-card.active::after {
    content: "✓";
    position: absolute;
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #25b981;
    color: #fff;
    font-weight: 900;
}

.main-panel,
.section-card,
.hero-copy,
.hero-preview,
.market-card,
.score-card,
.status-card,
.install-card,
.paytr-shell {
    box-shadow: 0 22px 58px rgba(35, 58, 92, .11);
}
.section-card,
.hero-copy,
.market-card,
.install-card {
    border-color: rgba(255,255,255,.72);
}
.btn {
    gap: 8px;
    transition: transform .18s ease, filter .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.btn:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: none;
    box-shadow: var(--sd-ring) !important;
}
.btn[disabled],
button[disabled] {
    opacity: .62;
    cursor: not-allowed;
    transform: none !important;
    filter: grayscale(.1);
}
.btn[data-loading="true"]::after {
    content: "";
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: sd-spin .75s linear infinite;
}
@keyframes sd-spin { to { transform: rotate(360deg); } }

.field input,
.field select,
.copy-input,
.admin-table select,
.swal2-input {
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.field input:hover,
.field select:hover,
.copy-input:hover,
.admin-table select:hover { background: #fff; }

.table-shell {
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.admin-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    backdrop-filter: blur(8px);
}
.admin-table tr:hover td { background: rgba(255,255,255,.28); }
.admin-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
}
.bulk-actions { align-items: center; }
.provider-card {
    background: rgba(255,255,255,.5);
    border-color: rgba(78,101,130,.14);
    color: #315278;
}
.provider-card code {
    padding: 12px;
    border-radius: 14px;
    background: rgba(49,82,120,.08);
    color: #315278;
    font-weight: 800;
}
.danger-text { color: #c81e3a; }
.mini-link { color: #2d62c4; }
.alert.success-alert {
    border: 1px solid rgba(37,185,129,.35);
    background: rgba(37,185,129,.13);
    color: #08784e;
}

.market-shell { overflow: hidden; }
.market-grid { align-items: stretch; }
.market-card {
    position: relative;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.market-card::after {
    content: "";
    position: absolute;
    right: -58px;
    top: -58px;
    width: 156px;
    height: 156px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(91,142,234,.18), transparent 65%);
    pointer-events: none;
}
.market-card:hover {
    transform: translateY(-5px);
    border-color: rgba(45,98,196,.32);
    box-shadow: 0 28px 64px rgba(35,58,92,.16);
}
.market-card .price { letter-spacing: -.8px; }
.checkout-mini-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}
.checkout-mini-grid .log-item { min-height: 74px; }

.paytr-header { grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); }
.paytr-frame-wrap { background: #fff; }

@media (min-width: 1441px) {
    .layout { max-width: 1680px; margin-inline: auto; }
    .market-shell, .paytr-shell { max-width: 1320px; }
    .main-panel { padding: 28px; }
}
@media (min-width: 1200px) and (max-width: 1440px) {
    .topbar { margin-inline: 16px; }
    .layout { grid-template-columns: 300px minmax(0, 1fr); gap: 18px; }
    h1 { font-size: clamp(32px, 3.7vw, 52px); }
}
@media (min-width: 768px) and (max-width: 1199px) {
    .topbar { border-radius: 28px; align-items: flex-start; }
    .language-switcher { margin-left: auto; }
    .top-actions { width: 100%; justify-content: flex-end; }
    .hero-grid, .paytr-header { grid-template-columns: 1fr; }
    .grid.three, .control-grid, .toggle-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chute-grid.modern { grid-template-columns: repeat(3, 1fr); }
    .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
    .topbar {
        top: 0;
        margin: 0;
        border-radius: 0 0 26px 26px;
        padding: 10px 12px;
        gap: 10px;
    }
    .brand { font-size: 20px; flex: 1; }
    .brand small, .byline { display: none; }
    .top-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .top-actions .btn { width: 100%; min-height: 40px; padding-inline: 10px; }
    .language-switcher {
        order: 6;
        width: 100%;
        justify-content: center;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .language-switcher::-webkit-scrollbar { display: none; }
    .lang-pill { flex: 1 0 auto; justify-content: center; }
    .lang-text small { display: none; }
    .layout { padding: 12px; }
    .main-panel, .market-shell, .paytr-shell { padding: 14px; border-radius: 22px; }
    .hero-copy { padding: 22px; }
    .section-head { align-items: stretch; flex-direction: column; }
    .section-head .btn { width: 100%; }
    .grid.three, .control-grid, .toggle-grid, .toggle-grid.compact, .chute-grid.modern, .language-card-grid, .market-grid, .checkout-mini-grid { grid-template-columns: 1fr; }
    .field.wide { grid-column: auto; }
    h1 { font-size: clamp(30px, 11vw, 42px); letter-spacing: -1.2px; }
    h2 { font-size: 20px; }
    .admin-table { min-width: 720px; }
    .paytr-frame-wrap, .paytr-frame-wrap iframe { min-height: 620px; }
}
@media (max-width: 480px) {
    .topbar { padding-inline: 10px; }
    .brand-mark { width: 30px; height: 30px; border-radius: 10px; }
    .brand { font-size: 18px; }
    .top-actions { grid-template-columns: 1fr; }
    .lang-pill { padding-inline: 8px; min-height: 36px; }
    .flag-icon { width: 25px; height: 20px; border-radius: 7px; }
    .section-card { padding: 16px; }
    .hero-actions { display: grid; grid-template-columns: 1fr; }
    .hero-actions .btn, .form-actions .btn { width: 100%; }
    .market-card { min-height: auto; padding: 18px; }
    .market-card .price { font-size: 24px; }
}
@media (max-width: 360px) {
    .brand span:not(.brand-mark) { max-width: 168px; }
    .lang-pill strong { font-size: 11px; }
    .flag-icon { width: 22px; height: 18px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

.checkout-body { min-height: 100vh; }
.checkout-shell {
    width: min(820px, calc(100% - 32px));
    margin: 28px auto 42px;
}
.checkout-shell h1 { font-size: clamp(2.1rem, 5vw, 4.4rem); }
.checkout-shell .live-log { margin-top: 18px; }

/* v0.10 - Credit wallet, feature grants and premium UX polish */
.v09-panel .sales-kpi-grid { grid-template-columns: repeat(5, minmax(120px, 1fr)); }
.credit-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 218, 121, .95), rgba(255, 183, 77, .9));
    color: #402504;
    font-weight: 900;
    box-shadow: 0 10px 24px rgba(255, 183, 77, .25);
    white-space: nowrap;
}
.credit-chip.large { font-size: 18px; padding: 9px 14px; }
.credit-admin-grid { align-items: stretch; margin-bottom: 18px; }
.mini-form {
    background: rgba(255,255,255,.52);
    border: 1px solid rgba(255,255,255,.58);
    border-radius: 24px;
    padding: 18px;
    box-shadow: 0 16px 38px rgba(64, 50, 120, .08);
}
.mini-form h3 { margin: 0 0 14px; font-size: 18px; }
.market-price-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.market-actions { display: grid; gap: 10px; margin-top: 12px; }
.v09-panel .market-card { transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.v09-panel .market-card:hover { transform: translateY(-4px); box-shadow: 0 22px 55px rgba(99, 75, 170, .16); }
@media (max-width: 1100px) { .v09-panel .sales-kpi-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); } }
@media (max-width: 640px) { .v09-panel .sales-kpi-grid, .grid.two.credit-admin-grid { grid-template-columns: 1fr; } .market-price-row { align-items: flex-start; } }

/* v1.0 SaaS workspace polish */
.tenant-chip{display:flex;flex-direction:column;gap:.25rem;padding:.85rem 1rem;border:1px solid rgba(255,255,255,.18);border-radius:18px;background:linear-gradient(135deg,rgba(255,255,255,.16),rgba(255,255,255,.06));box-shadow:inset 0 1px 0 rgba(255,255,255,.12)}
.tenant-chip strong{font-size:1rem;font-weight:850;letter-spacing:-.02em}.tenant-chip small{opacity:.72;font-weight:700}.admin-table td small{display:block;opacity:.68;margin-top:.2rem}.row-actions{display:flex;gap:.45rem;flex-wrap:wrap}.plan-input,.status-input{min-width:120px}.table-toolbar{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin:1rem 0}.table-toolbar .copy-input{max-width:420px}
@media(max-width:767px){.row-actions{flex-direction:column}.row-actions .btn{width:100%;justify-content:center}.table-toolbar .copy-input{max-width:none;width:100%}}

/* v1.1 — iframe-free studio preview. Prevents X-Frame/CSP preview breakage and gives a stable live demo. */
.hero-preview.live-preview-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 360px;
    background: linear-gradient(180deg, #c9fff3 0%, #b8dcff 56%, #c8d5f7 100%);
    border: 1px solid rgba(255,255,255,.78);
}
.studio-preview-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
}
.preview-toolbar {
    position: absolute;
    z-index: 3;
    top: 14px;
    left: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    border: 1px solid rgba(255,255,255,.62);
    border-radius: 18px;
    background: rgba(255,255,255,.74);
    box-shadow: 0 12px 30px rgba(38, 59, 91, .11);
    backdrop-filter: blur(12px);
}
.preview-toolbar > div {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 8px;
    color: #2c3f5f;
    font-size: 13px;
    font-weight: 900;
}
.preview-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #25d29b;
    box-shadow: 0 0 0 6px rgba(37,210,155,.18);
    flex: 0 0 auto;
}
.preview-open {
    flex: 0 0 auto;
    border: 0;
    border-radius: 999px;
    padding: 8px 11px;
    background: #ffffff;
    color: #486080;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(38, 59, 91, .1);
}
.preview-open:hover { transform: translateY(-1px); }
.preview-toast {
    position: absolute;
    z-index: 3;
    left: 50%;
    bottom: 18px;
    transform: translate(-50%, 14px);
    opacity: 0;
    pointer-events: none;
    min-width: 160px;
    max-width: calc(100% - 32px);
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(44, 63, 95, .9);
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    box-shadow: 0 14px 32px rgba(38, 59, 91, .22);
    transition: opacity .22s ease, transform .22s ease;
}
.preview-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}
@media (max-width: 1199px) {
    .hero-preview.live-preview-card { min-height: 300px; }
}
@media (max-width: 767px) {
    .preview-toolbar {
        align-items: flex-start;
        flex-direction: column;
        border-radius: 16px;
    }
    .preview-open { width: 100%; text-align: center; }
    .hero-preview.live-preview-card { min-height: 280px; }
}
