/* Landing Studio. Jazital indigo UI, ink + orange brand mark, 5px buttons, light and dark. */
:root {
  --bg: #f7f7f9; --panel: #ffffff; --elev: #ffffff; --line: #e6e6ec; --line-2: #d9d9e2;
  --ink: #0f0f1a; --text: #2a2a37; --muted: #6b6b7b; --faint: #9a9aab;
  --accent: #4f46e5; --accent-ink: #4338ca; --accent-soft: #eef0ff; --on-accent: #fff;
  --ok: #15803d; --ok-soft: #e8f6ee; --warn: #b45309; --warn-soft: #fdf3e5; --err: #c81e1e; --err-soft: #fdecec;
  --orange: #fd740c; --brand-ink: #1e1b4b;
  --r: 5px; --r-card: 10px; --shadow: 0 1px 2px rgba(16, 16, 30, .06), 0 8px 24px -12px rgba(16, 16, 30, .18);
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0c0c12; --panel: #13131b; --elev: #191923; --line: #24242f; --line-2: #2f2f3c;
  --ink: #f5f5fa; --text: #dcdce6; --muted: #9a9aae; --faint: #6c6c80;
  --accent: #7c75ff; --accent-ink: #a29dff; --accent-soft: rgba(124, 117, 255, .14);
  --ok: #4ade80; --ok-soft: rgba(74, 222, 128, .12); --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12); --err: #f87171; --err-soft: rgba(248, 113, 113, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -12px rgba(0, 0, 0, .6); color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #0c0c12; --panel: #13131b; --elev: #191923; --line: #24242f; --line-2: #2f2f3c;
  --ink: #f5f5fa; --text: #dcdce6; --muted: #9a9aae; --faint: #6c6c80;
  --accent: #7c75ff; --accent-ink: #a29dff; --accent-soft: rgba(124, 117, 255, .14);
  --ok: #4ade80; --ok-soft: rgba(74, 222, 128, .12); --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12); --err: #f87171; --err-soft: rgba(248, 113, 113, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -12px rgba(0, 0, 0, .6); color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
[hidden] { display: none !important; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--elev); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, opacity .12s; }
.btn:hover { background: var(--bg); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.live { background: var(--ok); border-color: var(--ok); color: #fff; }
:root[data-theme="dark"] .btn.live { color: #062b14; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.icon { width: 32px; padding: 0; }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn svg { width: 16px; height: 16px; }
.seg { display: inline-flex; padding: 2px; border-radius: 7px; background: var(--bg); border: 1px solid var(--line); }
.seg button { height: 26px; padding: 0 9px; border: 0; border-radius: var(--r); background: none; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; }
.seg button.on { background: var(--elev); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.seg svg { width: 15px; height: 15px; }

/* Shell */
.app { display: grid; grid-template-rows: 52px 1fr; height: 100vh; }
.top { display: flex; align-items: center; gap: 12px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.top .mark { height: 30px; }
.top .mark.dark { display: none; }
:root[data-theme="dark"] .top .mark.light { display: none; }
:root[data-theme="dark"] .top .mark.dark { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top .mark.light { display: none; } :root:not([data-theme="light"]) .top .mark.dark { display: block; } }
.top .spacer { flex: 1; }
.body { display: grid; grid-template-columns: 264px 1fr; min-height: 0; }

/* Sidebar */
.side { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.side-head { display: flex; gap: 8px; padding: 12px; }
.search { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--bg); }
.list { overflow: auto; padding: 0 8px 16px; }
.list h6 { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--faint); padding: 14px 8px 6px; }
.item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 8px; border: 0; border-radius: 6px; background: none; text-align: left; cursor: pointer; }
.item:hover { background: var(--bg); }
.item.on { background: var(--accent-soft); color: var(--accent-ink); }
.item .dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; background: var(--line-2); }
.item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.badge { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.err { background: var(--err-soft); color: var(--err); border-color: transparent; }
.badge.acc { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

/* Workspace */
.main { display: grid; grid-template-rows: auto 1fr; min-width: 0; min-height: 0; }
.bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 56px; flex-wrap: wrap; }
.bar .title { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.bar .title b { font-size: 15px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .title a { font-size: 12px; color: var(--muted); }
.bar .msg { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.bar .msg.err { color: var(--err); }
.bar .msg.ok { color: var(--ok); }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.split { display: grid; grid-template-columns: minmax(380px, 470px) 1fr; min-height: 0; }
.split.wide { grid-template-columns: minmax(420px, 1fr) 1fr; }
.empty { display: grid; place-items: center; color: var(--faint); }
.empty div { text-align: center; display: grid; gap: 12px; justify-items: center; }

/* Editor */
.editor { overflow: auto; background: var(--panel); border-right: 1px solid var(--line); min-height: 0; }
.tabs { position: sticky; top: 0; z-index: 3; display: flex; gap: 2px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { height: 28px; padding: 0 8px; border: 0; border-radius: var(--r); background: none; color: var(--muted); font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap; position: relative; }
.tabs button.on { background: var(--accent-soft); color: var(--accent-ink); }
.tabs button .n { position: absolute; top: 2px; right: 1px; width: 7px; height: 7px; border-radius: 50%; background: var(--err); }
.sec { padding: 16px 16px 8px; border-bottom: 1px solid var(--line); }
.sec > h3 { font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--faint); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.sec > h3 .btn { margin-left: auto; }
.f { display: grid; gap: 5px; margin-bottom: 12px; }
.f > label, .f > .lbl { font-size: 12.5px; font-weight: 600; color: var(--text); display: flex; gap: 6px; align-items: baseline; }
.f .count { margin-left: auto; font-weight: 500; color: var(--faint); font-size: 11.5px; }
.f .count.over { color: var(--warn); }
.in, .ta, .sel { width: 100%; min-height: 34px; padding: 7px 10px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--elev); transition: border-color .12s, box-shadow .12s; }
.in:focus, .ta:focus, .sel:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ta { resize: vertical; min-height: 64px; }
.in[readonly] { color: var(--muted); background: var(--bg); }
.f.bad .in, .f.bad .ta, .f.bad .sel, .f.bad .drop { border-color: var(--err); }
.f .err { font-size: 12px; color: var(--err); }
.f .warn { font-size: 12px; color: var(--warn); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; cursor: pointer; }

/* Lists */
.card { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--elev); margin-bottom: 10px; }
.card-head { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.card-head .t { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head .grip { cursor: grab; color: var(--faint); display: grid; }
.card.closed .card-body { display: none; }
.card.closed .card-head { border-bottom: 0; }
.card.drag-over { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card-body { padding: 12px 10px 2px; }
.card.bad { border-color: var(--err); }
.add { width: 100%; height: 34px; border: 1px dashed var(--line-2); border-radius: var(--r); background: none; color: var(--muted); font-weight: 600; cursor: pointer; margin-bottom: 14px; }
.add:hover { border-color: var(--accent); color: var(--accent-ink); }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; min-height: 34px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--elev); }
.tags:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 4px 0 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); font-size: 12.5px; font-weight: 500; cursor: default; }
.tag.pro { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.tag button { border: 0; background: none; width: 18px; height: 18px; border-radius: 3px; cursor: pointer; color: var(--faint); display: grid; place-items: center; }
.tag button:hover { background: var(--line); color: var(--text); }
.tags input { flex: 1; min-width: 90px; border: 0; background: none; outline: none; padding: 0 4px; }

/* Images */
.drop { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px dashed var(--line-2); border-radius: var(--r-card); background: var(--bg); cursor: pointer; transition: border-color .12s, background .12s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .thumb { width: 76px; height: 52px; border-radius: 6px; background: var(--elev) center/contain no-repeat; border: 1px solid var(--line); flex-shrink: 0; display: grid; place-items: center; color: var(--faint); }
.drop .thumb svg { width: 22px; height: 22px; }
.drop .meta { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop .meta b { display: block; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

/* Colour + palette */
.color { display: flex; gap: 8px; align-items: center; }
.color input[type=color] { width: 40px; height: 34px; padding: 2px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--elev); cursor: pointer; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.sw { display: grid; gap: 3px; justify-items: center; font-size: 10.5px; color: var(--muted); }
.sw i { width: 34px; height: 34px; border-radius: 7px; border: 1px solid var(--line); display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 13px; }
.checks { display: grid; gap: 3px; margin-bottom: 12px; }
.checks div { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.checks .r { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.checks .p { color: var(--ok); font-weight: 700; width: 14px; }
.checks .x { color: var(--err); font-weight: 700; width: 14px; }

/* Icon picker */
.iconbtn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--elev); cursor: pointer; width: 100%; }
.iconbtn svg { width: 18px; height: 18px; color: var(--accent-ink); }
.pop { position: fixed; z-index: 50; width: 320px; max-height: 340px; display: grid; grid-template-rows: auto 1fr; gap: 8px; padding: 10px; border-radius: var(--r-card); background: var(--elev); border: 1px solid var(--line); box-shadow: var(--shadow); }
.pop .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; overflow: auto; }
.pop .grid button { aspect-ratio: 1; border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; display: grid; place-items: center; color: var(--text); }
.pop .grid button:hover, .pop .grid button.on { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-soft); }
.pop .grid svg { width: 20px; height: 20px; }

/* Preview */
.pane { display: grid; grid-template-rows: 44px 1fr; min-width: 0; min-height: 0; background: var(--bg); }
.pane-bar { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.pane-bar .spacer { flex: 1; }
.stage { position: relative; overflow: hidden; }
.stage .frame { position: absolute; top: 0; left: 0; border: 0; background: #fff; transform-origin: 0 0; transition: opacity .18s; }
.stage.phone .frame { border-radius: 26px; box-shadow: 0 0 0 10px #111, 0 30px 60px -20px rgba(0, 0, 0, .5); }
.stage .frame.back { opacity: 0; pointer-events: none; }

/* Code editor (hand-built pages) */
.code { display: grid; grid-template-columns: auto 1fr; min-height: 0; height: 100%; background: var(--panel); font: 12.5px/1.6 var(--mono); }
.code .gutter { padding: 12px 8px 12px 12px; text-align: right; color: var(--faint); user-select: none; overflow: hidden; white-space: pre; border-right: 1px solid var(--line); }
.code textarea { border: 0; outline: none; resize: none; padding: 12px; background: none; font: inherit; white-space: pre; overflow: auto; tab-size: 2; color: var(--text); }
.code-wrap { display: grid; grid-template-rows: auto 1fr; min-height: 0; border-right: 1px solid var(--line); }
.code-tools { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }

/* Dialogs, login */
.scrim { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(10, 10, 20, .45); backdrop-filter: blur(3px); }
.dialog { width: min(420px, calc(100vw - 32px)); padding: 22px; border-radius: 14px; background: var(--elev); border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; gap: 14px; }
.dialog h2 { font-size: 17px; color: var(--ink); }
.dialog .acts { display: flex; justify-content: flex-end; gap: 8px; }
.login { height: 100vh; display: grid; place-items: center; background: var(--bg); }
.login form { width: min(340px, calc(100vw - 32px)); display: grid; gap: 14px; justify-items: center; }
.login img { width: 72px; height: 72px; }
.login h1 { font-size: 20px; color: var(--ink); }
.login .in, .login .btn { width: 100%; height: 40px; }
.login .err { color: var(--err); font-size: 13px; min-height: 18px; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 70; padding: 9px 14px; border-radius: 8px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 13px; box-shadow: var(--shadow); }
.issues { display: grid; gap: 4px; padding: 10px 16px; background: var(--err-soft); border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--err); }
.issues button { all: unset; cursor: pointer; text-decoration: underline; }

@media (max-width: 1180px) {
  .body { grid-template-columns: 220px 1fr; }
  .split { grid-template-columns: minmax(340px, 400px) 1fr; }
}
