/* استوديو الشورتس — styles. Mobile-first, RTL, light + dark. */

:root {
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", system-ui, -apple-system, sans-serif;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef0f4;
  --border: #e1e4ea;
  --border-strong: #c9ced8;
  --text: #171a21;
  --text-2: #4d5665;
  --text-3: #6b7483;

  --red: #d9150f;
  --red-hover: #bd100b;
  --red-soft: #fdecea;
  --red-text: #b3120d;
  --blue: #17357a;
  --blue-hover: #102a66;
  --blue-soft: #e9eefb;
  --blue-text: #1b3f94;
  --green: #12804a;
  --green-soft: #e4f5ec;
  --green-text: #0d6b3d;
  --amber-soft: #fff4d9;
  --amber-text: #7a5200;
  --amber-border: #f0d691;

  --focus: #2f6bff;
  --shadow-sm: 0 1px 2px rgba(18, 24, 38, .05);
  --shadow-md: 0 6px 24px rgba(18, 24, 38, .10);
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1217;
    --surface: #181c24;
    --surface-2: #1e232d;
    --surface-3: #262c38;
    --border: #2a303c;
    --border-strong: #3b4352;
    --text: #eceff4;
    --text-2: #b4bcc9;
    --text-3: #8e97a6;

    --red: #e5231c;
    --red-hover: #f0352e;
    --red-soft: #3a1917;
    --red-text: #ff8d86;
    --blue: #3d63c9;
    --blue-hover: #4b72dc;
    --blue-soft: #1b2744;
    --blue-text: #9db8ff;
    --green: #2fae6e;
    --green-soft: #14301f;
    --green-text: #6fdba1;
    --amber-soft: #33290f;
    --amber-text: #f2cf7a;
    --amber-border: #5b4a1c;

    --focus: #7aa2ff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, .45);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
img, video { max-width: 100%; display: block; }
svg { width: 1.25em; height: 1.25em; flex: none; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- spinner ---------- */
.spinner, .is-busy::after {
  width: 1.1em; height: 1.1em; flex: none;
  border: 2.5px solid currentColor; border-inline-start-color: transparent;
  border-radius: 50%; display: inline-block;
  animation: spin .7s linear infinite;
}
.is-busy::after { content: ""; }
.is-busy > svg { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: var(--tap); padding: 0 1.05em;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--surface-3); color: var(--text);
  font-weight: 600; font-size: .95rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .55; }
.btn-sm { min-height: 40px; padding: 0 .8em; font-size: .875rem; }
.btn-lg { min-height: 52px; padding: 0 1.4em; font-size: 1.05rem; }
.btn-block { width: 100%; }

.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--red-hover); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--red-hover); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-yt { background: var(--blue); color: #fff; }
.btn-yt:hover:not(:disabled) { background: var(--blue-hover); }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: var(--tap); height: var(--tap);
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-3);
  transition: background-color .15s, color .15s;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.icon-btn-danger:hover:not(:disabled) { background: var(--red-soft); color: var(--red-text); }
.icon-btn:disabled { opacity: .4; }

/* ---------- form fields ---------- */
.field { display: grid; gap: .35rem; }
.field-label { font-size: .9rem; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: .8rem; color: var(--text-3); }
.input {
  width: 100%; min-height: var(--tap); padding: .6rem .8rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 1rem; line-height: 1.6;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--text-3); opacity: 1; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent); }
textarea.input { resize: vertical; display: block; }
.form-error {
  padding: .55rem .75rem; border-radius: var(--radius-sm);
  background: var(--red-soft); color: var(--red-text); font-size: .9rem; font-weight: 500;
}

/* ---------- boot + login ---------- */
.boot {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center; gap: .6rem;
  color: var(--text-3);
}
.login { min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem; }
.login-card {
  width: 100%; max-width: 380px; display: grid; gap: 1rem;
  padding: 1.75rem 1.5rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-md);
}
.login-lead { color: var(--text-2); font-size: .95rem; margin-top: -.35rem; }

