/* ============================================================
   HNK Photoshop Ai Panel (Students) V5 — styles.css
   UXP-SAFE: flexbox only (no grid/fr), no pointer-events,
   no object-fit (thumbs = background-size), no sticky.
   Shell: .app absolute flex-column → header / .pages(scroll) / .botbar(tabs).

   THEME: all colours resolve to CSS custom properties. Dark is the default
   palette on :root; [data-theme="light"] re-maps the same tokens for a light,
   Adobe-Creative-Cloud-style skin. main.js sets data-theme on <html> and #app.
   ============================================================ */

:root {
  /* v6.18 — recoloured to sit exactly on the web app's palette (docs/app's
     --ink/--panel/--panel-2/--gold/--gold-hi/--cream tokens): --bg now
     matches --ink byte-for-byte, and every other surface token here carries
     the identical (-9,-7,-5) RGB shift so the whole family moves toward the
     web app's cooler blue-black undertone together — no token's contrast
     relationship to its neighbours changes, only the hue family does. */
  --bg: #0b0d14;
  --botbar: #0e1018;
  --panel: #141620;
  --panel-2: #1a1c2b;
  --sunk: #070912;
  --field: #1d1f2a;
  --field-2: #0e1019;
  --line: #222431;
  --line-2: #313341;
  --line-3: #343645;
  --btn: #222431;
  --btn-h: #2b2d3a;
  --text: #f3efe6;
  --text-2: #cfccd6;
  --muted: #a8a394;
  --muted-2: #8a8794;
  --faint: #5b5866;
  --accent: #d9a441;
  --accent-h: #f4d488;
  --accent-soft: #e9c46a;
  --accent-ink: #1a1408;
  --on-title: #e9c46a;
  --stage: #070912;
  --arm-y: #f2d38b;
  --arm-b: #5b8bf0;
  --arm-b-brd: #3f6fd6;
  --arm-b-ink: #0b1430;
  --go: #59c46a;
  --go-brd: #3e9c4e;
  --go-ink: #0e2a13;
  --ok: #7ec97e;
  --err: #ef8080;
  --warn: #e5a34a;
  --chip-bg: #2a2440;
  --chip-tx: #d8cff0;
  --chip-brd: #443b66;
  --chip-bg-h: #37305a;
  --shadow: rgba(0, 0, 0, 0.35);
}

[data-theme="light"] {
  --bg: #eef0f4;
  --botbar: #e5e7ed;
  --panel: #ffffff;
  --panel-2: #f5f6fa;
  --sunk: #e8eaf0;
  --field: #ffffff;
  --field-2: #f4f5f9;
  --line: #dcdde6;
  --line-2: #cdd0da;
  --line-3: #c6c9d4;
  --btn: #f1f2f6;
  --btn-h: #e6e7ee;
  --text: #23232b;
  --text-2: #3a3a44;
  --muted: #63636f;
  --muted-2: #7c7c88;
  --faint: #9a9aa6;
  --accent: #c68a26;
  --accent-h: #b57e1f;
  --accent-soft: #a9761d;
  --accent-ink: #fff8ec;
  --on-title: #a9761d;
  --stage: #e4e6ee;
  --arm-y: #f0cf82;
  --arm-b: #4f7fe6;
  --arm-b-brd: #3f6fd6;
  --arm-b-ink: #ffffff;
  --go: #46b25a;
  --go-brd: #3e9c4e;
  --go-ink: #ffffff;
  --ok: #2f9d4e;
  --err: #d24d4d;
  --warn: #c07d24;
  --chip-bg: #ece7fb;
  --chip-tx: #4a3f70;
  --chip-brd: #d4c9f0;
  --chip-bg-h: #e0d8f6;
  --shadow: rgba(60, 60, 90, 0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { width: 100%; height: 100%; }
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Noto Sans Myanmar", "Myanmar Text", "Noto Sans Thai", "Noto Sans SC", sans-serif;
  font-size: 12px;
  overflow: hidden;
  transition: background-color 0.18s ease, color 0.18s ease;
}

/* ---------- App shell ---------- */
.app {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg);
  transition: background-color 0.18s ease;
}
.hdr {
  flex: none;
  display: flex; flex-direction: row; align-items: center;
  padding: 9px 10px 6px 10px;
}
.pages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 10px 10px 10px;
}
.page { display: none; }
.page.on { display: block; }
.botbar {
  flex: none;
  background-color: var(--botbar);
  border-top: 1px solid var(--line);
  padding: 5px 5px 8px 5px;
}
.botbar .status { margin: 0 0 6px 0; min-height: 14px; }
.tabbar { display: flex; flex-direction: row; }
.tabb {
  font-size: 9px; font-weight: 700;
  flex: 1; min-width: 0;
  background-color: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--muted);
  letter-spacing: -0.2px;
  padding: 8px 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tabb + .tabb { margin-left: 3px; }
