/* FlowBuilder Studio demo app */
body { background: var(--bg-2); }
.demo-banner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; padding: 8px 16px; background: var(--deep); color: #fff; font-size: 13.5px; }
.demo-banner a, .demo-banner .linkish { color: #e9d5ff; }
.banner-actions { display: flex; gap: 16px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; color: var(--accent); }

.app { display: grid; grid-template-columns: 232px 1fr; min-height: calc(100vh - 36px); }
.side { background: var(--bg); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: calc(100vh - 36px); overflow: auto; }
.side .brand { padding: 4px 10px 16px; }
.studio-name { padding: 0 10px 14px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.studio-name b { display: block; color: var(--ink); font-size: 15px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-size: 14.5px; }
.side nav a:hover { background: var(--bg-3); }
.side nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side nav svg { width: 18px; height: 18px; flex: 0 0 18px; }
.side .sep { margin: 14px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.main { padding: 26px clamp(16px, 3vw, 40px) 80px; min-width: 0; }
.topbar { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; position: fixed; inset: 0 30% 0 0; z-index: 30; height: 100vh; box-shadow: var(--shadow-lg); }
  .side.open { display: block; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
  .topbar button { background: none; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font: inherit; color: var(--ink); }
}

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(26px, 3.4vw, 34px); }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.b { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 14px; font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap; }
.b:hover { background: var(--bg-3); }
.b.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.b.pri:hover { background: var(--accent-2); }
.b.danger { color: #b91c1c; }
.b.sm { padding: 6px 10px; font-size: 13px; }
.b[disabled] { opacity: .5; cursor: default; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; margin-bottom: 18px; }
.panel h2 { font-size: 18px; margin-bottom: 12px; letter-spacing: -0.01em; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; }
.stat b { display: block; font-size: 28px; letter-spacing: -0.02em; }
.stat span { color: var(--muted); font-size: 13.5px; }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr 1fr; } }

/* schedule */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
select, input[type=text], input[type=email], input[type=number], input[type=date], input[type=time], input[type=search], textarea {
  font: inherit; font-size: 14.5px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; max-width: 100%;
}
textarea { width: 100%; min-height: 70px; resize: vertical; }
label.f { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }
label.f input, label.f select, label.f textarea { font-weight: 400; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day h3 { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 8px; }
.day h3.today { color: var(--accent); }
.day h3 span { display: block; font-size: 20px; color: var(--ink); letter-spacing: -0.01em; text-transform: none; }
.day h3.today span { color: var(--accent); }
.cls { display: block; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--c, var(--accent)); border-radius: 10px; padding: 9px 10px; margin-bottom: 8px; text-decoration: none; color: var(--ink); font-size: 13px; }
.cls:hover { box-shadow: var(--shadow); }
.cls b { display: block; font-size: 13.5px; line-height: 1.25; }
.cls .t { color: var(--muted); font-size: 12.5px; }
.cls.past { opacity: .62; }
.cls.cancelled b { text-decoration: line-through; }
.cls .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-size: 11px; font-weight: 650; padding: 2px 7px; border-radius: 99px; background: var(--bg-3); color: var(--ink-2); white-space: nowrap; }
.tag.flow { background: var(--accent-soft); color: var(--accent); }
.tag.full { background: var(--sun-soft); color: var(--sun); }
.tag.ok { background: var(--sage-soft); color: var(--sage); }
@media (max-width: 980px) {
  .week { grid-template-columns: 1fr; gap: 4px; }
  .day { display: grid; grid-template-columns: 76px 1fr; gap: 10px; border-bottom: 1px solid var(--line); padding: 10px 0; }
  .day .empty { color: var(--muted); font-size: 13px; padding-top: 6px; }
}
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row a.title { color: var(--ink); font-weight: 600; text-decoration: none; }
.list-row a.title:hover { color: var(--accent); }
.av { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12.5px; background: var(--c, var(--accent)); }
.av.lg { width: 56px; height: 56px; flex-basis: 56px; font-size: 18px; }
.faces2 { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.faces2 .who { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 58px; font-size: 12px; color: var(--ink-2); text-align: center; }

/* toggles */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch:last-child { border-bottom: 0; }
.switch .lbl b { display: block; font-size: 15px; }
.switch .lbl span { color: var(--muted); font-size: 13px; }
.tg { position: relative; width: 46px; height: 28px; flex: 0 0 46px; }
.tg input { opacity: 0; width: 0; height: 0; position: absolute; }
.tg i { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .2s; cursor: pointer; }
.tg i::after { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .2s; }
.tg input:checked + i { background: var(--accent); }
.tg input:checked + i::after { transform: translateX(18px); }
.tg input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.linkbox { display: flex; gap: 8px; align-items: center; background: var(--bg-3); border-radius: 10px; padding: 8px 8px 8px 12px; font-size: 13px; }
.linkbox code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Menlo, monospace; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-color: var(--accent); }

