/* ============================================================================
   CODE BEYOND Studio — Phase 2 셸
   토큰(palette-mobile v1) 위에 컴포넌트만 정의한다. 색은 항상 var()만 쓴다.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 620px at 4% -12%, rgba(255, 176, 32, .10), transparent 60%),
    radial-gradient(900px 680px at 102% 4%, rgba(91, 124, 255, .10), transparent 58%),
    var(--ink);
  color: var(--bone);
  font-family: var(--f-sans);
  font-size: var(--f-body);
  line-height: 1.6;
  letter-spacing: var(--track-tight);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4, p, figure { margin: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; }
code, pre, .mono { font-family: var(--f-mono); }
::selection { background: color-mix(in oklab, var(--flame) 35%, transparent); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  padding: 10px 14px; border-radius: var(--r-m); background: var(--flame); color: #10151c; font-weight: 700;
}
.skip:focus { left: 12px; top: 12px; }
:focus-visible { outline: 2px solid var(--flame); outline-offset: 2px; border-radius: 6px; }

/* ── 셸 ───────────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100dvh; }

.rail {
  position: sticky; top: 0; align-self: flex-start;
  width: var(--rail); min-height: 100dvh;
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: 14px 10px;
  background: color-mix(in oklab, var(--ink-1) 86%, transparent);
  border-right: 1px solid var(--line-soft);
  backdrop-filter: blur(14px);
  z-index: 20;
}
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 12px; }
.rail-brand .mark {
  width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center;
  border-radius: 9px; background: linear-gradient(150deg, var(--flame), #ff7a1a);
  color: #0a0f16; font-weight: 800; font-size: 16px;
}
.rail-brand .rail-label { font-weight: 800; letter-spacing: .18em; font-size: 12px; color: var(--t-62); }
.rail-label { display: none; }

.rail-nav { display: flex; flex-direction: column; gap: 4px; }
.rail-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 44px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: var(--t-62); cursor: pointer;
  transition: background var(--ui) var(--ease), color var(--ui) var(--ease);
}
.rail-item .ico { font-size: 15px; width: 18px; text-align: center; opacity: .9; }
.rail-item:hover { background: color-mix(in oklab, var(--bone) 6%, transparent); color: var(--bone); }
.rail-item[aria-current="page"] {
  background: color-mix(in oklab, var(--flame) 12%, transparent);
  color: var(--bone-hi); border-color: color-mix(in oklab, var(--flame) 26%, transparent);
}
.rail-item[aria-current="page"]::before {
  content: ""; position: absolute; left: -10px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--flame);
}
.rail-sep { height: 1px; margin: 8px 6px; background: var(--line-soft); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

.health, .theme-toggle {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 40px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: transparent;
  color: var(--t-62); font-size: 12px; cursor: pointer;
}
.health .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--a3); box-shadow: 0 0 0 3px color-mix(in oklab, var(--a3) 22%, transparent); }
.health.ok .dot { background: var(--mint); box-shadow: 0 0 0 3px color-mix(in oklab, var(--mint) 22%, transparent); }
.health.warn .dot { background: var(--flame); box-shadow: 0 0 0 3px color-mix(in oklab, var(--flame) 22%, transparent); }
.health span:last-child, .theme-toggle .rail-label { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.cmd {
  position: sticky; top: 0; z-index: 15;
  height: var(--cmdbar-h); display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 var(--pad);
  background: color-mix(in oklab, var(--ink) 82%, transparent);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(16px);
}
.cmd-left { min-width: 0; }
.cmd-right { display: flex; align-items: center; gap: 10px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  white-space: nowrap; min-height: 34px; padding: 0 14px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: transparent; color: var(--t-62); cursor: pointer;
  font-size: 14px; font-weight: 600;
  transition: all var(--ui) var(--ease);
}
.tab:hover { color: var(--bone); background: color-mix(in oklab, var(--bone) 6%, transparent); }
.tab[aria-selected="true"] {
  color: var(--bone-hi); background: color-mix(in oklab, var(--bone) 10%, transparent);
  border-color: var(--line);
}
.chips { display: flex; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-pill); border: 1px solid var(--line-soft);
  background: color-mix(in oklab, var(--ink-2) 70%, transparent);
  color: var(--t-62); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip b { color: var(--bone); font-variant-numeric: tabular-nums; }
.chip-r b { color: var(--cyan); }
.chip-f b { color: var(--a3); }

/* ── 버튼 ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: transparent; color: var(--bone);
  font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform var(--ui) var(--ease), background var(--ui) var(--ease), border-color var(--ui) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: color-mix(in oklab, var(--bone) 7%, transparent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, var(--flame-soft), var(--flame)); border-color: transparent;
  color: #14100a; font-weight: 800;
  box-shadow: 0 10px 26px -14px color-mix(in oklab, var(--flame) 85%, transparent);
}
html[data-theme="light"] .btn-primary { color: #fff; }
.btn-primary:hover { background: linear-gradient(180deg, var(--flame), var(--flame-soft)); }
.btn-ghost { border-color: var(--line); background: transparent; }
.btn-danger { border-color: color-mix(in oklab, var(--a3) 50%, transparent); color: var(--a3); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn-xs { min-height: 30px; padding: 0 10px; font-size: 12px; border-radius: var(--r-pill); }
.btn-block { width: 100%; }

/* ── 배너·토스트 ──────────────────────────────────────────────────────── */
.banner {
  margin: 12px var(--pad) 0; padding: 10px 14px; border-radius: 12px;
  border: 1px solid color-mix(in oklab, var(--a3) 45%, transparent);
  background: color-mix(in oklab, var(--a3) 12%, transparent);
  color: var(--bone); font-size: 14px;
}
.banner.ok { border-color: color-mix(in oklab, var(--mint) 45%, transparent); background: color-mix(in oklab, var(--mint) 12%, transparent); }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px); transform: translateX(-50%);
  z-index: 60; max-width: min(92vw, 560px);
  padding: 10px 16px; border-radius: var(--r-pill);
  background: color-mix(in oklab, var(--ink-3) 94%, black);
  border: 1px solid var(--line); color: var(--bone); font-size: 13.5px;
  box-shadow: 0 18px 40px -18px rgba(0,0,0,.6);
}
.toast.err { border-color: color-mix(in oklab, var(--a3) 55%, transparent); }