.brand { display: inline-flex; align-items: center; gap: .6rem; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: 10px; background: var(--red); color: #fff;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-weight: 700; font-size: 1.1rem; white-space: nowrap; letter-spacing: 0; }
.brand-lg .brand-mark { width: 42px; height: 42px; border-radius: 12px; }
.brand-lg .brand-mark svg { width: 28px; height: 28px; }
.brand-lg .brand-name { font-size: 1.3rem; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 920px; margin: 0 auto; padding: .55rem 1rem;
  padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
.topbar .brand { flex: none; }
.topbar-tools { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; min-width: 0; flex: 1 1 0; }
.yt-slot { min-width: 0; display: flex; flex: 0 1 auto; }
.topbar-tools > .btn { flex: none; }
.btn-icon-text { padding: 0 .7em; }

.pill {
  display: inline-flex; align-items: center; gap: .45rem; min-width: 0; max-width: 100%;
  min-height: 40px; padding: 0 .75rem; border-radius: 999px;
  font-size: .875rem; font-weight: 600; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2);
}
.pill-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pill-ok { background: var(--green-soft); border-color: transparent; color: var(--green-text); padding-inline-end: .3rem; }
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.pill-muted { color: var(--text-3); }
.pill-action {
  border: 0; background: transparent; color: inherit; font-weight: 600; font-size: .8rem;
  min-height: 32px; padding: 0 .6rem; border-radius: 999px; flex: none;
  text-decoration: underline; text-underline-offset: 3px; opacity: .85;
}
.pill-action:hover { background: color-mix(in srgb, currentColor 12%, transparent); opacity: 1; }

.notices { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: -1.25rem; }
.notice {
  display: inline-flex; align-items: flex-start; gap: .4rem;
  padding: .3rem .7rem; border-radius: 10px; font-size: .82rem; line-height: 1.5; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
}
.notice svg { width: 1.05rem; height: 1.05rem; margin-top: .12rem; }
.notice-warn { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber-text); }

/* ---------- page ---------- */
.page {
  max-width: 920px; margin: 0 auto; padding: 1.25rem 1rem 5rem;
  padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
  display: grid; gap: 2.25rem;
}
.section { display: grid; gap: .9rem; min-width: 0; }
.section-head { display: grid; gap: .1rem; }
.section-head-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.section-title { font-size: 1.35rem; font-weight: 700; line-height: 1.35; }
.section-sub { color: var(--text-2); font-size: .95rem; }

/* ---------- composer ---------- */
.drafts { display: grid; gap: .8rem; }
.draft {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: .5rem .75rem .75rem;
  display: grid; gap: .55rem; position: relative;
  transition: border-color .15s, box-shadow .15s;
}
.draft-head { display: flex; align-items: center; gap: .6rem; min-height: var(--tap); }
.draft-num { font-weight: 700; font-size: .95rem; color: var(--blue-text); }
.draft-state { font-size: .85rem; color: var(--text-2); display: inline-flex; align-items: center; gap: .4rem; }
.draft.is-sending .draft-state::before {
  content: ""; width: .9em; height: .9em; border: 2px solid currentColor; border-inline-start-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.draft-head .icon-btn { margin-inline-start: auto; margin-inline-end: -.35rem; }
.draft-grid { display: grid; gap: .6rem; }
.draft-textarea { min-height: 132px; }
.draft.is-waiting, .draft.is-sending { opacity: .85; }
.draft.is-waiting .draft-textarea, .draft.is-sending .draft-textarea { background: var(--surface-2); }

.draft.is-invalid { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 16%, transparent); }
.draft-msg {
  display: flex; gap: .4rem; align-items: flex-start;
  padding: .5rem .7rem; border-radius: var(--radius-sm);
  background: var(--red-soft); color: var(--red-text); font-size: .9rem; font-weight: 500;
}
.draft.is-drop { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.draft.is-drop .picker-empty { border-color: var(--focus); background: var(--blue-soft); }

.picker { min-width: 0; }
.picker-empty {
  width: 100%; min-height: 68px; padding: .6rem .8rem;
  display: grid; grid-template-columns: auto 1fr; column-gap: .75rem; align-items: center; text-align: start;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-2);
  transition: border-color .15s, background-color .15s;
}
.picker-empty:hover:not(:disabled) { border-color: var(--blue-text); background: var(--blue-soft); }
.picker-empty:disabled { opacity: .6; }
.picker-icon {
  grid-row: span 2; width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  background: var(--blue-soft); color: var(--blue-text);
}
.picker-icon svg { width: 24px; height: 24px; }
.picker-title { font-weight: 600; color: var(--text); line-height: 1.3; align-self: end; }
.picker-hint { font-size: .8rem; color: var(--text-3); line-height: 1.4; align-self: start; }
@media (hover: none) and (pointer: coarse) {
  .picker-empty { grid-template-rows: auto; }
  .picker-hint { display: none; }
  .picker-title { align-self: center; }
  .picker-icon { grid-row: auto; }
}

