:root {
  --bg: #F4F3F1; --card: #FFFFFF; --ink: #17171A; --muted: #6B6B73; --line: #E3E1DD;
  --brand: #E6007E; --brand-ink: #FFFFFF; --stage: #DCDAD6; --focus: rgba(230, 0, 126, .25);
  --bar: #0E0F12; --bar-ink: #E9EDF2; --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111113; --card: #1B1B1F; --ink: #EDEDF0; --muted: #9A9AA3; --line: #2C2C32; --stage: #0B0B0D; --bar: #08090B; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 "Commissioner", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Πάνω μπάρα ---------- */
.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 24px; background: var(--bar); color: var(--bar-ink); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 14px; }
.brandmark { height: 44px; width: auto; display: block; }
.for { display: flex; flex-direction: column; line-height: 1.2; padding-left: 14px; border-left: 1px solid rgba(255,255,255,.14); }
.for span { font-size: 11px; color: #9AA3AF; letter-spacing: .08em; }
.for strong { font-size: 14px; font-weight: 600; }
.badge { font-style: normal; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; background: var(--brand); color: var(--brand-ink); padding: 3px 8px; border-radius: 20px; }
button.ghost.light { color: var(--bar-ink); border-color: rgba(255,255,255,.2); }

/* ---------- Διάταξη ---------- */
.layout { display: grid; grid-template-columns: 410px 1fr; gap: 20px; padding: 20px; max-width: 1680px; margin: 0 auto; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.side section + section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
h2 { font-size: 14.5px; margin: 0 0 10px; display: flex; gap: 8px; align-items: center; }
h2 span { font-size: 10.5px; color: var(--brand); letter-spacing: .1em; font-weight: 700; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.muted { color: var(--muted); font-size: 12.5px; }
small { color: var(--muted); font-weight: 400; }

/* τύποι */
.formats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.fmt { border: 1px solid var(--line); background: transparent; border-radius: 9px; padding: 7px 4px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; }
.fmt i { display: block; border: 1.5px solid currentColor; border-radius: 2px; opacity: .5; }
.fmt b { font-size: 12px; font-weight: 600; white-space: nowrap; }
.fmt small { font-size: 10px; line-height: 1.15; }
.fmt[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
.fmt[aria-pressed="true"] i { opacity: 1; color: var(--brand); }
.sizebar { display: flex; gap: 6px; align-items: center; margin-top: 10px; font-size: 13px; color: var(--muted); }
.sizebar input { width: 76px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }
.sizebar input:disabled { opacity: .7; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--bg); }
.seg button { border: 0; background: transparent; border-radius: 8px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.seg button b { font-size: 13px; font-weight: 600; }
.seg button small { font-size: 10.5px; }
.seg button[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg button[aria-pressed="true"] small { color: var(--brand); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.seg.mini { margin-top: 0; padding: 2px; }
.seg.mini button { flex-direction: row; justify-content: center; gap: 6px; font-size: 12.5px; padding: 5px 4px; }
.seg.mini button[aria-pressed="true"] { color: var(--brand); font-weight: 600; }
.ico { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; }
.ico.p { width: 9px; height: 12px; } .ico.l { width: 12px; height: 9px; }
.print { margin-top: 10px; display: grid; gap: 8px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; align-items: end; }
.sel { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.sel select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); width: 100%; }
.nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nums label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 4px; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px 4px; background: var(--bg); }
.nums label > span { grid-column: 1 / -1; line-height: 1.2; }
.nums input { width: 100%; min-width: 0; border: 0; background: transparent; padding: 1px 0; text-align: left; font-size: 14px; color: var(--ink); }
.nums input:focus { box-shadow: none; }
.nums i { font-style: normal; }

.in { display: block; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); margin-bottom: 8px; }
textarea.in { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--brand); width: 15px; height: 15px; margin: 0; }

/* υλικό */
.drop { display: block; border: 1.5px dashed var(--line); border-radius: 10px; padding: 12px; text-align: center; cursor: pointer; font-size: 13px; }
.drop input { display: none; }
.drop small { display: block; font-size: 11.5px; margin-top: 2px; }
.drop.over { border-color: var(--brand); background: var(--focus); }
.assets { display: grid; gap: 6px; margin-top: 8px; }
.assets:empty { display: none; }
.asset { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 9px; padding: 5px; }
.asset img { width: 52px; height: 40px; object-fit: cover; border-radius: 5px; background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0/8px 8px; }
.asset.logo img { object-fit: contain; }
.asset .meta { min-width: 0; display: grid; gap: 2px; }
.asset select { font-size: 12px; padding: 2px 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); width: max-content; }
.asset .desc { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset .x { border: 0; background: transparent; cursor: pointer; font-size: 16px; color: var(--muted); padding: 2px 6px; }

/* χρώματα */
.swatches { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.sw { aspect-ratio: 1; border-radius: 5px; border: 1px solid rgba(0,0,0,.12); cursor: pointer; padding: 0; position: relative; }
.sw[aria-pressed="true"]::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--c, #fff); }
.sw.add { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); overflow: hidden; }
.sw.add input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.swlabel { grid-column: 1 / -1; font-size: 11px; color: var(--muted); margin-top: 2px; }
.picked { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.picked:empty { display: none; }
.pc { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 20px; padding: 3px 4px; font-size: 12px; }
.pc i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }
.pc button { border: 0; background: var(--bg); border-radius: 12px; padding: 2px 8px; cursor: pointer; font-size: 11.5px; }
.pc button.role.primary { background: var(--ink); color: var(--bg); }
.pc .x { background: transparent; color: var(--muted); padding: 0 4px; font-size: 14px; }
.pc .warn { color: #C2410C; font-size: 11px; }

/* γραμματοσειρές */
.fonts { margin-top: 12px; }
.fhead { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.up { position: relative; overflow: hidden; cursor: pointer; }
.up input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pool { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fchip { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.fchip button { border: 0; background: transparent; padding: 4px 10px; cursor: pointer; font-size: 14px; color: inherit; }
.fchip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.fchip .x { padding: 4px 8px 4px 0; font-size: 13px; opacity: .6; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.chip { border: 1px solid var(--line); background: transparent; padding: 4px 10px; border-radius: 20px; cursor: pointer; font-size: 12.5px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

button.primary { width: 100%; background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 10px; padding: 12px 16px; font-weight: 700; cursor: pointer; margin-top: 14px; }
button.primary:disabled { opacity: .6; cursor: progress; }
button.ghost { background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; cursor: pointer; }
button.ghost:hover, .fmt:hover, .chip:hover { border-color: var(--muted); }
.small { padding: 5px 10px !important; font-size: 12.5px; border-radius: 8px !important; }
label.ghost { border: 1px solid var(--line); }
.err { color: #D0303A; font-size: 13px; }

/* ---------- Κύριο μέρος ---------- */
main { min-width: 0; }
main > section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
main > section + section { margin-top: 20px; }
.empty { display: grid; gap: 18px; justify-items: start; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: 100%; }
.steps div { border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-size: 13.5px; }
.steps b { display: block; color: var(--brand); font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.rhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rhead h2 { margin: 0; }

.variants { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.variant { border: 1px solid var(--line); border-radius: 10px; background: transparent; padding: 0; cursor: pointer; text-align: left; overflow: hidden; display: flex; flex-direction: column; }
.variant .thumb { background: var(--stage); padding: 12px; display: grid; place-items: center; aspect-ratio: 4 / 3; }
.variant .thumb svg { max-width: 100%; max-height: 100%; width: auto; height: auto; box-shadow: 0 4px 18px rgba(0,0,0,.18); }
.variant .thumb.pair { grid-template-columns: 1fr 1fr; gap: 8px; }
.variant .meta { padding: 9px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.variant .meta b { font-weight: 600; }
.variant[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
.variant.loading .thumb { background: linear-gradient(90deg, var(--stage), var(--line), var(--stage)); background-size: 200% 100%; animation: sh 1.2s infinite linear; color: var(--muted); font-size: 13px; }
@keyframes sh { to { background-position: -200% 0; } }
.pill { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 20px; padding: 2px 8px; white-space: nowrap; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; background: var(--bg); }
.tgroup { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tgroup + .tgroup { border-left: 1px solid var(--line); padding-left: 18px; }
.zoom { gap: 2px; }
.tb { border: 1px solid var(--line); background: var(--card); min-width: 32px; height: 28px; border-radius: 6px; cursor: pointer; font-variant-numeric: tabular-nums; }
#zFit { min-width: 56px; font-size: 12.5px; }
.tcheck { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.tcheck input { accent-color: var(--brand); }
.proof { margin-left: auto; font-size: 12px; color: var(--muted); }

.edit { display: grid; grid-template-columns: 1fr 330px; gap: 18px; align-items: start; }
.work { min-width: 0; display: grid; gap: 14px; }
.stage { background: var(--stage); border-radius: 10px; padding: 24px; display: grid; gap: 16px; place-items: start center; min-height: 380px; overflow: auto; max-height: 76vh; }
.stage.zoomed { place-items: start; }
.stage figure { margin: 0; display: grid; gap: 6px; justify-items: center; width: 100%; }
.stage figcaption { font-size: 12px; color: var(--muted); }
.stage svg { max-width: 100%; max-height: 68vh; width: auto; height: auto; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.stage.zoomed svg { max-width: none; max-height: none; }

.chat { border: 1px solid var(--line); border-radius: 10px; display: grid; }
.chead { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.msgs { display: flex; flex-direction: column; gap: 8px; padding: 12px; max-height: 240px; overflow: auto; }
.msg { max-width: 85%; padding: 8px 12px; border-radius: 12px; font-size: 13.5px; }
.msg.ai { background: var(--bg); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: var(--ink); color: var(--bg); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.err { background: #FDECEE; color: #A3202B; align-self: flex-start; }
.msg.typing { color: var(--muted); font-style: italic; }
.cform { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.cform input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.send { background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 8px; padding: 0 16px; font-weight: 700; cursor: pointer; }
.send:disabled { opacity: .6; }
.sugg { padding: 0 12px 8px; }

.props { padding: 14px; }
.f { display: block; margin-bottom: 10px; font-size: 12.5px; font-weight: 600; }
.f small { display: block; font-size: 11px; }
.f input:not([type=color]):not([type=range]), .f textarea, .f select { display: block; width: 100%; margin-top: 4px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-weight: 400; }
.f input[type=range] { width: 100%; accent-color: var(--brand); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 4px; }
.colors label { display: grid; justify-items: center; gap: 2px; font-weight: 400; }
.colors input { width: 100%; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
.colors small { font-size: 11px; }
.colors em { font-style: normal; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.imgrow { display: flex; gap: 8px; margin: 2px 0 6px; flex-wrap: wrap; }
.export { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 2px; display: grid; gap: 8px; }
.export .primary { margin-top: 10px; }
.export .ghost { width: 100%; }
.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .15s; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); width: min(560px, calc(100vw - 32px)); padding: 20px; }
dialog::backdrop { background: rgba(0,0,0,.4); }
.dhead { display: flex; justify-content: space-between; align-items: center; }
.dhead h3 { margin: 0; }
#histList { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; max-height: 60vh; overflow: auto; }
#histList button { width: 100%; text-align: left; border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 10px 12px; cursor: pointer; }
#histList small { display: block; }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 10px 16px 30px; }

/* ---------- Μετακίνηση στοιχείων ---------- */
#stage g[data-el] { cursor: move; }
#stage { touch-action: pan-x pan-y; }
#stage.grab { touch-action: none; }          /* με επιλεγμένο στοιχείο, το δάχτυλο σέρνει αντί να κυλάει */
#stage .handles [data-h] { pointer-events: all; }
.hint.sel { margin: -6px 0 0; }
.ur { display: flex; gap: 4px; }
.ur .tb { min-width: 34px; font-size: 16px; }
.ur .tb:disabled { opacity: .4; cursor: default; }
.inedit { position: fixed; z-index: 50; font: 15px/1.4 "Commissioner", system-ui, sans-serif; padding: 8px 10px; border: 2px solid var(--brand); border-radius: 8px; background: var(--card); color: var(--ink); box-shadow: 0 10px 30px rgba(0,0,0,.3); resize: both; max-width: calc(100vw - 16px); }

/* ---------- Responsive ---------- */
/* laptop: πιο στενή φόρμα, η προσαρμογή κάτω από τη μακέτα */
@media (max-width: 1400px) {
  .edit { grid-template-columns: 1fr; }
  .props { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
  .props > .f:nth-child(3), .props > .f:nth-child(4), .props > .export, .props > #expInfo, .props > .progress, .props > .imgrow { grid-column: 1 / -1; }
}
@media (max-width: 1200px) {
  .layout { grid-template-columns: 340px 1fr; gap: 16px; padding: 16px; }
  .steps { grid-template-columns: 1fr 1fr; }
}
/* tablet: μία στήλη */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .formats { grid-template-columns: repeat(6, 1fr); }
  .swatches { grid-template-columns: repeat(16, 1fr); }
}
/* κινητό */
@media (max-width: 640px) {
  body { font-size: 15px; }
  .layout { padding: 10px; gap: 10px; }
  .panel, main > section { padding: 14px; border-radius: 10px; }
  .top { padding: 8px 12px; }
  .brandmark { height: 34px; }
  .for { display: none; }
  .formats { grid-template-columns: repeat(4, 1fr); }
  .fmt small { display: none; }
  .fmt { padding: 8px 2px; }
  .swatches { grid-template-columns: repeat(8, 1fr); gap: 6px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .steps div { padding: 10px; font-size: 13px; }
  /* οι προτάσεις σε οριζόντια λωρίδα που κυλάει */
  .variants { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -14px; padding: 0 14px 6px; }
  .variant { flex: 0 0 72%; scroll-snap-align: center; }
  .rhead { margin-bottom: 8px; }
  /* γραμμή εργαλείων σε μία σειρά που κυλάει */
  .toolbar { flex-wrap: nowrap; overflow-x: auto; gap: 12px; padding: 6px 8px; scrollbar-width: none; }
  .toolbar::-webkit-scrollbar { display: none; }
  .tgroup { flex-wrap: nowrap; flex: 0 0 auto; }
  .tgroup + .tgroup { border-left: 1px solid var(--line); padding-left: 12px; }
  .proof { display: none; }
  .stage { padding: 8px; min-height: 0; max-height: none; border-radius: 8px; }
  .stage svg { max-height: 62vh; }
  .props { display: block; }
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .msgs { max-height: 200px; }
  .cform { padding: 8px; }
  dialog { padding: 14px; }
}
/* οθόνες αφής: μεγαλύτεροι στόχοι για το δάχτυλο */
@media (pointer: coarse) {
  .seg.mini button, .seg button { min-height: 40px; }
  .check, .tcheck { min-height: 36px; }
  .check input, .tcheck input { width: 20px; height: 20px; }
  .chip { padding: 8px 12px; }
  .tb { min-width: 40px; height: 36px; }
  .sel select, .sizebar input, .asset select { min-height: 40px; }
  .nums input { min-height: 28px; }
  button.ghost, .small { min-height: 38px; }
  .fchip button { padding: 8px 12px; }
  .asset .x { padding: 8px 10px; }
}
