/* ===== Design Tokens ===== */
:root {
    --bg-deep: #070714;
    --bg-body: #0b0b1e;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.07);
    --surface-active: rgba(255, 255, 255, 0.10);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.14);
    --text-primary: #f0f0f8;
    --text-secondary: #9a9ab8;
    --text-muted: #5e5e7e;
    --accent-violet: #818cf8;
    --accent-purple: #a78bfa;

    --accent-green: #34d399;
    --accent-red: #f87171;
    --accent-amber: #fbbf24;
    --accent-cyan: #22d3ee;
    --gradient-brand: linear-gradient(135deg, #818cf8 0%, #c084fc 50%, #f472b6 100%);
    --gradient-verify: linear-gradient(135deg, #34d399 0%, #22d3ee 100%);
    --gradient-danger: linear-gradient(135deg, #f87171 0%, #fb923c 100%);
    --glass-bg: rgba(16, 16, 40, 0.6);
    --glass-border: rgba(255, 255, 255, 0.06);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 56px rgba(0, 0, 0, 0.5);
    --shadow-glow-violet: 0 0 40px rgba(129, 140, 248, 0.15);
    --shadow-glow-green: 0 0 40px rgba(52, 211, 153, 0.15);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    --vvh: 100vh;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    position: relative;
}

/* ===== Background Effects ===== */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

.bg-glow-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.15) 0%, transparent 70%);
    top: -150px;
    left: -100px;
    animation: float-slow 20s ease-in-out infinite;
}

.bg-glow-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(192, 132, 252, 0.12) 0%, transparent 70%);
    bottom: -100px;
    right: -80px;
    animation: float-slow 25s ease-in-out infinite reverse;
}

.bg-glow-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(52, 211, 153, 0.08) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: float-slow 18s ease-in-out infinite 5s;
}

@keyframes float-slow {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -20px) scale(1.05);
    }

    66% {
        transform: translate(-20px, 15px) scale(0.95);
    }
}

/* ===== Page Wrapper — fills viewport ===== */
.page-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 40px 24px;
    position: relative;
    z-index: 1;
}

/* ===== Container ===== */
.container {
    width: 100%;
    max-width: 860px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 36px 40px 32px;
    box-shadow: var(--shadow-lg), var(--shadow-glow-violet);
    animation: container-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes container-in {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.logo-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.2), rgba(192, 132, 252, 0.2));
    border: 1px solid rgba(129, 140, 248, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand h1 {
    font-size: 18px;
    font-weight: 700;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.brand-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Language Toggle */
.lang-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--accent-violet);
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 0.3px;
}

.lang-toggle:hover {
    background: var(--surface-hover);
    border-color: var(--accent-violet);
    box-shadow: 0 0 12px rgba(129, 140, 248, 0.15);
}

.lang-toggle:active {
    transform: scale(0.92);
}

/* Connection Badge */
.connection-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-red);
    transition: var(--transition);
    flex-shrink: 0;
}

.connection-badge.connected {
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.25);
    color: var(--accent-green);
}

.conn-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-red);
    transition: var(--transition);
}

.connection-badge.connected .conn-dot {
    background: var(--accent-green);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4);
    }

    50% {
        opacity: 0.7;
        box-shadow: 0 0 0 4px rgba(52, 211, 153, 0);
    }
}

/* ===== Key Info Bar ===== */
.key-info-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 20px;
    animation: slide-down 0.4s ease;
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.key-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.key-info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.key-info-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.key-info-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.key-info-divider {
    width: 1px;
    height: 28px;
    background: var(--border);
    flex-shrink: 0;
}

.key-status-badge {
    font-size: 11px !important;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-green) !important;
}

/* ===== Stats Section ===== */
.stats-section {
    margin-bottom: 20px;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-left: 2px;
}

.label-icon {
    font-size: 14px;
}

.refresh-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.refresh-btn:hover {
    color: var(--accent-violet);
    background: var(--surface);
}

.refresh-btn.spinning svg {
    animation: spin 0.6s linear;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.stat-card {
    position: relative;
    padding: 16px 14px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    text-align: center;
    transition: var(--transition);
    overflow: hidden;
    cursor: default;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    opacity: 0.6;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.stat-success::before {
    background: var(--gradient-verify);
}

.stat-rejected::before {
    background: var(--gradient-danger);
}

.stat-failed::before {
    background: linear-gradient(90deg, var(--accent-amber), var(--accent-red));
}

.stat-cancelled::before {
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet));
}

.stat-processing::before {
    background: var(--gradient-brand);
}