#view { padding: var(--pad); max-width: var(--max); width: 100%; margin: 0 auto; flex: 1; }
#view:focus { outline: none; }

/* ── 페이지 머리 ──────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.eyebrow { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--flame); margin-bottom: 6px; }
.page-head h1 { font-size: clamp(26px, 3.2vw, 40px); line-height: 1.12; letter-spacing: var(--track-tighter); font-weight: 800; }
.page-head p { color: var(--t-62); margin-top: 6px; max-width: 62ch; font-size: 14.5px; }

/* ── 패널·카드 ────────────────────────────────────────────────────────── */
.panel {
  background: color-mix(in oklab, var(--ink-2) 82%, transparent);
  border: 1px solid var(--line-soft); border-radius: var(--r-l);
  padding: 20px;
}
.panel + .panel { margin-top: 14px; }
.panel h2 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel h3 { font-size: 15px; font-weight: 700; }
.hint { color: var(--t-52); font-size: 13px; margin-top: 4px; }
.stack { display: grid; gap: 14px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

/* ── 파이프라인 컴포저 ────────────────────────────────────────────────── */
.composer {
  position: relative; overflow: hidden;
  background:
    radial-gradient(700px 300px at 0% 0%, color-mix(in oklab, var(--flame) 14%, transparent), transparent 62%),
    color-mix(in oklab, var(--ink-2) 90%, transparent);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: clamp(18px, 2.6vw, 30px);
}
.composer h2 { font-size: clamp(20px, 2.2vw, 28px); font-weight: 800; letter-spacing: var(--track-tighter); line-height: 1.22; }
.composer .sub { color: var(--t-62); font-size: 14px; margin-top: 6px; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: var(--r-pill); background: color-mix(in oklab, var(--ink) 60%, transparent); border: 1px solid var(--line-soft); }
.seg button {
  min-height: 34px; padding: 0 14px; border-radius: var(--r-pill); border: 0; background: transparent;
  color: var(--t-62); font-size: 13px; font-weight: 700; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: color-mix(in oklab, var(--bone) 12%, transparent); color: var(--bone-hi); }

.field { display: grid; gap: 6px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 700; color: var(--t-62); letter-spacing: .02em; }
input[type="text"], input[type="url"], input[type="password"], input[type="search"], textarea, select {
  width: 100%; min-height: 44px; padding: 10px 13px;
  border-radius: 12px; border: 1px solid var(--line);
  background: color-mix(in oklab, var(--ink) 55%, transparent);
  color: var(--bone); font: inherit; font-size: 14.5px;
  transition: border-color var(--ui) var(--ease), background var(--ui) var(--ease);
}
textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--t-52); }
input:focus, textarea:focus, select:focus { outline: none; border-color: color-mix(in oklab, var(--flame) 60%, transparent); background: color-mix(in oklab, var(--ink) 75%, transparent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--t-62) 50%), linear-gradient(135deg, var(--t-62) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.form-note { font-size: 12.5px; color: var(--t-52); margin-top: 10px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

.engine-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px; }
.engine-pick label {
  position: relative; display: flex; align-items: center; gap: 9px;
  padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line-soft);
  background: color-mix(in oklab, var(--ink) 40%, transparent); cursor: pointer;
  font-size: 13.5px; font-weight: 700; color: var(--t-62);
  transition: all var(--ui) var(--ease);
}
.engine-pick label:has(input:checked) {
  border-color: color-mix(in oklab, var(--flame) 55%, transparent);
  background: color-mix(in oklab, var(--flame) 12%, transparent); color: var(--bone-hi);
}
.engine-pick input { width: 16px; height: 16px; accent-color: var(--flame); }
.engine-pick .ek { font-size: 10.5px; font-family: var(--f-mono); letter-spacing: .1em; color: var(--t-52); }

