/* ClipEngine production tool - ClipEngine SaaS design, FLAT variant
   (solid fills, hairline borders, NO gradients, NO shadows; Space Grotesk + Inter) */
:root {
  --bg: #EEF0F4;
  --ink: #0A0A0B;
  --ink-2: #54555E;
  --white: #fff;
  --line: rgba(10, 10, 11, .12);
  --accent: #2B4CFF;
  --lime: #C7F94B;
  --muted: #54555E;
  --r: 18px;
  --r-sm: 12px;
  --sans: 'Inter', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; box-shadow: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--sans); color: var(--ink); margin: 0 0 .4rem; font-weight: 700; letter-spacing: -0.02em; }
.mono, .k, .group-title, .badge, .tag, .step, .brand b, .btn, .nav a, label, .topbar .title { font-family: var(--sans); }

/* no decorative gradient mesh; keep a faint hairline grid only */
.mesh { display: none !important; }
.gridbg { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(rgba(10, 10, 11, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(10, 10, 11, .035) 1px, transparent 1px);
  background-size: 48px 48px; }

/* App shell */
.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.sidebar {
  width: 244px; margin: 16px; height: calc(100vh - 32px); position: sticky; top: 16px; flex-shrink: 0;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; }
.brand .logo {
  width: 34px; height: 34px; background: var(--accent); color: #fff;
  border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 14px; letter-spacing: -.02em;
}
.brand b { color: var(--ink); font-size: 19px; letter-spacing: -0.02em; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 12px;
  color: var(--ink-2); font-weight: 500; margin-bottom: 4px; cursor: pointer; transition: background .2s, color .2s;
}
.nav a:hover { background: #F1F2F6; color: var(--ink); }
.nav a.active { background: var(--accent); color: #fff; }
.nav a .ic { width: 18px; text-align: center; }

.main { flex: 1; min-width: 0; }
.topbar {
  height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
  position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar .title { font-weight: 700; color: var(--ink); font-size: 18px; letter-spacing: -.02em; }
.content { padding: 20px 28px 40px; max-width: 1180px; }

/* Cards - solid, hairline border, no shadow */
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r);
  padding: 24px; margin-bottom: 20px;
}
.card h3 { font-size: 17px; letter-spacing: -.02em; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

/* Template cards */
.tpl {
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 16px; cursor: pointer;
  background: var(--white); transition: transform .2s cubic-bezier(.2, .8, .2, 1), border-color .2s, background .2s;
}
.tpl:hover { transform: translateY(-2px); border-color: var(--accent); }
.tpl.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.tpl.selected h4 { color: #fff; }
.tpl.selected p { color: rgba(255, 255, 255, .8); }
.tpl.selected .tag { background: rgba(255, 255, 255, .2); color: #fff; }
.tpl .dot { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; color: #fff; font-weight: 800; margin-bottom: 12px; }
.tpl.selected .dot { background: rgba(255, 255, 255, .18); }
.tpl h4 { font-size: 15px; margin-bottom: 3px; }
.tpl p { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 10.5px; padding: 3px 10px; border-radius: 999px; background: rgba(43, 76, 255, .1); color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }

/* Forms */
label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 0 0 7px; text-transform: uppercase; letter-spacing: .04em; }
.field { margin-bottom: 16px; }
input[type=text], input[type=number], select, textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; font: inherit;
  font-family: var(--body); color: var(--ink); background: var(--white); outline: none; transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 150px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* Segmented toggle */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--white); }
.seg button { padding: 10px 16px; background: transparent; border: none; border-right: 1px solid var(--line); cursor: pointer; font: inherit; font-family: var(--sans); font-weight: 600; color: var(--ink-2); transition: background .2s, color .2s; }
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--accent); color: #fff; }

/* Buttons - solid, flat */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border: 1px solid var(--accent); border-radius: var(--r-sm);
  background: var(--accent); color: #fff; font: inherit; font-family: var(--sans); font-weight: 600;
  cursor: pointer; font-size: 14px; transition: transform .2s cubic-bezier(.2, .8, .2, 1), background .2s;
}
.btn:hover { transform: translateY(-2px); background: #1f3ce0; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.ghost { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: #F1F2F6; }
.btn.gray { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.gray:hover { background: #26262b; }
.btn.sm { padding: 8px 14px; font-size: 12.5px; }

/* Badges - tonal pills */
.badge { font-size: 11px; padding: 4px 11px; border-radius: 999px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.badge.ok { background: rgba(40, 199, 111, .16); color: #1f9d57; }
.badge.err { background: rgba(255, 76, 81, .16); color: #e03b40; }
.badge.run { background: rgba(43, 76, 255, .14); color: var(--accent); }
.badge.muted { background: rgba(10, 10, 11, .06); color: var(--muted); }

/* Stepper */
.stepper { display: flex; gap: 8px; margin: 12px 0 4px; }
.step { flex: 1; text-align: center; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.step .bar { height: 8px; border-radius: 999px; background: rgba(10, 10, 11, .08); margin-bottom: 7px; overflow: hidden; }
.step.done .bar { background: var(--accent); }
.step.active .bar { background: var(--lime); }
.step.active { color: var(--ink); font-weight: 700; }

/* YouTube preview thumbs */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--white); transition: transform .2s, border-color .2s; }
.thumb:hover { transform: translateY(-2px); border-color: var(--accent); }
.thumb img { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; }
.thumb .cap { padding: 9px 11px; font-size: 11.5px; color: var(--ink); line-height: 1.35; }

/* Video */
video { width: 100%; border-radius: var(--r-sm); border: 1px solid var(--line); background: #000; }
.vwrap.v916 { max-width: 300px; }

/* Library list */
.jitem { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.jitem:last-child { border-bottom: none; }
.jitem .meta { flex: 1; min-width: 0; }
.jitem .meta b { color: var(--ink); }
.jitem .meta .sub { font-size: 12px; color: var(--muted); font-family: var(--sans); }

/* Settings */
.setrow { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setrow:last-child { border-bottom: none; }
.setrow .lab { width: 260px; }
.setrow .lab b { color: var(--ink); display: block; font-size: 13.5px; }
.setrow .lab .k { font-size: 11px; color: var(--muted); }
.setrow .val { flex: 1; display: flex; gap: 8px; }
.group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; margin: 20px 0 2px; }
.banner { background: rgba(255, 159, 67, .15); color: #b9771a; padding: 13px 16px; border-radius: var(--r-sm); font-weight: 600; margin-bottom: 16px; border: 1px solid rgba(255, 159, 67, .3); font-size: 13px; }
.banner.ok { background: rgba(40, 199, 111, .16); color: #1f9d57; border-color: rgba(40, 199, 111, .3); }
.banner.err { background: rgba(255, 76, 81, .16); color: #e03b40; border-color: rgba(255, 76, 81, .3); }
.hide { display: none !important; }
.toast {
  position: fixed; bottom: 22px; right: 22px; background: var(--ink); color: #fff;
  padding: 13px 18px; border-radius: var(--r-sm); z-index: 100; font-weight: 600; border: 1px solid var(--ink);
  opacity: 0; transform: translateY(10px); transition: .25s;
}
.toast.show { opacity: 1; transform: none; }