.stat-number {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-success .stat-number {
    color: var(--accent-green);
}

.stat-rejected .stat-number {
    color: var(--accent-red);
}

.stat-failed .stat-number {
    color: var(--accent-amber);
}

.stat-cancelled .stat-number {
    color: var(--accent-cyan);
}

.stat-processing .stat-number {
    color: var(--accent-purple);
}

.stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 14px;
    opacity: 0.4;
}

.stat-card.full-width {
    grid-column: span 1;
}

/* ===== Action Buttons ===== */
.actions-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 0;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.action-btn:hover {
    border-color: var(--border-hover);
    background: var(--surface-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.action-btn:active {
    transform: translateY(0) scale(0.98);
}

.action-btn-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-emoji {
    font-size: 18px;
}

.action-arrow {
    opacity: 0.4;
    transition: var(--transition);
}

.action-btn:hover .action-arrow {
    opacity: 0.8;
    transform: translateX(3px);
}

.action-validate {
    border-color: rgba(52, 211, 153, 0.15);
}

.action-validate:hover {
    border-color: rgba(52, 211, 153, 0.3);
    box-shadow: 0 4px 20px rgba(52, 211, 153, 0.08);
}

.action-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 8px;
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-green);
    letter-spacing: 0.5px;
}

.batch-badge {
    background: rgba(129, 140, 248, 0.15);
    color: var(--accent-violet);
}

.action-verify {
    border-color: rgba(129, 140, 248, 0.15);
}

.action-verify:hover {
    border-color: rgba(129, 140, 248, 0.3);
    box-shadow: 0 4px 20px rgba(129, 140, 248, 0.08);
}

.action-history {
    border-color: rgba(192, 132, 252, 0.12);
}

.action-history:hover {
    border-color: rgba(192, 132, 252, 0.25);
}

.action-settings {
    border-color: rgba(255, 255, 255, 0.06);
}

.action-conn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-red);
    transition: var(--transition);
    flex-shrink: 0;
}

.action-conn-dot.connected {
    background: var(--accent-green);
    animation: pulse-dot 2s ease-in-out infinite;
}



/* ===== Modals ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
    display: flex;
    animation: overlay-in 0.25s ease;
}

@keyframes overlay-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: linear-gradient(180deg, rgba(20, 20, 50, 0.95) 0%, rgba(12, 12, 30, 0.98) 100%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    width: 100%;
    max-height: 85vh;
    max-height: calc(var(--vvh, 100vh) - 32px);
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modal-appear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: max-height 0.2s ease;
    margin: auto;
    scroll-padding-bottom: 120px;
}

.modal-sm {
    max-width: 100%;
}

.modal-md {
    max-width: 100%;
}

.modal-lg {
    max-width: 100%;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--surface);
}

.modal-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 18px;
    line-height: 1.5;
}

/* ===== Form Elements ===== */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.input-group textarea {
    resize: vertical;
    min-height: 80px;
    max-height: 200px;
    line-height: 1.6;
}

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: var(--text-muted);
}

.input-group input:focus,
.input-group textarea:focus {
    border-color: var(--accent-violet);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.1);
}

.input-hint {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.input-with-toggle {
    position: relative;
}

.input-with-toggle input {
    padding-right: 44px;
}

.toggle-vis-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}

.toggle-vis-btn:hover {
    color: var(--accent-violet);
}

/* Primary Button */
.btn-primary {
    width: 100%;
    padding: 14px 20px;
    background: var(--gradient-brand);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(129, 140, 248, 0.3);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-gradient-verify {
    background: var(--gradient-verify);
}

.btn-gradient-verify:hover {
    box-shadow: 0 6px 24px rgba(52, 211, 153, 0.3);
}

/* Danger Button */
.btn-danger {
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-red);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 16px;
    -webkit-tap-highlight-color: transparent;
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.08);
    border-color: rgba(248, 113, 113, 0.5);
}

/* Loader spinner */
.btn-loader {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ===== Result Area ===== */
.result-area {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.6;
    animation: fade-in 0.3s ease;
    white-space: pre-line;
    word-break: break-word;
}

.result-area.result-success {
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.2);
    color: var(--accent-green);
}

.result-area.result-error {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--accent-red);
}

.result-area.result-warning {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
    color: var(--accent-amber);
}

.result-area.result-info {
    background: rgba(129, 140, 248, 0.08);
    border: 1px solid rgba(129, 140, 248, 0.2);
    color: var(--accent-violet);
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Batch Results ===== */
.batch-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.batch-item {
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--text-muted);
    animation: fade-in 0.3s ease;
}

.batch-item.bi-valid {
    border-left-color: var(--accent-green);
}

.batch-item.bi-invalid {
    border-left-color: var(--accent-red);
}

.batch-item.bi-pending {
    border-left-color: var(--accent-purple);
}