.channel-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.channel-pick label {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--r-pill);
  border: 1px dashed var(--line); font-size: 12.5px; color: var(--t-62); cursor: pointer;
}
.channel-pick label:has(input:checked) { border-style: solid; border-color: color-mix(in oklab, var(--cream, var(--mint)) 50%, transparent); background: color-mix(in oklab, var(--mint) 10%, transparent); color: var(--bone); }
.channel-pick input { accent-color: var(--mint); }

.source-list { display: grid; gap: 8px; max-height: 288px; overflow: auto; padding-right: 4px; }
.source-item {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: center;
  padding: 8px; border-radius: 12px; border: 1px solid var(--line-soft);
  background: color-mix(in oklab, var(--ink) 35%, transparent); cursor: pointer;
}
.source-item:has(input:checked) { border-color: color-mix(in oklab, var(--flame) 55%, transparent); background: color-mix(in oklab, var(--flame) 10%, transparent); }
.source-item input { position: absolute; opacity: 0; pointer-events: none; }
.source-item img, .source-item .noimg { width: 64px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--ink-3); display: grid; place-items: center; color: var(--t-52); font-size: 11px; }
.source-item h4 { font-size: 13.5px; font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.source-item p { font-size: 11.5px; color: var(--t-52); margin-top: 2px; font-family: var(--f-mono); }

.details { border-top: 1px solid var(--line-soft); padding-top: 12px; margin-top: 14px; }
.details summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--t-62); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.details summary::-webkit-details-marker { display: none; }
.details summary::before { content: "＋"; font-size: 12px; }
.details[open] summary::before { content: "－"; }
.details .field-row { margin-top: 12px; }

