/* =====================================================================
   AI Workshop - layout on top of the studio's colours and controls
   (../studio/studio.css). Create on the left, preview in the middle,
   library on the right.
   ===================================================================== */
.gx { display: grid; height: 100dvh;
  grid-template-columns: 340px minmax(0, 1fr) 300px;
  grid-template-rows: 50px minmax(0, 1fr);
  grid-template-areas: "top top top" "create stage lib"; }
.gx .topbar { grid-area: top; }
.gx-create { grid-area: create; }
.gx-stage { grid-area: stage; }
.gx-library { grid-area: lib; }

.gx-title { display: flex; align-items: center; gap: 7px; font: 600 17px var(--font-cond); letter-spacing: .01em; }
.gx-title .ic { width: 18px; height: 18px; color: var(--press); }
.beta { font: 600 10px var(--font-cond); text-transform: uppercase; letter-spacing: .08em; padding: 2px 6px; border-radius: 99px;
  background: var(--press-soft); color: var(--press); }
.gx .top-right { margin-left: auto; }
.gx .mode-link.back { margin-left: 4px; border-radius: 8px; color: var(--sage); text-decoration: none; padding: 0 10px; }
.gx .mode-link.back span { display: inline; }

/* side panels */
.gx-create, .gx-library { min-height: 0; overflow-y: auto; margin: 0 6px 8px; padding: 10px 12px; border-radius: var(--radius-panel);
  background: var(--grove-1); scrollbar-width: thin; }
.gx-create { margin-right: 4px; display: flex; flex-direction: column; }
.gx-library { margin-left: 4px; }
.gx-head h2 { font: 600 18px/1.1 var(--font-cond); margin: 0 0 2px; }
.gx-head p { margin: 0 0 8px; font-size: 12px; color: var(--moss); }
.gx-block { padding: 8px 0; border-top: 1px solid var(--line); }
.gx-block h3, .opts summary h3 { margin: 0 0 6px; font: 600 12px var(--font-cond); letter-spacing: .06em; text-transform: uppercase; color: var(--sage); }
.row.wrap { flex-wrap: wrap; }
.row.gap { gap: 6px; }
.row.between { justify-content: space-between; }

/* task tabs */
.task-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 8px; }
.task-tabs button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 6px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--grove-2); color: var(--sage); font-size: 11px; font-weight: 600; line-height: 1.1; text-align: center; }
.task-tabs .ic { width: 22px; height: 22px; }
.task-tabs button:hover { color: var(--leaf); }
.task-tabs button[aria-selected="true"] { border-color: var(--press); background: var(--press-soft); color: var(--leaf); }

/* providers */
.prov-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.prov { display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; padding: 6px 8px; border-radius: 9px; border: 1px solid var(--line);
  background: transparent; color: var(--leaf); text-align: left; }
