:root {
    --bg: #0b0f19;
    --text: #f1f5f9;
    --glass-bg: rgba(15, 23, 42, 0.55);
    --glass-border: rgba(255, 255, 255, 0.07);
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --secondary: #1e293b;
    --secondary-hover: #334155;
    --accent: #06b6d4;
    --accent-hover: #0891b2;
    --danger: #f87171;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

body.modal-open { overflow: hidden; }

.hidden { display: none !important; }

/* ── Background ── */
.background-elements {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.blob {
    position: absolute;
    filter: blur(120px);
    border-radius: 50%;
    opacity: 0.15;
    animation: drift 20s infinite ease-in-out alternate;
}

.blob-1 {
    width: 44vw;
    height: 44vw;
    background: var(--primary);
    top: -18vh;
    left: -8vw;
}

.blob-2 {
    width: 36vw;
    height: 36vw;
    background: var(--accent);
    bottom: -16vh;
    right: -6vw;
    animation-delay: -7s;
}

@keyframes drift {
    to { transform: translate(40px, 40px) scale(1.05); }
}

/* ── Utilities ── */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.w-full { width: 100%; }
.mb-3 { margin-bottom: 0.75rem; }

/* ── App Shell ── */
.app-shell {
    max-width: 1360px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ── Navbar ── */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--glass-border);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-icon {
    width: 22px;
    height: 22px;
    color: var(--accent);
}

.navbar-brand span {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.navbar-end {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-status,
.navbar-detail {
    display: none;
}

.navbar-title {
    font-size: 0.82rem;
    color: #64748b;
    white-space: nowrap;
}

.account-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.account-provider {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.account-provider-copy {
    color: #64748b;
    font-size: 0.78rem;
}

/* ── Workspace Layout ── */
.workspace {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.25rem;
    align-items: start;
}

.hero-panel {
    grid-column: 1 / -1;
    padding: 1.5rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.hero-kicker,
.seo-kicker {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hero-panel h1,
.seo-card h2 {
    font-size: clamp(1.8rem, 3vw, 3rem);
    line-height: 1;
    letter-spacing: -0.04em;
}

.hero-copy {
    max-width: 60ch;
    color: #cbd5e1;
    line-height: 1.65;
}

.hero-points {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.hero-points span {
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #dbeafe;
    font-size: 0.82rem;
}

.pricing-section {
    grid-column: 1 / -1;
    padding: 1.5rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pricing-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: end;
}

.pricing-header h2,
.product-card h2 {
    font-size: clamp(1.4rem, 2.5vw, 2.4rem);
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.pricing-summary {
    max-width: 46ch;
    color: #cbd5e1;
    line-height: 1.65;
}

.pricing-grid,
.product-track {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.product-track {
    grid-column: 1 / -1;
}

.pricing-card,
.product-card {
    padding: 1.25rem;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.pricing-card-emphasis {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.14), rgba(6, 182, 212, 0.08));
    border-color: rgba(99, 102, 241, 0.35);
}

.pricing-badge,
.product-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.32rem 0.62rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #dbeafe;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.pricing-card h3 {
    margin-top: 0.9rem;
    font-size: 1.4rem;
}

.pricing-price {
    margin-top: 0.85rem;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.05em;
}

.pricing-period,
.pricing-copy,
.product-card p,
.api-pack-card p,
.api-pack-card span {
    color: #cbd5e1;
    line-height: 1.65;
}

.pricing-list {
    margin: 1rem 0 1.1rem;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    color: #f8fafc;
}

.product-card {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.product-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    margin-top: auto;
}

.api-pack-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.api-pack-card {
    padding: 0.85rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.api-pack-card strong,
.api-pack-card span {
    display: block;
}

.api-pack-card strong {
    margin-bottom: 0.3rem;
}

/* ── Control Panel ── */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Usage Panel ── */
.usage-panel {
    padding: 0.85rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.usage-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.plan-pill {
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.plan-pill-pro {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(6, 182, 212, 0.22));
    color: #f8fafc;
}

.usage-title {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 600;
    color: #e2e8f0;
}

.usage-detail {
    color: #475569;
    font-size: 0.75rem;
    line-height: 1.45;
}

.usage-meter {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
}

.usage-meter span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    transition: width 0.25s ease;
}

/* ── Upload ── */
.upload-section {
    padding: 2.25rem 1.25rem;
    text-align: center;
    border: 1.5px dashed rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.upload-section:hover,
.upload-section.drag-active {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

.batch-panel {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.batch-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 0.8rem;
}

.batch-panel h3 {
    font-size: 1rem;
    line-height: 1.2;
}

.batch-panel-copy,
.batch-job-count,
.batch-item span,
.batch-item-error {
    color: #94a3b8;
    font-size: 0.78rem;
    line-height: 1.55;
}

.batch-job {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.batch-job-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.batch-progress span {
    transition: width 0.2s ease;
}

.batch-item-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 0.15rem;
}

.batch-item {
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.batch-item strong {
    display: block;
    margin-bottom: 0.18rem;
    font-size: 0.82rem;
    color: #f8fafc;
}

.batch-item-error {
    display: block;
    margin-top: 0.35rem;
    color: #fda4af;
}

.api-access-panel {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.api-access-head,
.api-access-summary,
.api-key-form-row,
.api-key-card-head,
.api-key-card-actions,
.api-ledger-card {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    align-items: center;
}

.api-access-panel h3 {
    font-size: 1rem;
    line-height: 1.2;
}

.api-access-copy,
.api-endpoint,
.api-key-meta,
.api-ledger-card span,
.api-ledger-card em {
    color: #94a3b8;
    font-size: 0.78rem;
    line-height: 1.55;
}

.api-endpoint {
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.api-key-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.api-key-form label {
    font-size: 0.8rem;
    color: #e2e8f0;
}

.api-key-form-row input {
    flex: 1;
}

.api-key-card,
.api-ledger-card {
    padding: 0.85rem 0.9rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.api-key-card strong,
.api-ledger-card strong {
    display: block;
    margin-bottom: 0.15rem;
    color: #f8fafc;
}

.api-key-card-actions {
    margin-top: 0.75rem;
}

.api-ledger-card {
    align-items: flex-start;
}

.api-ledger-card em {
    font-style: normal;
}

.stack-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.generated-codes {
    padding: 0.95rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.generated-codes h3 {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
}

.code-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.code-chip {
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    background: rgba(41, 198, 162, 0.12);
    color: #d4fff5;
    font-weight: 700;
    letter-spacing: 0.04em;
    word-break: break-all;
}

.upload-icon {
    width: 36px;
    height: 36px;
    color: #475569;
    margin-bottom: 0.6rem;
}

.upload-heading {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 0.25rem;
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.link-btn:hover {
    color: #22d3ee;
}

.formats-info {
    font-size: 0.72rem;
    color: #475569;
}

/* ── Processing ── */
.processing-section {
    padding: 2.5rem 1.25rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loader-ring {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin-bottom: 0.85rem;
}

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

.processing-label {
    font-size: 0.9rem;
    font-weight: 600;
}

.sub-text {
    font-size: 0.82rem;
    color: #475569;
    margin-top: 0.35rem;
}

.processing-section .sub-text {
    max-width: 28ch;
    line-height: 1.5;
}

/* ── Tools / Editor ── */
.tools-section {
    padding: 1.1rem;
}

.tools-section h3 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.92rem;
    margin-bottom: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--glass-border);
}

.tool-group {
    margin-bottom: 1rem;
}

.tool-group label {
    display: block;
    font-size: 0.78rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 30px);
    gap: 0.45rem;
}

.color-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.15s;
}

.color-btn:hover {
    transform: scale(1.12);
}

.color-btn.active {
    border-color: white;
    transform: scale(1.12);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1rem;
}

/* ── Buttons ── */
.btn-primary,
.btn-secondary {
    padding: 0.6rem 1.15rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 2px 14px rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-sm {
    padding: 0.38rem 0.8rem;
    font-size: 0.78rem;
}

.btn-ghost {
    background: none;
    border: 1px solid var(--glass-border);
    color: #cbd5e1;
    padding: 0.38rem 0.8rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-family: inherit;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: white;
}

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

/* ── Advanced Settings ── */
.advanced-settings {
    overflow: hidden;
    padding: 0.2rem 1.1rem;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    cursor: pointer;
    user-select: none;
}

.accordion-header .title-wrap {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.accordion-header .chevron {
    transition: transform 0.3s ease;
}

.advanced-settings.open .chevron {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    opacity: 0;
}

.advanced-settings.open .accordion-content {
    max-height: 620px;
    opacity: 1;
    margin-bottom: 0.75rem;
}

.setting-item {
    margin-top: 1.1rem;
    margin-bottom: 0.3rem;
}

.setting-item label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #e2e8f0;
    margin-bottom: 0.4rem;
}

.custom-select {
    width: 100%;
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: white;
    outline: none;
    font-size: 0.82rem;
    font-family: inherit;
}

.custom-select option {
    background: var(--bg);
}

.fine-print {
    font-size: 0.7rem;
    color: #475569;
}

.toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider.round {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.08);
    transition: 0.3s;
    border-radius: 22px;
}

.slider.round:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider.round {
    background-color: var(--primary);
}

input:checked + .slider.round:before {
    transform: translateX(18px);
}

/* Range */
.range-group {
    margin-bottom: 0.7rem;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-bottom: 0.2rem;
}

input[type=range] {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    margin-top: -5px;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}

/* ── Preview Panel ── */
.preview-panel {
    min-height: 540px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem;
    position: relative;
    overflow: hidden;
}

.seo-section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.seo-card {
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.seo-grid,
.faq-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.seo-grid h3,
.faq-list h3 {
    margin-bottom: 0.45rem;
    font-size: 1rem;
}

.seo-grid p,
.faq-list p {
    color: #cbd5e1;
    line-height: 1.65;
    font-size: 0.95rem;
}

.empty-state {
    text-align: center;
    color: #334155;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.empty-state p {
    font-size: 0.85rem;
}

.huge-icon {
    width: 52px;
    height: 52px;
    opacity: 0.35;
}

/* ── Comparison Slider ── */
.comparison-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 4 / 5;
    border-radius: var(--radius-sm);
    overflow: hidden;
    user-select: none;
}

.image-wrapper img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.result-layer {
    position: absolute;
    inset: 0;
    transition: background 0.3s ease;
}

.checkerboard {
    background-color: #f8fafc;
    background-image:
        linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
        linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.original-layer {
    position: absolute;
    inset: 0;
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}

.slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    background: white;
    cursor: ew-resize;
    transform: translateX(-50%);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.slider-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: white;
    color: var(--bg);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.25);
}

.label-badge {
    position: absolute;
    bottom: 14px;
    padding: 4px 10px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
    z-index: 5;
    pointer-events: none;
}

.original-badge { left: 14px; }
.result-badge { right: 14px; }

/* ── Toasts ── */
.toast-container {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: white;
    padding: 0.75rem 1.15rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.55rem;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-size: 0.85rem;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.error { border-left: 3px solid var(--danger); }
.toast.success { border-left: 3px solid #10b981; }

/* ── Modals ── */
.upgrade-modal,
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.upgrade-modal-backdrop,
.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 15, 25, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.upgrade-modal-card,
.auth-modal-card {
    position: relative;
    width: min(100%, 440px);
    padding: 1.5rem;
    z-index: 1;
}

.upgrade-modal-close,
.auth-modal-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
    cursor: pointer;
}

.upgrade-modal-eyebrow,
.auth-modal-eyebrow {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.35rem;
}

.upgrade-modal-card h2,
.auth-modal-card h2 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.upgrade-modal-copy,
.auth-modal-copy {
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 0.88rem;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    margin-bottom: 0.85rem;
}

.auth-tab {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    color: #94a3b8;
    padding: 0.6rem 0.85rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    font-family: inherit;
}

.auth-tab.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(6, 182, 212, 0.14));
    color: #f8fafc;
    border-color: rgba(6, 182, 212, 0.28);
}

.auth-divider {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin: 0.85rem 0 0.7rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
}

.auth-divider span {
    padding: 0 0.7rem;
}

.google-auth-block { margin-top: 0.85rem; }

.google-signin-slot {
    min-height: 42px;
    display: flex;
    justify-content: center;
}

.google-link-slot { justify-content: flex-start; }

.google-auth-help {
    color: #64748b;
    font-size: 0.75rem;
    line-height: 1.5;
    margin-top: 0.55rem;
}

.auth-form,
.upgrade-form {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.auth-form label,
.upgrade-form label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
}

.auth-form input,
.upgrade-form input {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: #f8fafc;
    outline: none;
    font-size: 0.85rem;
    font-family: inherit;
}

.auth-form input:focus,
.upgrade-form input:focus {
    border-color: rgba(6, 182, 212, 0.5);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.1);
}

.auth-form input:disabled,
.upgrade-form input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-confirm-group {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.auth-modal-error,
.upgrade-modal-error {
    color: #fca5a5;
    font-size: 0.8rem;
}

.auth-form-actions {
    margin-top: 0.15rem;
}

.upgrade-auth-required {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin-bottom: 0.85rem;
}

.upgrade-modal-help {
    color: #64748b;
    font-size: 0.75rem;
    line-height: 1.5;
}

.upgrade-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-top: 0.3rem;
}

/* ── Homepage Refresh ── */
.workspace {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.workspace-main {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.preview-column {
    min-width: 0;
    display: flex;
}

.preview-column .preview-panel {
    width: 100%;
}

.hero-shell,
.pricing-section,
.service-hub {
    padding: 1.5rem 1.4rem;
}

.hero-shell {
    overflow: hidden;
}

.hero-main {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.85fr);
    gap: 1rem;
    align-items: stretch;
}

.hero-copy-block {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.hero-shell h1 {
    font-size: clamp(2rem, 4vw, 4rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
    max-width: 11ch;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.15rem;
}

.hero-proof {
    display: flex;
}

.hero-proof-card {
    width: 100%;
    padding: 1.15rem;
    border-radius: calc(var(--radius) + 4px);
    background:
        radial-gradient(circle at top right, rgba(6, 182, 212, 0.18), transparent 45%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.09);
}

.hero-proof-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.8rem;
}

.hero-proof-metric {
    padding: 0.85rem;
    border-radius: var(--radius-sm);
    background: rgba(11, 15, 25, 0.34);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.hero-proof-metric strong {
    display: block;
    font-size: 1rem;
    color: #f8fafc;
}

.hero-proof-metric span {
    display: block;
    margin-top: 0.25rem;
    color: #94a3b8;
    font-size: 0.8rem;
    line-height: 1.45;
}

#pricing-section,
#workflow-hub {
    scroll-margin-top: 1rem;
}

.pricing-section,
.service-hub {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pricing-header,
.service-hub-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
}

.service-hub-head h2 {
    font-size: clamp(1.4rem, 2.5vw, 2.4rem);
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.pricing-tabs,
.workflow-tabs {
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.28rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    width: fit-content;
}

.pricing-tab-btn,
.workflow-tab-btn {
    border: 0;
    background: transparent;
    color: #94a3b8;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.pricing-tab-btn:hover,
.workflow-tab-btn:hover {
    color: #e2e8f0;
}

.pricing-tab-btn.active,
.workflow-tab-btn.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.18));
    color: #f8fafc;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.pricing-tab-pane,
.workflow-pane {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.api-pricing-layout,
.workflow-pane-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
    gap: 1rem;
    align-items: start;
}

.pricing-note-card {
    padding: 1.2rem;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pricing-note-card h3 {
    font-size: 1.35rem;
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.service-summary-card {
    min-height: 100%;
}

.compact-pack-grid {
    grid-template-columns: 1fr;
}

.learn-section {
    display: flex;
}

.learn-details {
    width: 100%;
    overflow: hidden;
    padding: 0;
}

.learn-details summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    cursor: pointer;
    padding: 1.2rem 1.4rem;
}

.learn-details summary::-webkit-details-marker {
    display: none;
}

.learn-details summary h2 {
    font-size: clamp(1.15rem, 2vw, 1.7rem);
    line-height: 1.1;
    letter-spacing: -0.04em;
    margin-top: 0.15rem;
}

.learn-details[open] summary {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.learn-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding: 1.3rem 1.4rem 1.4rem;
}

.learn-card {
    padding: 1.2rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.learn-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.75rem;
}

.learn-card h3 {
    margin-bottom: 0.38rem;
    font-size: 1rem;
}

.learn-card p {
    color: #cbd5e1;
    line-height: 1.65;
    font-size: 0.95rem;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .workspace,
    .workspace-main,
    .hero-main,
    .api-pricing-layout,
    .workflow-pane-grid,
    .learn-grid {
        grid-template-columns: 1fr;
    }

    .pricing-header,
    .service-hub-head,
    .pricing-grid,
    .product-track,
    .seo-section,
    .seo-grid,
    .faq-list {
        grid-template-columns: 1fr;
    }

    .pricing-header,
    .service-hub-head,
    .product-card-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .pricing-tabs,
    .workflow-tabs {
        width: 100%;
    }

    .api-pack-grid {
        grid-template-columns: 1fr;
    }

    .api-access-head,
    .api-access-summary,
    .api-key-form-row,
    .api-key-card-head,
    .api-key-card-actions,
    .api-ledger-card,
    .batch-panel-head,
    .batch-job-meta {
        flex-direction: column;
        align-items: stretch;
    }

    .preview-panel {
        min-height: 380px;
    }
}

@media (max-width: 640px) {
    .app-shell {
        padding: 0 1rem 1.5rem;
    }

    .navbar {
        flex-wrap: wrap;
    }

    .navbar-end {
        width: 100%;
        justify-content: flex-end;
    }

    .navbar-title {
        display: none;
    }

    .hero-shell,
    .pricing-section,
    .service-hub {
        padding: 1.15rem;
    }

    .hero-actions,
    .learn-details summary {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-proof-grid {
        grid-template-columns: 1fr;
    }

    .pricing-tab-btn,
    .workflow-tab-btn {
        flex: 1;
        text-align: center;
    }

    .learn-grid {
        padding: 1rem;
    }

    .upgrade-modal-card,
    .auth-modal-card {
        padding: 1.15rem;
    }

    .upgrade-form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .auth-tabs {
        grid-template-columns: 1fr;
    }
}