/* flow.css: extra components for the Radar > Ad Detail > Iterate > Image Ad Generation flow.
   Built on tokens.css + atria.css. Only add things here that atria.css does not have. Values taken from the Figma
   screens in ../reference/ (Figma) or the 2025-10 walkthrough frames (video). Nothing here is new design. */

/* ---------- Overlay + modal placement ---------- */
.page-mask { position: absolute; inset: 0; background: var(--color-neutral-bg-mask); z-index: 50; }
.modal-wrap { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; }
.modal.sm-w { width: 440px; }            /* "Link your brand" */
.modal.xl-w { width: 800px; padding: 0; max-height: calc(100vh - 48px); display: flex; flex-direction: column; } /* "Ad context" */
.modal .close { color: var(--text-3); cursor: pointer; }
.modal .modal-title { font-size: 20px; line-height: 28px; font-weight: 600; }
.modal .modal-header.big { margin-bottom: 12px; }
.modal-section { display: grid; grid-template-columns: 96px 1fr; gap: 0 0; padding: 16px 24px; }
.modal-section + .modal-section { border-top: 1px solid var(--border-2); }
.modal-section > .lbl { font-weight: 600; padding-top: 2px; }
.modal-body-scroll { overflow: auto; flex: 1; padding: 0; }
.modal-foot { display: flex; align-items: center; gap: 12px; padding: 16px 24px 16px; border-top: 0; }
.modal-foot .grow { flex: 1; }
.req::before { content: "*"; color: var(--color-error-base); margin-right: 4px; }
.field-label { margin-bottom: 8px; }
.input-group { display: flex; gap: 8px; }
.input-group .input.with-prefix { flex: 1; display: flex; align-items: center; gap: 8px; padding: 0 11px; }
.input-group .input.with-prefix .pre { font-size: 12px; white-space: nowrap; }
.input-group .input.with-prefix input { border: 0; outline: 0; flex: 1; min-width: 0; font: inherit; color: var(--text); background: none; }
.help { font-size: 12px; line-height: 20px; color: var(--text-3); margin: 6px 0 8px; }
.help .link { text-decoration: underline; }
.hint { color: var(--text-4); }
.thumbs { display: flex; gap: 8px; }
.thumb-box { width: 72px; height: 72px; border: 1px solid var(--border); border-radius: 6px; background: #fff; padding: 2px; display: grid; place-items: center; overflow: hidden; }
.thumb-box img { max-width: 100%; max-height: 100%; border-radius: 4px; display: block; }
.thumb-box.add { color: var(--text-3); border-style: solid; flex-direction: column; font-size: 12px; }
.swatches { display: flex; gap: 8px; align-items: center; }
.swatch { width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 6px; padding: 3px; background: #fff; }
.swatch > i { display: block; width: 100%; height: 100%; border-radius: 3px; }
.swatch.add { display: grid; place-items: center; color: var(--text); }
.select-menu-anchor { position: relative; }
.select-menu-anchor .select-menu { position: absolute; top: 36px; left: 0; right: 0; z-index: 5; }
.field-note { color: var(--text-2); }

/* ---------- Toast ---------- */
.toast-stack { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.toast { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; background: #fff; border-radius: 8px; box-shadow: var(--shadow-box-shadow-secondary); }
.toast .ok { width: 14px; height: 14px; border-radius: 50%; background: var(--color-success-base); color: #fff; display: grid; place-items: center; }
.toast .ok .ic { width: 9px; height: 9px; }

/* ---------- Generation progress panel (orange) ---------- */
.gen-banner { border-radius: 8px; overflow: hidden; margin: 0 0 8px; background: linear-gradient(180deg, #FFEBDB 0%, #FFF7F0 100%); }
.gen-banner .eta { display: flex; align-items: center; justify-content: center; gap: 6px; height: 32px; font-size: 12px; line-height: 20px; color: var(--text-2); border-bottom: 1px solid rgba(246,108,48,.12); }
.gen-banner .eta .ic { color: var(--primary); width: 14px; height: 14px; }
.gen-banner .eta b { color: var(--primary); font-weight: 400; }
.gen-banner .body { display: grid; grid-template-columns: 236px 1fr; gap: 24px; padding: 16px 24px 20px; align-items: start; }
.steps { display: flex; flex-direction: column; gap: 10px; }
.steps .step { display: flex; align-items: center; gap: 8px; color: var(--text); }
.steps .step .dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(0,0,0,.25); margin: 0 3px; flex: none; }
.steps .step.active .dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(246,108,48,.2); }
.steps .step.done .ic { color: var(--primary); width: 14px; height: 14px; margin: 0 1px; }
.steps .step.todo { color: var(--text-2); }
.gen-now .t { font-size: 12px; line-height: 20px; font-weight: 600; margin-bottom: 6px; }
.gen-now .snippet { font-size: 12px; line-height: 20px; color: var(--text-2); border-top: 1px solid var(--primary); padding-top: 4px; }
.skel { background: linear-gradient(90deg, rgba(246,108,48,.10), rgba(246,108,48,.22), rgba(246,108,48,.10)); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; border-radius: 4px; height: 12px; }
.skel.grey { background: linear-gradient(90deg, rgba(0,0,0,.03), rgba(0,0,0,.07), rgba(0,0,0,.03)); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Recommendation table with the extra "Iterate ads" column */
.rec-table.wide td, .rec-table.wide th { height: auto; padding: 16px 8px; vertical-align: middle; }
.rec-table.wide th { padding: 0 8px; height: 48px; }
.rec-table.wide td:first-child { width: 180px; font-weight: 600; }
.rec-table.wide td:nth-child(2) { width: 150px; }
.rec-table.wide td.ex { width: 380px; }
.rec-table.wide td.it { width: 230px; }
.rec-table ol { margin: 0; padding-left: 18px; } .rec-table em { color: var(--text-3); }
.it-cells { display: flex; gap: 8px; }
.it-cell { width: 100px; height: 100px; border-radius: 4px; overflow: hidden; position: relative; }
.it-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.it-cell .more { position: absolute; inset: 0; background: rgba(0,0,0,.45); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 16px; }

/* ---------- Full-page image-ad screens (no app rail) ---------- */
.ia-bar { height: 48px; display: flex; align-items: center; gap: 6px; padding: 0 24px; background: #fff; font-size: 14px; border-bottom: 1px solid var(--border-2); }
.ia-bar .crumb { color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
.ia-bar .cur { color: var(--text); }
.ia-bar .ic { color: var(--text-3); }
.ia { display: grid; grid-template-columns: 320px 1fr; min-height: calc(100vh - 48px); background: var(--bg-layout); }
.ia-left { background: transparent; padding: 24px 20px; display: flex; flex-direction: column; gap: 12px; }
.ia-left h4 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
.ia-left .orig { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 8px; display: block; }
.ia-left .when { text-align: center; color: var(--text-3); font-size: 12px; line-height: 20px; display: flex; gap: 6px; justify-content: center; align-items: center; }
.fold { border-radius: 8px; padding: 12px 16px; font-size: 12px; line-height: 20px; color: var(--text-2); }
.fold .hd { display: flex; justify-content: space-between; align-items: center; font-size: 14px; line-height: 22px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.fold.perf { background: var(--color-palette-gold-1); }
.fold.pers { background: var(--color-palette-green-1); }
.fold .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ia-main { padding: 24px 24px 48px 40px; min-width: 0; }
.ia-sec { margin-bottom: 32px; }
.ia-sec + .ia-sec { border-top: 1px solid var(--border-2); padding-top: 32px; }
.ia-sec .head { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; align-items: start; margin-bottom: 12px; }
.ia-sec h2 { margin: 0 0 8px; font-size: 24px; line-height: 32px; font-weight: 600; grid-column: 1; }
.ia-sec .why { grid-column: 1; font-size: 16px; line-height: 24px; position: relative; padding-left: 12px; margin: 0; }
.ia-sec .why::before { content: ""; position: absolute; left: 0; top: 4px; width: 4px; height: 16px; border-radius: 2px; background: var(--primary); }
.ia-sec .why b { font-weight: 600; }
.ia-sec .head .btn { grid-column: 2; grid-row: 1; margin-top: 8px; }
.cards4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.concept { background: #fff; border-radius: 8px; overflow: hidden; cursor: pointer; }
.concept .img { aspect-ratio: 2/3; background: #E6E6E6; display: block; width: 100%; object-fit: cover; }
.concept .tx { padding: 16px 16px 16px; }
.concept .tx .t { font-size: 16px; line-height: 24px; font-weight: 600; margin-bottom: 6px; }
.concept .tx .d { font-size: 12px; line-height: 20px; color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; height: 40px; }
.concept .tx .tags { display: flex; gap: 6px; margin-top: 12px; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px; background: var(--color-neutral-fill-tertiary); font-size: 12px; white-space: nowrap; }
.pill.more { background: var(--color-neutral-fill-quaternary); color: var(--text-3); padding: 0 8px; }
.gen-card { border-radius: 8px; aspect-ratio: 2/3; background: #E6E6E6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-3); font-size: 12px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(0,0,0,.15); border-top-color: rgba(0,0,0,.45); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Single generated image view ---------- */
.iad { display: grid; grid-template-columns: 280px 1fr 340px; height: calc(100vh - 48px); background: #fff; }
.iad-list { overflow: auto; padding: 20px 16px; border-right: 1px solid var(--border-2); }
.iad-list h4 { margin: 0 0 12px; font-size: 16px; line-height: 24px; font-weight: 600; }
.iad-list .grp { margin-bottom: 28px; }
.iad-list .g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.iad-list .g2 img, .iad-list .g2 .gen-card { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px; display: block; border: 2px solid transparent; }
.iad-list .g2 img.sel { border-color: var(--primary); }
.iad-stage { display: flex; flex-direction: column; align-items: center; padding: 16px 24px 0; overflow: hidden; background: #fff; }
.iad-tools { display: flex; gap: 20px; height: 32px; align-items: center; color: var(--text); margin-bottom: 16px; }
.iad-tools .ic { width: 16px; height: 16px; cursor: pointer; color: rgba(0,0,0,.75); }
.iad-tools .sep { width: 1px; height: 14px; background: var(--border); }
.iad-stage img.big { height: calc(100% - 48px); aspect-ratio: 2/3; object-fit: cover; display: block; }
.iad-panel { border-left: 1px solid var(--border-2); display: flex; flex-direction: column; min-height: 0; }
.iad-panel .ptabs { display: flex; align-items: center; gap: 8px; padding: 12px 12px 0 12px; }
.iad-panel .ptabs .segmented { flex: 1; }
.iad-panel .ptabs .segmented .item { flex: 1; }
.iad-panel .pbody { padding: 16px 16px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.iad-panel .pbody .lbl { font-size: 14px; line-height: 22px; margin-bottom: 6px; }
.iad-panel .pbody .sub { font-size: 12px; line-height: 20px; color: var(--text-3); margin: 6px 0 4px; }
.iad-panel .tagrow { display: flex; flex-wrap: wrap; gap: 6px; }
.iad-panel .tagrow .pill { background: var(--color-neutral-fill-tertiary); height: 24px; font-size: 12px; }
.iad-panel .pfoot { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border-2); }
.iad-panel .pfoot .grow { flex: 1; min-width: 0; padding: 0 8px; gap: 6px; overflow: hidden; }
.iad-panel .pfoot .select { flex: none; width: 64px !important; }
.ia-left .chip { white-space: nowrap; font-size: 12px; }
.iad-panel textarea.input { width: 100%; display: block; }
.thumb-sm { width: 52px; height: 65px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; background: #fff; padding: 2px; }
.thumb-sm img { width: 100%; height: 100%; object-fit: cover; border-radius: 2px; display: block; }
.is-hidden { display: none !important; }
