/* ================================================================
   VIPCut UI — Sora (display) + Inter (body) · Teal #087f79
   Matches cutdee.com marketing aesthetic.
   ================================================================ */
:root {
  --canvas: #f6f4ef; --paper: #fff; --paper-soft: #fafaf8;
  --ink: #151918; --ink-soft: #4d5754; --muted: #74807c;
  --line: #e5e8e4; --line-strong: #c7cfc9;
  --teal: #087f79; --teal-dark: #05645f; --teal-soft: #e6f4f1; --teal-glow: rgba(8,127,121,.22);
  --amber: #a65a0a; --amber-soft: #fff6e8;
  --red: #b42318; --red-soft: #fff0ee;
  --green: #16794b; --green-soft: #e7f5ec;
  --blue: #2563a8; --blue-soft: #eaf1fb;
  --grad-hero: linear-gradient(135deg, #087f79 0%, #0a9d96 35%, #6d28d9 100%);
  --grad-button: linear-gradient(135deg, #087f79, #0a9d96);
  --grad-bg: radial-gradient(ellipse at 0% 0%, rgba(8,127,121,.07), transparent 45%),
             radial-gradient(ellipse at 100% 100%, rgba(109,40,217,.05), transparent 50%);
  --shadow-sm: 0 2px 6px rgba(15,32,28,.05), 0 1px 2px rgba(15,32,28,.04);
  --shadow: 0 10px 28px rgba(15,32,28,.08), 0 2px 6px rgba(15,32,28,.04);
  --shadow-teal: 0 8px 24px rgba(8,127,121,.28);
  --r-xs: 6px; --r-sm: 10px; --r: 14px;
}
* { box-sizing: border-box; }
html { min-width: 0; }
body {
  margin: 0; min-height: 100vh; overflow-x: hidden;
  color: var(--ink); background: var(--canvas);
  background-image:
    var(--grad-bg),
    linear-gradient(rgba(8,127,121,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8,127,121,.035) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
  background-attachment: fixed;
  font: 15px/1.55 Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal); text-decoration: none; transition: color .15s; }
a:hover { color: var(--teal-dark); text-decoration: underline; }
::selection { background: var(--teal); color: white; }
button:focus-visible, a:focus-visible, label[for]:focus-visible,
select:focus-visible, input:focus-visible {
  outline: 3px solid var(--teal-glow); outline-offset: 2px; border-radius: var(--r-xs);
}

/* Typography */
h1, h2, .brand-copy strong, .tab strong, .primary,
.dropzone-label strong, .brand-cutdee, .brand-copy strong {
  font-family: Sora, Inter, system-ui, sans-serif;
  letter-spacing: -.025em; margin: 0;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.04;
      margin: 0 0 .6rem; letter-spacing: -.035em; }
h1 .grad { background: var(--grad-hero); -webkit-background-clip: text;
            background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
h2 { font-size: 1.15rem; font-weight: 700; line-height: 1.3; margin: 0 0 .85rem; }
.lead { max-width: 640px; margin: 0; color: var(--ink-soft); font-size: 1.02rem; line-height: 1.6; }
.lead strong { color: var(--ink); font-weight: 600; }
code { padding: .12rem .4rem; border-radius: 5px; background: var(--paper-soft);
       border: 1px solid var(--line); color: var(--teal-dark);
       font: .82em/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); font-size: .82rem; }

/* Eyebrow + section-label (small uppercase) */
.eyebrow, .section-label {
  display: inline-block;
  margin: 0 0 .5rem; color: var(--teal);
  font-family: Sora, sans-serif; font-size: .68rem; font-weight: 800;
  letter-spacing: .15em; text-transform: uppercase;
}

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center;
          justify-content: space-between; gap: 1.5rem; min-height: 76px;
          padding: .75rem max(1rem, calc((100vw - 1180px) / 2));
          border-bottom: 1px solid var(--line); background: rgba(255,255,255,.85);
          -webkit-backdrop-filter: saturate(180%) blur(14px);
          backdrop-filter: saturate(180%) blur(14px); box-shadow: var(--shadow-sm); }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; width: 42px; height: 42px; flex: 0 0 42px;
              place-items: center; border-radius: var(--r-sm);
              background: var(--grad-button); color: white;
              box-shadow: var(--shadow-teal); transition: transform .25s; }
