@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
    color-scheme: light;
    --bg: #f4f7fb;
    --bg-strong: #e9eff8;
    --surface: rgba(255, 255, 255, .82);
    --surface-solid: #ffffff;
    --surface-soft: #f7f9fd;
    --surface-muted: #eef3fa;
    --text: #15233d;
    --text-soft: #60708d;
    --text-muted: #8b98ad;
    --line: rgba(28, 53, 91, .11);
    --line-strong: rgba(28, 53, 91, .2);
    --primary: #4f46e5;
    --primary-strong: #3730a3;
    --primary-soft: #eef0ff;
    --accent: #15b8a6;
    --accent-soft: #e3fbf7;
    --warning: #f59e0b;
    --danger: #e05252;
    --success: #159a78;
    --shadow-sm: 0 8px 24px rgba(39, 62, 104, .08);
    --shadow-md: 0 18px 50px rgba(39, 62, 104, .13);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --ease-out: cubic-bezier(.23, 1, .32, 1);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1120;
    --bg-strong: #111b31;
    --surface: rgba(18, 29, 51, .78);
    --surface-solid: #121d33;
    --surface-soft: #17243d;
    --surface-muted: #1b2a46;
    --text: #edf4ff;
    --text-soft: #a7b5cb;
    --text-muted: #71819b;
    --line: rgba(207, 225, 255, .12);
    --line-strong: rgba(207, 225, 255, .22);
    --primary: #818cf8;
    --primary-strong: #a5b4fc;
    --primary-soft: rgba(99, 102, 241, .18);
    --accent: #2dd4bf;
    --accent-soft: rgba(20, 184, 166, .15);
    --warning: #fbbf24;
    --danger: #fb7185;
    --success: #34d399;
    --shadow-sm: 0 8px 24px rgba(0, 0, 0, .2);
    --shadow-md: 0 18px 50px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

html { min-height: 100%; scroll-behavior: smooth; }

body {
    min-height: 100vh;
    margin: 0;
    padding: 24px;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 8%, rgba(79, 70, 229, .12), transparent 28rem),
        radial-gradient(circle at 90% 12%, rgba(21, 184, 166, .1), transparent 24rem),
        var(--bg);
    font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
    transition: background-color .25s ease, color .25s ease;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .28;
    background-image: linear-gradient(rgba(95, 116, 155, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(95, 116, 155, .05) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), transparent 72%);
    z-index: -1;
}

button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { outline-color: var(--primary); }
a { color: var(--primary); }

.container { width: min(1240px, 100%); margin: 0 auto; }

.navbar {
    position: sticky;
    top: 16px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    min-height: 72px;
    padding: 12px 16px 12px 20px;
    margin-bottom: 28px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: var(--radius-lg);
    color: #fff;
    background: linear-gradient(135deg, rgba(20, 31, 66, .97), rgba(46, 42, 112, .94));
    box-shadow: 0 16px 42px rgba(18, 28, 68, .22);
    backdrop-filter: blur(16px);
}