.picker-filled {
  display: grid; grid-template-columns: 84px 1fr; gap: .75rem; align-items: center;
  padding: .45rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.picker-preview { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; background: var(--surface-3); }
.picker-meta { display: grid; gap: .4rem; min-width: 0; }
.picker-file { display: flex; gap: .5rem; align-items: baseline; min-width: 0; font-size: .85rem; }
.picker-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; color: var(--text-2); }
.picker-size { color: var(--text-3); flex: none; font-size: .8rem; }
.picker-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--blue); border-radius: inherit; transition: width .2s; }
@media (prefers-color-scheme: dark) { .progress-bar { background: var(--blue-text); } }

.add-draft {
  width: 100%; min-height: 60px; padding: .5rem 1rem;
  display: flex; align-items: center; justify-content: center; gap: .7rem;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  background: transparent; color: var(--blue-text); font-weight: 700; font-size: 1.02rem;
  transition: background-color .15s, border-color .15s;
}
.add-draft:hover { background: var(--blue-soft); border-color: var(--blue-text); }
.add-draft-icon {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--blue); color: #fff;
}
.add-draft-icon svg { width: 22px; height: 22px; }

.submit-bar {
  position: sticky; bottom: 0; z-index: 10;
  margin: 0 -1rem; padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: grid; gap: .45rem;
}
.privacy-toggle { display: flex; align-items: center; justify-content: center; gap: .4rem; flex-wrap: wrap; }
.privacy-label { font-size: .85rem; color: var(--text-2, var(--text-3)); margin-inline-end: .2rem; }
.privacy-toggle .chip-btn[data-privacy="private"][aria-pressed="true"] { background: #1a3fa8; border-color: #1a3fa8; color: #fff; }
.privacy-toggle .chip-btn[data-privacy="public"][aria-pressed="true"] { background: #15803d; border-color: #15803d; color: #fff; }
.submit-hint { font-size: .82rem; color: var(--text-3); text-align: center; min-height: 0; }
.submit-hint:empty { display: none; }
.submit-all { width: 100%; }

/* ---------- history ---------- */
.live { display: inline-flex; align-items: center; gap: .45rem; font-size: .82rem; color: var(--text-3); font-weight: 500; }
.live-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .6rem .8rem; display: grid; gap: 0; min-width: 0;
}
.stat-num { font-size: 1.6rem; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-label { font-size: .82rem; color: var(--text-2); font-weight: 500; }
.stat-done .stat-num { color: var(--green-text); }
.stat-active.is-live .stat-num { color: var(--blue-text); }
.stat-error.is-on .stat-num { color: var(--red-text); }

.filters { display: flex; gap: .4rem; overflow-x: auto; padding: 3px; margin: -3px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip-btn {
  flex: none; min-height: 40px; padding: 0 1rem; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font-weight: 600; font-size: .9rem; transition: background-color .15s, color .15s, border-color .15s;
}
.chip-btn:hover { background: var(--surface-3); }
.chip-btn[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.jobs { display: grid; gap: .65rem; }
.job {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: .75rem; display: grid; gap: .65rem; min-width: 0;
}
.job[data-status="error"] { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.job-main { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: .75rem; align-items: start; }
.job-thumb-wrap {
  width: 64px; height: 64px; border-radius: 10px; overflow: hidden; position: relative;
  background: var(--surface-3); color: var(--text-3); display: grid; place-items: center;
}
.job-thumb-wrap > svg { width: 26px; height: 26px; }
.job-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.job-thumb-wrap.is-missing .job-thumb { display: none; }
.job-body { display: grid; gap: .4rem; min-width: 0; }
.job-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.job-top-end { display: flex; align-items: center; gap: .15rem; margin-inline-start: auto; }
.job-top-end .icon-btn { width: 40px; height: 40px; margin-block: -8px; margin-inline-end: -8px; }
.job-top-end .icon-btn svg { width: 1.15em; height: 1.15em; }
.job-time { font-size: .8rem; color: var(--text-3); white-space: nowrap; }
.job-title {
  font-size: 1rem; font-weight: 600; line-height: 1.5;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.job.is-open .job-title { -webkit-line-clamp: unset; line-clamp: unset; }

.badge {
  display: inline-flex; align-items: center; gap: .4rem; padding: .12rem .65rem; border-radius: 999px;
  font-size: .8rem; font-weight: 700; line-height: 1.6; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge.is-active .badge-dot { animation: pulse 1.2s ease-in-out infinite; }
.badge-parsing, .badge-rendering, .badge-uploading { background: var(--blue-soft); color: var(--blue-text); }
.badge-done { background: var(--green-soft); color: var(--green-text); }
.badge-error { background: var(--red-soft); color: var(--red-text); }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: .1rem; }
.step { display: grid; gap: 3px; min-width: 0; }
.step-mark { height: 4px; border-radius: 999px; background: var(--surface-3); position: relative; overflow: hidden; }
.step-label { font-size: .72rem; color: var(--text-3); line-height: 1.4; white-space: nowrap; }
.step-done .step-mark { background: var(--green); }
.step-done .step-label { color: var(--text-2); }
.step-failed .step-mark { background: var(--red); }
.step-failed .step-label { color: var(--red-text); font-weight: 700; }
.step-active .step-mark { background: var(--blue-soft); }
.step-active .step-mark::after {
  content: ""; position: absolute; inset: 0; width: 45%; border-radius: inherit; background: var(--blue-text);
  animation: slide 1.3s ease-in-out infinite;
}
.step-active .step-label { color: var(--blue-text); font-weight: 700; }
@keyframes slide { 0% { inset-inline-start: -45%; } 100% { inset-inline-start: 100%; } }

.job-error {
  display: flex; gap: .55rem; align-items: flex-start;
  padding: .6rem .75rem; border-radius: var(--radius-sm); background: var(--red-soft); color: var(--red-text);
}
.job-error > svg { margin-top: .2rem; }
.job-error-body { display: grid; gap: .1rem; min-width: 0; }
.job-error-title { font-size: .92rem; }
.job-error-msg { font-size: .86rem; color: var(--text); opacity: .9; white-space: pre-wrap; max-height: 9rem; overflow: auto; }

.job-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.btn-details svg { transition: transform .2s; width: 1.1em; height: 1.1em; }
.btn-details[aria-expanded="true"] svg { transform: rotate(180deg); }

.job-editor {
  display: grid; gap: .75rem; padding: .85rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.editor-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.job-details {
  display: grid; gap: .9rem; padding-top: .75rem; border-top: 1px solid var(--border);
}
.job-video { display: grid; justify-items: center; }
.job-video-el { width: 100%; max-width: 220px; aspect-ratio: 9 / 16; background: #000; border-radius: 12px; }
.detail-list { display: grid; gap: .65rem; min-width: 0; }
.detail { display: grid; gap: .1rem; min-width: 0; }
.detail dt { font-size: .78rem; font-weight: 600; color: var(--text-3); }
.detail dd { font-size: .93rem; min-width: 0; }
.detail dd > span { display: block; }
.pre { white-space: pre-wrap; }
.pre-scroll { max-height: 11rem; overflow: auto; padding: .5rem .65rem; background: var(--surface-2); border-radius: 8px; border: 1px solid var(--border); }
.tags { display: flex !important; flex-wrap: wrap; gap: .3rem; }
.tag { padding: .05rem .6rem; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: .82rem; }

.empty {
  padding: 1.75rem 1rem; text-align: center; color: var(--text-3); font-size: .95rem;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
div.empty { display: flex; align-items: center; justify-content: center; gap: .6rem; }
.more-wrap { display: flex; justify-content: center; }

/* ---------- dialog ---------- */
.dialog {
  border: 1px solid var(--border); border-radius: 16px; padding: 0; background: var(--surface); color: var(--text);
  width: min(92vw, 400px); box-shadow: var(--shadow-md);
}
.dialog::backdrop { background: rgba(10, 13, 20, .55); }
.dialog-body { padding: 1.25rem; display: grid; gap: .5rem; }
.dialog-title { font-size: 1.1rem; font-weight: 700; }
.dialog-text { color: var(--text-2); font-size: .95rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .75rem; }
.dialog-actions .btn { flex: 1 1 0; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; z-index: 100; inset-inline: 0; top: calc(62px + env(safe-area-inset-top)); pointer-events: none;
  padding: 0 .75rem;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.toast {
  pointer-events: auto; width: 100%; max-width: 440px;
  display: flex; align-items: center; gap: .6rem; padding: .55rem .55rem .55rem .9rem;
  padding-inline: .9rem .4rem;
  background: #1d222c; color: #f3f5f8; border-radius: 12px; box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, .08);
  font-size: .93rem; font-weight: 500; line-height: 1.5;
  animation: toast-in .2s ease-out;
}
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; }
.toast-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none; background: rgba(255, 255, 255, .14); }
.toast-icon svg { width: 16px; height: 16px; }
.toast-success .toast-icon { background: #1f9d5c; color: #fff; }
.toast-error .toast-icon { background: #e5231c; color: #fff; }
.toast-text { flex: 1 1 auto; min-width: 0; }
.toast-action {
  flex: none; border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-weight: 700; font-size: .85rem;
  min-height: 36px; padding: 0 .8rem; border-radius: 8px;
}
.toast-action:hover { background: rgba(255, 255, 255, .24); }
.toast-close {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; background: transparent; color: #aeb6c4; border-radius: 8px;
}
.toast-close:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.toast-close svg { width: 16px; height: 16px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

.noscript { padding: 2rem; text-align: center; }

/* ---------- small phones ---------- */
.show-sm { display: none; }
@media (max-width: 479px) {
  .hide-sm { display: none; }
  .brand-name { font-size: 1rem; }
  .topbar .btn-yt .btn-label { font-size: .85rem; }
}
@media (max-width: 379px) {
  .topbar .brand-name { display: none; }
}

/* ---------- tablet / desktop ---------- */
@media (min-width: 720px) {
  .page { padding-top: 2rem; gap: 2.75rem; }
  .section-title { font-size: 1.5rem; }
  .draft { padding: .6rem 1rem 1rem; }
  .draft-grid { grid-template-columns: minmax(0, 1fr) 232px; align-items: stretch; }
  .draft-textarea { min-height: 168px; height: 100%; }
  .picker { display: grid; }
  .picker-empty {
    min-height: 168px; height: 100%; grid-template-columns: 1fr; justify-items: center; text-align: center;
    align-content: center; row-gap: .3rem; padding: 1rem;
  }
  .picker-icon { grid-row: auto; }
  .picker-title, .picker-hint { align-self: auto; }
  .picker-filled { grid-template-columns: 1fr; align-content: start; height: 100%; }
  .picker-preview { width: 100%; height: 124px; }
  .submit-bar {
    margin: 0; padding: .75rem 0; grid-template-columns: 1fr auto; align-items: center;
    border-top: 0; background: color-mix(in srgb, var(--bg) 88%, transparent);
  }
  .privacy-toggle { grid-column: 1 / -1; justify-content: flex-start; }
  .submit-hint { text-align: start; }
  .submit-all { width: auto; min-width: 240px; }
  .job { padding: 1rem; }
  .job-main { grid-template-columns: 84px minmax(0, 1fr); gap: 1rem; }
  .job-thumb-wrap { width: 84px; height: 84px; }
  .steps { max-width: 420px; }
  .job-details { grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
  .job-details:not(:has(.job-video:not([hidden]))) { grid-template-columns: 1fr; }
  .job-editor { grid-template-columns: 1fr 1fr; }
  .job-editor > :nth-child(n+3) { grid-column: 1 / -1; }
  .toasts { top: auto; bottom: 0; align-items: flex-start; padding: 0 1.25rem 1.25rem; }
  .dialog-actions .btn { flex: 0 0 auto; min-width: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; scroll-behavior: auto !important; }
  .step-active .step-mark::after { inset-inline-start: 0; width: 100%; opacity: .6; }
}