.batch-item-url {
    font-size: 11px;
    color: var(--text-muted);
    word-break: break-all;
    margin-bottom: 6px;
    line-height: 1.3;
}

.batch-item-status {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.batch-item-status.bis-valid {
    color: var(--accent-green);
}

.batch-item-status.bis-invalid {
    color: var(--accent-red);
}

.batch-item-status.bis-pending {
    color: var(--accent-purple);
}

.batch-item-detail {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== Jobs Container (batch tracking) ===== */
.jobs-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    max-height: 50vh;
    overflow-y: auto;
}

.job-tracker {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    animation: fade-in 0.3s ease;
}

.job-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.job-index {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    background: var(--accent-violet);
    color: white;
    flex-shrink: 0;
}

.job-id-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.job-id-value {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.cancel-job-btn {
    background: none;
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--accent-red);
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.cancel-job-btn:hover {
    background: rgba(248, 113, 113, 0.1);
}

.progress-wrap {
    margin-bottom: 6px;
}

.progress-bar {
    height: 6px;
    background: var(--surface-active);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-brand);
    border-radius: 3px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
}

.progress-stage {
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-pct {
    color: var(--accent-violet);
    font-weight: 700;
}

.progress-message {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

/* Job final states */
.job-tracker.jt-success {
    border-left: 3px solid var(--accent-green);
}

.job-tracker.jt-failed {
    border-left: 3px solid var(--accent-amber);
}

.job-tracker.jt-rejected {
    border-left: 3px solid var(--accent-red);
}

.job-tracker.jt-cancelled {
    border-left: 3px solid var(--accent-cyan);
}

.job-tracker.jt-error {
    border-left: 3px solid var(--accent-red);
}

/* ===== History ===== */
.filter-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.filter-tab:hover {
    color: var(--text-secondary);
    border-color: var(--border-hover);
}

.filter-tab.active {
    background: var(--accent-violet);
    border-color: var(--accent-violet);
    color: white;
}

.history-content {
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.history-content::-webkit-scrollbar {
    width: 4px;
}

.history-content::-webkit-scrollbar-track {
    background: transparent;
}

.history-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.history-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 8px;
    border-left: 3px solid var(--text-muted);
    transition: var(--transition);
}

.history-item:hover {
    border-color: var(--border-hover);
    background: var(--surface-hover);
}

.history-item.status-success {
    border-left-color: var(--accent-green);
}

.history-item.status-failed {
    border-left-color: var(--accent-amber);
}

.history-item.status-rejected {
    border-left-color: var(--accent-red);
}

.history-item.status-cancelled {
    border-left-color: var(--accent-cyan);
}

.history-item.status-processing,
.history-item.status-queued {
    border-left-color: var(--accent-purple);
}

.history-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 4px;
}

.history-row:last-child {
    margin-bottom: 0;
}

.status-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-pill.st-success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-green);
}

.status-pill.st-failed {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-amber);
}

.status-pill.st-rejected {
    background: rgba(248, 113, 113, 0.15);
    color: var(--accent-red);
}

.status-pill.st-cancelled {
    background: rgba(34, 211, 238, 0.15);
    color: var(--accent-cyan);
}

.status-pill.st-processing,
.status-pill.st-queued {
    background: rgba(167, 139, 250, 0.15);
    color: var(--accent-purple);
}

.history-url {
    font-size: 11px;
    color: var(--text-muted);
    word-break: break-all;
    margin-bottom: 6px;
    line-height: 1.4;
}