/* ── 파이프라인 보드 ──────────────────────────────────────────────────── */
.board { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.lane {
  display: flex; flex-direction: column; min-height: 240px;
  border-radius: var(--r-l); border: 1px solid var(--line-soft);
  background: color-mix(in oklab, var(--ink-2) 85%, transparent);
  overflow: hidden;
}
.lane-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.lane-head .badge { flex: 0 0 auto; }
.lane-head h3 { font-size: 14px; font-weight: 800; flex: 1; min-width: 0; }
.lane-body { padding: 12px 14px; display: grid; gap: 10px; flex: 1; }
.lane-stage { font-size: 12.5px; color: var(--t-62); min-height: 18px; }
.lane-preview { border-radius: 10px; overflow: hidden; border: 1px solid var(--line-soft); background: var(--ink); display: grid; place-items: center; min-height: 96px; }
.lane-preview img { width: 100%; display: block; }
.lane-preview iframe { width: 100%; height: 168px; border: 0; background: #fff; }
.lane-preview video { width: 100%; max-height: 220px; background: #000; }
.lane-preview .ph { padding: 22px 12px; text-align: center; color: var(--t-52); font-size: 12px; }
.lane-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.lane-foot { padding: 10px 14px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lane .empty { color: var(--t-52); font-size: 12.5px; }

.progress { position: relative; height: 4px; border-radius: 99px; background: color-mix(in oklab, var(--bone) 12%, transparent); overflow: hidden; }
.progress i { position: absolute; inset: 0 auto 0 0; display: block; background: linear-gradient(90deg, var(--flame), var(--flame-soft)); border-radius: 99px; transition: width 400ms var(--ease); }
.progress.done i { background: var(--mint); }
.progress.fail i { background: var(--a3); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 700;
  border: 1px solid var(--line-soft); color: var(--t-62); background: color-mix(in oklab, var(--ink) 40%, transparent);
  white-space: nowrap;
}
.badge.queued { color: var(--t-62); }
.badge.running, .badge.rendering { color: var(--cyan); border-color: color-mix(in oklab, var(--cyan) 40%, transparent); }
.badge.done { color: var(--mint); border-color: color-mix(in oklab, var(--mint) 40%, transparent); }
.badge.failed, .badge.dead { color: var(--a3); border-color: color-mix(in oklab, var(--a3) 42%, transparent); }
.badge.naver { color: #2fcf7d; }
.badge.tistory { color: #ff8a5c; }
.badge.hub { color: var(--flame); }
.badge.kind { font-family: var(--f-mono); letter-spacing: .04em; }

/* ── 엔진 콘솔 ────────────────────────────────────────────────────────── */
.engine { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.preview-col { min-width: 0; }
.preview-frame { border-radius: var(--r-l); border: 1px solid var(--line-soft); background: var(--ink-2); overflow: hidden; min-height: 220px; }
.frame-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); font-size: 11.5px; color: var(--t-52); font-family: var(--f-mono); }
.frame-bar a { color: var(--flame); text-decoration: none; }
.preview-frame iframe { width: 100%; height: clamp(260px, 46vh, 560px); border: 0; background: #fff; display: block; }
.preview-frame video { width: 100%; max-height: 62vh; background: #000; display: block; }
.preview-frame pre { margin: 0; padding: 16px; white-space: pre-wrap; max-height: 56vh; overflow: auto; font-size: 12.5px; line-height: 1.7; color: var(--bone-2); }
.preview-empty { display: grid; place-items: center; gap: 6px; padding: 48px 20px; text-align: center; color: var(--t-52); font-size: 13px; }
.preview-empty b { color: var(--bone); font-size: 14px; }

.status-card { display: grid; gap: 8px; }
.status-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.status-line .state { font-size: 15px; font-weight: 800; }
.status-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--t-52); }
.status-meta code { color: var(--t-62); }

.feed { display: grid; gap: 8px; }
.feed-item {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line-soft);
  background: color-mix(in oklab, var(--ink) 35%, transparent);
}
.feed-item img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; }
.feed-item .fi-body { min-width: 0; }
.feed-item h4 { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-item .fi-meta { font-size: 11.5px; color: var(--t-52); font-family: var(--f-mono); }

/* ── 표 ──────────────────────────────────────────────────────────────── */
.table-wrap { border: 1px solid var(--line-soft); border-radius: var(--r-l); overflow: hidden; background: color-mix(in oklab, var(--ink-2) 72%, transparent); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 10px 14px; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--t-52); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; color: var(--bone-2); }
tr:last-child td { border-bottom: 0; }
td.wrap { max-width: 380px; }
td .sub { display: block; font-size: 11.5px; color: var(--t-52); margin-top: 2px; }
td.mono, .mono { font-family: var(--f-mono); font-size: 12px; color: var(--t-62); }

/* ── 산출물 ──────────────────────────────────────────────────────────── */
.art-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 248px), 1fr)); }
.art {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px; border-radius: var(--r-l); border: 1px solid var(--line-soft);
  background: color-mix(in oklab, var(--ink-2) 78%, transparent);
  transition: border-color var(--ui) var(--ease), transform var(--ui) var(--ease);
}
.art:hover { border-color: var(--line); transform: translateY(-1px); }
.art-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.art h3 { font-size: 14px; font-weight: 700; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.art .meta { font-size: 11.5px; color: var(--t-52); font-family: var(--f-mono); }
.art-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

/* ── 운영 대시보드 ───────────────────────────────────────────────────── */
.kpi-row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi {
  padding: 14px 16px; border-radius: var(--r-l); border: 1px solid var(--line-soft);
  background: color-mix(in oklab, var(--ink-2) 82%, transparent);
}
.kpi .k-label { font-size: 11.5px; color: var(--t-52); font-family: var(--f-mono); letter-spacing: .08em; text-transform: uppercase; }
.kpi .k-value { font-size: clamp(24px, 2.6vw, 34px); font-weight: 800; letter-spacing: var(--track-tighter); line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--t-52); margin-top: 4px; }
.kpi.warn { border-color: color-mix(in oklab, var(--a3) 40%, transparent); }
.kpi.good { border-color: color-mix(in oklab, var(--mint) 32%, transparent); }

.ops-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.channel-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.channel-row:last-child { border-bottom: 0; }
.channel-row .c-name { width: 92px; font-weight: 700; font-size: 13.5px; }
.channel-row .c-meta { flex: 1; font-size: 12px; color: var(--t-52); }
.channel-row .c-num { font-family: var(--f-mono); font-size: 13px; color: var(--bone); }