.prov:hover { background: var(--grove-2); }
.prov.on { border-color: var(--pimento); background: var(--pimento-soft); }
.prov:disabled { opacity: .45; }
.prov-name { font-weight: 600; font-size: 13px; }
.prov small { grid-column: 1 / -1; color: var(--moss); font-size: 11px; line-height: 1.3; }
.pill { align-self: center; font: 600 10.5px var(--font-cond); padding: 1px 7px; border-radius: 99px; background: var(--grove-3); color: var(--sage); }
.pill-ready, .pill-free { background: rgba(92, 160, 90, .2); color: #8fd18a; }
.pill-key, .pill-base { background: var(--press-soft); color: var(--press); }
:root[data-theme="light"] .pill-ready, :root[data-theme="light"] .pill-free { color: #2f7a2c; }

/* drop zones */
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 120px;
  padding: 10px; border-radius: 12px; border: 1.5px dashed var(--line-strong); background: var(--grove-0); color: var(--sage);
  text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over, .drop:focus-visible { border-color: var(--press); background: var(--grove-2); outline: none; }
.drop .ic.big { width: 30px; height: 30px; color: var(--moss); }
.drop b { font-size: 12.5px; color: var(--leaf); font-weight: 600; }
.drop small { font-size: 11px; color: var(--moss); }
.drop.has { cursor: default; min-height: 0; padding: 6px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; width: 100%; }
.thumbs figure { position: relative; margin: 0; aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  background: repeating-conic-gradient(var(--grove-2) 0 25%, var(--grove-1) 0 50%) 0 0 / 14px 14px; }
.thumbs img, .view img, .drop.mini img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumbs .add { aspect-ratio: 1; border-radius: 8px; border: 1.5px dashed var(--line-strong); background: transparent; color: var(--sage); }
.drop .x { position: absolute; top: 3px; right: 3px; background: rgba(18,21,16,.75); color: #fff; }
.views { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.drop.view { min-height: 0; aspect-ratio: 1; padding: 0; overflow: hidden;
  background: repeating-conic-gradient(var(--grove-2) 0 25%, var(--grove-0) 0 50%) 0 0 / 14px 14px; }
.drop.view > span { position: absolute; left: 6px; bottom: 5px; font: 600 11px var(--font-cond); padding: 1px 6px; border-radius: 99px;
  background: rgba(18,21,16,.7); color: #fff; }
.drop.view .ic { width: 20px; height: 20px; }
.drop.mini { min-height: 64px; width: 96px; aspect-ratio: 1; padding: 0; overflow: hidden; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: -2px 0 8px; font-size: 11.5px; color: var(--moss); }
.chips > span { width: 100%; }
.chip { height: 22px; padding: 0 8px; border-radius: 99px; border: 1px solid var(--line-strong); background: transparent; color: var(--sage); font-size: 11.5px; }
.chip:hover { color: var(--leaf); border-color: var(--press); }
textarea.input { height: auto; padding: 6px 8px; resize: vertical; line-height: 1.35; font: inherit; }
.source { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px; padding: 4px; margin-bottom: 6px;
  border-radius: 9px; background: var(--grove-2); }
.source img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--grove-0); }

/* settings */
.opts summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.opts summary::-webkit-details-marker { display: none; }
.opts summary::after { content: "▾"; color: var(--moss); font-size: 12px; transition: transform .15s; }
.opts:not([open]) summary::after { transform: rotate(-90deg); }
.opts:not([open]) summary h3 { margin: 0; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; font-size: 12.5px; color: var(--sage); }
.demo-note { font-size: 11.5px; margin: 4px 0; }

/* generate */
.gx-go { position: sticky; bottom: -10px; margin: auto -12px -10px; padding: 10px 12px 12px; border-top: 1px solid var(--line);
  background: linear-gradient(to bottom, color-mix(in oklab, var(--grove-1) 85%, transparent), var(--grove-1) 30%); }
.estimate { margin: 0 0 4px; font: 500 12px var(--font-cond); color: var(--sage); }
.why { margin: 0 0 6px; font-size: 11.5px; color: var(--press); }
.go { height: 40px; font-size: 14px; }
.go .ic { width: 18px; height: 18px; }

/* stage */
.gx-stage { margin: 0 2px 8px; }
.gx-view { position: absolute; inset: 0; }
.gx-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 24px; text-align: center;
  color: #4b5444; pointer-events: none; }
.gx-empty .ic { width: 44px; height: 44px; color: #8b7a3a; opacity: .8; }
.gx-empty h2 { margin: 0; font: 600 22px var(--font-cond); color: #2c3328; }
.gx-empty p { margin: 0; max-width: 380px; font-size: 13px; }
.gx-warn { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6; max-width: calc(100% - 24px); padding: 8px 14px;
  border-radius: 10px; background: #3a2d10; color: #f0d27a; font-size: 12.5px; box-shadow: var(--shadow-float); }
.gx-loader { position: absolute; left: 0; right: 0; top: 0; height: 3px; overflow: hidden; z-index: 5; }
.gx-loader i { position: absolute; inset: 0 70% 0 0; background: var(--press); animation: gx-slide 1.1s ease-in-out infinite; }
@keyframes gx-slide { from { transform: translateX(-100%); } to { transform: translateX(400%); } }
.gx-jobs { position: absolute; left: 12px; top: 12px; z-index: 5; display: flex; flex-direction: column; gap: 6px; width: min(330px, calc(100% - 24px)); }
.job { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 9px; padding: 7px 7px 7px 7px; border-radius: 11px;
  background: rgba(18, 21, 16, .86); color: #e6e9df; backdrop-filter: blur(8px); box-shadow: var(--shadow-float); }
.job img, .job-ic { width: 40px; height: 40px; border-radius: 7px; object-fit: contain; background: rgba(255,255,255,.08); display: grid; place-items: center; }
.job-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.job-main b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-main span { font: 500 11.5px var(--font-cond); color: #a3ab98; }
.job .err { color: #ff9a8a; white-space: normal; }
.job .icon-btn { color: #a3ab98; }
.bar { position: relative; display: block; height: 4px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--press); transition: width .6s; }
.bar.busy > i { animation: gx-slide 1.3s ease-in-out infinite; }
.job.saving .bar > i { background: #8fd18a; }
#pdock .txt { font-size: 12px; font-weight: 600; padding: 0 9px; }

/* library */
.sel { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.sel .field { margin: 0; }
.meta { margin: 0; font-size: 11.5px; color: var(--moss); line-height: 1.4; }
.meta i { color: var(--sage); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.stats span { display: flex; flex-direction: column; padding: 5px 7px; border-radius: 8px; background: var(--grove-2); font-size: 10.5px; color: var(--moss); }
.stats b { font: 600 13px var(--font-cond); color: var(--leaf); font-variant-numeric: tabular-nums; }
.btn.danger:hover { color: #ff8a7a; border-color: #ff8a7a; }
.gx-library .search { margin: 4px 0 8px; }
.lib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card { display: flex; flex-direction: column; gap: 2px; padding: 4px 4px 6px; border-radius: 11px; border: 1px solid var(--line);
  background: transparent; color: var(--leaf); text-align: left; min-width: 0; }
.card:hover { background: var(--grove-2); }
.card.on { border-color: var(--pimento); background: var(--pimento-soft); }
.card .thumb { position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  background: radial-gradient(120% 95% at 50% 32%, #f2f3ee, #c4c9bb); color: #8b937f; }
.card .thumb img { width: 100%; height: 100%; object-fit: contain; }
.card .thumb .ic { width: 26px; height: 26px; }
.card .thumb .badge { position: absolute; right: 4px; bottom: 4px; width: 18px; height: 18px; padding: 2px; border-radius: 5px;
  background: rgba(18,21,16,.7); color: #f0cf62; }
.card .nm { font-size: 12px; font-weight: 600; padding: 2px 3px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card small { font-size: 10.5px; color: var(--moss); padding: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* settings dialog */
.key-row { padding: 10px 0; border-top: 1px solid var(--line); }
.key-row a { font-size: 12px; color: var(--press); }
.key-row em { font-style: normal; color: var(--moss); }
.key-row em.ok { color: #8fd18a; }
.key-row .field { margin: 6px 0; }
#dialog { width: min(520px, calc(100vw - 32px)); }

/* narrower screens */
@media (max-width: 1280px) { .gx { grid-template-columns: 310px minmax(0, 1fr) 260px; } }
@media (max-width: 1000px) {
  .gx { grid-template-columns: 1fr; grid-template-rows: 50px 52vh auto auto; grid-template-areas: "top" "stage" "create" "lib"; height: auto; min-height: 100dvh; }
  body { overflow: auto; }
  .gx-create, .gx-library { margin: 0 6px 8px; overflow: visible; }
  .gx-go { position: static; margin: 8px -12px -10px; }
  .gx .topbar .tool-text, .mode-link.back span, #settings-btn span { display: none; }
}
.gx-licence { margin: 6px 0 0; font-size: 11.5px; line-height: 1.4; }
