/* Velqu Assets — Creative Mist tokens (same values as VelquTheme/CreativeMist.xcassets). */
:root {
  --primary: #B4AEDB; --secondary: #F2F0F7; --canvas: #F7F7F9; --surface: #FFFFFF; --on-accent: #1D1D1F;
  --text: #1D1D1F; --muted: rgba(29,29,31,.6); --faint: rgba(29,29,31,.38); --border: #EAEAEA; --logo: #1D1D1F;
  --dot: rgba(29,29,31,.09); --ok: #3E8E5E; --issue: #C2563B;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --primary: #9A94C4; --secondary: #2C2A35; --canvas: #17161A; --surface: #222126; --text: #F5F5F7;
    --muted: rgba(245,245,247,.62); --faint: rgba(245,245,247,.38); --border: #323038; --logo: #FFFFFF;
    --dot: rgba(245,245,247,.07); --ok: #6FC08F; --issue: #E88B70; }
}
* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body { font: 14px/1.45 var(--sans); color: var(--text); background: var(--canvas); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

.mark { width: 22px; aspect-ratio: 278.754 / 286.836; background: var(--logo); flex: none;
  -webkit-mask: url(/mark.svg) no-repeat center / contain; mask: url(/mark.svg) no-repeat center / contain; }
.dotted { background-color: var(--canvas); background-image: radial-gradient(var(--dot) 1px, transparent 1.2px); background-size: 20px 20px; }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); white-space: nowrap; transition: background-color .15s ease, transform .15s var(--ease); }
.btn:hover { background: var(--secondary); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); border-color: transparent; color: var(--on-accent); font-weight: 500; }
.btn.primary:hover { filter: brightness(.96); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--secondary); }
.btn.danger { color: var(--issue); }
.btn:disabled { opacity: .4; pointer-events: none; }
.icon { width: 30px; padding: 0; justify-content: center; font-size: 15px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  height: 28px; padding: 0 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); width: 100%; min-width: 0; }
textarea { height: auto; padding: 6px 8px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
input[type=color] { width: 28px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 7px; background: none; cursor: pointer; flex: none; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 3px; }
input[type=color]::-webkit-color-swatch { border: none; border-radius: 4px; }

/* Sign in */
.signin { height: 100%; display: grid; place-items: center; padding: 24px; }
.signin form { position: relative; width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 4px;
  padding: 36px 32px 28px; display: grid; gap: 12px; animation: rise .6s var(--ease) both; }
.signin .label { position: absolute; left: 0; bottom: 100%; padding-bottom: 6px; }
.signin h1 { margin: 14px 0 0; font-size: 24px; letter-spacing: -.02em; }
.signin p { margin: 0 0 6px; color: var(--muted); }
.signin label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.signin input { height: 34px; }
.signin .btn { height: 36px; justify-content: center; margin-top: 4px; }
.error { color: var(--issue); font-size: 13px; min-height: 18px; }

/* Shell */
.app { height: 100%; display: grid; grid-template-rows: 52px 1fr; }
.top { display: flex; align-items: center; gap: 14px; padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--border); min-width: 0; }
.top .brand { display: flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: -.01em; }
.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--secondary); }
.seg button { border: 0; background: transparent; height: 26px; padding: 0 12px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.spacer { flex: 1; }
.status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.status.busy i { background: var(--primary); animation: pulse 1s ease-in-out infinite alternate; }
.status.bad i { background: var(--issue); }

/* Gallery */
.gallery { display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); min-height: 0; height: 100%; }
.cats { border-right: 1px solid var(--border); background: var(--surface); overflow: auto; padding: 10px 8px; }
.cats h4 { margin: 12px 8px 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.cats button { display: flex; width: 100%; justify-content: space-between; border: 0; background: none; padding: 6px 8px; border-radius: 7px; cursor: pointer; text-align: left; color: var(--muted); }
.cats button:hover { background: var(--secondary); }
.cats button.on { background: var(--secondary); color: var(--text); }
.cats button small { color: var(--faint); font-family: var(--mono); font-size: 11px; }
.grid-wrap { overflow: auto; padding: 22px 26px 60px; }
.grid-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.grid-head h2 { margin: 0; font-size: 20px; letter-spacing: -.015em; }
.grid-head input[type=search] { width: 220px; height: 30px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column;
  transition: border-color .15s ease, transform .2s var(--ease); animation: rise .4s var(--ease) both; }
.card:hover { border-color: var(--primary); }
.card.clickable { cursor: pointer; }
.card .pv { height: 180px; display: grid; place-items: center; padding: 14px; border-bottom: 1px solid var(--border); }
.card .pv svg { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; }
.card .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; padding: 9px 10px 10px 12px; }
.card .meta b { font-weight: 500; flex: 1 1 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta .btn:first-of-type { margin-left: auto; }
.card .meta .btn { height: 26px; padding: 0 9px; font-size: 12.5px; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 10px; }

/* Editor */
.editor { display: grid; grid-template-columns: 240px minmax(0, 1fr) 260px; grid-template-rows: minmax(0, 1fr); min-height: 0; height: 100%; }
.panel { background: var(--surface); overflow: auto; min-height: 0; }
.panel.left { border-right: 1px solid var(--border); }
.panel.right { border-left: 1px solid var(--border); }
.panel section { padding: 12px; border-bottom: 1px solid var(--border); display: grid; gap: 8px; }
.panel h4 { margin: 0; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.field { display: grid; grid-template-columns: 18px 1fr; align-items: center; gap: 4px; }
.field span { font-size: 11px; color: var(--faint); text-align: center; }
.inline { display: flex; align-items: center; gap: 6px; }
.layers { padding: 6px; }
.layer { display: flex; align-items: center; gap: 6px; height: 26px; padding-right: 6px; border-radius: 6px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.layer:hover { background: var(--secondary); }
.layer.on { background: var(--secondary); color: var(--text); box-shadow: inset 2px 0 0 var(--primary); }
.layer .k { width: 14px; text-align: center; font-size: 11px; color: var(--faint); flex: none; }
.layer .n { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.layer.hidden-node .n { opacity: .45; }

.stage { position: relative; overflow: hidden; min-width: 0; touch-action: none; }
.tools { position: absolute; z-index: 5; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.tools .sep { width: 1px; background: var(--border); margin: 4px 3px; }
.tools .btn.on { background: var(--primary); color: var(--on-accent); }
.zoom { position: absolute; z-index: 5; bottom: 12px; right: 12px; display: flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px; }
.zoom span { min-width: 46px; text-align: center; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.world svg { display: block; overflow: visible; }
.world .frame-label { position: absolute; left: 0; bottom: 100%; padding-bottom: 4px; font: 11px var(--mono); color: var(--muted); white-space: nowrap; transform-origin: 0 100%; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.box { position: absolute; border: 1.5px solid var(--primary); }
.box.hover { border-width: 1px; opacity: .7; }
.box.draft { border-style: dashed; }
.handle { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; background: #fff; border: 1.5px solid var(--primary); border-radius: 2px; pointer-events: auto; }
.size-badge { position: absolute; transform: translateX(-50%); padding: 1px 7px; border-radius: 5px; background: var(--primary); color: var(--on-accent);
  font: 500 10.5px var(--mono); white-space: nowrap; }
.text-edit { position: absolute; z-index: 6; border: 1.5px solid var(--primary); background: rgba(255,255,255,.96); color: #1D1D1F; padding: 0 2px; resize: none; outline: none; line-height: 1.2; }

/* Notices and dialogs */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50; padding: 9px 14px; border-radius: 10px;
  background: var(--text); color: var(--surface); font-size: 13px; animation: rise .3s var(--ease) both; max-width: min(560px, 90vw); }
dialog { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); padding: 22px; width: min(560px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.25); }
dialog h3 { margin: 0 0 6px; font-size: 17px; }
dialog p { margin: 0 0 12px; color: var(--muted); }
dialog textarea { width: 100%; height: 150px; font-family: var(--mono); font-size: 12px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.loading { height: 100%; display: grid; place-items: center; color: var(--muted); }
.loading .bar { width: 180px; height: 3px; border-radius: 2px; background: var(--border); overflow: hidden; margin-top: 12px; }
.loading .bar i { display: block; height: 100%; width: 40%; background: var(--primary); animation: slide 1.2s var(--ease) infinite; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 1100px) { .editor { grid-template-columns: 200px 1fr 230px; } .gallery { grid-template-columns: 180px 1fr; } }