.note-box { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-soft); background: color-mix(in oklab, var(--ink) 40%, transparent); font-size: 12.5px; color: var(--t-62); line-height: 1.65; }
.note-box b { color: var(--bone); }
.note-box .when { font-family: var(--f-mono); font-size: 11.5px; color: var(--flame); }

.list-plain { display: grid; gap: 8px; }
.list-plain a, .list-plain .row-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-soft);
  text-decoration: none; font-size: 13px; color: var(--bone-2);
}
.list-plain a:hover { border-color: var(--line); background: color-mix(in oklab, var(--bone) 5%, transparent); }
.list-plain .t { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-plain .d { font-family: var(--f-mono); font-size: 11px; color: var(--t-52); flex: 0 0 auto; }

/* ── 모달·확인 ───────────────────────────────────────────────────────── */
.modal, .confirm { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(3, 6, 10, .68); backdrop-filter: blur(6px); }
.modal[hidden], .confirm[hidden] { display: none; }
.modal-shell { width: min(980px, 100%); max-height: 92dvh; display: flex; flex-direction: column; border-radius: var(--r-l); border: 1px solid var(--line); background: var(--ink-2); overflow: hidden; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.modal-kind { font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; color: var(--t-52); text-transform: uppercase; }
.modal-head h2 { font-size: 16px; font-weight: 800; margin-top: 2px; }
.modal-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.modal-body { overflow: auto; }
.modal-body iframe { width: 100%; height: 72dvh; border: 0; background: #fff; }
.modal-body video { width: 100%; max-height: 72dvh; background: #000; }
.modal-body pre { margin: 0; padding: 16px; white-space: pre-wrap; font-size: 12.5px; color: var(--bone-2); }

.confirm-card { width: min(460px, 100%); padding: 22px; border-radius: var(--r-l); border: 1px solid var(--line); background: var(--ink-2); box-shadow: 0 30px 80px -30px rgba(0,0,0,.7); }
.confirm-card h3 { font-size: 17px; font-weight: 800; }
.confirm-card p { margin-top: 8px; color: var(--t-62); font-size: 13.5px; line-height: 1.6; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ── 설정 ────────────────────────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; font-size: 13px; align-items: center; }
.kv b { color: var(--t-52); font-weight: 600; font-size: 12px; }
.kv code { font-size: 12px; word-break: break-all; color: var(--bone-2); }
pre.json { margin: 0; padding: 14px; border-radius: 12px; border: 1px solid var(--line-soft); background: color-mix(in oklab, var(--ink) 55%, transparent); font-size: 11.5px; line-height: 1.6; max-height: 340px; overflow: auto; color: var(--bone-2); }

.skeleton { color: var(--t-52); font-size: 13px; padding: 16px; text-align: center; border: 1px dashed var(--line-soft); border-radius: 12px; }

/* ── 반응형 ──────────────────────────────────────────────────────────── */
@media (max-width: 1179px) {
  .rail { width: 72px; }
}
@media (min-width: 1180px) {
  .rail-label { display: inline; }
  .health span:last-child, .theme-toggle .rail-label { display: inline; font-size: 12px; }
  .grid-2 { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .engine { grid-template-columns: minmax(320px, 40%) minmax(0, 60%); align-items: start; }
  .ops-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .lane-preview iframe { height: 200px; }
}
@media (max-width: 900px) {
  .cmd .chips { display: none; }
}
@media (max-width: 767px) {
  :root { --cmdbar-h: 52px; }
  .rail { display: none; }
  .app { display: block; }
  #view { padding: 16px 16px calc(var(--tabbar-h) + 20px); }
  .cmd { padding: 0 14px; }
  .cmd-right .btn { min-height: 36px; padding: 0 14px; font-size: 13px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 26px; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(6, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: color-mix(in oklab, var(--ink-1) 94%, black);
    border-top: 1px solid var(--line-soft); backdrop-filter: blur(16px);
  }
  .tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: transparent; color: var(--t-52); font-size: 10.5px; font-weight: 700; cursor: pointer;
  }
  .tabbar button span { font-size: 15px; }
  .tabbar button[aria-current="page"] { color: var(--flame); }
  .toast { bottom: calc(var(--tabbar-h) + 14px); }
}
@media (min-width: 768px) {
  .tabbar { display: none; }
}
@media (max-width: 380px) {
  #view { padding: 12px 12px calc(var(--tabbar-h) + 16px); }
  .composer { padding: 16px; border-radius: var(--r-l); }
  .btn { padding: 0 16px; }
  .engine-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