/* poses */
.poses { display: grid; gap: 0; }
.prow { display: grid; grid-template-columns: 24px 48px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; }
.prow .n { color: var(--muted); font-size: 12px; text-align: right; }
.prow .nm { font-weight: 600; font-size: 14.5px; line-height: 1.25; }
.prow .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.prow.skipped { opacity: .5; }
.prow.skipped .nm > span { text-decoration: line-through; }
.prow .ctrl { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.prow .ctrl input[type=number] { width: 70px; padding: 5px 6px; }
.prow .ctrl select { padding: 5px 6px; }
.ib { background: none; border: 1px solid var(--line); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; color: var(--ink-2); font-size: 14px; display: grid; place-items: center; }
.ib:hover { background: var(--bg-3); }
.thumb { width: 48px; height: 48px; border-radius: 10px; background: var(--bg-3); display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 42px; height: 42px; }
.thumb img.mirror { transform: scaleX(-1); }
.thumb .ph { font-size: 11px; color: var(--muted); }
.strip2 { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.strip2 figure { margin: 0; flex: 0 0 72px; text-align: center; }
.strip2 .thumb { width: 72px; height: 72px; }
.strip2 .thumb img { width: 62px; height: 62px; }
.strip2 figcaption { font-size: 11px; color: var(--ink-2); margin-top: 4px; line-height: 1.2; }
.strip2 figcaption small { color: var(--muted); display: block; }
@media (max-width: 600px) { .prow { grid-template-columns: 40px minmax(0,1fr); } .prow .n { display: none; } .prow .ctrl { grid-column: 1 / -1; justify-content: flex-start; } .thumb { width: 40px; height: 40px; } .thumb img { width: 34px; height: 34px; } }

.picker { position: relative; }
.picker-list { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 320px; overflow: auto; }
.picker-list button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 6px 10px; border: 0; background: none; text-align: left; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
.picker-list button:hover, .picker-list button:focus { background: var(--accent-soft); }
.picker-list .thumb { width: 36px; height: 36px; }
.picker-list .thumb img { width: 30px; height: 30px; }
.picker-list small { color: var(--muted); display: block; font-size: 12px; }

/* public pages */
.pub { max-width: 760px; margin: 0 auto; padding: 24px 16px 80px; }
.pub-wide { max-width: 1100px; }
.pub-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.pub-head .logo { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #2d1654, #7c3aed); color: #fff; display: grid; place-items: center; font-weight: 800; }
.pub-head b { font-size: 17px; display: block; }
.pub-head span { color: var(--muted); font-size: 13.5px; }
.pub-note { background: var(--sun-soft); color: var(--sun); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 18px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pub-note a { color: inherit; font-weight: 600; }
.hero-class h1 { font-size: clamp(28px, 5vw, 40px); }
.meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--ink-2); margin: 12px 0 18px; font-size: 15px; }
.cap { height: 8px; background: var(--bg-3); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.cap i { display: block; height: 100%; background: var(--sage); border-radius: 99px; }
.cap.full i { background: var(--sun); }
.ok-box { background: var(--sage-soft); color: var(--sage); border-radius: 12px; padding: 14px 16px; font-weight: 600; }
.ok-box p { font-weight: 400; color: var(--ink-2); margin: 6px 0 0; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.cmt { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cmt:last-child { border-bottom: 0; }
.cmt .body { flex: 1; min-width: 0; }
.cmt .body b { font-size: 14px; }
.cmt .body p { margin: 3px 0 0; color: var(--ink-2); font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cmt .on-pose { font-size: 12px; color: var(--accent); font-weight: 600; }
.media { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.media .m { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--bg-2); }
.media video { width: 100%; border-radius: 8px; background: #000; max-height: 220px; }
.media audio { width: 100%; }
.media .m b { font-size: 14px; display: block; margin-bottom: 6px; overflow-wrap: anywhere; }
.empty-state { text-align: center; color: var(--muted); padding: 22px 10px; font-size: 14.5px; }

/* dialog, toast */
.dlg { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg); }
.dlg::backdrop { background: rgba(20, 12, 40, .45); }
.dlg form { padding: 22px; max-height: 86vh; overflow: auto; }
.dlg h2 { font-size: 21px; margin-bottom: 14px; }
.dlg .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }
pre.code { background: var(--bg-3); border-radius: 10px; padding: 12px; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; margin: 0; }
.embed-frame { border: 1px solid var(--line); border-radius: 12px; width: 100%; height: 420px; background: var(--bg); }
.cols > *, .main-wrap, .week > * { min-width: 0; }
.pub-mid { max-width: 1000px; }