.tabb.on { background-color: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Header bits ---------- */
.logo { width: 32px; height: 32px; border-radius: 8px; margin-right: 8px; }

/* ---------- Hero banner (v6.0) ----------
   UXP-SAFE: flexbox, background-size (the repo's sanctioned image-fit) and
   linear-gradient only. The banner background is the studio's signature
   artwork; a cinematic dark shade keeps the branding readable, so the hero
   stays identical (and premium) in both themes — its colours are fixed, not
   theme tokens. */
.hero {
  display: block;
  padding: 0;
  background-color: #0b0d14;
  background-image: url("icons/hero-banner.jpg");
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--accent);
}
.hero-shade {
  padding: 12px 10px 9px 10px;
  background: linear-gradient(100deg, rgba(8, 9, 15, 0.94) 0%, rgba(10, 12, 20, 0.86) 42%, rgba(8, 9, 15, 0.38) 78%, rgba(8, 9, 15, 0.55) 100%);
}
.hero-row { display: flex; flex-direction: row; align-items: center; }
.hero-badge {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin-right: 9px;
  border: 1px solid #d9a441;
  border-radius: 11px;
  background: linear-gradient(160deg, rgba(26, 29, 41, 0.9), rgba(12, 13, 20, 0.9));
}
.hero-logo { width: 36px; height: 36px; border-radius: 8px; margin-right: 0; }
.hero-t { flex: 1; min-width: 0; }
.hero-brand {
  font-size: 12px; font-weight: 800; letter-spacing: 0.8px;
  color: #f3efe6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hero-brand-gold { color: #e9c46a; }
.hero-app { font-size: 9px; font-weight: 600; color: #c9c4b8; margin-top: 1px; }
.hero-sub { font-size: 9px; color: #a8a394; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-sub #brandProv { color: #e9c46a; font-weight: 700; }
.hero-chips { display: flex; flex-direction: row; flex-wrap: wrap; margin-top: 10px; }
.hero-chip {
  flex: 0 1 auto; text-align: center;
  margin-right: 4px; margin-bottom: 2px; padding: 3px 7px;
  border: 1px solid rgba(233, 196, 106, 0.45); border-radius: 999px;
  background-color: rgba(10, 12, 19, 0.72); color: #efe7d2;
  font-size: 8.5px; font-weight: 700; white-space: nowrap;
}
.hero-chip:last-child { margin-right: 0; }
/* header controls sit on the photo — keep them legible in both themes */
.hero .lang-sel, .hero .btn-icon {
  background-color: rgba(16, 18, 27, 0.82); color: #efe7d2;
  border-color: rgba(233, 196, 106, 0.5);
}

/* ---------- Per-page hero banners (v6.0) ----------
   Each tab opens on its own signature visual from the studio's 355-asset
   library with a meaning line. UXP-SAFE: background-size cover + gradient
   shade; fixed premium colours so banners read identically in both themes. */
.pgbanner {
  margin: 2px 0 10px 0;
  border: 1px solid rgba(217, 164, 65, 0.55);
  border-radius: 12px;
  overflow: hidden;
  background-color: #0b0d14;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.pgb-setup   { background-image: url("icons/banners/setup.jpg"); background-position: center 30%; }
.pgb-studio  { background-image: url("icons/banners/studio.jpg"); background-position: center 12%; }
.pgb-create  { background-image: url("icons/banners/create.jpg"); background-position: center 18%; }
.pgb-aitools { background-image: url("icons/banners/aitools.jpg"); background-position: center 14%; }
.pgb-presets { background-image: url("icons/banners/presets.jpg"); background-position: center 18%; }
.pgb-retouch { background-image: url("icons/banners/retouch.jpg"); background-position: center 38%; }
.pgbanner-shade {
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 118px;
  padding: 12px 12px 9px 12px;
  background: linear-gradient(180deg, rgba(8, 9, 15, 0.02) 0%, rgba(8, 9, 15, 0.22) 55%, rgba(8, 9, 15, 0.85) 100%);
}
.pgbanner-kick {
  font-size: 7.5px; font-weight: 800; letter-spacing: 2px;
  color: #e9c46a; text-transform: uppercase;
}
.pgbanner-title {
  margin-top: 2px;
  font-size: 17px; font-weight: 800; letter-spacing: 1.2px;
  color: #f7f4ec;
}
.pgbanner-sub {
  margin-top: 2px;
  font-size: 9px; line-height: 1.45; color: #ddd6c6;
}
.hdr-t { flex: 1; min-width: 0; }
.title { font-size: 12px; font-weight: 700; color: var(--on-title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 9px; color: var(--muted-2); }
.hdr-ctl { display: flex; flex-direction: row; align-items: center; flex: none; }
.lang-sel {
  background-color: var(--field); border: 1px solid var(--line-2);
  border-radius: 7px; color: var(--text);
  font-size: 11px; height: 26px; padding: 0 6px; min-width: 62px;
}
.lang-sel:focus { border-color: var(--accent); }
.btn-icon {
  width: 30px; height: 26px; padding: 0; margin-left: 6px;
  font-size: 14px; line-height: 1;
  background-color: var(--btn); border: 1px solid var(--line-3);
  border-radius: 7px; color: var(--text);
}

/* ---------- Cards + collapsible heads ---------- */
.card {
  background-color: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  margin-bottom: 8px;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}
.chead { display: flex; flex-direction: row; align-items: center; }
.chead .car { color: var(--accent); margin-right: 7px; font-size: 10px; width: 10px; }
.chead-t {
  flex: 1; min-width: 0;
  font-size: 11px; font-weight: 700; color: var(--accent);
  letter-spacing: 0.6px; text-transform: uppercase;
}
.chead-r { font-size: 10px; color: var(--muted-2); margin-left: 8px; }
.cbody { margin-top: 9px; }

.row { display: flex; flex-direction: row; align-items: center; margin-bottom: 6px; }
.row.last { margin-bottom: 0; }
.row.tight { margin-bottom: 0; margin-top: 6px; }
.grow { flex: 1; min-width: 0; }
.lbl { width: 42px; color: var(--muted); font-size: 11px; }
.mut { font-size: 10px; color: var(--muted-2); margin-bottom: 7px; line-height: 1.45; }

/* ---------- Inputs ---------- */
.inp {
  height: 26px;
  background-color: var(--field-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  padding: 0 8px;
  font-size: 11px;
  min-width: 0;
}
.inp:focus { border-color: var(--accent); }
select.inp { padding: 5px 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-color: var(--btn);
  border: 1px solid var(--line-3);
  border-radius: 7px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 12px;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn + .btn { margin-left: 6px; }
.btn-sm { padding: 5px 8px; font-size: 11px; }
.btn-xs { padding: 4px 5px; font-size: 10px; border-radius: 6px; }
.btn-gold { background-color: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn:disabled { opacity: 0.45; }

/* ---------- Prompt (native textarea — UXP typeable) ----------
   NOTE: class-only selector — UXP's CSS engine skips tag.class compounds. */
.pwrap { margin-bottom: 8px; }
.pbox {
  width: 100%;
  min-height: 130px;
  max-height: 260px;
  background-color: var(--field);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 9px;
  font-size: 12px;
  line-height: 1.55;
  font-family: "Segoe UI", "Noto Sans Myanmar", "Myanmar Text", "Noto Sans Thai", "Noto Sans SC", sans-serif;
  overflow-y: auto;
  height: 140px;
  resize: none;
}
.pbox:focus { border-color: var(--accent); outline: none; }
.cnt { font-size: 10px; color: var(--muted-2); }
.cnt.warn { color: var(--warn); }
.cnt.max { color: var(--err); font-weight: 700; }

/* ---------- Reference slots (background-div thumbs) ---------- */
.refrow { display: flex; flex-direction: row; }
.refslot { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.refslot + .refslot { margin-left: 8px; }
.refthumb {
  position: relative;
  width: 100%; height: 92px;
  background-color: var(--field);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.refbg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  display: none;
}
.refph { color: var(--faint); font-size: 22px; font-weight: 700; }
.xbtn {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px; border-radius: 9px;
  background-color: #000000; opacity: 0.75;
  color: #ffffff; border: 0; font-size: 11px;
  display: none; align-items: center; justify-content: center;
}
.reflb {
  font-size: 9px; color: var(--muted-2); margin-top: 3px; height: 12px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

/* ---------- URL bar ---------- */
.urlbar { display: none; margin-top: 8px; background-color: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px; }
.urlhead { display: flex; flex-direction: row; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.urlttl { font-size: 10px; color: var(--text-2); font-weight: 600; }
.urltag { font-size: 10px; color: var(--accent); font-weight: 700; }
.urlbar .inp { width: 100%; margin-bottom: 2px; }

/* ---------- Segmented (1K/2K/4K) ---------- */
.seg { display: flex; flex-direction: row; background-color: var(--field); border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; }
/* Standalone segmented options each read as a real button (not bare text), so the
   whole control looks like one unit whether or not an option is selected. */
.segb {
  flex: 1; min-width: 0;
  background-color: var(--field);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  color: var(--text-2);
  padding: 6px 4px;
  font-size: 11px;
  margin: 0 2px;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.segb.on { background-color: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
/* Inside a .seg pill the options stay flush (no gaps/individual borders). */
.seg > .segb { background-color: transparent; border: 0; border-radius: 0; margin: 0; }
.seg > .segb.on { background-color: var(--accent); }

/* ---------- Sub groups ---------- */
.grp { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.grp.last { margin-bottom: 0; }
.grp-h {
  display: flex; flex-direction: row; align-items: center;
  background-color: var(--panel-2); padding: 7px 9px;
  font-weight: 600; color: var(--text-2); font-size: 11px;
}
.grp-h .car { margin-right: 6px; color: var(--accent); font-size: 10px; }
.grp-b { padding: 8px 8px 4px 8px; display: none; }
.pbtns { display: flex; flex-direction: row; flex-wrap: wrap; }
.pbtn {
  background-color: var(--btn); border: 1px solid var(--line-3); border-radius: 7px;
  color: var(--text); padding: 6px 9px; font-size: 11px;
  margin: 0 6px 6px 0;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.pbtn.sel { background-color: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.pbtn.gold { border-color: var(--accent); color: var(--accent-soft); font-weight: 700; }

/* ---------- Cleanup checkboxes ---------- */
.ckrow { display: flex; flex-direction: row; align-items: center; margin-bottom: 7px; }
.ckrow.last { margin-bottom: 2px; }
.ckb {
  width: 19px; height: 19px; border-radius: 5px;
  border: 1px solid var(--line-3); background-color: var(--field);
  color: var(--accent-ink); font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin-right: 9px; padding: 0;
}
.ckb.on { background-color: var(--accent); border-color: var(--accent); }
.cklb { font-size: 11px; color: var(--text-2); line-height: 1.4; }

/* ---------- Retouch Pro sliders + swatches ---------- */
.srow { display: flex; flex-direction: row; align-items: center; margin-bottom: 7px; }
.srow.last { margin-bottom: 2px; }
.slbl { width: 98px; font-size: 10px; color: var(--text-2); line-height: 1.35; }
.sval { width: 34px; text-align: right; font-size: 10px; color: var(--accent); font-weight: 700; margin-left: 6px; }
.srow input { flex: 1; min-width: 0; }
.swrow { display: flex; flex-direction: row; align-items: flex-start; margin-bottom: 7px; }
.swrow.last { margin-bottom: 2px; }
.sws { display: flex; flex-direction: row; flex-wrap: wrap; flex: 1; min-width: 0; }
.sw {
  width: 20px; height: 20px; border-radius: 10px;
  border: 2px solid var(--line-2);
  margin: 0 5px 5px 0; padding: 0;
  background-color: transparent;
}
.sw.on { border-color: var(--accent); }
.sw.none { background-color: var(--field); color: var(--muted-2); font-size: 10px; display: flex; align-items: center; justify-content: center; }

/* ---------- Toggles ---------- */
.tglrow { display: flex; flex-direction: row; align-items: center; margin-bottom: 7px; }
.tgltxt { flex: 1; min-width: 0; margin-right: 8px; color: var(--text-2); font-size: 11px; line-height: 1.5; }
.tgl {
  min-width: 46px; padding: 4px 9px; border-radius: 20px;
  background-color: var(--line-2); color: var(--muted); border: 0;
  font-size: 10px; font-weight: 700;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.tgl.on { background-color: var(--accent); color: var(--accent-ink); }

/* ---------- Intensity (presets) ---------- */
.introw { display: flex; flex-direction: row; align-items: center; margin-bottom: 8px; }
.introw .lbl2 { color: var(--muted); margin-right: 8px; font-size: 11px; }
.intval { width: 38px; text-align: right; color: var(--accent); font-weight: 700; margin-left: 8px; font-size: 11px; }
input[type="range"] { min-width: 0; }
.introw input { flex: 1; }

/* ---------- Generate ---------- */
.gen {
  width: 100%;
  background-color: var(--accent);
  padding: 11px;
  font-size: 14px; font-weight: 800;
  border: 0; border-radius: 10px;
  color: var(--accent-ink); letter-spacing: 1px;
  margin-top: 2px;
  transition: background-color 0.15s ease;
}
.gen:disabled { opacity: 0.5; }
/* v5.4 Generate + Realistic Boost — a gold secondary action under GENERATE */
.status { min-height: 14px; font-size: 11px; color: var(--muted); text-align: center; line-height: 1.35; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

/* ---------- Before / After compare ---------- */
.cmp {
  position: relative; width: 100%; height: 200px;
  background-color: var(--sunk); border-radius: 8px; overflow: hidden;
}
.cmp-base { position: absolute; left: 0; top: 0; display: none; }
.cmp-top { position: absolute; left: 0; top: 0; height: 100%; overflow: hidden; width: 50%; }
.cmp-top img { position: absolute; left: 0; top: 0; display: none; }
.cmp-line { position: absolute; top: 0; bottom: 0; width: 2px; background-color: var(--accent); left: 50%; }
.cmp-tag {
  position: absolute; top: 6px; font-size: 9px; font-weight: 700;
  background-color: #000000; opacity: 0.7; color: #ffffff;
  padding: 2px 6px; border-radius: 4px;
}
.tag-b { left: 6px; }
.tag-a { right: 6px; }
.slider { margin-top: 6px; display: flex; }
.slider input { flex: 1; }

/* ---------- Footer ---------- */
.ftr { text-align: center; color: var(--faint); font-size: 9px; margin: 2px 0 4px 0; }

/* ---------- Studio Lighting (v2.2) ---------- */
.lstage {
  position: relative; width: 100%; height: 210px;
  background-color: var(--stage); border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 9px; overflow: hidden;
}
.lfloor {
  position: absolute; left: 12%; right: 12%; top: 14%; bottom: 14%;
  border: 1px dashed var(--line-2); border-radius: 50%;
}
.lsubj {
  position: absolute; left: 50%; top: 50%;
  width: 44px; height: 20px; margin-left: -22px; margin-top: -7px;
  background-color: var(--btn); border: 1px solid var(--line-3); border-radius: 10px;
  color: var(--text-2); font-size: 8px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.lcam {
  position: absolute; left: 50%; bottom: 4px;
  width: 40px; margin-left: -20px;
  background-color: var(--panel-2); border: 1px solid var(--line-2); border-radius: 6px;
  color: var(--muted-2); font-size: 8px; font-weight: 700; text-align: center; padding: 2px 0;
}
.ldot {
  position: absolute; display: none;
  background-color: var(--accent); border: 2px solid var(--arm-y); border-radius: 50%;
  color: var(--accent-ink); font-size: 9px; font-weight: 800;
  align-items: center; justify-content: center;
}
.ldot.sel { border-color: #ffffff; }
.lrow {
  display: flex; flex-direction: row; align-items: center;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 8px; margin-bottom: 6px; background-color: var(--panel-2);
}
.lrow.sel { border-color: var(--accent); }
.lrow .ckb { margin-right: 8px; }
.lname { flex: 1; min-width: 0; font-size: 11px; color: var(--text); }
.lsum { font-size: 9px; color: var(--muted-2); margin-left: 6px; white-space: nowrap; }
.lctl {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px; margin: 4px 0 8px 0; background-color: var(--field-2);
}
.lselname { font-size: 10px; font-weight: 700; color: var(--accent); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.ltchip {
  width: auto; height: auto; border-radius: 6px;
  padding: 3px 7px; font-size: 9px; color: var(--text-2);
  background-color: var(--field);
}
.ltchip.on { background-color: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }

/* ---------- v2.3: hover lift + press + chains ---------- */
.btn:hover, .pbtn:hover, .tabb:hover, .segb:hover, .ckb:hover, .tgl:hover, .sw:hover, .lrow:hover {
  border-color: var(--accent);
}
.btn:hover, .pbtn:hover { background-color: var(--btn-h); color: var(--accent-soft); }
.btn-gold:hover, .gen:hover { background-color: var(--accent-h); color: var(--accent-ink); }
.tabb:hover { color: var(--accent-soft); }
.grp-h:hover, .chead:hover .chead-t { color: var(--accent-soft); }
.btn:active, .pbtn:active, .gen:active, .tabb:active, .ckb:active, .sw:active { opacity: 0.65; }
.ltchip.chn { margin-bottom: 6px; }
.ltchip.chn.on { background-color: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.sws .cklb { font-size: 10px; }
.sws .ckb { margin-right: 5px; }

/* ---------- v2.4: history strip ---------- */
.histrow { display: flex; flex-direction: row; overflow-x: auto; overflow-y: hidden; margin-bottom: 6px; min-height: 60px; }
.histTh {
  width: 54px; height: 54px; flex: none;
  border: 2px solid var(--line-2); border-radius: 8px;
  margin-right: 6px;
  background-size: cover; background-position: center;
  background-color: var(--field);
}
.histTh.sel { border-color: var(--accent); }
.histTh:hover { border-color: var(--accent-soft); }

/* ---------- v2.5: Web AI browser ---------- */
.webv {
  width: 100%; height: 500px;
  border: 1px solid var(--line); border-radius: 10px;
  margin: 8px 0; background-color: var(--sunk);
}

/* ---------- v3.1: Learn Mode ---------- */
.pbtn.armed, .btn.armed, .gen.armed {
  background-color: var(--arm-y); border-color: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.pbtn.armp, .btn.armp, .gen.armp {
  background-color: var(--arm-b); border-color: var(--arm-b-brd); color: var(--arm-b-ink); font-weight: 700;
}
.pbtn.go, .btn.go, .gen.go {
  background-color: var(--go); border-color: var(--go-brd); color: var(--go-ink); font-weight: 700;
}
.gbox {
  position: fixed; left: 8px; right: 8px; bottom: 62px;
  display: none; z-index: 60;
  background-color: var(--field-2); border: 1px solid var(--accent); border-radius: 12px;
  padding: 10px 12px;
  max-height: 46%; overflow-y: auto;
  box-shadow: 0 6px 22px var(--shadow);
}
.gbox-h { display: flex; flex-direction: row; align-items: center; margin-bottom: 6px; }
.gbox-t { flex: 1; font-size: 11px; font-weight: 700; color: var(--arm-y); }
.gbox-b { font-size: 10px; color: var(--text); white-space: pre-line; line-height: 1.55; }
.gbox-f { margin-top: 8px; font-size: 9px; color: var(--accent); font-weight: 700; }

/* v4.3 locks consolidation */
.keepcols { display: flex; flex-wrap: wrap; }
.keepcols > .tglrow, .keepcols > .row, .keepcols > .mut { width: 100%; }
.keepcols > .ckrow { width: 50%; box-sizing: border-box; padding-right: 6px; }

/* v4.12 Create pro */
.chiprow { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { background: var(--chip-bg); color: var(--chip-tx); border: 1px solid var(--chip-brd); border-radius: 14px; padding: 5px 11px; font-size: 12px; cursor: pointer; }
.chip:hover { background: var(--chip-bg-h); }
.gallery { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.gthumb { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--chip-brd); cursor: pointer; }
.gthumb:hover { border-color: var(--accent-soft); }
.gthumb.sel { border-color: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft) inset; }
.cengine { margin-top: 6px; color: var(--accent); font-weight: 600; }

/* v5.1 Reference Library — 4-button ref rows wrap cleanly on narrow panels */
.refbtns { flex-wrap: wrap; }
.refbtns .btn { margin-bottom: 4px; }
.refbtns .btn + .btn { margin-left: 4px; }

/* v5.0 Diagnostics / installation checker */
.diag { display: flex; flex-direction: column; }
.diagrow {
  display: flex; flex-direction: row; align-items: center;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 9px; margin-bottom: 6px; background-color: var(--panel-2);
}
.diag-ic { width: 18px; font-size: 12px; text-align: center; margin-right: 8px; }
.diag-nm { flex: 1; min-width: 0; font-size: 11px; color: var(--text); }
.diag-st { font-size: 10px; color: var(--muted-2); margin-left: 8px; white-space: nowrap; }
.diag-ic.ok { color: var(--ok); }
.diag-ic.warn { color: var(--warn); }
.diag-ic.err { color: var(--err); }
.diag-ic.pend { color: var(--muted-2); }

/* ============================================================
   HNK AI Tools — Free Generate + Smart Workflow UI
   Uses the existing CSS-variable palette so it inherits both themes.
   Rendered into #hnkAiToolsRoot by src/ui/app-controller (later phase).
   ============================================================ */
#hnkAiToolsRoot { display:flex; flex-direction:column; gap:10px; padding:10px; color:var(--text); }
.hnk-nav { display:flex; gap:4px; flex-wrap:wrap; }
.hnk-nav-btn { flex:1 1 auto; padding:7px 8px; border:1px solid var(--line); background:var(--btn);
  color:var(--text); border-radius:8px; font-size:12px; cursor:pointer; }
.hnk-nav-btn:hover { background:var(--btn-h); }
.hnk-nav-btn.active { background:var(--accent); color:var(--accent-ink); border-color:var(--accent); font-weight:700; }
.hnk-screen { display:flex; flex-direction:column; gap:10px; }
.hnk-sec { font-size:11px; letter-spacing:.08em; color:var(--muted); margin-top:6px; text-transform:uppercase; }
.hnk-h-title { font-size:15px; font-weight:600; }
.hnk-h-actions, .hnk-wf-list { display:flex; flex-direction:column; gap:8px; }
.hnk-action { text-align:left; padding:11px 12px; border:1px solid var(--line); background:var(--panel);
  color:var(--text); border-radius:10px; cursor:pointer; }
.hnk-action:hover { border-color:var(--accent); }
.hnk-action-label { font-weight:600; font-size:13px; }
.hnk-action-sub { font-size:11px; color:var(--muted); margin-top:2px; }
.hnk-slots { display:flex; flex-wrap:wrap; gap:8px; }
.hnk-slot { display:flex; align-items:center; gap:8px; padding:8px; border:1px dashed var(--line-2);
  border-radius:8px; background:var(--field); font-size:11px; }
.hnk-slot-x { border:none; background:transparent; color:var(--err); cursor:pointer; font-size:14px; }
.hnk-slot-errors { display:flex; flex-direction:column; gap:4px; margin-top:4px; }
.hnk-slot-err { font-size:11px; color:var(--err, #d05b5b); line-height:1.4; }
.hnk-prompt { width:100%; min-height:96px; resize:vertical; padding:9px; border:1px solid var(--line);
  border-radius:8px; background:var(--field); color:var(--text); font-size:13px; box-sizing:border-box; }
.hnk-btn { padding:8px 11px; border:1px solid var(--line); background:var(--btn); color:var(--text);
  border-radius:8px; font-size:12px; cursor:pointer; }
.hnk-btn:hover { background:var(--btn-h); }
.hnk-btn.is-disabled, .hnk-btn:disabled { opacity:.45; cursor:not-allowed; }
.hnk-model, .hnk-sel { width:100%; padding:7px; border:1px solid var(--line); border-radius:8px;
  background:var(--field); color:var(--text); font-size:12px; }
.hnk-model-banner { font-size:11px; color:var(--accent); }
.hnk-hint { font-size:11px; color:var(--muted); line-height:1.4; margin-bottom:6px; }
.hnk-field { display:flex; flex-direction:column; gap:3px; }
.hnk-field-label { font-size:11px; color:var(--muted); }
.hnk-variants { display:flex; gap:6px; }
.hnk-variant { flex:1; }
.hnk-estimate, .hnk-status, .hnk-wf-route, .hnk-wf-desc { font-size:11px; color:var(--muted); }
.hnk-generate { background:var(--go); color:var(--go-ink); border-color:var(--go-brd); font-weight:700;
  padding:11px; font-size:13px; }
.hnk-req-row { display:flex; align-items:center; gap:8px; padding:6px 0; font-size:12px; }
.hnk-req-label { flex:1; }
.hnk-req-mark { font-size:11px; color:var(--muted); min-width:52px; }
.hnk-todo { font-size:12px; color:var(--muted); padding:16px 0; }

/* ---- HNK AI Tools: History screen (§22) ---- */
.hnk-hist-list { display:flex; flex-direction:column; gap:8px; }
.hnk-hist { display:flex; flex-direction:column; gap:4px; padding:10px; border:1px solid var(--line);
  border-radius:10px; background:var(--panel); }
.hnk-hist-badge { align-self:flex-start; font-size:10px; letter-spacing:.06em; padding:2px 7px;
  border-radius:99px; font-weight:700; }
.hnk-hist-badge.free { background:var(--accent-soft); color:var(--accent-ink); }
.hnk-hist-badge.wf { background:var(--chip-bg); color:var(--chip-tx); border:1px solid var(--chip-brd); }
.hnk-hist-meta { font-size:11px; color:var(--muted); }
.hnk-hist-prompt { font-size:12px; }
.hnk-hist-actions { display:flex; gap:6px; margin-top:4px; }

/* ============================================================
   HNK AI Tools — density options + staged workflow buttons
   ============================================================ */
/* Density scales spacing + font on the whole panel (spec: density options). */
.hnk-root { --hnk-gap: 10px; --hnk-pad: 11px; --hnk-fs: 13px; }
.hnk-density-compact     { --hnk-gap: 6px;  --hnk-pad: 7px;  --hnk-fs: 12px; }
.hnk-density-normal      { --hnk-gap: 10px; --hnk-pad: 11px; --hnk-fs: 13px; }
.hnk-density-comfortable { --hnk-gap: 15px; --hnk-pad: 15px; --hnk-fs: 14px; }
.hnk-root .hnk-screen  { gap: var(--hnk-gap); }
.hnk-root .hnk-action  { padding: var(--hnk-pad); font-size: var(--hnk-fs); }
.hnk-root .hnk-h-actions, .hnk-root .hnk-wf-list { gap: var(--hnk-gap); }

/* Ready / missing state markers + status colours (clear states, spec UX). */
.hnk-req-mark.ok   { color: var(--go, #2fae52); font-weight: 700; }
.hnk-req-mark.miss { color: var(--err, #d05b5b); }
.hnk-status.ok     { color: var(--go, #2fae52); font-weight: 600; }
.hnk-prepare       { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.hnk-direct        { align-self: flex-start; font-size: 11px; }
.hnk-req-add       { white-space: nowrap; }
/* Never clip buttons / overlap cards on narrow panels. */
.hnk-root .hnk-req-row { flex-wrap: wrap; }
.hnk-root button { max-width: 100%; }

/* AI Tools mount failure report (should never be seen — real errors surface
   here instead of an empty tab) */
.hnk-mount-err {
  margin: 8px 2px;
  padding: 10px 12px;
  border: 1px solid var(--err);
  border-radius: 9px;
  color: var(--err);
  font-size: 11px;
  line-height: 1.5;
}

/* ---------- AI Tools: workflow visuals (v6.0) ----------
   Signature-artwork thumbs on every workflow card + a wide hero and meaning
   chips on the selected workflow. UXP-SAFE: inline backgroundImage +
   background-size (the repo's proven pattern) — no object-fit. */
.hnk-action.has-thumb { display: flex; flex-direction: row; align-items: center; text-align: left; }
.hnk-thumb {
  flex: none; width: 48px; height: 48px; margin-right: 10px;
  border: 1px solid rgba(217, 164, 65, 0.6); border-radius: 10px;
  background-color: #0b0d14; background-size: cover; background-position: center; background-repeat: no-repeat;
}
.hnk-action-txt { flex: 1; min-width: 0; }
.hnk-action-meta { margin-top: 2px; font-size: 8.5px; font-weight: 700; color: var(--accent-soft); }
.hnk-wf-hero {
  height: 118px; margin: 6px 0 8px;
  border: 1px solid rgba(217, 164, 65, 0.6); border-radius: 11px;
  background-color: #0b0d14; background-size: cover; background-position: center 30%; background-repeat: no-repeat;
}
.hnk-wf-chips { display: flex; flex-direction: row; flex-wrap: wrap; margin-bottom: 6px; }
.hnk-wf-chip {
  margin: 0 4px 4px 0; padding: 2px 7px;
  border: 1px solid var(--chip-brd); border-radius: 999px;
  background-color: var(--chip-bg); color: var(--chip-tx);
  font-size: 8.5px; font-weight: 700; white-space: nowrap;
}
.hnk-wf-chip.protect { border-color: #2f6855; color: #7ec9a0; background-color: rgba(16, 38, 30, 0.55); }
[data-theme="light"] .hnk-wf-chip.protect { border-color: #8fcda3; color: #1f7a3d; background-color: rgba(47, 157, 78, 0.12); }

/* ============================================================
   v6.9.0 "Results are real" — staged progress strips
   Classic panel strip (#hnkStrip above the status bar) + the AI Tools
   sub-app strip (.hnk-progress). UXP-safe: flexbox only, no emoji.
   ============================================================ */
.hstrip { display: none; }
.hstrip.on {
  display: flex; flex-wrap: wrap; justify-content: center;
  margin: 0 0 4px 0; padding: 0 4px;
}
.hstep {
  font-size: 9px; line-height: 1.6; color: var(--faint);
  padding: 1px 6px; margin: 1px 2px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  white-space: nowrap;
}
.hstep.done { color: var(--muted); border-color: var(--line-2); }
.hstep.on {
  color: var(--accent-ink); background: var(--accent);
  border-color: var(--accent); font-weight: 600;
}

.hnk-progress { display: none; }
.hnk-progress.on, .hnk-progress.ok, .hnk-progress.err {
  display: block; margin: 8px 0 2px 0; padding: 6px 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}
.hnk-progress-row { display: flex; flex-wrap: wrap; }
.hnk-pstep {
  font-size: 9px; line-height: 1.7; color: var(--faint);
  padding: 1px 6px; margin: 1px 2px; border-radius: 999px;
  background: var(--field-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.hnk-pstep.done { color: var(--muted); border-color: var(--line-2); }
.hnk-pstep.on {
  color: var(--accent-ink); background: var(--accent);
  border-color: var(--accent); font-weight: 600;
}
.hnk-progress-msg { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.75; }
.hnk-progress.ok .hnk-progress-msg { color: var(--go, #2fae52); font-weight: 600; }
.hnk-progress.err .hnk-progress-msg { color: var(--err, #e05d5d); font-weight: 600; }
.hnk-btn.is-busy { opacity: .55; cursor: wait; }

/* ---- v6.17 premium select triggers (dropdown wave) — token-driven so both
   themes work; UXP-safe (plain borders, gradients, box-shadow only) ---- */
select.inp, .lang-sel, .hnk-sel, .hnk-model {
  background-image: linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,.12));
  border: 1px solid rgba(217,164,65,.35);
  border-radius: 8px;
}
select.inp:focus, .lang-sel:focus, .hnk-sel:focus, .hnk-model:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(217,164,65,.22);
}
[data-theme="light"] select.inp, [data-theme="light"] .lang-sel,
[data-theme="light"] .hnk-sel, [data-theme="light"] .hnk-model {
  background-image: linear-gradient(180deg, rgba(255,255,255,.5), rgba(0,0,0,.04));
  border-color: rgba(198,138,38,.45);
}

/* ---- v6.19 keyboard focus ring — every primary action in the AI Tools
   panel (buttons, nav, slot remove, chip add) was missing a visible
   :focus-visible ring, a real keyboard-accessibility gap. One shared rule,
   matching the accent-color treatment select.inp/.hnk-sel already use above. */
.hnk-btn:focus-visible, .hnk-nav-btn:focus-visible, .hnk-action:focus-visible,
.hnk-generate:focus-visible, .hnk-variant:focus-visible,
.hnk-slot-x:focus-visible, .hnk-req-add:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