.brand-mark svg { width: 24px; fill: none; stroke: currentColor;
                   stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.2; }
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.05); }
.brand-copy { display: flex; min-width: 0; flex-direction: column; line-height: 1.2; }
.brand-copy strong { font-size: 1.08rem; }
.brand-copy small { margin-top: .15rem; color: var(--muted); font-size: .7rem; }
.brand-divider { color: var(--line-strong); font-weight: 400; -webkit-user-select: none; user-select: none; }
.brand-cutdee { display: inline-flex; align-items: center; gap: .3rem;
                padding: .25rem .5rem; border-radius: var(--r-xs);
                color: var(--ink-soft); font-family: Sora, Inter, sans-serif;
                font-size: .8rem; font-weight: 600; letter-spacing: -.01em;
                transition: background .15s, color .15s;
                -webkit-user-select: none; user-select: none; }
.brand-cutdee:hover { background: var(--teal-soft); color: var(--teal-dark); text-decoration: none; }
.beagle-icon { width: 14px; height: 14px; flex: 0 0 14px; color: var(--teal); transition: transform .3s; }
.brand-cutdee:hover .beagle-icon { transform: scale(1.15) rotate(-6deg); }
.brand-cutdee-accent { color: var(--teal); font-weight: 700; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; min-width: 0; }

.gpu-status { display: flex; align-items: center; gap: .5rem; min-width: 145px;
              padding: .45rem .65rem; border: 1px solid #b9dcd8;
              border-radius: var(--r-sm); background: #effcf8; color: var(--teal-dark); }
.gpu-status > span:last-child { display: flex; min-width: 0; flex-direction: column; line-height: 1.2; }
.gpu-status strong { font-size: .76rem; white-space: nowrap; }
.gpu-status small { margin-top: .12rem; font-size: .64rem; opacity: .82; }
.gpu-status-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%;
                  background: currentColor; box-shadow: 0 0 0 4px rgba(8,127,121,.12); }
.gpu-status[data-state="ready"] .gpu-status-dot { animation: gpu-pulse 1.8s ease-in-out infinite; }
.gpu-status[data-state="error"] { border-color: #e9b4aa; background: var(--red-soft); color: var(--red); }
@keyframes gpu-pulse { 50% { box-shadow: 0 0 0 7px rgba(8,127,121,.06); } }

/* Quota bar */
.quota-bar { display: flex; align-items: center; gap: .6rem; min-width: 200px;
              padding: .5rem .75rem; border: 1px solid #b9dcd8; border-radius: var(--r-sm);
              background: var(--teal-soft); color: var(--teal-dark); transition: all .2s; }
.quota-bar.warning { border-color: #f3c589; background: var(--amber-soft); color: #7a4308;
                     animation: pulse-warn 2s ease-in-out infinite; }
.quota-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%;
              background: currentColor; box-shadow: 0 0 0 4px rgba(8,127,121,.11); }
