/* Graphkit Social Media Studio — UI styles.
   Visual identity from the Graphkit Social Media Studio prototype (dark navy, neon lime + cyan, Manrope).
   Everything is scoped under .gks-app / gks- prefixes so it can live inside graphkit.io next to main.css. */

.gks-app, .gks-standalone {
  --gks-bg: #06101e; --gks-panel: #071626; --gks-panel2: #0a1b2d; --gks-field: #0b2033;
  --gks-line: #17334a; --gks-line2: #25465e; --gks-text: #f4f7ff; --gks-muted: #92a9c2; --gks-dim: #6f8aa6;
  --gks-lime: #b5ff27; --gks-cyan: #24e4db; --gks-blue: #138bff; --gks-danger: #ff6b6b;
  --gks-grad: linear-gradient(100deg, #b5ff27, #24e4db);
  --gks-font: "GK Manrope", Manrope, "Segoe UI", Arial, sans-serif;
}

/* ---------- standalone page shell (index.html) ---------- */
body.gks-standalone { margin: 0; background: var(--gks-bg); color: var(--gks-text); font-family: var(--gks-font); overflow: hidden; }
.gks-topbar { height: 60px; background: #050d1b; border-bottom: 1px solid #183149; display: flex; align-items: center; gap: 28px; padding: 0 20px; white-space: nowrap; box-sizing: border-box; }
.gks-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: #f4f7ff; font-size: 19px; font-weight: 800; letter-spacing: -.7px; min-width: 160px; }
.gks-brand-mark { width: 31px; height: 34px; }
.gks-brand-accent { color: var(--gks-lime); }
.gks-main-nav { display: flex; align-items: center; gap: 22px; flex: 1; overflow: hidden; }
.gks-main-nav a { font-size: 12px; text-decoration: none; color: #b4c3d7; }
.gks-main-nav a:hover { color: #fff; }
.gks-new, .gks-free { font-size: 8px; letter-spacing: .3px; color: var(--gks-lime); border: 1px solid #416b22; padding: 2px 4px; border-radius: 3px; margin-left: 4px; }
.gks-free { background: #263b1a; }
.gks-account-nav { display: flex; gap: 9px; align-items: center; }
.gks-outline-btn { border: 1px solid #537b24; color: var(--gks-lime); background: #071626; padding: 9px 12px; border-radius: 6px; font-size: 11px; text-decoration: none; }
.gks-signout { background: var(--gks-grad); color: #06101e; border-radius: 6px; padding: 10px 15px; font-weight: 800; font-size: 11px; text-decoration: none; }
body.gks-standalone .gks-app { height: calc(100vh - 60px); height: calc(100dvh - 60px); }

/* ---------- app root ---------- */
.gks-app { position: relative; display: flex; flex-direction: column; min-height: 560px; background: var(--gks-bg); color: var(--gks-text); font-family: var(--gks-font); font-size: 13px; line-height: 1.35; text-align: left; -webkit-font-smoothing: antialiased; }
.gks-app *, .gks-app *::before, .gks-app *::after { box-sizing: border-box; }
:where(.gks-app) :where(button, input, select, textarea) { font: inherit; color: inherit; margin: 0; }
:where(.gks-app) button { cursor: pointer; }
.gks-app button:disabled { cursor: not-allowed; opacity: .45; }
:where(.gks-app) :where(h2, h3, p, ul) { margin: 0; padding: 0; }
.gks-app img { display: inline-block; }
.gks-app a { color: inherit; }
.gks-app :focus-visible { outline: 2px solid var(--gks-cyan); outline-offset: 2px; }
.gks-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gks-muted { color: var(--gks-muted); }
.gks-small { font-size: 11px; line-height: 1.5; margin-top: 12px !important; }

/* ---------- toolbar ---------- */
.gks-toolbar { flex: 0 0 auto; height: 64px; display: grid; grid-template-columns: minmax(200px, 1fr) minmax(200px, 1fr) auto auto; align-items: center; gap: 16px; padding: 0 20px; background: linear-gradient(90deg, #071a32, #081323 70%); border-bottom: 1px solid var(--gks-line); }
.gks-crumb { display: flex; align-items: center; gap: 10px; color: #9eb2c9; font-size: 13px; min-width: 0; white-space: nowrap; }
.gks-crumb a { text-decoration: none; color: #9eb2c9; }
.gks-crumb a:hover { color: #fff; }
.gks-crumb-icon { color: var(--gks-cyan); }
.gks-crumb strong { color: var(--gks-lime); font-weight: 700; }
.gks-slash { color: #526981; }
.gks-docname { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 14px; font-weight: 700; min-width: 0; }
#gksDocName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
.gks-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; background: transparent; border: 0; border-radius: 6px; color: #b5c8dc; }
.gks-icon-btn:hover:not(:disabled) { background: #102941; }
.gks-icon-btn img { width: 17px; height: 17px; }
.gks-history { display: flex; gap: 4px; border-right: 1px solid #234057; padding-right: 14px; }
.gks-history .gks-icon-btn img { width: 21px; height: 21px; }
.gks-actions { display: flex; gap: 10px; align-items: center; }
.gks-preview-btn, .gks-export-btn, .gks-ghost-btn { height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 16px; border-radius: 7px; font-weight: 700; white-space: nowrap; text-decoration: none; }
.gks-preview-btn img, .gks-export-btn img, .gks-ghost-btn img { width: 17px; height: 17px; }
.gks-preview-btn { background: #081a2c; border: 1px solid #27718d; }
.gks-preview-btn:hover { border-color: var(--gks-cyan); }
.gks-export-btn { background: var(--gks-grad); border: 0; color: #06101c; }
.gks-export-btn img { filter: brightness(0) saturate(100%); opacity: .85; }
.gks-export-btn:hover:not(:disabled) { filter: brightness(1.06); }
.gks-ghost-btn { background: var(--gks-field); border: 1px solid #23455e; color: #cfe0ef; height: 38px; font-size: 12px; padding: 0 12px; }
.gks-ghost-btn:hover:not(:disabled) { border-color: #3f8da0; color: #fff; }
.gks-caret { border-left: 1px solid #7cce89; padding-left: 12px; font-size: 17px; margin-left: 2px; line-height: 1; }
.gks-wide { width: 100%; }
.gks-export-wrap { position: relative; }
.gks-export-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 290px; background: #081a2b; border: 1px solid #25516a; border-radius: 12px; padding: 16px; box-shadow: 0 20px 50px #000a; display: flex; flex-direction: column; gap: 12px; }
.gks-export-menu[hidden] { display: none; }
.gks-export-menu h3 { font-size: 14px; font-weight: 800; }

/* ---------- generic controls ---------- */
.gks-seg { display: flex; gap: 4px; }
.gks-seg button { flex: 1; height: 36px; border-radius: 6px; border: 1px solid var(--gks-line2); background: #0a1d30; color: #d4e3f2; font-weight: 700; font-size: 12px; }
.gks-seg button[aria-pressed="true"] { background: #163c5b; border-color: var(--gks-cyan); color: #fff; }
.gks-field { display: flex; flex-direction: column; gap: 6px; color: #a6bdd2; font-size: 11px; }
.gks-field > span { font-weight: 600; }
:where(.gks-app) :where(select, input[type="number"], input[type="text"], input[type="search"], textarea) { min-width: 0; width: 100%; height: 38px; background: var(--gks-field); border: 1px solid #26475e; border-radius: 6px; color: #e4effa; padding: 0 10px; font-weight: 600; font-size: 12px; }
:where(.gks-app) textarea { height: auto; padding: 9px 10px; line-height: 1.4; resize: vertical; font-weight: 500; }
.gks-app select { cursor: pointer; }
.gks-app input[type="range"] { width: 100%; accent-color: #3edbd5; height: 22px; background: transparent; border: 0; padding: 0; }
.gks-app input[type="color"] { width: 34px; height: 30px; padding: 0; border: 1px solid #25445a; border-radius: 6px; background: var(--gks-panel2); cursor: pointer; flex: 0 0 auto; }
.gks-app input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.gks-app input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 4px; }
.gks-check { display: flex; align-items: center; gap: 8px; color: #c8d9e9; font-size: 12px; cursor: pointer; }
.gks-check input { accent-color: var(--gks-cyan); width: 16px; height: 16px; margin: 0; }
.gks-check small { color: var(--gks-dim); }
.gks-btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.gks-btn-row.gks-center { justify-content: center; }
.gks-msg { font-size: 12px; padding: 8px 10px; border-radius: 6px; margin: 8px 0 !important; }
.gks-error { background: #3a1420; color: #ffc2c2; border: 1px solid #6b2737; }
.gks-msg[hidden] { display: none; }

/* ---------- workspace grid ---------- */
.gks-workspace { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 88px 360px minmax(320px, 1fr) 330px; position: relative; }
.gks-workspace.gks-left-closed { grid-template-columns: 88px 0 minmax(320px, 1fr) 330px; }
.gks-workspace.gks-left-closed .gks-left { display: none; }
.gks-rail { background: #061322; border-right: 1px solid #18334a; display: flex; flex-direction: column; padding-top: 8px; gap: 4px; overflow-y: auto; scrollbar-width: none; }
.gks-rail-item { height: 72px; flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 0; background: transparent; color: #b0c2d7; position: relative; font-size: 11px; padding: 0 4px; text-align: center; }
.gks-rail-item img { width: 23px; height: 23px; }
.gks-rail-item:hover { background: #0a1c2e; color: #fff; }
.gks-rail-item.active { background: #0d2134; color: #fff; }
.gks-rail-item.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(var(--gks-lime), var(--gks-cyan)); }
.gks-left, .gks-right { background: var(--gks-panel); min-width: 0; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #24455f #071626; }
.gks-left { padding: 14px 14px 12px; border-right: 1px solid #19364d; }
.gks-right { padding: 14px 14px 14px; border-left: 1px solid #19364d; }
.gks-panel-head { min-height: 32px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.gks-panel-head h2 { font-size: 18px; font-weight: 800; letter-spacing: -.4px; }
.gks-panel[hidden] { display: none; }
.gks-sub { font-size: 12px; font-weight: 800; color: #d0deeb; margin: 16px 0 9px !important; text-transform: uppercase; letter-spacing: .6px; }
.gks-sub:first-child { margin-top: 2px !important; }

/* templates panel */
.gks-search { height: 42px; border: 1px solid #25465f; border-radius: 7px; background: #0a1c2e; display: flex; align-items: center; gap: 9px; padding: 0 10px; margin-bottom: 14px; }
.gks-search img { width: 17px; height: 17px; }
.gks-search input { border: 0 !important; background: transparent !important; height: 38px !important; padding: 0 !important; outline: 0; }
.gks-search input::placeholder { color: #9ab0c7; }
.gks-chips { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; flex-wrap: wrap; }
.gks-chip { border: 1px solid transparent; border-radius: 18px; padding: 8px 13px; background: #10263b; color: #b6c9dc; white-space: nowrap; font-size: 11px; font-weight: 600; }
.gks-chip:hover { color: #fff; }
.gks-chip[aria-pressed="true"] { background: var(--gks-grad); color: #06101e; font-weight: 800; }
.gks-tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gks-tpl-card { border: 1px solid #18384e; background: #0a1b2b; border-radius: 9px; padding: 0; overflow: hidden; min-width: 0; transition: border-color .15s, transform .15s; display: flex; flex-direction: column; text-align: left; }
.gks-tpl-card:hover { transform: translateY(-2px); border-color: #3f8da0; }
.gks-tpl-card[aria-pressed="true"] { border: 2px solid var(--gks-cyan); box-shadow: 0 0 0 1px #1b6376; }
.gks-tpl-card canvas { width: 100%; height: auto; display: block; background: #0d2134; }
.gks-tpl-card span { display: block; padding: 7px 9px 8px; font-size: 11px; font-weight: 700; color: #d7e7f6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gks-tpl-card small { display: block; padding: 0 9px 8px; margin-top: -5px; font-size: 10px; color: var(--gks-dim); }
.gks-empty { color: var(--gks-muted); padding: 20px 4px; text-align: center; }
.gks-panel-foot { margin-top: 16px; padding: 12px 2px 3px; border-top: 1px solid #19364d; color: #9bb1c8; font-size: 11px; display: flex; align-items: center; gap: 6px; }
.gks-live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--gks-lime); }

/* elements panel */
.gks-el-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gks-el-btn { border: 1px solid #18384e; background: #0a1b2b; border-radius: 8px; padding: 8px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.gks-el-btn:hover { border-color: #3f8da0; background: #0d2236; }
.gks-el-btn canvas { width: 56px; height: 56px; }
.gks-el-btn small { font-size: 10px; color: #a9bfd4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* text panel */
.gks-text-presets { display: flex; flex-direction: column; gap: 8px; }
.gks-text-preset { border: 1px solid #1f3f57; background: #0a1b2b; border-radius: 8px; padding: 12px 14px; text-align: left; color: #f4f7ff; }
.gks-text-preset:hover { border-color: var(--gks-cyan); background: #0d2236; }

/* uploads panel */
.gks-upload-zone { width: 100%; border: 2px dashed #2a4d66; border-radius: 10px; background: #0a1c2e; padding: 20px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: #e4effa; }
.gks-upload-zone:hover { border-color: var(--gks-lime); background: #0d2236; }
.gks-upload-zone img { width: 24px; height: 24px; }
.gks-upload-zone small { color: var(--gks-muted); font-size: 11px; text-align: center; line-height: 1.5; }
.gks-up-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.gks-up-card { border: 1px solid #18384e; background: #0a1b2b; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.gks-up-card .gks-up-thumb { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: repeating-conic-gradient(#0f2438 0 25%, #0b1d2f 0 50%) 0 0 / 16px 16px; border: 0; padding: 4px; width: 100%; }
.gks-up-card canvas { max-width: 100%; max-height: 100%; }
.gks-up-actions { display: flex; border-top: 1px solid #18384e; }
.gks-up-actions button { flex: 1; border: 0; background: transparent; color: #b9ccde; font-size: 10px; padding: 7px 2px; font-weight: 700; }
.gks-up-actions button + button { border-left: 1px solid #18384e; }
.gks-up-actions button:hover { background: #102941; color: #fff; }

/* brand kit */
.gks-brand-colors { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.gks-swatch-wrap { position: relative; }
.gks-swatch { width: 38px; height: 38px; border-radius: 8px; border: 1px solid #2a4d66; padding: 0; }
.gks-swatch:hover { transform: scale(1.06); }
.gks-swatch-edit { position: absolute; right: -5px; bottom: -5px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid #2a4d66; background: #0b2033; font-size: 9px; padding: 0; line-height: 1; overflow: hidden; }
.gks-swatch-edit input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.gks-swatch-add { width: 38px; height: 38px; border-radius: 8px; border: 1px dashed #3a5d76; background: transparent; color: #9ab0c7; font-size: 18px; padding: 0; }
.gks-brand-logo { min-height: 90px; border: 1px dashed #2a4d66; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; background: repeating-conic-gradient(#0f2438 0 25%, #0b1d2f 0 50%) 0 0 / 16px 16px; color: var(--gks-muted); font-size: 12px; padding: 10px; }
.gks-brand-logo canvas { max-width: 100%; max-height: 120px; }
.gks-left .gks-field { margin-bottom: 10px; }

/* designs */
.gks-cloud { margin-top: 14px; }
.gks-cloud-usage { font-size: 12px; color: #c8d9e9; display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.gks-cloud-usage b { color: var(--gks-lime); }
.gks-cloud-bar { height: 6px; border-radius: 6px; background: #10263b; overflow: hidden; }
.gks-cloud-bar i { display: block; height: 100%; background: var(--gks-grad); }
.gks-cloud-note { font-size: 12px; line-height: 1.5; color: #c8d9e9; background: #0a1d30; border: 1px solid #1f3f57; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.gks-cloud-note.gks-warn { border-color: #6b5326; background: #2a2010; }
.gks-cloud-note a { color: var(--gks-lime); }
.gks-designs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.gks-design-card { border: 1px solid #18384e; background: #0a1b2b; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.gks-design-card.current { border-color: var(--gks-cyan); }
.gks-design-card .gks-design-open { border: 0; padding: 0; background: #0d2134; display: block; }
.gks-design-card img { width: 100%; display: block; aspect-ratio: 4/5; object-fit: contain; background: #0d2134; }
.gks-design-card b { font-size: 11px; padding: 6px 8px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gks-design-card small { font-size: 10px; color: var(--gks-dim); padding: 2px 8px 6px; }

/* ---------- canvas area ---------- */
.gks-canvas-area { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 48%, #10263b 0, #091a2c 44%, #071423 75%); }
.gks-canvas-area::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(#27435c 1px, transparent 1px); background-size: 18px 18px; opacity: .18; pointer-events: none; }
.gks-stage { position: absolute; inset: 30px 10px 76px 30px; overflow: auto; display: flex; scrollbar-width: thin; scrollbar-color: #24455f transparent; }
.gks-canvas-wrap { position: relative; margin: auto; flex: 0 0 auto; box-shadow: 0 24px 60px #0008; outline: 1px solid #16455c; touch-action: pan-x pan-y; }
.gks-canvas-wrap canvas { display: block; width: 100%; height: 100%; }
.gks-canvas-area.gks-dragging .gks-drop-hint { display: flex; }
.gks-drop-hint { display: none; position: absolute; inset: 30px 10px 76px 30px; z-index: 8; align-items: center; justify-content: center; border: 2px dashed var(--gks-lime); border-radius: 12px; background: #06101ecc; color: var(--gks-lime); font-weight: 800; font-size: 15px; pointer-events: none; }
.gks-ruler { position: absolute; color: #8ca9c4; font-size: 9px; z-index: 2; pointer-events: none; }
.gks-ruler-top { left: 30px; right: 10px; top: 0; height: 24px; border-bottom: 1px solid #29445b; }
.gks-ruler-left { top: 30px; bottom: 76px; left: 0; width: 24px; border-right: 1px solid #29445b; }
.gks-ruler span { position: absolute; white-space: nowrap; }
.gks-ruler-top span { top: 6px; transform: translateX(-50%); }
.gks-ruler-top span::after { content: ""; position: absolute; left: 50%; top: 13px; width: 1px; height: 5px; background: #4a6782; }
.gks-ruler-left span { left: 2px; transform: translateY(-50%) rotate(-90deg); transform-origin: center; width: 20px; text-align: center; }
.gks-canvas-controls { position: absolute; bottom: 10px; left: 14px; right: 14px; height: 54px; border: 1px solid #1b3b54; background: #081a2be6; backdrop-filter: blur(10px); border-radius: 8px; display: flex; align-items: center; gap: 12px; padding: 0 10px; z-index: 6; }
.gks-format-pick { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 260px; }
.gks-format-pick img { width: 17px; height: 17px; flex: 0 0 auto; }
.gks-format-pick select { height: 36px; }
.gks-safe-toggle { white-space: nowrap; }
.gks-safe-toggle[hidden], .gks-props-toggle { display: none; }
.gks-zoom { display: flex; align-items: center; gap: 6px; color: #c7d7e8; margin-left: auto; }
.gks-zoom input { width: 100px; }
#gksZoomLabel { min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; font-size: 12px; }
.gks-canvas-hint { position: absolute; bottom: 68px; left: 0; right: 0; text-align: center; color: #6f8aa6; font-size: 10px; z-index: 2; pointer-events: none; }

/* overlays above the canvas: never part of the exported image */
.gks-safe { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.gks-safe[hidden] { display: none; }
.gks-safe-band { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, rgba(255, 107, 107, .2) 0 10px, rgba(255, 107, 107, .07) 10px 20px); display: flex; align-items: center; justify-content: center; }
.gks-safe-band.gks-top { top: 0; border-bottom: 1px dashed #ff6b6b; }
.gks-safe-band.gks-bottom { bottom: 0; border-top: 1px dashed #ff6b6b; }
.gks-safe-band span { font-size: 10px; font-weight: 700; color: #fff; background: #000a; padding: 2px 8px; border-radius: 10px; }
.gks-slots { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.gks-slot { position: absolute; display: flex; align-items: center; justify-content: center; }
.gks-slot span { display: inline-flex; align-items: center; gap: 6px; background: #06101ecc; color: #e8f6ff; border: 1px solid #ffffff40; border-radius: 30px; padding: 6px 11px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.gks-slot span img { width: 14px; height: 14px; }
.gks-guide { position: absolute; z-index: 3; pointer-events: none; background: #ff3fa4; }
.gks-guide[hidden] { display: none; }
.gks-guide-v { top: 0; bottom: 0; width: 1px; }
.gks-guide-h { left: 0; right: 0; height: 1px; }
.gks-sel { position: absolute; z-index: 4; border: 1.5px solid #178dff; box-shadow: 0 0 0 1px #06101e66; cursor: move; touch-action: none; transform-origin: 50% 50%; }
.gks-sel[hidden] { display: none; }
.gks-sel.gks-locked { border-style: dashed; border-color: #ffcc33; cursor: not-allowed; }
.gks-sel.gks-locked .gks-h, .gks-sel.gks-locked .gks-rot-line { display: none; }
.gks-sel.gks-panning { border-color: var(--gks-lime); cursor: grab; }
.gks-sel.gks-editing { cursor: text; }
.gks-sel.gks-editing .gks-h, .gks-sel.gks-editing .gks-rot-line { display: none; }
.gks-h { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; background: #fff; border: 2px solid #168dff; border-radius: 3px; padding: 0; touch-action: none; }
.gks-h::after { content: ""; position: absolute; inset: -8px; }
.gks-h-nw { left: 0; top: 0; cursor: nwse-resize; } .gks-h-n { left: 50%; top: 0; cursor: ns-resize; } .gks-h-ne { left: 100%; top: 0; cursor: nesw-resize; } .gks-h-e { left: 100%; top: 50%; cursor: ew-resize; }
.gks-h-se { left: 100%; top: 100%; cursor: nwse-resize; } .gks-h-s { left: 50%; top: 100%; cursor: ns-resize; } .gks-h-sw { left: 0; top: 100%; cursor: nesw-resize; } .gks-h-w { left: 0; top: 50%; cursor: ew-resize; }
.gks-h-n, .gks-h-s { width: 18px; height: 8px; margin: -4px 0 0 -9px; border-radius: 4px; }
.gks-h-e, .gks-h-w { width: 8px; height: 18px; margin: -9px 0 0 -4px; border-radius: 4px; }
.gks-h-rot { left: 50%; top: -30px; border-radius: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-color: var(--gks-cyan); cursor: grab; }
.gks-rot-line { position: absolute; left: 50%; top: -23px; width: 1px; height: 23px; background: #178dff; pointer-events: none; }
.gks-sel-tag { position: absolute; left: -1px; bottom: calc(100% + 4px); max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #178dff; color: #fff; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 4px; pointer-events: none; }
.gks-sel.gks-small-box .gks-h-n, .gks-sel.gks-small-box .gks-h-s, .gks-sel.gks-small-box .gks-h-e, .gks-sel.gks-small-box .gks-h-w { display: none; }
.gks-inline { position: absolute !important; z-index: 5; margin: 0 !important; padding: 0 !important; border: 1px dashed var(--gks-cyan) !important; border-radius: 0 !important; background: rgba(6, 16, 30, .06) !important; resize: none !important; overflow: hidden; white-space: pre-wrap; overflow-wrap: break-word; outline: none !important; transform-origin: 50% 50%; caret-color: var(--gks-cyan); }
.gks-inline[hidden] { display: none; }

/* ---------- right panel: properties ---------- */
.gks-selected { display: flex; align-items: center; gap: 12px; padding: 0 0 14px; border-bottom: 1px solid #1c394f; }
.gks-el-icon { width: 48px; height: 48px; border: 1px solid #246481; border-radius: 7px; background: #0c2539; display: grid; place-items: center; font-size: 24px; font-weight: 600; flex: 0 0 auto; }
.gks-el-icon img { width: 22px; height: 22px; }
.gks-selected strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gks-selected small { display: block; color: #8da8c3; margin-top: 4px; }
.gks-selected > div:not(.gks-el-icon) { min-width: 0; flex: 1; }
.gks-sec { border-bottom: 1px solid #1c394f; }
.gks-sec > summary { list-style: none; cursor: pointer; padding: 13px 0; font-size: 13px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.gks-sec > summary::-webkit-details-marker { display: none; }
.gks-sec > summary::after { content: "⌄"; color: #8da8c3; font-size: 15px; transition: transform .15s; }
.gks-sec[open] > summary::after { transform: rotate(180deg); }
.gks-sec-body { padding: 0 0 15px; display: flex; flex-direction: column; gap: 10px; }
.gks-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gks-row > label, .gks-row > .gks-lbl { flex: 0 0 92px; color: #a6bdd2; font-size: 11px; }
.gks-row > .gks-grow { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.gks-row output { min-width: 40px; text-align: right; font-size: 11px; color: #e2ecf7; font-variant-numeric: tabular-nums; }
.gks-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gks-two label { display: flex; flex-direction: column; gap: 6px; color: #a6bdd2; font-size: 11px; }
.gks-two-a { display: grid; grid-template-columns: 1fr 86px; gap: 8px; }
.gks-fmt-row { display: flex; gap: 4px; }
.gks-fmt-btn { height: 36px; min-width: 34px; flex: 1; background: #0a1d30; border: 1px solid #25465e; border-radius: 6px; color: #d4e3f2; font-size: 14px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.gks-fmt-btn img { width: 17px; height: 17px; }
.gks-fmt-btn[aria-pressed="true"] { background: #163c5b; border-color: #2a87a7; color: #fff; }
.gks-fmt-sp { width: 8px; flex: 0 0 8px; }
.gks-color { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gks-color code { color: #e2ecf7; font-size: 11px; font-family: ui-monospace, Consolas, monospace; min-width: 58px; }
.gks-mini-sw { display: flex; gap: 4px; flex-wrap: wrap; width: 100%; }
.gks-mini-sw button { width: 18px; height: 18px; border-radius: 4px; border: 1px solid #ffffff2a; padding: 0; }
.gks-mini-sw button:hover { transform: scale(1.15); }
.gks-mini-sw .gks-none { background: linear-gradient(135deg, transparent 45%, #ff6b6b 45% 55%, transparent 55%), #0b2033; }
.gks-hint-box { font-size: 11px; color: #9bb1c8; line-height: 1.5; background: #0a1d30; border: 1px solid #1f3f57; border-radius: 6px; padding: 8px 10px; }
.gks-act-row { display: flex; gap: 6px; flex-wrap: wrap; }
.gks-act-row .gks-ghost-btn { flex: 1 1 auto; height: 34px; }
.gks-act-row .gks-ghost-btn[aria-pressed="true"] { border-color: var(--gks-lime); color: var(--gks-lime); }

/* layers */
.gks-layers-section { padding-top: 14px; }
.gks-layers-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.gks-layers-head h3 { font-size: 13px; font-weight: 700; }
.gks-layers-head h3 b { font-size: 10px; color: #06101e; background: var(--gks-cyan); border-radius: 9px; padding: 1px 6px; margin-left: 4px; }
.gks-layers-head > div { display: flex; gap: 0; }
.gks-layers-head .gks-icon-btn { width: 28px; height: 28px; }
.gks-layers { list-style: none; display: flex; flex-direction: column; gap: 5px; max-height: 330px; overflow-y: auto; scrollbar-width: thin; }
.gks-layer { display: flex; align-items: center; gap: 4px; padding: 0 4px 0 0; border: 1px solid #203f56; background: #091b2c; border-radius: 7px; min-height: 38px; }
.gks-layer.active { border-color: var(--gks-cyan); background: #0b2639; box-shadow: inset 3px 0 var(--gks-cyan); }
.gks-layer.gks-hidden-layer .gks-lname { opacity: .45; }
.gks-lname { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; border: 0; background: transparent; text-align: left; padding: 8px 4px 8px 10px; color: #c8d9e9; }
.gks-lname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gks-lsym { width: 18px; flex: 0 0 18px; text-align: center; font-size: 13px; color: #d7e7f6; font-weight: 700; }
.gks-lbtn { width: 28px; height: 28px; border: 0; background: transparent; border-radius: 5px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.gks-lbtn:hover { background: #102941; }
.gks-lbtn img { width: 15px; height: 15px; opacity: .8; }
.gks-lname-edit { height: 30px !important; margin: 4px; }
.gks-quick { border-top: 1px solid #1c394f; margin-top: 14px; padding-top: 12px; display: flex; gap: 7px; flex-wrap: wrap; }
.gks-quick button { background: var(--gks-field); border: 1px solid #23455e; color: #b9ccde; border-radius: 6px; padding: 9px 10px; font-size: 11px; display: flex; align-items: center; gap: 6px; }
.gks-quick button:hover { color: #fff; border-color: #3f8da0; }
.gks-quick img { width: 14px; height: 14px; }
.gks-right-close { display: none; }

/* ---------- modal & toasts ---------- */
.gks-modal { position: fixed; inset: 0; z-index: 1200; background: #020813d9; display: flex; align-items: center; justify-content: center; padding: 20px; }
.gks-modal[hidden] { display: none; }
.gks-modal-box { position: relative; width: min(620px, 95vw); max-height: 94vh; overflow: auto; background: #081a2b; border: 1px solid #25516a; border-radius: 14px; padding: 24px; display: flex; flex-direction: column; align-items: center; }
.gks-modal-box h2 { font-size: 22px; font-weight: 800; }
.gks-modal-box > p { color: #9bb0c7; margin: 7px 0 16px; }
.gks-modal-close { position: absolute; right: 14px; top: 10px; background: none; border: 0; font-size: 28px; color: #c4d6e7; line-height: 1; }
.gks-preview-mount { width: 100%; display: flex; justify-content: center; margin-bottom: 18px; }
.gks-preview-mount img { max-width: 100%; max-height: 62vh; box-shadow: 0 15px 40px #0008; border-radius: 4px; background: repeating-conic-gradient(#1a2c3f 0 25%, #12212f 0 50%) 0 0 / 20px 20px; }
.gks-toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 1300; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.gks-toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-radius: 8px; background: #eaffcb; color: #0a1a16; font-weight: 700; box-shadow: 0 10px 30px #0006; animation: gksIn .2s ease-out; max-width: min(520px, 92vw); font-size: 13px; }
.gks-toast.gks-warn { background: #ffe1d6; color: #3d0d00; }
.gks-toast.gks-out { opacity: 0; transform: translateY(8px); transition: .3s; }
.gks-toast button { border: 0; background: #06101e; color: #b5ff27; border-radius: 6px; padding: 6px 10px; font-weight: 800; font-size: 12px; }
@keyframes gksIn { from { opacity: 0; transform: translateY(10px); } }
.gks-app.gks-busy { cursor: progress; }

/* ---------- responsive ---------- */
@media (max-width: 1450px) {
  .gks-workspace { grid-template-columns: 76px 300px minmax(300px, 1fr) 300px; }
  .gks-workspace.gks-left-closed { grid-template-columns: 76px 0 minmax(300px, 1fr) 300px; }
  .gks-toolbar { grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) auto auto; gap: 10px; padding: 0 12px; }
  .gks-main-nav { gap: 13px; }
  .gks-actions > .gks-ghost-btn span, .gks-preview-btn span { display: none; }
  .gks-actions .gks-ghost-btn, .gks-preview-btn { padding: 0 12px; }
}
@media (max-width: 1120px) {
  .gks-main-nav { display: none; }
  .gks-workspace, .gks-workspace.gks-left-closed { grid-template-columns: 70px 280px minmax(280px, 1fr); }
  .gks-workspace.gks-left-closed { grid-template-columns: 70px 0 minmax(280px, 1fr); }
  .gks-docname { display: none; }
  .gks-toolbar { grid-template-columns: 1fr auto auto; }
  .gks-history { border: 0; }
  .gks-workspace { overflow: hidden; }
  .gks-right { position: absolute; right: 0; top: 0; bottom: 0; width: min(340px, 92vw); z-index: 40; transform: translateX(102%); transition: transform .2s; box-shadow: -20px 0 40px #0008; }
  .gks-right.gks-open { transform: none; }
  .gks-right-close { display: inline-flex; }
  .gks-props-toggle { display: inline-flex; }
  .gks-props-toggle.gks-has-sel { border-color: var(--gks-lime); color: var(--gks-lime); }
  .gks-format-pick { flex-basis: 200px; }
}
@media (max-width: 760px) {
  body.gks-standalone { overflow: auto; }
  .gks-topbar { height: 52px; }
  .gks-account-nav .gks-outline-btn { display: none; }
  body.gks-standalone .gks-app { height: auto; min-height: calc(100dvh - 52px); }
  .gks-toolbar { height: auto; display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .gks-crumb { flex: 1; min-width: 140px; font-size: 12px; }
  .gks-crumb a, .gks-crumb .gks-slash { display: none; }
  .gks-actions { width: 100%; }
  .gks-actions > * { flex: 1; }
  .gks-export-wrap .gks-export-btn { width: 100%; }
  .gks-export-btn .gks-caret { display: none; }
  .gks-export-menu { right: 0; left: auto; width: min(300px, calc(100vw - 20px)); }
  .gks-workspace, .gks-workspace.gks-left-closed { display: flex; flex-direction: column; height: auto; }
  .gks-rail { flex-direction: row; order: 0; padding: 0; overflow-x: auto; border-right: 0; border-bottom: 1px solid #18334a; }
  .gks-rail-item { height: 56px; min-width: 72px; font-size: 10px; gap: 4px; }
  .gks-rail-item img { width: 19px; height: 19px; }
  .gks-rail-item.active::before { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 3px; }
  .gks-left { order: 1; max-height: 46vh; border-right: 0; border-bottom: 1px solid #19364d; padding: 12px; }
  .gks-workspace.gks-left-closed .gks-left { display: none; }
  .gks-canvas-area { order: 2; height: 72vh; min-height: 440px; }
  .gks-stage { inset: 8px 8px 72px 8px; }
  .gks-drop-hint { inset: 8px 8px 72px 8px; }
  .gks-ruler { display: none; }
  .gks-canvas-controls { left: 6px; right: 6px; gap: 6px; padding: 0 6px; }
  .gks-zoom input, .gks-zoom #gksZoomOut, .gks-zoom #gksZoomIn { display: none; }
  .gks-props-toggle span { display: none; }
  .gks-canvas-hint { display: none; }
  .gks-right { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 72vh; border-left: 0; border-top: 1px solid #25516a; border-radius: 14px 14px 0 0; transform: translateY(102%); box-shadow: 0 -20px 40px #000a; z-index: 1100; }
  .gks-right.gks-open { transform: none; }
  .gks-tpl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gks-el-grid { grid-template-columns: repeat(4, 1fr); }
  .gks-h { width: 16px; height: 16px; margin: -8px 0 0 -8px; }
}
@media (max-width: 420px) { .gks-tpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (pointer: coarse) { .gks-h::after { inset: -12px; } }
@media (prefers-reduced-motion: reduce) { .gks-app *, .gks-toast { transition: none !important; animation: none !important; } }

/* ---------- AI posts (ai.js) ---------- */
.gks-rail-ai span::after { content: "NEW"; display: block; margin: 3px auto 0; width: max-content; font-size: 7px; letter-spacing: .4px; color: var(--gks-lime); border: 1px solid #416b22; padding: 1px 3px; border-radius: 3px; }
.gks-ai-form { display: flex; flex-direction: column; gap: 10px; }
.gks-ai-form .gks-field { margin-bottom: 0 !important; }
.gks-ai-form .gks-field small { font-size: 10px; line-height: 1.4; }
.gks-ai-form .gks-check { font-size: 12px; color: #c8d9e9; display: flex; align-items: center; gap: 8px; }
.gks-ai-form .gks-msg[hidden] { display: none; }
.gks-ai-promo { border: 1px solid #2c5a2a; border-radius: 10px; padding: 14px; background: radial-gradient(ellipse at 100% 0, #b5ff2714, transparent 60%), #0a1b2b; }
.gks-ai-promo b { display: block; font-size: 15px; margin-bottom: 6px; }
.gks-ai-promo p { color: #c8d9e9; font-size: 12px; line-height: 1.5; margin-bottom: 10px; }
.gks-ai-promo ul { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.gks-ai-promo li { font-size: 12px; color: #dbe8f4; padding-left: 18px; position: relative; }
.gks-ai-promo li::before { content: "✓"; position: absolute; left: 0; color: var(--gks-lime); font-weight: 800; }
.gks-ai-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.gks-ai-head b { font-size: 14px; }
.gks-ai-head small { font-size: 11px; }
.gks-ai-progress { display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: #c8d9e9; margin-bottom: 12px; padding: 10px 12px; border: 1px solid #1f3f57; border-radius: 8px; background: #0a1d30; }
.gks-ai-progress .gks-cloud-bar i { transition: width .4s ease; }
.gks-ai-results > .gks-export-btn { margin-bottom: 12px; }
.gks-ai-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gks-ai-card { border: 1px solid #18384e; background: #0a1b2b; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.gks-ai-card.current { border-color: var(--gks-cyan); box-shadow: 0 0 0 1px #1b6376; }
.gks-ai-card b { font-size: 11px; padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gks-ai-open { position: relative; border: 0; padding: 0; background: #0d2134; display: block; cursor: pointer; }
.gks-ai-open:disabled { cursor: default; }
.gks-ai-open canvas { display: block; width: 100%; height: auto; }
.gks-ai-card.gks-pending canvas { visibility: hidden; }
.gks-ai-card.gks-pending .gks-ai-open { aspect-ratio: auto; min-height: 110px; background: repeating-linear-gradient(135deg, #0c2033 0 10px, #0a1b2b 10px 20px); }
.gks-ai-wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--gks-muted); font-weight: 700; }
.gks-ai-busy .gks-ai-card.gks-pending .gks-ai-wait { animation: gks-ai-pulse 1.4s ease-in-out infinite; }
@keyframes gks-ai-pulse { 50% { opacity: .35; } }
.gks-ai-caption { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid #1b6376; border-radius: 8px; background: #0a1d30; }
.gks-ai-caption .gks-sub { margin-top: 0 !important; }
.gks-ai-caption textarea { font-size: 12px; }
.gks-ai-results .gks-btn-row { margin-top: 14px; }
.gks-ai-history { margin-top: 18px; padding-top: 12px; border-top: 1px solid #19364d; display: flex; flex-direction: column; gap: 6px; }
.gks-ai-hist { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 1px solid #18384e; background: #0a1b2b; border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.gks-ai-hist:hover { border-color: var(--gks-cyan); }
.gks-ai-hist b { font-size: 12px; }
.gks-ai-hist small { font-size: 10px; color: var(--gks-dim); }
@media (prefers-reduced-motion: reduce) { .gks-ai-busy .gks-ai-card.gks-pending .gks-ai-wait { animation: none; } }

.gks-ai-form .gks-seg button:disabled { opacity: .35; cursor: not-allowed; }
.gks-ai-more { margin-top: 12px; }
.gks-ai-all { display: block; margin-top: 6px; font-size: 12px; color: var(--gks-lime); text-decoration: none; padding: 4px 2px; }
.gks-ai-all:hover { text-decoration: underline; }

/* ---------- Text from image (OCR) — ocr.js ---------- */
.gks-ocr { display: flex; flex-direction: column; gap: 10px; }
.gks-ocr .gks-sub { margin: 6px 0 0 !important; }
.gks-ocr .gks-field { margin-bottom: 0 !important; }
.gks-ocr-src { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gks-ocr-src .gks-ghost-btn { padding: 0 6px; font-size: 11px; height: 34px; }
.gks-ocr-src .gks-ghost-btn[aria-pressed="true"] { border-color: var(--gks-cyan); color: #fff; background: #12324a; }
.gks-ocr-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 120px; padding: 12px; text-align: center; border: 1.5px dashed #2a5470; border-radius: 8px; background: #0a1b2b; cursor: pointer; color: #d6e6f4; font-size: 12px; }
.gks-ocr-drop:hover, .gks-ocr-drop.over, .gks-ocr-drop:focus-visible { border-color: var(--gks-cyan); background: #0d2236; outline: none; }
.gks-ocr-drop.has { border-style: solid; }
.gks-ocr-drop canvas { max-width: 100%; height: auto; border-radius: 4px; background: repeating-conic-gradient(#1a3248 0 25%, #12263a 0 50%) 0 0 / 14px 14px; }
.gks-ocr-drop small { font-size: 11px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.gks-ocr textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; min-height: 120px; }
.gks-ocr-acts .gks-ghost-btn { flex: 1 1 auto; height: 34px; }
