:root {
  --bg: #f7f4f2; --surface: #ffffff; --surface-2: #f1ece9; --line: #e4dcd7; --ink: #211c22; --ink-2: #5d5560; --ink-3: #8f8691;
  --accent: #d9475f; --accent-ink: #ffffff; --accent-soft: #fbe3e7; --ok: #1f8a5b; --ok-soft: #dff3ea; --warn: #b26a00; --warn-soft: #fbefd9;
  --bad: #c23434; --bad-soft: #fbe2e2; --info: #2f63c9; --info-soft: #e2eafb; --radius: 14px; --shadow: 0 1px 2px rgba(30,20,30,.06), 0 4px 16px rgba(30,20,30,.05);
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17141a; --surface: #211d25; --surface-2: #2a252f; --line: #3a333f; --ink: #f2edf3; --ink-2: #c3b9c6; --ink-3: #8e8493;
    --accent: #f06a82; --accent-ink: #1b0f13; --accent-soft: #43222b; --ok: #4cc28d; --ok-soft: #173327; --warn: #e3a64a; --warn-soft: #3a2c15;
    --bad: #f07272; --bad-soft: #3d1d1d; --info: #7fa6f3; --info-soft: #1d2840; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 16px; } h4 { font-size: 14px; color: var(--ink-2); }
small, .muted { color: var(--ink-3); font-size: 13px; }
button, input, select, textarea { font: inherit; color: inherit; }

.layout { display: flex; min-height: 100vh; }
.side { width: 200px; flex-shrink: 0; border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; background: var(--surface); }
.brand { font-weight: 800; font-size: 17px; padding: 4px 10px 16px; letter-spacing: -.02em; }
.brand span { color: var(--accent); }
.nav a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; color: var(--ink-2); font-weight: 600; }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.nav .ico { width: 20px; text-align: center; }
main { flex: 1; min-width: 0; padding: 22px 28px 60px; max-width: 1180px; }
.bottom-nav { display: none; }
@media (max-width: 760px) {
  .side { display: none; }
  main { padding: 14px 16px 96px; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 7px 0 6px; font-size: 11px; color: var(--ink-3); font-weight: 600; }
  .bottom-nav a .ico { font-size: 18px; line-height: 1.2; }
  .bottom-nav a.on { color: var(--accent); }
}

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.tight { padding: 12px; }
.card h3 + * { margin-top: 10px; }
.section { margin-top: 22px; }
.section > h2, .section > .row > h2 { margin-bottom: 10px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap; min-height: 38px; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.form .wide { grid-column: 1 / -1; }
input[type=text], input[type=url], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=password], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; min-height: 38px; font-size: 16px;
}
@media (min-width: 761px) { input, select, textarea { font-size: 14px !important; } }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; cursor: pointer; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.check.done span { color: var(--ink-3); text-decoration: line-through; }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 6px 0 16px; scrollbar-width: none; }
.tabs a { padding: 9px 12px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-color: var(--accent); }

.list > * + * { border-top: 1px solid var(--line); }
.item { padding: 10px 0; display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.item .main { min-width: 0; flex: 1; }
.item .title { font-weight: 600; overflow-wrap: anywhere; }

.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.col { width: 250px; flex-shrink: 0; background: var(--surface-2); border-radius: var(--radius); padding: 10px; }
.col h3 { font-size: 14px; display: flex; justify-content: space-between; margin: 2px 4px 8px; }
.bcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; cursor: pointer; display: block; color: inherit; }
.bcard .t { font-weight: 600; font-size: 14px; }
@media (max-width: 760px) { .board { flex-direction: column; overflow: visible; } .col { width: 100%; } }

.scene { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px; display: grid; grid-template-columns: 120px 1fr; gap: 12px; }
.scene.fix { border-color: var(--bad); }
.scene .thumb { width: 120px; aspect-ratio: 9 / 16; border-radius: 10px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--ink-3); font-size: 12px; text-align: center; cursor: pointer; border: 1px dashed var(--line); }
.scene .thumb img, .scene .thumb video { width: 100%; height: 100%; object-fit: cover; }
.scene .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-width: 0; }
.scene .fields .wide { grid-column: 1 / -1; }
@media (max-width: 760px) { .scene { grid-template-columns: 84px 1fr; padding: 10px; } .scene .thumb { width: 84px; } .scene .fields { grid-template-columns: 1fr; } }
.scene-head { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

.assets { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.asset { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.asset .pv { aspect-ratio: 1; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.asset .pv img, .asset .pv video { width: 100%; height: 100%; object-fit: cover; }
.asset .meta { padding: 8px; font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.asset.sel { outline: 3px solid var(--accent); }

video.player { width: 100%; max-width: 360px; aspect-ratio: 9 / 16; background: #000; border-radius: 12px; display: block; }
audio { width: 100%; max-width: 420px; height: 40px; }

.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.step { font-size: 12px; padding: 4px 8px; border-radius: 8px; background: var(--surface-2); color: var(--ink-3); font-weight: 600; }
.step.done { background: var(--ok-soft); color: var(--ok); }
.step.running { background: var(--info-soft); color: var(--info); }
.step.failed { background: var(--bad-soft); color: var(--bad); }
.flow { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.flow .f { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--surface); }
.flow .f b { display: block; font-size: 13px; }
.flow .f.ok { border-color: var(--ok); }
.flow .f.warn { border-color: var(--warn); }
pre.log { background: var(--surface-2); padding: 10px; border-radius: 10px; font-size: 12px; white-space: pre-wrap; max-height: 260px; overflow: auto; margin: 8px 0 0; }

.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.next { background: var(--accent); color: var(--accent-ink); border: 0; }
.next small { color: inherit; opacity: .85; }
.next a { color: inherit; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.table-wrap { overflow-x: auto; }
.notice { padding: 10px 12px; border-radius: 10px; background: var(--info-soft); color: var(--ink-2); font-size: 13px; }
.notice.warn { background: var(--warn-soft); }
.notice.bad { background: var(--bad-soft); }
.empty { color: var(--ink-3); padding: 16px 0; text-align: center; font-size: 14px; }

dialog { border: 0; border-radius: 18px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(20,10,20,.45); }
dialog .dh { padding: 16px 18px 0; display: flex; justify-content: space-between; align-items: center; }
dialog .db { padding: 14px 18px; overflow-y: auto; max-height: calc(100vh - 170px); }
dialog .df { padding: 0 18px 16px; display: flex; gap: 8px; justify-content: flex-end; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 100; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
#toast div { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
#toast div.bad { background: var(--bad); color: #fff; }
.login { max-width: 360px; margin: 18vh auto; }
.hide-m { } @media (max-width: 760px) { .hide-m { display: none !important; } }