.history-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.history-credits {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Skeleton */
.skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-item {
    height: 80px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 0.2;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-text {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== API Info Panel ===== */
.api-info-panel {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    animation: fade-in 0.3s ease;
}

.panel-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.info-grid {
    display: grid;
    gap: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 13px;
    gap: 8px;
}

.info-label {
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.info-value {
    color: var(--text-primary);
    font-weight: 700;
    text-align: right;
    word-break: break-word;
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: 90%;
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(20, 20, 50, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    pointer-events: auto;
    animation: toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.toast.toast-out {
    animation: toast-out 0.25s ease forwards;
}

.toast-success {
    border-left: 3px solid var(--accent-green);
}

.toast-error {
    border-left: 3px solid var(--accent-red);
}

.toast-warning {
    border-left: 3px solid var(--accent-amber);
}

.toast-info {
    border-left: 3px solid var(--accent-violet);
}

.toast-emoji {
    font-size: 16px;
    flex-shrink: 0;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Custom scrollbar in modals */
.modal::-webkit-scrollbar {
    width: 4px;
}

.modal::-webkit-scrollbar-track {
    background: transparent;
}

.modal::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.jobs-container::-webkit-scrollbar {
    width: 4px;
}

.jobs-container::-webkit-scrollbar-track {
    background: transparent;
}

.jobs-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* ======================================================
   RESPONSIVE BREAKPOINTS
   ====================================================== */
/* ── Desktop (> 768px): wide layout ── */
@media (min-width: 769px) {
    .page-wrapper {
        padding: 48px 32px;
    }

    .container {
        max-width: 860px;
        padding: 36px 40px 32px;
    }

    .header {
        margin-bottom: 28px;
    }

    .brand h1 {
        font-size: 22px;
    }

    .brand-sub {
        font-size: 12px;
    }

    .logo {
        width: 48px;
        height: 48px;
    }

    .stat-number {
        font-size: 34px;
    }

    .stat-label {
        font-size: 11px;
    }

    .stat-card {
        padding: 20px 16px;
    }

    .action-btn {
        padding: 16px 20px;
        font-size: 15px;
    }

    .key-info-bar {
        padding: 16px 20px;
    }

    .key-info-value {
        font-size: 16px;
    }

    .key-info-label {
        font-size: 11px;
    }

    .section-label {
        font-size: 13px;
        margin-bottom: 16px;
    }

    .modal-overlay {
        align-items: center;
        padding: 32px;
    }

    .modal {
        border-radius: var(--radius-xl);
        max-height: 85vh;
        padding: 32px;
    }

    .modal-sm {
        max-width: 520px;
    }

    .modal-md {
        max-width: 600px;
    }

    .modal-lg {
        max-width: 700px;
    }

    .modal-header h2 {
        font-size: 20px;
    }

    @keyframes modal-appear {
        from {
            opacity: 0;
            transform: translateY(30px) scale(0.97);
        }

        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }

    .toast-container {
        top: 24px;
        right: 24px;
        left: auto;
        transform: none;
        max-width: 420px;
    }

    @keyframes toast-in {
        from {
            opacity: 0;
            transform: translateX(30px) scale(0.95);
        }

        to {
            opacity: 1;
            transform: translateX(0) scale(1);
        }
    }

    @keyframes toast-out {
        from {
            opacity: 1;
            transform: translateX(0);
        }

        to {
            opacity: 0;
            transform: translateX(40px);
        }
    }
}

/* ── Large Desktop (> 1200px): even wider ── */
@media (min-width: 1201px) {
    .container {
        max-width: 960px;
        padding: 40px 48px 36px;
    }

    .stat-number {
        font-size: 38px;
    }

    .action-btn {
        padding: 18px 24px;
        font-size: 16px;
    }

    .stats-grid {
        gap: 16px;
    }

    .actions-section {
        gap: 14px;
    }
}

/* ── Tablet (481px - 768px) ── */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        max-width: 600px;
        padding: 28px 24px 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .stat-card.full-width {
        grid-column: span 3;
    }

    .actions-section {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Mobile (< 480px): single column compact ── */
@media (max-width: 480px) {
    .page-wrapper {
        padding: 12px;
        align-items: center;
    }

    .container {
        max-width: 100%;
        padding: 22px 18px 18px;
        border-radius: var(--radius-lg);
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card.full-width {
        grid-column: span 2;
    }

    .stat-number {
        font-size: 26px;
    }

    .actions-section {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .action-btn {
        padding: 14px 16px;
        font-size: 14px;
    }

    .brand h1 {
        font-size: 17px;
    }

    .logo {
        width: 40px;
        height: 40px;
    }
}

/* ── Small phones (< 380px): tighter spacing ── */
@media (max-width: 380px) {
    .container {
        padding: 16px 12px 12px;
    }

    .brand h1 {
        font-size: 15px;
    }

    .brand-sub {
        font-size: 10px;
    }

    .logo {
        width: 36px;
        height: 36px;
    }

    .logo svg {
        width: 20px;
        height: 20px;
    }

    .stat-number {
        font-size: 22px;
    }

    .stats-grid {
        gap: 6px;
    }

    .stat-card {
        padding: 12px 10px;
    }

    .action-btn {
        padding: 12px 14px;
        font-size: 13px;
    }

    .modal {
        padding: 16px 12px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .modal-header h2 {
        font-size: 16px;
    }

    .key-info-bar {
        padding: 10px 12px;
    }

    .key-info-value {
        font-size: 12px;
    }
}

/* ── iPhone safe areas ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .page-wrapper {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* ── Orientation: landscape on mobile ── */
@media (max-height: 500px) and (orientation: landscape) {
    .page-wrapper {
        align-items: flex-start;
        padding-top: 8px;
    }

    .container {
        margin-bottom: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .stat-card.full-width {
        grid-column: span 1;
    }

    .stat-number {
        font-size: 20px;
    }

    .stat-label {
        font-size: 9px;
    }

    .stat-icon {
        display: none;
    }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}