:root {
  color-scheme: light;
  --navy-950: #061521;
  --navy-900: #081b2d;
  --navy-800: #0d2940;
  --teal-700: #087878;
  --teal-600: #0a9290;
  --teal-500: #12aaa6;
  --teal-100: #dff7f4;
  --blue-600: #2563eb;
  --surface: #ffffff;
  --canvas: #f3f7f9;
  --line: #dce6ea;
  --line-soft: #eaf0f2;
  --text: #112a3b;
  --muted: #647784;
  --danger: #c73b48;
  --success: #16856b;
  --warning: #b87712;
  --shadow-sm: 0 4px 16px rgb(7 32 48 / 6%);
  --shadow-md: 0 18px 48px rgb(7 32 48 / 10%);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--canvas);
  color: var(--text);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
svg { display: block; }

/* App chrome */
.app-layout { min-height: 100vh; display: grid; grid-template-columns: 280px minmax(0, 1fr); direction: rtl; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 22px;
  background:
    radial-gradient(circle at 20% 8%, rgb(18 170 166 / 16%), transparent 28%),
    linear-gradient(180deg, var(--navy-900), var(--navy-950));
  color: #fff;
  border-left: 1px solid rgb(255 255 255 / 7%);
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; min-width: 0; }
.brand > span:last-child { display: grid; gap: 1px; }
.brand strong { font-size: 1.22rem; letter-spacing: .08em; }
.brand small { color: #9eb4c2; font-size: .76rem; }
.brand-mark { width: 42px; height: 42px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 3px; padding: 8px; border-radius: 13px; background: linear-gradient(145deg, var(--teal-500), #62d5cb); box-shadow: 0 9px 24px rgb(12 170 166 / 25%); flex: 0 0 auto; }
.brand-mark i { display: block; border-radius: 2px; background: #fff; }
.brand-mark i:first-child { grid-row: 1 / 3; border-radius: 7px 2px 2px 7px; }
.brand-mark i:nth-child(2) { border-radius: 2px 7px 2px 2px; }
.brand-mark i:nth-child(3) { border-radius: 2px 2px 7px 2px; opacity: .66; }
.brand-mark.large { width: 52px; height: 52px; border-radius: 16px; padding: 10px; }

.side-nav { display: grid; gap: 5px; margin-top: 38px; }
.nav-label { margin: 20px 14px 8px; color: #6f899a; font-size: .71rem; font-weight: 800; letter-spacing: .08em; }
.side-nav a { min-height: 48px; display: flex; align-items: center; gap: 13px; padding: 0 14px; border-radius: 12px; color: #b9c9d3; text-decoration: none; font-size: .91rem; font-weight: 650; transition: .18s ease; }
.side-nav a svg { width: 20px; height: 20px; fill: currentColor; opacity: .82; }
.side-nav a:hover { color: #fff; background: rgb(255 255 255 / 6%); transform: translateX(-2px); }
.side-nav a.is-active { color: #fff; background: linear-gradient(135deg, rgb(18 170 166 / 24%), rgb(18 170 166 / 10%)); box-shadow: inset -3px 0 var(--teal-500); }
.side-nav a.is-active svg { color: #42d2c7; opacity: 1; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 11px; padding: 16px 14px; border: 1px solid rgb(255 255 255 / 8%); border-radius: 14px; background: rgb(255 255 255 / 4%); }
.sidebar-foot > div { display: grid; gap: 3px; }
.sidebar-foot strong { font-size: .78rem; }
.sidebar-foot small { color: #7792a2; font-size: .68rem; direction: ltr; }
.system-dot { width: 9px; height: 9px; border-radius: 50%; background: #35d29d; box-shadow: 0 0 0 5px rgb(53 210 157 / 10%); }

.workspace { min-width: 0; direction: rtl; }
.mobile-bar { display: none; }
.shell { width: min(1440px, calc(100% - 72px)); margin: 0 auto; padding: 44px 0 70px; }

/* Typography and page headers */
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.75rem, 3vw, 2.35rem); line-height: 1.25; letter-spacing: -.035em; }
h2 { font-size: 1.28rem; line-height: 1.4; }
h3 { font-size: 1rem; }
.eyebrow { margin: 0 0 7px; color: var(--teal-600); font-size: .76rem; font-weight: 850; letter-spacing: .06em; }
.muted, .page-description { color: var(--muted); line-height: 1.8; }
.page-description { margin: 0; font-size: .91rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 28px; }
.topbar > div:first-child { min-width: 0; }
.topbar form { display: block; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* Components */
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-sm); }
.button-link, button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 11px 18px; background: linear-gradient(135deg, var(--teal-600), #087976); color: #fff; text-decoration: none; font-weight: 750; cursor: pointer; box-shadow: 0 8px 20px rgb(10 146 144 / 16%); transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button-link:hover, button:hover { transform: translateY(-1px); box-shadow: 0 11px 25px rgb(10 146 144 / 23%); }
button.secondary, .secondary-link { background: #eaf4f5; color: #176e70; box-shadow: none; }
button.danger { background: #bf3946; box-shadow: 0 8px 18px rgb(191 57 70 / 14%); }
.text-link { display: inline-flex; align-items: center; color: var(--teal-700); font-weight: 750; text-decoration: none; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.icon-button { width: 44px; padding: 0; background: #fff; color: #536976; border: 1px solid var(--line); box-shadow: none; }
.icon-button svg { width: 19px; height: 19px; fill: currentColor; }
.button-row { display: flex; gap: 11px; flex-wrap: wrap; align-items: center; }

.alert, .success { display: flex; align-items: center; gap: 9px; border-radius: 12px; padding: 13px 15px; margin-bottom: 20px; font-size: .9rem; font-weight: 650; }
.alert { background: #fff2f3; color: #a52c3a; border: 1px solid #f4ced3; }
.alert > span { width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 50%; color: #fff; background: #d24755; }
.success { background: #edfbf6; color: #126e58; border: 1px solid #c4eedf; }

/* Forms */
form { display: grid; gap: 18px; margin-top: 22px; }
label { display: grid; gap: 8px; color: #243d4d; font-size: .88rem; font-weight: 720; }
input, textarea, select { width: 100%; border: 1px solid #cfdce1; border-radius: 12px; padding: 13px 14px; color: var(--text); background: #fff; transition: .16s ease; }
input, select { min-height: 48px; }
textarea { resize: vertical; line-height: 1.7; }
input::placeholder, textarea::placeholder { color: #9aabb5; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgb(10 146 144 / 12%); border-color: var(--teal-600); box-shadow: 0 0 0 1px var(--teal-600); }
input[type="file"] { padding: 10px; background: #f9fbfc; }
input[type="file"]::file-selector-button { border: 0; border-radius: 8px; padding: 8px 12px; margin-left: 10px; color: #176e70; background: #dff4f2; font-weight: 750; cursor: pointer; }
.form-card { width: min(760px, 100%); }
.form-card > .muted { margin-bottom: 4px; }
.optional-note { margin: 0 0 4px; padding: 12px 14px; border: 1px solid #ccebe7; border-radius: 12px; color: #176e70; background: #f0fbf9; font-size: .8rem; line-height: 1.75; }
.field-label-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field-label-line small { padding: 4px 8px; border-radius: 999px; color: #267a78; background: #e5f7f5; font-size: .66rem; font-weight: 800; }
.field-help { margin-top: -3px; color: var(--muted); font-size: .69rem; font-weight: 500; }

/* Dashboard */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { min-width: 0; display: flex; align-items: center; gap: 16px; padding: 20px; background: #fff; border: 1px solid var(--line-soft); border-radius: 18px; box-shadow: var(--shadow-sm); }
.stat-icon { width: 50px; height: 50px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 15px; }
.stat-icon svg { width: 23px; height: 23px; fill: currentColor; }
.stat-card > div:last-child { min-width: 0; display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px; }
.stat-card span { color: #617581; font-size: .77rem; font-weight: 700; white-space: nowrap; }
.stat-card strong { grid-row: 1 / 3; grid-column: 2; font-size: 1.9rem; line-height: 1; color: var(--text); }
.stat-card small { color: #94a4ad; font-size: .67rem; }
.stat-teal .stat-icon { color: #078985; background: #dff7f4; }
.stat-blue .stat-icon { color: #306bd5; background: #e8f0ff; }
.stat-amber .stat-icon { color: #b77718; background: #fff2d9; }
.stat-violet .stat-icon { color: #7652c5; background: #f0eaff; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 22px; }
.section-heading h2 { margin-bottom: 0; }
.ai-badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; color: #176e70; background: #e7f8f6; font-size: .69rem; font-weight: 800; direction: ltr; white-space: nowrap; }
.ai-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--teal-500); box-shadow: 0 0 0 4px rgb(18 170 166 / 10%); }
.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.quick-actions > a { min-height: 178px; display: flex; flex-direction: column; align-items: flex-start; gap: 13px; position: relative; padding: 19px; border: 1px solid var(--line); border-radius: 16px; background: #fbfdfd; text-decoration: none; transition: .18s ease; }
.quick-actions > a:hover { transform: translateY(-3px); border-color: #9bd7d3; background: #f5fcfb; box-shadow: 0 14px 30px rgb(8 77 79 / 8%); }
.quick-actions > a > span:nth-child(2) { display: grid; gap: 6px; }
.quick-actions strong { font-size: .94rem; }
.quick-actions small { color: var(--muted); line-height: 1.65; font-size: .74rem; }
.quick-actions b { position: absolute; left: 17px; bottom: 16px; color: var(--teal-600); font-size: 1.25rem; }
.quick-icon { width: 43px; height: 43px; display: grid; place-items: center; color: var(--teal-700); background: #e4f6f4; border-radius: 13px; }
.quick-icon svg { width: 21px; height: 21px; fill: currentColor; }
.account-card { text-align: center; }
.account-avatar { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 18px; background: linear-gradient(145deg, var(--navy-800), var(--teal-700)); color: #fff; font-size: 1.5rem; font-weight: 850; box-shadow: 0 12px 24px rgb(8 65 70 / 18%); }
.account-card h3 { margin-bottom: 4px; }
.account-card > p { margin-bottom: 17px; color: var(--muted); font-size: .77rem; direction: ltr; overflow-wrap: anywhere; }
.account-status { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 10px; border-radius: 10px; background: #effaf6; color: #17725b; font-size: .73rem; font-weight: 720; }
.account-status span { width: 7px; height: 7px; border-radius: 50%; background: #22ad80; }
.secondary-link-block { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line-soft); color: var(--teal-700); font-size: .78rem; font-weight: 760; text-decoration: none; }

/* Templates and jobs */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
.template-card { overflow: hidden; background: #fff; border: 1px solid var(--line-soft); border-radius: 20px; box-shadow: var(--shadow-sm); transition: .18s ease; }
.template-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.template-preview { display: block; padding: 12px; background: linear-gradient(145deg, #edf3f5, #f8fbfc); }
.template-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 12px; }
.template-card-body { padding: 18px; }
.card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-heading h2 { margin-bottom: 4px; font-size: 1rem; }
.card-title { text-decoration: none; }
.status-badge { display: inline-flex; align-items: center; width: fit-content; white-space: nowrap; border-radius: 999px; padding: 6px 10px; background: #fff4db; color: #966511; font-size: .69rem; font-weight: 800; }
.status-active, .status-approved, .status-completed { background: #e4f8ef; color: #117054; }
.status-review_required, .status-needs_review, .status-awaiting_approval { background: #e9efff; color: #345ab5; }
.status-queued, .status-processing, .status-generating, .status-qa, .status-composing { background: #e8f8f8; color: #087776; }
.status-failed, .status-rejected { background: #fff0f1; color: #aa3040; }
.empty-state { text-align: center; padding-block: 70px; }
.empty-state h2 { margin-bottom: 8px; }
.template-detail-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr); gap: 22px; align-items: start; }
.preview-panel { position: sticky; top: 22px; }
.preview-panel img { display: block; width: 100%; max-height: 760px; object-fit: contain; border-radius: 15px; background: #eef3f5; }
.preview-meta, .review-heading, .field-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.preview-meta { margin-top: 15px; color: var(--muted); font-size: .8rem; }
.review-panel h2 { margin-bottom: 5px; }
.review-heading .inline-form { margin: 0; }
.field-list { display: grid; gap: 13px; }
.field-row { display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 15px; background: #fcfdfd; }
.field-row legend { padding: 0 7px; color: var(--teal-700); font-size: .82rem; font-weight: 800; }
.field-meta { color: var(--muted); font-size: .74rem; flex-wrap: wrap; }
.check-label { display: flex; align-items: center; gap: 7px; }
.check-label input { width: auto; min-height: auto; }
.job-form-grid, .comparison-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(420px, 1.15fr); gap: 22px; align-items: start; margin-top: 22px; }
.comparison-grid img { display: block; width: 100%; max-height: 760px; object-fit: contain; background: #edf3f5; border-radius: 14px; }
.status-line { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; color: var(--muted); font-size: .81rem; }
.values-list { display: grid; gap: 0; }
.values-list div { display: grid; grid-template-columns: minmax(130px, .34fr) 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.values-list dt { font-weight: 750; }
.values-list dd { margin: 0; white-space: pre-wrap; color: #49616f; }
.unchanged-note { display: flex; flex-direction: column; gap: 5px; padding: 18px; border: 1px dashed #b8dcd8; border-radius: 14px; color: #176e70; background: #f4fbfa; }
.unchanged-note span { color: var(--muted); font-size: .8rem; }
.progress-track { height: 10px; background: #deecec; border-radius: 999px; overflow: hidden; }
.progress-track span { display: block; width: 62%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal-600), #4bd1c6); animation: pulse 1.4s infinite alternate; }
@keyframes pulse { from { opacity: .55; transform: translateX(5%); } to { opacity: 1; transform: translateX(-5%); } }
.batch-errors { max-height: 260px; overflow: auto; padding: 11px 14px; border: 1px solid #f3d19a; border-radius: 12px; background: #fff9ed; color: #965e0d; }
.batch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 20px; }
.batch-grid article { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fbfdfd; }
.batch-grid article form { display: flex; gap: 8px; }
.batch-grid img { width: 100%; max-height: 300px; object-fit: contain; border-radius: 9px; background: #edf3f5; }
.jobs-table { display: grid; overflow: hidden; }
.jobs-table a { display: grid; grid-template-columns: 2fr 1fr 1fr .7fr; align-items: center; gap: 12px; min-height: 58px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); color: inherit; text-decoration: none; transition: .15s ease; }
.jobs-table a:hover { background: #f3faf9; }
.jobs-table a span:nth-child(3) { width: fit-content; padding: 5px 9px; border-radius: 999px; background: #e9efff; color: #345ab5; font-size: .72rem; font-weight: 750; }
.attempt-list p { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: .82rem; }

/* One-step design studio */
.studio-topbar { margin-bottom: 20px; }
.flow-pill { display: inline-flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid #bfe8e3; border-radius: 999px; color: #14756e; background: #edfbf8; font-size: .75rem; font-weight: 800; }
.flow-pill i { width: 8px; height: 8px; border-radius: 50%; background: #24b987; box-shadow: 0 0 0 5px rgb(36 185 135 / 10%); }
.template-switcher { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 18px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow-sm); }
.template-switcher-copy, .template-switcher-copy > div { display: flex; align-items: center; gap: 11px; }
.template-switcher-copy > div { display: grid; gap: 2px; }
.template-switcher-copy small { color: var(--muted); font-size: .69rem; }
.template-switcher form { width: min(440px, 48%); margin: 0; }
.template-switcher select { min-height: 46px; }
.step-number { width: 29px; height: 29px; display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 9px; color: #fff; background: linear-gradient(145deg, var(--teal-600), #35bcb3); font-size: .73rem; font-weight: 850; box-shadow: 0 6px 14px rgb(10 146 144 / 18%); }
.design-studio { display: grid; grid-template-columns: minmax(310px, .78fr) minmax(520px, 1.22fr); gap: 18px; align-items: start; margin: 0; }
.studio-preview-card, .studio-editor-card { overflow: hidden; border: 1px solid var(--line-soft); border-radius: 22px; background: #fff; box-shadow: var(--shadow-sm); }
.studio-preview-card { position: sticky; top: 20px; }
.preview-heading, .editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 19px; border-bottom: 1px solid var(--line-soft); }
.preview-heading > div, .editor-heading > div, .editor-heading > div > div { display: flex; align-items: center; gap: 10px; }
.preview-heading small { color: var(--muted); direction: ltr; }
.studio-canvas { display: grid; place-items: center; min-height: 460px; padding: 18px; background: radial-gradient(circle at 50% 0, #fff, #edf3f5 75%); }
.studio-canvas img { display: block; width: 100%; max-height: 650px; object-fit: contain; border-radius: 14px; filter: drop-shadow(0 16px 20px rgb(8 34 50 / 13%)); }
.preview-tip { display: flex; align-items: center; gap: 8px; margin: 0; padding: 13px 18px; color: #4d6874; background: #fbfdfd; border-top: 1px solid var(--line-soft); font-size: .75rem; }
.preview-tip span { color: var(--success); font-weight: 900; }
.editor-heading h2 { margin: 0; font-size: 1.08rem; }
.editor-heading p { margin: 2px 0 0; color: var(--muted); font-size: .72rem; }
.change-counter { padding: 6px 10px; border-radius: 999px; color: #14756e; background: #e6f8f5; font-size: .69rem; font-weight: 850; white-space: nowrap; }
.studio-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-height: 610px; overflow: auto; padding: 17px; background: #f8fbfc; }
.studio-field { align-content: start; gap: 7px; padding: 13px; border: 1px solid #dce7ea; border-radius: 14px; background: #fff; transition: border-color .16s ease, box-shadow .16s ease; }
.studio-field:focus-within { border-color: #82cbc5; box-shadow: 0 0 0 3px rgb(10 146 144 / 7%); }
.field-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-title small { color: #73909a; font-size: .62rem; }
.studio-field input:not([type="file"]) { min-height: 44px; padding: 10px 12px; border-radius: 10px; }
.current-value { overflow: hidden; color: #8a9ca5; font-size: .62rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.image-field { grid-column: 1 / -1; }
.upload-control { position: relative; min-height: 68px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px dashed #a9d4d0; border-radius: 11px; background: #f3fbfa; cursor: pointer; }
.upload-control input { position: absolute; inset: 0; min-height: 0; opacity: 0; cursor: pointer; }
.upload-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; color: #137a75; background: #dff5f2; font-size: 1.25rem; }
.upload-copy { min-width: 0; display: grid; gap: 3px; }
.upload-copy b { font-size: .78rem; }
.upload-copy small { overflow: hidden; color: var(--muted); font-size: .65rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.studio-action-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 19px; border-top: 1px solid var(--line-soft); background: #fff; }
.studio-action-bar > div { display: grid; gap: 3px; }
.studio-action-bar > div strong { font-size: .8rem; }
.studio-action-bar > div small { color: var(--muted); font-size: .65rem; }
.generate-button { min-width: 205px; min-height: 50px; }
.generate-button:disabled { cursor: not-allowed; transform: none; background: #a9babf; box-shadow: none; opacity: .72; }
.button-arrow { font-size: 1.1rem; }
.design-studio.is-submitting { pointer-events: none; opacity: .8; }
.empty-studio { text-align: center; }

/* Live production and result */
.job-topbar { margin-bottom: 22px; }
.live-production { min-height: 540px; overflow: hidden; display: grid; grid-template-columns: .72fr 1.28fr; border: 1px solid rgb(38 193 182 / 22%); border-radius: 28px; background: #fff; box-shadow: var(--shadow-md); }
.production-visual { position: relative; min-height: 540px; display: grid; place-items: center; overflow: hidden; color: #fff; background: radial-gradient(circle at 50% 40%, #0f6e73, #092a40 62%, #061925); }
.production-visual::before { content: ""; position: absolute; inset: 0; opacity: .18; background-image: linear-gradient(rgb(255 255 255 / 16%) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 16%) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(circle, #000 10%, transparent 70%); }
.production-orbit { position: relative; width: 180px; height: 180px; display: grid; place-items: center; border: 1px solid rgb(95 225 214 / 25%); border-radius: 50%; animation: orbit-breathe 2.2s ease-in-out infinite alternate; }
.production-orbit::before, .production-orbit::after { content: ""; position: absolute; border: 1px solid rgb(95 225 214 / 15%); border-radius: 50%; }
.production-orbit::before { inset: -34px; }
.production-orbit::after { inset: 28px; }
.orbit-core { width: 72px; height: 72px; border-radius: 22px; background: linear-gradient(145deg, #6ce3d7, #12aaa6); box-shadow: 0 0 50px rgb(75 209 198 / 45%); }
.production-orbit i { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #76e6dc; box-shadow: 0 0 15px #65d9d0; }
.production-orbit i:nth-child(2) { top: 16px; left: 28px; }
.production-orbit i:nth-child(3) { right: -4px; top: 82px; }
.production-orbit i:nth-child(4) { bottom: -22px; left: 80px; }
.ai-working { position: absolute; bottom: 50px; padding: 8px 12px; border: 1px solid rgb(255 255 255 / 12%); border-radius: 999px; background: rgb(255 255 255 / 7%); font-size: .68rem; }
@keyframes orbit-breathe { to { transform: scale(1.05) rotate(4deg); } }
.production-copy { display: flex; flex-direction: column; justify-content: center; padding: clamp(30px, 5vw, 68px); }
.production-copy h2 { margin-bottom: 10px; font-size: clamp(1.8rem, 3vw, 2.6rem); }
.live-progress { height: 11px; overflow: hidden; margin: 20px 0 28px; border-radius: 999px; background: #e1eeee; }
.live-progress span { display: block; width: var(--progress); height: 100%; border-radius: inherit; background: linear-gradient(90deg, #0a8785, #51d4c8); transition: width .45s ease; }
.production-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.production-steps > div { display: grid; justify-items: center; gap: 8px; color: #91a3ad; text-align: center; font-size: .65rem; }
.production-steps span { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #d4e0e4; border-radius: 50%; background: #fff; font-weight: 850; }
.production-steps .is-active { color: var(--teal-700); }
.production-steps .is-active span { color: #fff; border-color: var(--teal-600); background: var(--teal-600); box-shadow: 0 0 0 5px rgb(10 146 144 / 10%); }
.production-steps .is-done span { color: #fff; border-color: #38aa88; background: #38aa88; }
.production-meta { display: flex; justify-content: space-between; gap: 14px; margin-top: 32px; padding-top: 17px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: .67rem; }
.production-meta b { color: var(--text); direction: ltr; }
.live-dot { display: flex; align-items: center; gap: 7px; }
.live-dot i { width: 7px; height: 7px; border-radius: 50%; background: #2cba8b; animation: pulse-dot 1.1s infinite alternate; }
@keyframes pulse-dot { to { box-shadow: 0 0 0 6px rgb(44 186 139 / 12%); } }
.result-hero { padding: 22px; border: 1px solid var(--line-soft); border-radius: 26px; background: #fff; box-shadow: var(--shadow-md); }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.result-heading h2 { margin: 0; }
.quality-score { padding: 7px 11px; border-radius: 999px; color: #117054; background: #e5f8ef; font-size: .71rem; font-weight: 850; }
.result-canvas { display: grid; place-items: center; min-height: 560px; padding: 17px; border-radius: 18px; background: linear-gradient(145deg, #eaf0f2, #f8fafb); }
.result-canvas img { display: block; max-width: 100%; max-height: 820px; object-fit: contain; border-radius: 10px; box-shadow: 0 18px 45px rgb(6 24 37 / 15%); }
.result-actions { display: flex; align-items: stretch; gap: 10px; margin-top: 16px; }
.result-actions form { margin: 0; }
.result-actions > form:first-child button { min-height: 50px; }
.retry-form { display: flex; flex: 1; gap: 9px; margin: 0; }
.retry-form input { min-width: 220px; min-height: 50px; }
.result-download { margin-top: 16px; }
.source-disclosure, .attempt-disclosure { margin-top: 16px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.source-disclosure summary, .attempt-disclosure summary { padding: 15px 18px; color: #45616f; cursor: pointer; font-size: .78rem; font-weight: 800; }
.source-disclosure .comparison-grid, .attempt-disclosure .attempt-list { margin: 0; padding: 0 16px 16px; }
.quality-note { display: flex; gap: 10px; margin-top: 14px; padding: 13px 15px; border: 1px solid #f0d49f; border-radius: 12px; color: #8b5d13; background: #fff9ed; font-size: .76rem; }
.failure-card { display: flex; align-items: flex-start; gap: 20px; padding: 30px; border: 1px solid #f0cbd0; border-radius: 22px; background: #fff; box-shadow: var(--shadow-sm); }
.failure-icon { width: 50px; height: 50px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 15px; color: #fff; background: #cb4654; font-size: 1.5rem; font-weight: 900; }
.failure-card > div { flex: 1; }
.failure-card .retry-form { align-items: center; }

/* Authentication */
.auth-body { background: #fff; }
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: 1.08fr .92fr; direction: ltr; }
.auth-layout > section { direction: rtl; }
.auth-visual { position: relative; min-height: 100vh; overflow: hidden; display: flex; flex-direction: column; padding: clamp(32px, 5vw, 66px); color: #fff; background: linear-gradient(145deg, #061725 0%, #0a2d43 55%, #0b5e62 140%); isolation: isolate; }
.auth-visual::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .12; background-image: linear-gradient(rgb(255 255 255 / 22%) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 22%) 1px, transparent 1px); background-size: 50px 50px; mask-image: linear-gradient(to bottom, #000, transparent 88%); }
.auth-glow { position: absolute; border-radius: 50%; z-index: -1; filter: blur(10px); }
.auth-glow-one { width: 420px; height: 420px; left: -190px; top: -180px; background: rgb(27 209 193 / 18%); }
.auth-glow-two { width: 500px; height: 500px; right: -280px; bottom: -290px; background: rgb(20 174 169 / 18%); }
.auth-brand { display: flex; align-items: center; gap: 13px; }
.auth-brand > span:last-child { display: grid; }
.auth-brand strong { font-size: 1.45rem; letter-spacing: .09em; }
.auth-brand small { color: #99b6c3; font-size: .75rem; }
.auth-message { max-width: 610px; margin-top: clamp(60px, 10vh, 120px); }
.pill { width: fit-content; display: inline-flex; align-items: center; gap: 8px; margin-bottom: 20px; padding: 8px 12px; border: 1px solid rgb(111 228 216 / 18%); border-radius: 999px; background: rgb(36 177 170 / 10%); color: #8ee1da; font-size: .72rem; font-weight: 700; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: #56d6c9; box-shadow: 0 0 0 4px rgb(86 214 201 / 9%); }
.auth-message h1 { max-width: 590px; margin-bottom: 18px; font-size: clamp(2.25rem, 4.6vw, 4.2rem); line-height: 1.2; letter-spacing: -.055em; }
.auth-message h1 em { color: #53d3c8; font-style: normal; }
.auth-message p { max-width: 520px; color: #a8bec9; line-height: 1.9; font-size: .96rem; }
.visual-preview { position: relative; width: min(530px, 88%); min-height: 230px; margin-top: auto; margin-left: auto; border: 1px solid rgb(255 255 255 / 13%); border-radius: 20px; background: rgb(255 255 255 / 7%); box-shadow: 0 28px 80px rgb(0 0 0 / 24%); backdrop-filter: blur(14px); transform: perspective(1100px) rotateY(-5deg) rotateX(2deg); }
.preview-top { height: 42px; display: flex; align-items: center; gap: 6px; padding: 0 15px; border-bottom: 1px solid rgb(255 255 255 / 9%); direction: ltr; }
.preview-top span { width: 7px; height: 7px; border-radius: 50%; background: #5bd4c9; opacity: .8; }
.preview-top span:nth-child(2) { opacity: .45; }
.preview-top span:nth-child(3) { opacity: .25; }
.preview-top b { margin-left: auto; color: #91a9b4; font-size: .65rem; font-weight: 600; }
.preview-body { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; padding: 17px; direction: ltr; }
.preview-image { position: relative; min-height: 154px; overflow: hidden; border-radius: 13px; background: linear-gradient(155deg, #168b8c, #0f3950 60%, #092333); }
.preview-image::before { content: ""; position: absolute; width: 80px; height: 130px; bottom: -12px; left: 44%; background: linear-gradient(90deg, #d0d7d1, #fff, #a8bcb9); clip-path: polygon(35% 0, 65% 0, 100% 100%, 0 100%); opacity: .86; }
.preview-image::after { content: ""; position: absolute; inset: auto 0 0; height: 48%; background: linear-gradient(transparent, rgb(2 18 28 / 70%)); }
.preview-shine { position: absolute; width: 100px; height: 100px; top: -30px; right: -25px; border: 18px solid rgb(118 235 222 / 13%); border-radius: 50%; }
.preview-copy { display: flex; flex-direction: column; align-items: flex-start; padding-top: 11px; direction: rtl; }
.preview-copy i { display: block; width: 100%; height: 7px; margin-bottom: 8px; border-radius: 99px; background: rgb(255 255 255 / 10%); }
.preview-copy i:nth-child(2) { width: 76%; }
.preview-copy i:nth-child(3) { width: 54%; margin-bottom: auto; }
.preview-copy strong { font-size: .85rem; }
.preview-copy small { margin-top: 5px; color: #69d7ce; font-size: .63rem; }
.floating-chip { position: absolute; display: flex; align-items: center; gap: 9px; padding: 10px 13px; border: 1px solid rgb(255 255 255 / 13%); border-radius: 12px; color: #fff; background: rgb(8 32 47 / 82%); box-shadow: 0 14px 28px rgb(0 0 0 / 23%); backdrop-filter: blur(12px); }
.floating-chip span { color: #9fb3bd; font-size: .63rem; }
.floating-chip b { color: #58d5ca; }
.floating-chip svg { width: 18px; height: 18px; fill: #58d5ca; }
.chip-quality { top: 66px; right: -46px; }
.chip-speed { left: -35px; bottom: 34px; }
.auth-form-side { min-height: 100vh; display: grid; place-items: center; padding: 40px clamp(32px, 6vw, 90px); background: #fff; }
.auth-form-wrap { width: min(430px, 100%); }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 44px; }
.auth-mobile-brand.always { display: flex; justify-content: center; }
.auth-mobile-brand strong { font-size: 1.2rem; letter-spacing: .08em; }
.auth-form-wrap > h2 { margin-bottom: 8px; font-size: 2rem; letter-spacing: -.035em; }
.auth-subtitle { margin-bottom: 28px; }
.auth-form { gap: 18px; margin-top: 0; }
.auth-form label > span:first-child { font-size: .83rem; }
.input-shell { min-height: 52px; display: flex; align-items: center; gap: 10px; border: 1px solid #ccd9de; border-radius: 13px; padding: 0 14px; background: #fff; transition: .16s ease; }
.input-shell:focus-within { border-color: var(--teal-600); box-shadow: 0 0 0 3px rgb(10 146 144 / 11%); }
.input-shell svg { width: 19px; height: 19px; flex: 0 0 auto; fill: #8ca0aa; }
.input-shell input { min-height: auto; padding: 0; border: 0; border-radius: 0; box-shadow: none; outline: 0; direction: ltr; text-align: left; }
.input-shell input:focus { outline: 0; box-shadow: none; }
.primary-action { width: 100%; min-height: 52px; margin-top: 5px; border-radius: 13px; }
.primary-action svg { width: 18px; height: 18px; fill: currentColor; transform: rotate(180deg); }
.secure-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 24px; color: #8a9ba5; font-size: .71rem; }
.secure-note svg { width: 15px; height: 15px; fill: #65a49d; }
.password-layout { min-height: 100vh; display: grid; place-items: center; padding: 32px; background: radial-gradient(circle at 50% 0, #dff7f4, transparent 36%), var(--canvas); }
.password-card { width: min(500px, 100%); padding: 38px; text-align: center; border: 1px solid var(--line-soft); border-radius: 26px; background: #fff; box-shadow: var(--shadow-md); }
.security-icon { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 18px; color: var(--teal-700); background: #dff7f4; }
.security-icon svg { width: 30px; height: 30px; fill: currentColor; }
.password-card .auth-form { text-align: right; }
.password-hint { display: flex; align-items: center; gap: 7px; margin: -4px 0 0; color: var(--muted); font-size: .7rem; }
.password-hint span { color: var(--success); font-weight: 900; }

/* Responsive */
@media (max-width: 1180px) {
  .app-layout { grid-template-columns: 230px minmax(0, 1fr); }
  .sidebar { padding-inline: 14px; }
  .shell { width: min(100% - 44px, 1200px); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions { grid-template-columns: 1fr; }
  .quick-actions > a { min-height: 118px; }
  .auth-layout { grid-template-columns: 1fr 1fr; }
  .visual-preview { width: 96%; }
  .design-studio { grid-template-columns: minmax(280px, .7fr) minmax(440px, 1.3fr); }
  .studio-fields { grid-template-columns: 1fr; }
  .image-field { grid-column: auto; }
}

@media (max-width: 900px) {
  .app-layout { display: block; }
  .sidebar { display: none; }
  .mobile-bar { height: 66px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; color: #fff; background: var(--navy-900); }
  .brand.compact { gap: 8px; }
  .brand.compact .brand-mark { width: 34px; height: 34px; padding: 7px; border-radius: 10px; }
  .mobile-action { padding: 8px 11px; border-radius: 9px; color: #c7f7f2; background: rgb(18 170 166 / 17%); text-decoration: none; font-size: .76rem; font-weight: 750; }
  .shell { width: min(100% - 32px, 820px); padding-top: 28px; }
  .dashboard-grid, .template-detail-grid, .job-form-grid, .comparison-grid { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  .auth-layout { display: block; }
  .auth-visual { display: none; }
  .auth-form-side { padding: 34px 24px; }
  .auth-mobile-brand { display: flex; }
  .design-studio, .live-production { grid-template-columns: 1fr; }
  .studio-preview-card { position: static; }
  .studio-canvas { min-height: 360px; }
  .production-visual { min-height: 280px; }
  .production-orbit { transform: scale(.78); }
  .ai-working { bottom: 24px; }
}

@media (max-width: 650px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; }
  .dashboard-topbar .button-link { flex: 1; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { min-height: 130px; flex-direction: column; align-items: flex-start; padding: 15px; }
  .stat-card > div:last-child { width: 100%; }
  .stat-card strong { font-size: 1.55rem; }
  .card { padding: 20px; border-radius: 18px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .jobs-table a { grid-template-columns: 1fr auto; }
  .jobs-table a span:nth-child(2), .jobs-table a span:nth-child(4) { display: none; }
  .values-list div { grid-template-columns: 1fr; gap: 4px; }
  .password-layout { padding: 16px; }
  .password-card { padding: 26px 20px; }
  h1 { font-size: 1.72rem; }
  .template-switcher, .studio-action-bar, .result-actions, .failure-card { align-items: stretch; flex-direction: column; }
  .template-switcher form { width: 100%; }
  .studio-action-bar .generate-button { width: 100%; }
  .production-copy { padding: 28px 20px; }
  .production-steps strong { display: none; }
  .result-canvas { min-height: 360px; padding: 9px; }
  .retry-form { flex-direction: column; }
  .retry-form input { min-width: 0; }
}