.quota-bar.warning .quota-dot { box-shadow: 0 0 0 4px rgba(166,90,10,.13); }
.quota-copy { display: flex; min-width: 0; flex-direction: column; line-height: 1.25; }
.quota-copy strong { overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.quota-copy small { margin-top: .15rem; color: currentColor; font-size: .68rem; opacity: .8; }
@keyframes pulse-warn { 0%, 100% { box-shadow: 0 0 0 0 rgba(166,90,10,0); }
                          50% { box-shadow: 0 0 0 6px rgba(166,90,10,.14); } }

/* User */
.user { display: flex; align-items: center; gap: .55rem; min-width: 0; color: var(--muted); font-size: .85rem; }
.user strong { color: var(--ink); font-weight: 600; }
.user a { display: inline-flex; align-items: center; min-height: 38px; padding: .45rem .85rem;
          border: 1px solid var(--line-strong); border-radius: var(--r-xs);
          color: var(--ink); font-weight: 600; transition: all .15s; }
.user a:hover { border-color: var(--teal); background: var(--teal-soft);
                color: var(--teal-dark); text-decoration: none; }

/* Container */
.container { width: min(1180px, 100%); margin: 0 auto; padding: 2.4rem 1.5rem 3rem; }

/* Page intro */
.page-intro { display: flex; align-items: flex-end; justify-content: space-between;
               gap: 2rem; margin-bottom: 1.6rem; }
.policy-note { display: flex; flex-direction: column; gap: .15rem; max-width: 390px;
                padding: .8rem 1rem; border-left: 3px solid #d8872b;
                background: var(--amber-soft); color: #6f430f; font-size: .82rem; }
.policy-note strong { color: #6f430f; font-weight: 700; }
.policy-note span { color: #8c5a1d; font-size: .76rem; }

/* Steps */
.steps { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
          gap: .5rem; max-width: 760px; margin: 0 0 1.4rem; padding: 0; list-style: none; }
.steps::before { position: absolute; top: 17px; right: 9%; left: 9%; height: 2px;
                  background: var(--line); content: ""; }
.step { position: relative; z-index: 1; display: flex; align-items: center; gap: .55rem;
          min-width: 0; color: var(--muted); font-weight: 500; }
.step span { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center;
              border: 2px solid var(--line); border-radius: 50%; background: var(--paper);
              font-family: Sora, sans-serif; font-size: .82rem; font-weight: 700;
              transition: all .25s; }
.step em { overflow: hidden; font-style: normal; font-size: .82rem;
            font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.step.active { color: var(--teal-dark); font-weight: 600; }
.step.active span { border-color: var(--teal); background: var(--teal); color: white;
                     box-shadow: 0 0 0 5px var(--teal-soft); }
.step.complete span { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }

/* Tabs */
.tabs { position: relative; display: flex; width: min(820px, 100%);
          border: 1px solid var(--line); border-bottom: 0;
          border-radius: var(--r) var(--r) 0 0; background: #f0f1ed; overflow: hidden; }
.tab { position: relative; flex: 1; min-width: 0; padding: 1rem 1.1rem .95rem; border: 0;
        background: transparent; color: var(--muted); text-align: left;
        transition: background .2s, color .2s; }
.tab:hover { background: rgba(255,255,255,.6); }
.tab.active { background: var(--paper); color: var(--ink); }
.tab-kicker { display: block; color: var(--teal); font-family: Sora, sans-serif;
              font-size: .65rem; font-weight: 800; letter-spacing: .08em;
              text-transform: uppercase; }
.tab strong { display: block; overflow: hidden; font-size: .95rem;
               text-overflow: ellipsis; white-space: nowrap; }
.tab small { display: block; overflow: hidden; margin-top: .15rem;
              font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.tab.active::after { content: ""; position: absolute; bottom: -1px; left: 0; right: 0; height: 3px;
                      background: var(--grad-button); border-radius: 3px 3px 0 0; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel[hidden] { display: none !important; }

/* Editor layout */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 292px;
                  border: 1px solid var(--line); border-radius: 0 var(--r) var(--r) 0;
                  background: var(--paper); box-shadow: var(--shadow); margin-bottom: 1.4rem; }
.editor-main { min-width: 0; padding: 1.5rem 1.5rem 1.4rem; }
.editor-guide { min-width: 0; padding: 1.5rem 1.35rem;
                 border-left: 1px solid var(--line); background: var(--paper-soft); }
.editor-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
                   align-items: end; gap: 1.5rem; margin-bottom: 1.2rem; }
.editor-heading.ab-heading { display: block; }
.field { display: grid; gap: .35rem; min-width: 0; }
.field label { color: var(--ink-soft); font-size: .75rem; font-weight: 700; }
select, input[type="text"] { width: 100%; min-width: 0; min-height: 42px; padding: .55rem .75rem;
                              border: 1px solid var(--line-strong); border-radius: var(--r-xs);
                              background: white; color: var(--ink); font-size: .92rem;
                              transition: border-color .15s, box-shadow .15s; }
select:hover, input[type="text"]:hover { border-color: var(--teal); }
select:focus, input[type="text"]:focus { border-color: var(--teal);
                                            box-shadow: 0 0 0 3px var(--teal-glow); outline: none; }

/* Dropzone */
.dropzone { position: relative; min-width: 0; margin-bottom: 1rem;
            border: 2px dashed #9bc4bf; border-radius: var(--r);
            background: linear-gradient(180deg, #fbfffe 0%, #f4faf8 100%); transition: all .2s ease; }
.dropzone:hover { border-color: var(--teal);
                   background: linear-gradient(180deg, #effaf7 0%, #e3f3ef 100%); }
.dropzone.dragging { border-color: var(--teal); border-style: solid; background: var(--teal-soft);
                      transform: translateY(-2px); box-shadow: var(--shadow-teal); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; margin: -1px;
                                padding: 0; overflow: hidden; clip: rect(0,0,0,0); border: 0; white-space: nowrap; }
.dropzone.compact { border-radius: var(--r-sm); }
.dropzone-label { display: flex; align-items: center; gap: 1rem; min-width: 0;
                   padding: 1.4rem 1.4rem 1.1rem; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.dropzone-label.compact-label { min-height: 96px; padding: 1rem; text-align: center;
                                  justify-content: center; }
.upload-icon { display: grid; width: 54px; height: 54px; flex: 0 0 54px;
                place-items: center; border-radius: 50%;
                background: var(--teal-soft); color: var(--teal); transition: transform .25s; }
.upload-icon svg { width: 32px; fill: none; stroke: currentColor;
                    stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.dropzone:hover .upload-icon { transform: scale(1.06) rotate(-4deg); background: var(--teal); color: white; }
.dropzone-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; line-height: 1.4; }
.dropzone-label.compact-label .dropzone-copy { align-items: center; }
.dropzone-copy strong { color: var(--teal-dark); font-size: 1rem; font-weight: 700; }
.dropzone-copy span { color: var(--muted); font-size: .78rem; }
.select-files-button, .add-more-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; padding: .45rem .85rem; border: 1px solid var(--teal);
  border-radius: var(--r-xs); color: var(--teal-dark);
  font-size: .78rem; font-weight: 700; white-space: nowrap; cursor: pointer;
  transition: all .15s;
}
.select-files-button:hover, .add-more-button:hover { background: var(--teal); color: white; }
.upload-formats { margin: 0; padding: 0 1.4rem 1rem 6.5rem; color: var(--muted); font-size: .72rem; }

/* Queue (file list) */
.queue { margin-top: 1rem; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.queue-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
               padding: .75rem .85rem; border-bottom: 1px solid var(--line); background: #f7f8f5; }
.queue-head > div { display: flex; min-width: 0; flex-direction: column; }
.queue-head strong { font-size: .86rem; }
.queue-head span { color: var(--muted); font-size: .7rem; }
.file-list { margin: 0; padding: 0; list-style: none; }
.file-list.single-list { margin-top: .55rem; border: 1px solid var(--line);
                          border-radius: var(--r-sm); background: white; overflow: hidden; }
/* Multi-file AB Roll lanes: same boxed look as the single-list variant but
   keep the index column so users see 01, 02, 03 ... for reordering context. */
.abroll-zone .file-list { margin-top: .55rem; border: 1px solid var(--line);
                          border-radius: var(--r-sm); background: white; overflow: hidden; }
.abroll-zone .file-list:empty::before { content: 'ยังไม่มีไฟล์ในคิว'; display: block;
                                          padding: 1.25rem; color: var(--muted);
                                          font-size: .82rem; text-align: center; }
.empty-queue { padding: 1.25rem; color: var(--muted); font-size: .82rem; text-align: center; }
.file-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto;
             align-items: center; gap: .8rem; min-width: 0;
             padding: .68rem .85rem; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.file-list.single-list .file-row { grid-template-columns: minmax(0, 1fr) auto; }
.file-index { color: var(--teal); font-family: Sora, sans-serif; font-size: .8rem; font-weight: 800; }
.file-copy { display: flex; min-width: 0; flex-direction: column; }
.file-copy strong { overflow: hidden; font-size: .82rem;
                     text-overflow: ellipsis; white-space: nowrap; }
.file-copy small { margin-top: .1rem; color: var(--muted); font-size: .68rem; }
.file-type { padding: .15rem .4rem; border: 1px solid var(--line); border-radius: 4px;
              color: var(--muted); font-size: .65rem; font-weight: 700; }
.remove-file { padding: .25rem .5rem; border: 0; background: transparent; color: var(--red);
                font-size: .75rem; font-weight: 700; cursor: pointer; transition: background .15s; }
.remove-file:hover { background: var(--red-soft); border-radius: 4px; }

/* Mode hint */
.mode-hint { margin: .8rem 0 0; padding: .7rem .85rem; border: 1px solid #f0bf7c;
              border-radius: var(--r-xs); background: var(--amber-soft); color: #79480e;
              font-size: .8rem; animation: slide-down .25s ease; }
.mode-hint[data-state="error"] { border-color: #efb0a9; background: var(--red-soft); color: var(--red); }
.mode-hint[data-state="warning"] { border-color: #f0bf7c; background: var(--amber-soft); color: #79480e; }
.mode-hint[hidden] { display: none; }
@keyframes slide-down { from { opacity: 0; transform: translateY(-6px); }
                          to { opacity: 1; transform: translateY(0); } }

/* Mode guide (in editor aside) */
.mode-guide { margin: 1rem 0 0; }
.mode-guide div { padding: .8rem 0; border-top: 1px solid var(--line); }
.mode-guide div:first-child { border-top: 0; padding-top: .5rem; }
.mode-guide dt { color: var(--ink); font-size: .8rem; font-weight: 700; }
.mode-guide dd { margin: .2rem 0 0; color: var(--muted); font-size: .74rem; }
.privacy-note { display: flex; flex-direction: column; gap: .15rem; margin-top: 1rem;
                padding: .75rem .85rem; border-left: 2px solid var(--teal);
                background: var(--teal-soft); color: var(--teal-dark); font-size: .74rem; }
.privacy-note strong { font-weight: 700; }
.privacy-note span { color: var(--teal-dark); opacity: .85; font-size: .7rem; }

/* Editor action (footer row inside editor-main) */
.editor-action { display: flex; align-items: center; justify-content: space-between;
                  gap: 1.25rem; margin-top: 1.15rem; padding-top: 1rem;
                  border-top: 1px solid var(--line); flex-wrap: wrap; }
.editor-action p { display: flex; min-width: 0; flex-direction: column; margin: 0;
                     color: var(--ink-soft); font-size: .8rem; }
.editor-action p strong { color: var(--ink); font-weight: 700; }
.editor-action p span { color: var(--muted); font-size: .72rem; }

/* Buttons + status */
.primary { position: relative; min-height: 46px; padding: .7rem 1.4rem; border: 0;
            border-radius: var(--r-xs); background: var(--grad-button); color: white;
            font-family: Sora, sans-serif; font-size: .9rem; font-weight: 700;
            box-shadow: var(--shadow-teal); transition: all .2s; }
.primary:hover:not(:disabled) { background: linear-gradient(135deg, #05645f, #087f79);
                                  transform: translateY(-1px); box-shadow: 0 12px 28px rgba(8,127,121,.35); }
.primary:active:not(:disabled) { transform: translateY(0); }
.primary:disabled { background: #c7d2cf; color: #6f7c78; box-shadow: none; cursor: not-allowed; }
.primary.small { min-height: 38px; padding: .5rem .9rem; font-size: .82rem; }
.primary[data-loading="true"] { padding-left: 2.5rem; color: transparent; }
.primary[data-loading="true"]::before { content: ""; position: absolute; top: 50%; left: 1rem;
                                          width: 14px; height: 14px; margin-top: -7px;
                                          border: 2px solid rgba(255,255,255,.5);
                                          border-top-color: white; border-radius: 50%;
                                          animation: spin .75s linear infinite; }
#submit-btn-ab[data-loading="true"] { color: white; min-width: 245px; }
@keyframes spin { to { transform: rotate(360deg); } }
.status { min-height: 1.2rem; margin: .55rem 0 0; color: var(--muted); font-size: .82rem; }
.status[data-state="error"] { color: var(--red); font-weight: 600; }
.status[data-state="success"] { color: var(--green); font-weight: 600; }
.status[data-state="loading"] { color: var(--blue); }

/* Upload progress panel (AB Roll + reusable across editors) */
.upload-progress-panel { margin-top: 1rem; padding: 1rem 1.1rem;
                          border: 1px solid var(--line); border-radius: var(--r);
                          background: linear-gradient(180deg, #fbfffe 0%, #f8f7ff 100%);
                          box-shadow: var(--shadow-sm); }
.upload-progress-panel[hidden] { display: none; }
.upload-progress-panel[data-state="error"] { border-color: #e9b4aa; background: var(--red-soft); }
.upload-progress-head { display: flex; align-items: center; justify-content: space-between;
                         gap: 1rem; margin-bottom: .55rem; }
.upload-progress-head > div { display: flex; min-width: 0; flex-direction: column; gap: .1rem; }
.upload-progress-head strong { color: var(--ink); font-size: .88rem; font-weight: 700; }
.upload-progress-head small { color: var(--muted); font-size: .72rem; }
.upload-progress-percent { font-family: Sora, sans-serif; font-size: 1.05rem; font-weight: 800;
                            color: var(--teal-dark); font-variant-numeric: tabular-nums;
                            min-width: 3.5rem; text-align: right; }
.progress-bar { position: relative; width: 100%; height: 8px; overflow: hidden;
                 border-radius: 999px; background: var(--line); }
.progress-bar .progress-fill { display: block; height: 100%; min-width: 0;
                                background: linear-gradient(90deg, #087f79, #0a9d96);
                                border-radius: 999px; transition: width .15s ease-out; }
.upload-progress-current { margin: .55rem 0 .65rem; color: var(--ink-soft); font-size: .76rem; }
.upload-file-list { display: flex; min-width: 0; flex-direction: column; gap: .45rem;
                     margin: 0; padding: 0; list-style: none; }
.upload-file-list .upload-file-row { display: flex; min-width: 0; flex-direction: column;
                                       gap: .25rem; padding: .55rem .65rem;
                                       border: 1px solid var(--line); border-radius: var(--r-sm);
                                       background: var(--paper); }
.upload-file-list .upload-file-head { display: flex; align-items: center;
                                       gap: .55rem; font-size: .76rem; }
.upload-file-list .upload-file-lane { display: inline-grid; place-items: center;
                                       width: 22px; height: 22px; flex: 0 0 22px;
                                       border-radius: 50%; color: white;
                                       font-family: Sora, sans-serif; font-weight: 800;
                                       font-size: .72rem; }
.upload-file-list .upload-file-lane[data-lane="a"] { background: linear-gradient(135deg, #087f79, #0a9d96); }
.upload-file-list .upload-file-lane[data-lane="b"] { background: linear-gradient(135deg, #c86f1c, #e08528); }
.upload-file-list .upload-file-lane[data-lane="audio"] { background: linear-gradient(135deg, #6d28d9, #8b5cf6); }
.upload-file-list .upload-file-name { flex: 1; min-width: 0; overflow: hidden;
                                       text-overflow: ellipsis; white-space: nowrap;
                                       color: var(--ink); font-weight: 600; }
.upload-file-list .upload-file-size { color: var(--muted); font-size: .7rem;
                                       font-variant-numeric: tabular-nums; }
.upload-file-list .upload-file-percent { color: var(--teal-dark); font-family: Sora, sans-serif;
                                          font-size: .72rem; font-weight: 700;
                                          min-width: 3rem; text-align: right;
                                          font-variant-numeric: tabular-nums; }
.upload-file-list .progress-bar { height: 5px; }
.upload-file-list .upload-file-row[data-status="done"] .upload-file-percent { color: var(--green); }
.upload-file-list .upload-file-row[data-status="error"] .upload-file-percent { color: var(--red); }

/* AB Roll */
.abroll-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 1rem; margin-bottom: 1.1rem; }
.abroll-zone { min-width: 0; padding: 1rem; border: 1px solid var(--line);
                border-radius: var(--r); background: var(--paper-soft); transition: border-color .2s; }
.abroll-zone:hover { border-color: var(--line-strong); }
.abroll-audio-zone { grid-column: 1 / -1; background: linear-gradient(180deg, #fcfbff, #f8f6ff); }
.zone-label { display: flex; align-items: center; gap: .7rem; margin-bottom: .7rem; }
.zone-label > div { display: flex; min-width: 0; flex-direction: column; }
.zone-label strong { font-size: .9rem; font-weight: 700; }
.zone-label small { color: var(--muted); font-size: .68rem; }
.badge-zone { display: grid; width: 34px; height: 34px; flex: 0 0 34px;
              place-items: center; border-radius: 50%; color: white;
              font-family: Sora, sans-serif; font-weight: 800; font-size: .95rem; }
.badge-zone.a { background: linear-gradient(135deg, #087f79, #0a9d96); box-shadow: 0 4px 10px rgba(8,127,121,.35); }
.badge-zone.b { background: linear-gradient(135deg, #c86f1c, #e08528); box-shadow: 0 4px 10px rgba(200,111,28,.35); }
.badge-zone.audio { background: linear-gradient(135deg, #6d28d9, #8b5cf6);
                    box-shadow: 0 4px 10px rgba(109,40,217,.28); }
.badge-zone.ai-video { background: linear-gradient(135deg, #2563a8, #4d82c5);
                       box-shadow: 0 4px 10px rgba(37,99,168,.3); }
.badge-zone.ai-audio { background: linear-gradient(135deg, #6d28d9, #8b5cf6);
                       box-shadow: 0 4px 10px rgba(109,40,217,.28); }
.ai-editor { border: 1px solid var(--line); border-radius: 0 var(--r) var(--r) var(--r);
             background: var(--paper); box-shadow: var(--shadow); }
.ai-zone { background: linear-gradient(180deg, #fbfffe 0%, #f8f7ff 100%); }
.lane-help { min-height: 2.35rem; margin: -.3rem 0 .45rem; color: var(--muted);
             font-size: .7rem; line-height: 1.5; }
.ai-policy { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
             gap: .75rem; margin-top: .2rem; padding: .9rem;
             border: 1px solid #cfdedb; border-radius: var(--r-sm);
             background: var(--teal-soft); }
.ai-policy div { display: flex; min-width: 0; flex-direction: column; gap: .1rem; }
.ai-policy strong { color: var(--teal-dark); font-family: Sora, sans-serif;
                    font-size: .8rem; }
.ai-policy span { color: var(--ink-soft); font-size: .68rem; }
.ab-settings { display: grid; grid-template-columns: minmax(230px, .65fr) minmax(0, 1fr);
                align-items: end; gap: 1.2rem; margin-top: 1rem;
                padding: 1rem; border-top: 1px solid var(--line);
                border-bottom: 1px solid var(--line); }
.checkbox-label { display: inline-flex; align-items: center; gap: .6rem;
                   min-width: 0; cursor: pointer; font-size: .9rem; }
.checkbox-label input { width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--teal); }
.checkbox-label span { display: flex; min-width: 0; flex-direction: column; }
.checkbox-label strong { font-size: .8rem; }
.checkbox-label small { color: var(--muted); font-size: .7rem; }
.hint { display: inline-grid; place-items: center; width: 16px; height: 16px;
          border-radius: 50%; background: var(--teal-soft); color: var(--teal-dark);
          font-size: .7rem; font-style: normal; cursor: help; }

/* Recent jobs */
.recent-jobs { margin-top: 1.4rem; padding: 1.3rem 1.4rem; border: 1px solid var(--line);
                border-radius: var(--r); background: rgba(255,255,255,.85);
                box-shadow: var(--shadow-sm); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between;
                    gap: 1rem; margin-bottom: .8rem; }
.section-heading > div { display: flex; flex-direction: column; }
.section-heading h2 { margin: 0; font-size: 1.1rem; }
.text-button { border: 0; background: transparent; color: var(--teal);
                font-size: .78rem; font-weight: 700; cursor: pointer;
                padding: .25rem .5rem; border-radius: var(--r-xs); transition: background .15s; }
.text-button:hover { background: var(--teal-soft); color: var(--teal-dark); }
.jobs-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.jobs-table th { padding: .55rem .75rem; border-bottom: 1px solid var(--line); color: var(--muted);
                  font-family: Sora, sans-serif; font-size: .7rem; font-weight: 700;
                  text-align: left; text-transform: uppercase; letter-spacing: .05em; }
.jobs-table td { padding: .7rem .75rem; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
.jobs-table tr:last-child td { border-bottom: 0; }
.jobs-table tbody tr { transition: background .15s; }
.jobs-table tbody tr:hover { background: var(--paper-soft); }
.jobs-table code { font-size: .78rem; background: transparent; border: 0; padding: 0;
                    color: var(--ink); font-weight: 500; }

/* Status pills */
.status-pill { display: inline-flex; align-items: center; min-height: 24px; padding: .2rem .6rem;
                border-radius: 999px; font-family: Sora, sans-serif; font-size: .68rem;
                font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.status-queued { background: var(--amber-soft); color: var(--amber); }
.status-running { background: var(--blue-soft); color: var(--blue); position: relative; padding-left: 1.1rem; }
.status-running::before { content: ""; position: absolute; left: .45rem; top: 50%; width: 6px; height: 6px;
                           margin-top: -3px; border-radius: 50%; background: var(--blue);
                           animation: pulse-dot 1.4s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; transform: scale(1); }
                        50% { opacity: .5; transform: scale(1.4); } }
.status-done { background: var(--green-soft); color: var(--green); }
.status-failed { background: var(--red-soft); color: var(--red); }

/* Processing/result page */
.result-container { width: min(960px, 100%); }
.result-intro { align-items: flex-start; }
.result-intro .lead { min-width: 0; overflow-wrap: anywhere; }
.result-intro code { word-break: break-all; }
.card { min-width: 0; margin-top: 1rem; padding: 1.3rem 1.4rem;
        border: 1px solid var(--line); border-radius: var(--r);
        background: rgba(255,255,255,.92); box-shadow: var(--shadow-sm); }
.status-inline { margin: 0; color: var(--ink-soft); }
.result-status-badges { display: inline-flex; align-items: center; gap: .55rem; }
.progress-bar { height: 8px; margin: 1rem 0; overflow: hidden;
                border-radius: 999px; background: var(--line); }
.progress-bar .fill { width: 8%; height: 100%; border-radius: inherit;
                      background: var(--grad-button); transition: width .35s ease; }
.result-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
               gap: .7rem; min-width: 0; }
.result-meta span { min-width: 0; padding: .7rem .8rem; border-radius: var(--r-xs);
                    background: var(--paper-soft); color: var(--ink-soft);
                    overflow-wrap: anywhere; }
.result-meta strong { display: block; margin-bottom: .15rem; color: var(--muted);
                      font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; }
.btn-download { display: inline-flex; align-items: center; justify-content: center;
                min-height: 40px; padding: .5rem .85rem; border: 1px solid var(--teal);
                border-radius: var(--r-xs); background: var(--teal-soft);
                color: var(--teal-dark); font-weight: 700; }
.btn-download:hover { background: var(--teal); color: white; text-decoration: none; }
.result-video { display: block; width: 100%; max-width: 100%; height: auto;
                max-height: 70vh; border-radius: var(--r-sm); background: #050807;
                object-fit: contain; }
audio.result-video { min-height: 54px; background: transparent; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.result-item { min-width: 0; padding: .85rem; border: 1px solid var(--line);
               border-radius: var(--r-sm); background: var(--paper-soft); }
.result-item-head { display: flex; align-items: center; justify-content: space-between;
                    gap: .7rem; margin-bottom: .7rem; }
.result-item-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis;
                           white-space: nowrap; font-size: .82rem; }
.result-item .btn-download { min-height: 34px; padding: .4rem .65rem; font-size: .74rem; }
.result-item .result-video { max-height: 56vh; }
#media-ready-status[data-state="success"] { color: var(--green); }
#media-ready-status[data-state="error"] { color: var(--red); }
.log-card summary { color: var(--ink-soft); font-weight: 700; cursor: pointer; }
.logs { min-width: 0; margin-top: .8rem; padding: .8rem;
        border-radius: var(--r-xs); background: #17211f; color: #d8e6e1;
        font: .76rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
        overflow-wrap: anywhere; white-space: pre-wrap; }

/* Footer */
footer { display: flex; justify-content: center; gap: 1.2rem; margin-top: 2.2rem;
          padding-top: 1.2rem; border-top: 1px solid var(--line);
          color: var(--muted); font-size: .78rem; flex-wrap: wrap; }
footer a { color: var(--muted); font-weight: 500; }
footer a:hover { color: var(--teal-dark); }

/* Misc */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 860px) {
  .container { padding: 1.8rem 1.2rem 2.4rem; }
  .topbar { gap: .8rem; padding: .7rem 1rem; }
  .page-intro { flex-direction: column; align-items: stretch; gap: 1rem; }
  .policy-note { max-width: none; }
  .editor-layout { grid-template-columns: 1fr; border-radius: 0 0 var(--r) var(--r); }
  .editor-guide { border-top: 1px solid var(--line); border-left: 0; }
  .editor-heading { grid-template-columns: 1fr; gap: .8rem; }
  .abroll-grid { grid-template-columns: 1fr; }
  .abroll-audio-zone { grid-column: auto; }
  .ab-settings { grid-template-columns: 1fr; align-items: stretch; }
  .result-grid { grid-template-columns: 1fr; }
  .jobs-table th:nth-child(4), .jobs-table td:nth-child(4) { display: none; }
}
@media (max-width: 640px) {
  body { background-size: 100% 100%, 24px 24px, 24px 24px; }
  .topbar { flex-wrap: wrap; min-height: 0; padding: .7rem 1rem; }
  .topbar-actions { width: 100%; flex-wrap: wrap; justify-content: space-between; }
  .quota-bar { min-width: 0; padding: .45rem .6rem; }
  .quota-copy strong { font-size: .76rem; }
  .brand-mark { width: 38px; height: 38px; flex-basis: 38px; }
  .brand-mark svg { width: 20px; }
  .brand-copy small { display: none; }
  .brand-divider, .brand-cutdee { display: none; }
  h1 { font-size: 2rem; }
  .lead { font-size: .9rem; }
  .steps { max-width: none; }
  .steps::before { right: 12%; left: 12%; top: 15px; }
  .step { flex-direction: column; gap: .25rem; text-align: center; }
  .step span { width: 28px; height: 28px; flex-basis: 28px; font-size: .72rem; }
  .step em { width: 100%; font-size: .65rem; }
  .tabs { width: 100%; }
  .tab { padding: .8rem .7rem; }
  .tab strong { font-size: .85rem; }
  .tab small { font-size: .65rem; }
  .ai-policy { grid-template-columns: 1fr; }
  .editor-main, .editor-guide { padding: 1.1rem 1rem; }
  .dropzone-label { flex-direction: column; text-align: center; padding: 1.2rem 1rem; gap: .8rem; }
  .dropzone-label.compact-label { flex-direction: row; }
  .upload-formats { padding: 0 1rem .9rem; text-align: center; }
  .queue-head { align-items: flex-start; }
  .queue-head > div { max-width: 65%; }
  .file-row { grid-template-columns: 30px minmax(0, 1fr) auto; gap: .55rem; padding: .65rem .7rem; }
  .file-type { display: none; }
  .remove-file { grid-column: 3; }
  .editor-action { flex-direction: column; align-items: stretch; gap: .8rem; }
  .primary { width: 100%; }
  .status { text-align: center; }
  .result-container { padding-right: 1rem; padding-left: 1rem; }
  .result-intro h1 { font-size: 1.8rem; }
  .result-meta { grid-template-columns: 1fr; }
  .card { padding: 1rem; }
  .card .section-heading { align-items: flex-start; }
  .btn-download { flex: 0 0 auto; }
  .result-video { max-height: 58vh; }
  footer { gap: .7rem 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important;
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; }
}