.navbar-header { display: flex; align-items: center; gap: 14px; min-width: 0; }
.navbar-title { display: inline-flex; align-items: center; gap: 9px; min-width: 0; color: #fff; font-family: 'Space Grotesk', 'Cairo', sans-serif; font-size: 19px; font-weight: 700; white-space: nowrap; }
.navbar-title span { overflow: hidden; text-overflow: ellipsis; }
.site-logo { width: 34px; height: 34px; flex: 0 0 34px; object-fit: contain; border-radius: 9px; background: rgba(255,255,255,.14); }

.burger-menu { display: none; flex-direction: column; gap: 4px; cursor: pointer; padding: 8px; border-radius: 10px; }
.burger-menu:hover { background: rgba(255,255,255,.12); }
.burger-menu span { width: 22px; height: 2px; border-radius: 99px; background: #fff; }

.theme-toggle {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 12px;
    color: #fff;
    background: rgba(255,255,255,.1);
    cursor: pointer;
    transition: transform .18s var(--ease-out), background .18s ease;
}
.theme-toggle:hover { transform: translateY(-2px); background: rgba(255,255,255,.2); }
.theme-toggle:active { transform: scale(.96); }
.theme-toggle span { font-size: 19px; line-height: 1; }

.navbar-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    width: auto;
    margin: 0;
    padding: 0;
    list-style: none;
}
.navbar-nav li { list-style: none; }
.navbar-nav a { display: block; padding: 9px 12px; border: 1px solid transparent; border-radius: 11px; color: rgba(255,255,255,.82); text-decoration: none; font-size: 12px; font-weight: 600; transition: background .18s ease, color .18s ease, transform .18s var(--ease-out); }
.navbar-nav a:hover { color: #fff; background: rgba(255,255,255,.13); transform: translateY(-1px); }
.navbar-nav a.btn-danger { color: #fff; background: rgba(224,82,82,.82); }
.navbar-nav a.btn-danger:hover { background: #d94b56; }

#menuOverlay { position: fixed; inset: 0; z-index: 1400; background: rgba(4, 8, 20, .68); backdrop-filter: none !important; filter: none !important; }

header {
    position: relative;
    overflow: hidden;
    padding: 52px 32px;
    margin-bottom: 28px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 30px;
    color: #fff;
    text-align: center;
    background: linear-gradient(135deg, #171d4d 0%, #37308a 54%, #126f78 100%);
    box-shadow: var(--shadow-md);
}
header::after { content: ''; position: absolute; width: 260px; height: 260px; left: -70px; top: -110px; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; box-shadow: 0 0 0 28px rgba(255,255,255,.03), 0 0 0 56px rgba(255,255,255,.025); }
header h1 { position: relative; z-index: 1; margin: 0 0 10px; font-size: clamp(28px, 4vw, 46px); letter-spacing: -.5px; }
header .subtitle { position: relative; z-index: 1; margin: 0; color: rgba(255,255,255,.8); font-size: 16px; }
.brand-heading { display: inline-flex; align-items: center; justify-content: center; gap: 12px; }
.brand-heading .site-logo { width: 52px; height: 52px; background: transparent; }

main { display: grid; gap: 20px; }
.card, .dashboard-card {
    border: 1px solid var(--line) !important;
    border-radius: var(--radius-md);
    background: var(--surface) !important;
    box-shadow: var(--shadow-sm) !important;
    backdrop-filter: blur(16px);
}
.card { padding: clamp(20px, 3vw, 30px); }
.card h1, .card h2, .card h3 { color: var(--text) !important; }
.card h2 { margin: 0 0 18px; font-size: 21px; border-bottom-color: var(--line) !important; }
.card p { color: var(--text-soft); line-height: 1.8; }

.admin-container, .dashboard-container { width: min(1240px, 100%); margin: 0 auto; padding: 8px 0 36px; }
.admin-container > .card, .dashboard-container > .card { margin-bottom: 20px; }
.dashboard-container h1 { margin: 12px 0 26px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.5px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.dashboard-card { display: flex; min-height: 170px; flex-direction: column; align-items: flex-start; padding: 22px; transition: transform .2s var(--ease-out), border-color .2s ease, box-shadow .2s ease; }
.dashboard-card:hover { transform: translateY(-4px); border-color: rgba(79,70,229,.35); box-shadow: var(--shadow-md); }
.dashboard-card h3 { margin: 0 0 8px; font-size: 17px; }
.dashboard-card p { flex: 1; margin: 0 0 16px; color: var(--text-soft); font-size: 13px; line-height: 1.7; }
.dashboard-card a { padding: 8px 12px; border-radius: 9px; color: var(--primary); background: var(--primary-soft); text-decoration: none; font-size: 12px; font-weight: 700; }

.form-group { margin-bottom: 17px; }
.form-group label { display: block; margin-bottom: 7px; color: var(--text); font-size: 13px; font-weight: 700; }
.form-control, .form-group input, .form-group select, .form-group textarea, input[type="text"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    outline: none;
    color: var(--text);
    background: var(--surface-solid);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
textarea { min-height: 110px; resize: vertical; }
.form-control:focus, .form-group input:focus, .form-group select:focus, .form-group textarea:focus, input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79,70,229,.13); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 10px 17px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; color: #fff; font-size: 13px; font-weight: 700; text-decoration: none; transition: transform .18s var(--ease-out), box-shadow .18s ease, background .18s ease, border-color .18s ease; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 9px 20px rgba(40, 51, 103, .16); }
.btn:active { transform: scale(.97); }
.btn:disabled { cursor: not-allowed; opacity: .56; transform: none; box-shadow: none; }
.btn-primary { color: #fff !important; background: linear-gradient(135deg, var(--primary), #6d64f5) !important; }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-strong), var(--primary)) !important; }
.btn-secondary { color: #fff !important; background: linear-gradient(135deg, #0d9488, #16b7a4) !important; }
.btn-success { color: #fff !important; background: linear-gradient(135deg, #119a77, #18b995) !important; }
.btn-danger { color: #fff !important; background: linear-gradient(135deg, #d94b56, #ed6671) !important; }
.btn-warning { color: #3b2a06 !important; background: linear-gradient(135deg, #fbbf24, #f59e0b) !important; }
.btn-outline { color: var(--primary) !important; border-color: rgba(79,70,229,.35) !important; background: transparent !important; }
.btn-outline:hover { color: #fff; background: var(--primary); }
.btn-sm, .btn-small { min-height: 34px; padding: 7px 11px; border-radius: 9px; font-size: 11px; }
.btn-group, .button-group { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }

.alert { padding: 13px 15px; margin-bottom: 15px; border: 1px solid transparent; border-radius: 11px; font-size: 13px; line-height: 1.7; }
.alert-error, .error { color: var(--danger); border-color: rgba(224,82,82,.22); background: rgba(224,82,82,.1); }
.alert-success, .success { color: var(--success); border-color: rgba(21,154,120,.22); background: rgba(21,154,120,.1); }
.loading { color: var(--primary); border-color: rgba(79,70,229,.22); background: var(--primary-soft); }
.flash-area { min-height: 0; }
.empty-state { padding: 44px 24px; color: var(--text-muted); text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); background: var(--surface-soft); }
.nav-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px; color: var(--primary); font-size: 13px; font-weight: 700; text-decoration: none; }

.upload-form { display: flex; flex-wrap: wrap; align-items: center; gap: 13px; }
.file-input-wrapper { flex: 1; min-width: 220px; }
.file-input-wrapper input[type="file"] { display: none; }
.file-label, .upload-area { display: block; width: 100%; padding: 25px 18px; border: 1.5px dashed rgba(79,70,229,.38); border-radius: var(--radius-md); color: var(--text-soft); text-align: center; background: linear-gradient(145deg, var(--surface-soft), var(--primary-soft)); cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s var(--ease-out); }
.file-label:hover, .upload-area:hover, .upload-area.drag-over { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-2px); }
.upload-area strong { display: block; margin-bottom: 5px; color: var(--text); }

.progress-track, #progressContainer > div { overflow: hidden; height: 12px; border-radius: 99px; background: var(--surface-muted) !important; }
.progress-bar, #progressBar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--accent)) !important; box-shadow: 0 0 16px rgba(79,70,229,.32); }
#progressText { color: var(--text-soft) !important; }

#downloadsSection { margin-top: 20px; }
#downloadsSection h3 { color: var(--text); margin-bottom: 15px; }
.file-list { padding: 0; margin: 0 0 15px; list-style: none; }
.file-list li, .profile-item, .project-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px; border-bottom: 1px solid var(--line); }
.file-list li:last-child, .profile-item:last-child, .project-item:last-child { border-bottom: 0; }
.filename { color: var(--text); font-weight: 600; }
.badge { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 99px; color: #fff; font-size: 11px; font-weight: 700; }
.badge-image { background: #4f46e5; }
.badge-text { background: #0d9488; }

.preview-box, .json-editor, .variable-item, .file-list li { color: var(--text-soft); background: var(--surface-soft); }
.preview-box { padding: 16px; border-radius: 11px; white-space: pre-wrap; }
.variables-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.variable-item { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-family: monospace; font-size: 12px; }

.designs-panel { border-color: var(--line) !important; background: var(--surface-soft) !important; }
.design-card { border-color: var(--line-strong) !important; background: var(--surface-solid) !important; transition: transform .18s var(--ease-out), border-color .18s ease, box-shadow .18s ease; }
.design-card:hover, .design-card.selected { border-color: var(--primary) !important; box-shadow: 0 10px 25px rgba(79,70,229,.14) !important; transform: translateY(-3px); }
.design-card-name { color: var(--text) !important; }

table { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-solid); }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--text-soft); text-align: right; font-size: 12px; }
th { color: var(--text); background: var(--surface-soft); font-weight: 800; }
tr:last-child td { border-bottom: 0; }

.result { min-height: 24px; margin-top: 15px; }
#genResult img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; }
.generation-steps { display:grid; grid-template-columns:repeat(4,1fr); gap:6px; margin:16px 0 13px; }
.generation-step { position:relative; padding:8px 5px; color:var(--text-muted); text-align:center; font-size:10px; }.generation-step::before { content:''; display:block; width:8px; height:8px; margin:0 auto 5px; border:2px solid var(--line-strong); border-radius:50%; background:var(--surface-solid); }.generation-step.is-active { color:var(--primary); font-weight:800; }.generation-step.is-active::before { border-color:var(--primary); background:var(--primary); box-shadow:0 0 0 4px var(--primary-soft); }.generation-step.is-done { color:var(--success); }.generation-step.is-done::before { border-color:var(--success); background:var(--success); }
.result-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:22px 0 13px; }.result-toolbar h3 { margin:0; color:var(--text); font-size:18px; }.result-toolbar p { margin:3px 0 0; color:var(--text-soft); font-size:11px; }
.batch-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:13px; }.output-card { overflow:hidden; border:1px solid var(--line); border-radius:15px; background:var(--surface-solid); box-shadow:var(--shadow-sm); transition:transform .18s var(--ease-out),box-shadow .18s ease; }.output-card:hover { transform:translateY(-3px); box-shadow:var(--shadow-md); }.output-card-image { display:block; width:100%; height:190px; object-fit:contain; padding:8px; background:var(--surface-soft); cursor:zoom-in; }.output-card-body { padding:11px; }.output-card-name { overflow:hidden; margin:0 0 9px; color:var(--text-soft); font-size:11px; text-overflow:ellipsis; white-space:nowrap; direction:ltr; text-align:left; }.output-card .btn { width:100%; }
.preview-text { overflow:auto; max-height:210px; padding:12px; margin:0; color:var(--text-soft); background:var(--surface-soft); white-space:pre-wrap; font:12px/1.8 monospace; direction:rtl; }
.image-preview-modal { position:fixed; inset:0; z-index:1400; display:grid; place-items:center; padding:22px; background:rgba(4,8,20,.78); backdrop-filter:blur(7px); }.image-preview-modal[hidden] { display:none; }.image-preview-dialog { position:relative; width:min(850px,100%); max-height:92vh; padding:15px; border:1px solid rgba(255,255,255,.18); border-radius:18px; background:var(--surface-solid); box-shadow:0 25px 70px rgba(0,0,0,.35); }.image-preview-dialog img { display:block; width:100%; max-height:76vh; object-fit:contain; border-radius:11px; background:var(--surface-soft); }.image-preview-dialog figcaption { padding:10px 3px 1px; color:var(--text-soft); font-size:12px; direction:ltr; text-align:left; }.image-preview-close { position:absolute; top:10px; left:10px; z-index:1; display:grid; place-items:center; width:34px; height:34px; border:0; border-radius:50%; color:#fff; background:rgba(10,16,37,.7); cursor:pointer; font-size:20px; }
.toast-stack { position:fixed; top:22px; left:22px; z-index:2000; display:grid; gap:10px; width:min(360px,calc(100vw - 44px)); pointer-events:none; }.toast { display:flex; align-items:flex-start; gap:10px; padding:13px 15px; border:1px solid var(--line); border-radius:14px; color:var(--text); background:var(--surface-solid); box-shadow:var(--shadow-md); font-size:12px; line-height:1.7; opacity:0; transform:translateY(-10px) scale(.98); transition:opacity .25s ease,transform .25s var(--ease-out); }.toast.is-visible { opacity:1; transform:translateY(0) scale(1); }.toast-icon { display:grid; place-items:center; width:21px; height:21px; flex:none; border-radius:50%; color:#fff; background:var(--primary); font-family:'Space Grotesk',sans-serif; font-size:12px; font-weight:800; }.toast-success { border-color:rgba(21,154,120,.35); }.toast-success .toast-icon { background:var(--success); }.toast-error { border-color:rgba(224,82,82,.35); }.toast-error .toast-icon { background:var(--danger); }.toast-info .toast-icon { background:var(--primary); }


.login-page { padding: 0; background: #0c1430; }
.login-page::before { opacity: .16; }
.login-shell { position: relative; display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(380px, .76fr); width: min(1180px, calc(100% - 40px)); min-height: calc(100vh - 48px); margin: 24px auto; overflow: hidden; border: 1px solid rgba(255,255,255,.16); border-radius: 32px; background: rgba(19, 29, 61, .76); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login-visual { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 680px; padding: clamp(30px, 6vw, 76px); overflow: hidden; color: #fff; background: linear-gradient(150deg, rgba(79,70,229,.98), rgba(38,31,106,.93) 62%, rgba(15,118,110,.9)); }
.login-visual::before, .login-visual::after { content: ''; position: absolute; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; pointer-events: none; }
.login-visual::before { width: 470px; height: 470px; left: -180px; bottom: -210px; box-shadow: 0 0 0 36px rgba(255,255,255,.03), 0 0 0 72px rgba(255,255,255,.025); }
.login-visual::after { width: 280px; height: 280px; right: -80px; top: -90px; box-shadow: 0 0 0 22px rgba(255,255,255,.035), 0 0 0 44px rgba(255,255,255,.02); }
.login-orbit { position: absolute; right: 13%; bottom: 18%; width: 130px; height: 130px; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; animation: orbit-float 7s ease-in-out infinite; }
.login-orbit::after { content: ''; position: absolute; top: 11px; right: 13px; width: 11px; height: 11px; border-radius: 50%; background: #74f1d8; box-shadow: 0 0 22px #74f1d8; }
.login-brand { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 800; }
.login-brand img { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.15); }
.login-visual h1 { position: relative; z-index: 1; max-width: 560px; margin: auto 0 16px; color: #fff; font-size: clamp(34px, 5vw, 62px); line-height: 1.18; letter-spacing: -1px; }
.login-visual > p { position: relative; z-index: 1; max-width: 530px; margin: 0 0 28px; color: rgba(255,255,255,.78); font-size: 16px; line-height: 2; }
.login-features { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 9px; padding: 0; margin: 0; list-style: none; }
.login-features li { padding: 8px 11px; border: 1px solid rgba(255,255,255,.18); border-radius: 99px; color: rgba(255,255,255,.88); background: rgba(255,255,255,.1); font-size: 11px; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: clamp(22px, 5vw, 58px); background: rgba(8, 15, 37, .42); }
.login-container { width: 100%; max-width: 410px; padding: 0; border: 0; color: #fff; background: transparent; box-shadow: none; }
.login-heading { margin-bottom: 30px; }
.login-heading h2 { margin: 0 0 8px; color: #fff; font-size: 30px; }
.login-heading p { margin: 0; color: rgba(255,255,255,.62); font-size: 13px; }
.login-form .form-group { margin-bottom: 18px; }
.login-form .form-group label { color: rgba(255,255,255,.78); }
.login-form .form-group input { min-height: 50px; border-color: rgba(255,255,255,.17); color: #fff; background: rgba(255,255,255,.08); }
.login-form .form-group input::placeholder { color: rgba(255,255,255,.4); }
.login-form .form-group input:focus { border-color: #8d89ff; background: rgba(255,255,255,.12); box-shadow: 0 0 0 4px rgba(129,140,248,.18); }
.btn-login { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 50px; padding: 12px 18px; border: 0; border-radius: 13px; color: #fff; background: linear-gradient(135deg, #6d64f5, #18b7a5); cursor: pointer; font-size: 14px; font-weight: 800; text-decoration: none; box-shadow: 0 12px 30px rgba(71, 75, 206, .27); transition: transform .18s var(--ease-out), box-shadow .18s ease; }
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(71, 75, 206, .35); }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 24px 0 16px; color: rgba(255,255,255,.45); font-size: 11px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.14); }
.provider-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.provider-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 45px; padding: 10px; border: 1px solid rgba(255,255,255,.16); border-radius: 12px; color: rgba(255,255,255,.86); background: rgba(255,255,255,.07); text-decoration: none; font-size: 12px; font-weight: 700; transition: background .18s ease, transform .18s var(--ease-out); }
.provider-btn:hover { color: #fff; background: rgba(255,255,255,.14); transform: translateY(-2px); }
.provider-btn.is-disabled { cursor: not-allowed; opacity: .42; }
.login-note { margin-top: 22px; color: rgba(255,255,255,.42); font-size: 11px; line-height: 1.8; text-align: center; }
.login-page .theme-toggle { position: fixed; z-index: 10; top: 18px; left: 18px; border-color: rgba(255,255,255,.25); }
@keyframes orbit-float { 0%, 100% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(-12px, -18px) rotate(14deg); } }

@media (max-width: 980px) {
    body { padding: 16px; }
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .navbar { top: 10px; }
    .navbar-nav { gap: 3px; }
    .navbar-nav a { padding-inline: 8px; font-size: 11px; }
}

@media (max-width: 720px) {
    body { padding: 10px; }
    .navbar { z-index: 1600; }

    .login-shell { grid-template-columns: 1fr; width: calc(100% - 20px); min-height: calc(100vh - 20px); margin: 10px auto; border-radius: 24px; }
    .login-visual { min-height: 420px; padding: 28px 22px; }
    .login-visual h1 { margin-top: auto; font-size: 34px; }
    .login-visual > p { font-size: 13px; line-height: 1.8; }
    .login-panel { padding: 32px 22px; }
    .login-heading h2 { font-size: 26px; }
    .login-page .theme-toggle { top: 12px; left: 12px; }

    .navbar { min-height: 62px; padding: 10px 12px; margin-bottom: 18px; }
    .navbar-header { flex: 1; justify-content: space-between; }
    .navbar-title { font-size: 16px; }
    .site-logo { width: 30px; height: 30px; flex-basis: 30px; }
    .burger-menu { display: flex; }
    .navbar-nav { position: fixed; top: 0; right: 0; left: auto; z-index: 1500; display: flex; width: min(310px, 86vw); height: 100vh; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 8px; padding: 80px 18px 24px; border-left: 1px solid rgba(255,255,255,.18); background: rgb(18, 26, 57) !important; box-shadow: -18px 0 44px rgba(0,0,0,.35); backdrop-filter: none !important; opacity: 1 !important; filter: none !important; transform: translateX(100%); transition: transform .28s var(--ease-out); }
    .navbar-nav.active { transform: translateX(0); }
    .navbar-nav a { padding: 12px 14px; font-size: 13px; text-align: right; }
    header { padding: 36px 18px; border-radius: 22px; }
    header h1 { font-size: 29px; }
    .brand-heading .site-logo { width: 42px; height: 42px; }
    .admin-container, .dashboard-container { padding-bottom: 24px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .card { padding: 18px; }
    .project-item, .profile-item { align-items: flex-start; flex-direction: column; }
    .project-actions { width: 100%; justify-content: flex-start !important; }
    .variables-list { grid-template-columns: 1fr; }
    .button-group, .btn-group { align-items: stretch; flex-direction: column; }
    .button-group .btn, .btn-group .btn { width: 100%; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Font picker */
.editor-hint { margin: -7px 0 15px; color: var(--text-soft); font-size: 12px; line-height: 1.8; }
.editor-hint a { color: var(--primary); font-weight: 800; }
.font-select { min-width: 170px; color: var(--text); background-color: var(--surface-solid); }
.font-select option { color: #111827; background: #fff; }
[data-theme="dark"] .font-select option { color: #f8fafc; background: #17213b; }
@media (max-width: 840px) { .font-select { min-width: 140px; } }
@media (max-width: 620px) { .font-select { min-width: 100%; } }

/* Per-row image assets and image slots */
.assets-panel { margin-top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, var(--surface-soft), var(--surface-solid)); }
.assets-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.assets-panel-heading h3 { margin: 0 0 5px; color: var(--text); font-size: 17px; }
.assets-panel-heading p { margin: 0; color: var(--text-soft); font-size: 12px; line-height: 1.8; }
.asset-count { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: 12px; font-weight: 800; }
.asset-drop-zone { margin-bottom: 10px; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; margin-top: 14px; }
.asset-card { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-solid); box-shadow: var(--shadow-sm); transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.asset-card:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: var(--shadow-md); }
.asset-card img { display: block; width: 100%; height: 105px; object-fit: contain; background: var(--surface-muted); }
.asset-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 8px; color: var(--text); font-size: 11px; }
.asset-card-footer span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-delete { display: inline-grid; place-items: center; width: 25px; height: 25px; flex: 0 0 25px; border: 0; border-radius: 8px; color: var(--danger); background: var(--danger-soft); cursor: pointer; font-size: 18px; line-height: 1; transition: transform .18s ease, background .18s ease; }
.asset-delete:hover { transform: scale(1.08); background: rgba(239, 68, 68, .18); }
.asset-empty, .table-empty { grid-column: 1 / -1; padding: 15px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--text-soft); background: var(--surface-soft); font-size: 12px; text-align: center; }
.image-slot-item { border-inline-start: 3px solid var(--accent) !important; }
.image-slot-item label { color: var(--accent) !important; }
.editor-table .font-select, .editor-table select[data-target="updateImageSlot"] { min-width: 150px; }
@media (max-width: 620px) {
  .assets-panel-heading { flex-direction: column; }
  .asset-count { align-self: flex-start; }
  .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-table .font-select, .editor-table select[data-target="updateImageSlot"] { min-width: 130px; }
}

/* Live generation view */
.live-generation-view { margin-top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, var(--surface-soft), var(--surface-solid)); box-shadow: var(--shadow-sm); }
.live-view-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.live-view-header h3 { margin: 0 0 4px; color: var(--text); font-size: 17px; }
.live-view-header p { margin: 0; color: var(--text-soft); font-size: 12px; }.live-view-actions { display:flex; align-items:center; flex-wrap:wrap; justify-content:flex-end; gap:7px; }.live-view-actions .btn { margin:0; }
.live-current-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 92px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-soft); background: var(--surface-muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
.live-current-badge.is-processing { color: #6b4c00; border-color: rgba(245, 183, 49, .55); background: #fff3bf; box-shadow: 0 0 0 4px rgba(245, 183, 49, .12); }
.live-row-list { display: grid; gap: 8px; max-height: 480px; overflow: auto; padding: 2px; }
.live-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) 68px; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: var(--surface-solid); transition: background .25s ease, border-color .25s ease, box-shadow .25s ease, transform .25s ease; }
.live-row.is-current { border-color: #eab308; background: linear-gradient(90deg, #fff8cc, #fff3b0); box-shadow: 0 0 0 3px rgba(234, 179, 8, .14); transform: translateY(-1px); }
[data-theme="dark"] .live-row.is-current { color: #fff8db; border-color: #f3c74b; background: linear-gradient(90deg, rgba(112, 82, 10, .62), rgba(70, 55, 8, .62)); }
.live-row-completed { border-inline-start: 3px solid var(--success); }
.live-row-failed { border-inline-start: 3px solid var(--danger); background: var(--danger-soft); }.live-row-cancelled { border-inline-start: 3px solid var(--text-muted); background: var(--surface-soft); }.live-row-cancel_requested { border-inline-start: 3px solid #d4a017; background: rgba(245,183,49,.12); }
.live-row-processing { border-inline-start: 3px solid #eab308; }
.live-row-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--primary); background: var(--primary-soft); font-size: 12px; font-weight: 900; }
.live-row-content { min-width: 0; }
.live-row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.live-row-title strong { font-size: 13px; }
.live-row-status { padding: 3px 7px; border-radius: 999px; color: var(--text-soft); background: var(--surface-muted); font-size: 10px; font-weight: 800; }
.live-row-processing .live-row-status { color: #765500; background: #ffefaa; }
.live-row-completed .live-row-status { color: var(--success); background: var(--success-soft); }
.live-row-failed .live-row-status { color: var(--danger); background: var(--danger-soft); }.live-row-cancelled .live-row-status { color: var(--text-soft); background: var(--surface-muted); }.live-row-cancel_requested .live-row-status { color:#8a6500; background:#fff3bf; }
.live-row-meta { display: flex; gap: 8px; margin-top: 4px; color: var(--text-soft); font-size: 11px; overflow: hidden; }
.live-row-meta span { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-row-content > small { display: block; margin-top: 4px; color: var(--text-soft); font-size: 10px; }
.live-row-error { color: var(--danger) !important; }
.live-row-preview-wrap { display: grid; place-items: center; min-height: 48px; }
.live-row-preview { position: relative; display: grid; place-items: center; width: 54px; height: 54px; overflow: hidden; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-muted); text-decoration: none; }
.live-row-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.live-row-preview span { position: absolute; inset-inline: 3px; bottom: 3px; padding: 2px 4px; border-radius: 5px; color: #fff; background: rgba(0, 0, 0, .68); font-size: 9px; text-align: center; }
.live-row-state-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--text-soft); background: var(--surface-muted); font-size: 18px; font-weight: 900; }
.live-row-processing .live-row-state-icon { color: #a66f00; background: #ffefaa; animation: live-pulse 1.1s ease-in-out infinite; }
.live-row-completed .live-row-state-icon { color: var(--success); background: var(--success-soft); }
.live-row-failed .live-row-state-icon { color: var(--danger); background: var(--danger-soft); }
.live-empty { padding: 20px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--text-soft); text-align: center; font-size: 12px; }
@keyframes live-pulse { 50% { transform: scale(1.13); opacity: .65; } }
@media (max-width: 620px) {
  .live-view-header { align-items: stretch; flex-direction: column; }
  .live-view-actions { justify-content:flex-start; }
  .live-current-badge { align-self: flex-start; }
  .live-row { grid-template-columns: 34px minmax(0, 1fr) 54px; gap: 8px; padding: 9px; }
  .live-row-number { width: 30px; height: 30px; }
  .live-row-meta { display: block; }
  .live-row-meta span { display: block; max-width: 100%; }
  .live-row-preview { width: 48px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .live-row, .live-row-state-icon { transition: none; animation: none; }
}

/* Preflight and single-row preview */
.preflight-panel { margin-top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, var(--surface-soft), var(--surface-solid)); box-shadow: var(--shadow-sm); }
.preflight-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.preflight-header h3 { margin: 4px 0; color: var(--text); font-size: 18px; }
.preflight-header p { margin: 0; color: var(--text-soft); font-size: 12px; }
.preflight-state-badge { display: inline-flex; padding: 8px 12px; border-radius: 999px; color: var(--text-soft); background: var(--surface-muted); font-size: 11px; font-weight: 900; white-space: nowrap; }
.preflight-state-badge.is-ready { color: var(--success); background: var(--success-soft); }
.preflight-state-badge.has-warnings { color: #8a6100; background: #fff3bf; }
.preflight-state-badge.has-errors { color: var(--danger); background: var(--danger-soft); }
.preflight-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.preflight-actions label { color: var(--text-soft); font-size: 12px; font-weight: 800; }
.preflight-actions select { min-width: 230px; max-width: 100%; }
.preflight-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.preflight-summary span { padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--text-soft); background: var(--surface-solid); font-size: 11px; }
.preflight-summary b { color: var(--text); }
.preflight-summary .is-ready-text b { color: var(--success); }
.preflight-summary .is-error-text b { color: var(--danger); }
.preflight-summary .is-warning-text b { color: #a66f00; }
.preflight-issues { display: grid; gap: 7px; max-height: 240px; overflow: auto; margin-top: 12px; }
.preflight-issue { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; background: var(--danger-soft); }
.preflight-issue.is-warning { background: #fff8db; }
[data-theme="dark"] .preflight-issue.is-warning { background: rgba(111, 83, 10, .38); }
.preflight-issue > span { color: var(--danger); font-size: 10px; font-weight: 900; }
.preflight-issue.is-warning > span { color: #9a6b00; }
.preflight-issue p { margin: 0; color: var(--text); font-size: 11px; }
.preflight-clean { padding: 11px; border-radius: 10px; color: var(--success); background: var(--success-soft); font-size: 12px; }
.single-preview-box { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 360px); align-items: center; gap: 18px; margin-top: 16px; padding: 14px; border: 1px solid var(--primary); border-radius: 14px; background: var(--primary-soft); }
.single-preview-box h4 { margin: 0 0 5px; color: var(--text); }
.single-preview-box p { margin: 0; color: var(--text-soft); font-size: 12px; }
.single-preview-box img { display: block; width: 100%; max-height: 360px; object-fit: contain; border-radius: 9px; box-shadow: var(--shadow-sm); background: #fff; }
@media (max-width: 680px) {
  .preflight-header { flex-direction: column; }
  .preflight-actions { align-items: stretch; flex-direction: column; }
  .preflight-actions .btn, .preflight-actions select { width: 100%; }
  .single-preview-box { grid-template-columns: 1fr; }
}

/* Preflight column mapping wizard */
.column-mapping-wizard { margin-top: 14px; padding: 14px; border: 1px dashed var(--primary); border-radius: 13px; background: color-mix(in srgb, var(--primary-soft) 65%, var(--surface-solid)); }
.column-mapping-wizard h4 { margin: 0 0 4px; color: var(--text); font-size: 14px; }
.column-mapping-wizard p { margin: 0; color: var(--text-soft); font-size: 11px; }
.column-mapping-list { display: grid; gap: 8px; margin: 12px 0; }
.mapping-row { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(180px, 1.2fr); align-items: center; gap: 10px; color: var(--text); font-size: 11px; font-weight: 800; }
.mapping-row select { width: 100%; }
@media (max-width: 620px) { .mapping-row { grid-template-columns: 1fr; gap: 4px; } .canvas-toolbar { align-items:stretch; } .canvas-toolbar .canvas-tool-group { flex:1; justify-content:center; } .canvas-help { width:100%; } }

/* Visual editor toolbar and fitting controls */
.canvas-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.canvas-tool-group { display:inline-flex; align-items:center; gap:4px; padding:3px; border:1px solid var(--line); border-radius:9px; background:var(--surface); }
.canvas-tool-group .btn { margin:0; }.zoom-label { min-width:45px; color:var(--text); font-size:11px; text-align:center; }.canvas-wrapper { max-width:100%; overflow:auto; overscroll-behavior:contain; border-radius:10px; }

.canvas-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 12px; font-weight: 800; }
.canvas-toggle input { accent-color: var(--primary); }
.canvas-help { color: var(--text-soft); font-size: 11px; }
#fontsTable input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
#fontsTable td { vertical-align: middle; }

/* Excel row assignments */
.excel-rows-panel { margin-top:16px; padding:18px; border:1px solid var(--line); border-radius:16px; background:linear-gradient(145deg,var(--surface-soft),var(--surface-solid)); box-shadow:var(--shadow-sm); }
.excel-rows-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:14px; }
.excel-rows-header h3 { margin:0 0 5px; color:var(--text); font-size:17px; }
.excel-rows-header p { margin:0; color:var(--text-soft); font-size:12px; }
.excel-row-tools { display:flex; align-items:center; flex-wrap:wrap; gap:8px; padding:12px; margin-bottom:12px; border:1px solid var(--line); border-radius:12px; background:var(--surface-soft); }
.excel-row-tools label { color:var(--text-soft); font-size:11px; font-weight:800; }
.excel-row-tools input, .excel-row-tools select { min-width:150px; padding:8px 10px; border:1px solid var(--line-strong); border-radius:8px; color:var(--text); background:var(--surface-solid); }
.excel-table-scroll { max-width:100%; overflow:auto; border:1px solid var(--line); border-radius:12px; }
.excel-table-scroll table { width:100%; min-width:720px; border-collapse:collapse; color:var(--text); font-size:11px; }
.excel-table-scroll th, .excel-table-scroll td { padding:8px; border-bottom:1px solid var(--line); text-align:center; vertical-align:middle; }
.excel-table-scroll thead th { position:sticky; top:0; z-index:1; color:var(--text); background:var(--surface-muted); font-weight:900; }
.excel-table-scroll tbody th { color:var(--primary); background:var(--surface-soft); }
.excel-table-scroll td { max-width:170px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.excel-table-scroll select { max-width:170px; padding:7px 8px; border:1px solid var(--line-strong); border-radius:8px; color:var(--text); background:var(--surface-solid); font-size:11px; }
.excel-row-drop { display:grid; place-items:center; width:62px; height:62px; margin:auto; overflow:hidden; border:1px dashed var(--line-strong); border-radius:10px; color:var(--text-muted); background:var(--surface-soft); font-size:10px; cursor:copy; transition:border-color .2s, background .2s, transform .2s; }
.excel-row-drop:hover, .excel-row-drop.drag-over { border-color:var(--primary); background:var(--primary-soft); transform:scale(1.03); }
.excel-row-drop img { display:block; width:100%; height:100%; object-fit:cover; }
.excel-table-scroll td small { display:block; max-width:110px; margin:4px auto 0; overflow:hidden; color:var(--text-muted); text-overflow:ellipsis; white-space:nowrap; font-size:9px; }
.generation-profile-label { display:block; width:100%; margin-bottom:3px; color:var(--text-soft); font-size:11px; font-weight:800; }
@media (max-width:620px) { .excel-rows-header { align-items:stretch; flex-direction:column; }.excel-row-tools { align-items:stretch; flex-direction:column; }.excel-row-tools input, .excel-row-tools select, .excel-row-tools .btn { width:100%; }.excel-table-scroll table { min-width:650px; } }

.excel-rows-pager { display:flex; align-items:center; justify-content:center; gap:12px; margin-top:12px; color:var(--text-soft); font-size:11px; }.excel-rows-pager .btn { margin:0; }.excel-rows-pager button:disabled { cursor:not-allowed; opacity:.45; }

.processing-workspace-title { margin-bottom:14px; }.processing-workspace-title h2 { margin:3px 0 5px; }.processing-workspace-title p { margin:0; color:var(--text-soft); font-size:12px; }.profile-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:6px; }
@media (max-width:620px) { .profile-actions { width:100%; justify-content:stretch; margin-top:10px; }.profile-actions .btn { flex:1 1 auto; } }
