/* samStudio — 셸 스타일 */
:root {
  --font: 'Pretendard Variable', Pretendard, 'Malgun Gothic', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel2: #f8f9fb;
  --sunken: #eef1f5;
  --line: #e2e6ec;
  --line2: #d3d9e1;
  --text: #17202c;
  --muted: #697586;
  --accent: #2563eb;
  --accent-soft: #e6eefe;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --run: #16a34a;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --r: 8px;
  --c-hyd: #2563eb;
  --c-pneu: #0891b2;
  --c-elec: #d97706;
  --c-plc: #7c3aed;
  --c-hmi: #db2777;
  --c-cnc: #475569;
  --c-elec2: #059669;
  --c-vis: #e11d48;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141b; --panel: #161c25; --panel2: #1b222d; --sunken: #111721; --line: #263040; --line2: #313c4e;
    --text: #e6ebf2; --muted: #8b97a8; --accent: #5b8cff; --accent-soft: #1d2b4a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141b; --panel: #161c25; --panel2: #1b222d; --sunken: #111721; --line: #263040; --line2: #313c4e;
  --text: #e6ebf2; --muted: #8b97a8; --accent: #5b8cff; --accent-soft: #1d2b4a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code, kbd, .mono { font-family: var(--mono); font-size: 12px; }
kbd { padding: 1px 6px; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; background: var(--panel2); color: var(--muted); font-size: 11px; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.pad { padding: 12px; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

#app { height: 100%; }
.boot { display: grid; place-items: center; }
.boot-msg { display: flex; align-items: center; gap: 10px; color: var(--muted); }

.logo { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; font-weight: 800; font-size: 20px; }
.logo.sm { width: 28px; height: 28px; font-size: 15px; border-radius: 8px; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line2); background: var(--panel); font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--panel2); border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: color-mix(in srgb, var(--err) 10%, transparent); border-color: var(--err); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn .ic { width: 16px; height: 16px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: var(--r); background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--sunken); color: var(--text); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.sm .ic { width: 15px; height: 15px; }
.link { border: 0; background: none; color: var(--accent); padding: 0; text-align: left; }
.link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.inp { height: 32px; padding: 0 10px; border: 1px solid var(--line2); border-radius: 7px; background: var(--panel); width: 100%; min-width: 0; }
.inp:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.inp.sm { height: 28px; font-size: 13px; }
.inp.xs { height: 24px; font-size: 12px; padding: 0 4px; width: auto; }
.inp.lg { height: 44px; font-size: 16px; }
.inp:disabled { opacity: .55; }
select.inp { padding-right: 4px; }

.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.ghost { background: var(--sunken); color: var(--muted); }
.badge { display: inline-grid; place-items: center; min-width: 34px; height: 22px; padding: 0 5px; border-radius: 6px; background: color-mix(in srgb, var(--bc) 14%, transparent); color: var(--bc); font: 700 10.5px/1 var(--mono); letter-spacing: .02em; flex: none; }
.badge.xs { min-width: 28px; height: 18px; font-size: 9.5px; }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line2); transition: background .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); }

.led { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--line2); flex: none; margin-right: 6px; vertical-align: middle; }
.led.on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.led.err.on { background: var(--err); box-shadow: 0 0 6px var(--err); }

/* ═══ 홈 ═══ */
.home { height: 100%; overflow: auto; }
.home-hero { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px; padding: 40px max(24px, calc((100% - 1120px) / 2)) 28px; background: linear-gradient(180deg, var(--panel), var(--bg)); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 16px; }
.brand .logo { width: 56px; height: 56px; font-size: 28px; border-radius: 15px; }
.brand h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.brand p { margin: 4px 0 0; color: var(--muted); }
.hero-actions { display: flex; gap: 10px; align-items: center; }
.home-body { max-width: 1120px; margin: 0 auto; padding: 8px 24px 40px; }
.home-sec h2 { font-size: 16px; margin: 28px 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.cards.sm { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.card { text-align: left; padding: 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); transition: transform .12s, border-color .12s; display: flex; flex-direction: column; gap: 6px; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card h3 { margin: 4px 0 0; font-size: 15px; }
.card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.card-top { display: flex; align-items: center; gap: 8px; }
.recent { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.recent-row { display: flex; align-items: center; border-bottom: 1px solid var(--line); padding-right: 6px; }
.recent-row:last-child { border-bottom: 0; }
.recent-open { flex: 1; display: grid; grid-template-columns: 20px 1fr auto 90px; align-items: center; gap: 12px; padding: 11px 14px; border: 0; background: none; text-align: left; }
.recent-open:hover { background: var(--panel2); }
.recent-open .name { font-weight: 600; }
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px 20px; }
.type { display: flex; gap: 12px; align-items: flex-start; }
.type p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.empty { padding: 18px; border: 1px dashed var(--line2); border-radius: 12px; text-align: center; }
.home-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

/* ═══ 작업 공간 ═══ */
.work { display: flex; flex-direction: column; height: 100%; }
.topbar { display: flex; align-items: center; gap: 6px; height: 50px; padding: 0 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.logo-btn { border: 0; background: none; padding: 4px; border-radius: 8px; }
.logo-btn:hover { background: var(--sunken); }
.menu-btn { margin-right: 2px; }
.proj-name { border: 1px solid transparent; background: transparent; font-weight: 700; font-size: 15px; padding: 4px 8px; border-radius: 6px; width: 220px; }
.proj-name:hover { border-color: var(--line2); }
.proj-name:focus { border-color: var(--accent); outline: none; background: var(--panel); }
.save-state { color: var(--muted); font-size: 12px; white-space: nowrap; margin-right: 10px; }
.run-group { display: flex; align-items: center; gap: 4px; padding: 3px; border-radius: 10px; background: var(--sunken); margin-left: auto; }
.work .grow { flex: 1; }
.run-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px 0 10px; border: 0; border-radius: 8px; background: var(--run); color: #fff; font-weight: 600; }
.run-btn:hover { filter: brightness(1.08); }
.run-btn.on { background: var(--warn); }
.speed { height: 30px; border: 0; background: transparent; color: var(--muted); border-radius: 6px; }
.clock { font: 600 12px var(--mono); color: var(--muted); min-width: 64px; text-align: right; padding-right: 8px; }
.is-running .clock { color: var(--run); }
.train-badge { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 99px; border: 0; background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); font-weight: 600; font-size: 12px; }
.train-badge .ic { width: 14px; height: 14px; }

.work-body { flex: 1; display: flex; min-height: 0; min-width: 0; width: 100%; overflow: hidden; }
.sidebar { width: 230px; flex: none; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); }
.side-head { display: flex; align-items: center; justify-content: space-between; height: 38px; padding: 0 8px 0 14px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); flex: none; }
.page-list { flex: 1; overflow: auto; padding: 6px; }
.page-row { display: flex; align-items: center; border-radius: 8px; }
.page-row:hover { background: var(--panel2); }
.page-row.active { background: var(--accent-soft); }
.page-row.split { box-shadow: inset 3px 0 0 var(--accent); }
.page-row.drop { box-shadow: inset 0 2px 0 var(--accent); }
.page-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px; border: 0; background: none; text-align: left; }
.pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-row.active .pname { font-weight: 600; }
.page-row .more { opacity: 0; }
.page-row:hover .more, .page-row.active .more { opacity: 1; }
.add-page { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 8px; height: 36px; border-radius: 8px; border: 1px dashed var(--line2); background: none; color: var(--muted); }
.add-page:hover { border-color: var(--accent); color: var(--accent); }

.center { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tabs { display: flex; align-items: flex-end; gap: 2px; height: 38px; min-width: 0; padding: 0 6px; background: var(--panel2); border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; scrollbar-width: thin; }
.tab { display: flex; align-items: center; height: 32px; border-radius: 8px 8px 0 0; border: 1px solid transparent; border-bottom: 0; color: var(--muted); flex: none; }
.tab:hover { background: var(--sunken); }
.tab.active { background: var(--panel); border-color: var(--line); color: var(--text); margin-bottom: -1px; height: 33px; }
.tab-open { display: flex; align-items: center; gap: 6px; height: 100%; padding: 0 4px 0 10px; border: 0; background: none; max-width: 220px; }
.tab-open span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-x { display: grid; place-items: center; width: 22px; height: 22px; margin-right: 4px; border: 0; border-radius: 5px; background: none; color: var(--muted); opacity: .6; }
.tab-x:hover { background: var(--line); opacity: 1; }
.tab-x .ic { width: 13px; height: 13px; }

.stage-wrap { position: relative; flex: 1; min-height: 0; }
.stage { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr; }
.stage.split { grid-template-columns: 1fr 1fr; }
.stage.split .page-host.secondary { border-left: 1px solid var(--line); }
.page-host { position: relative; min-width: 0; min-height: 0; grid-row: 1; overflow: hidden; background: var(--panel); }
.split-head { position: absolute; top: 8px; right: 10px; z-index: 5; display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 12px; }
.split-head .inp { width: 160px; }
.stage-empty { position: absolute; inset: 0; overflow: auto; background: var(--bg); padding: 30px; }
.gallery h2 { margin: 0 0 4px; font-size: 20px; }
.gallery h3 { font-size: 13px; color: var(--muted); margin: 18px 0 8px; }
.gallery.inline { max-width: 1000px; margin: 0 auto; }
.type-card .card-top b { font-size: 14px; }

/* 집중 보기 */
.work.focus .sidebar, .work.focus .inspector, .work.focus .dock, .work.focus .tabs { display: none; }

/* 속성 패널 */
.inspector { width: 300px; flex: none; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); }
.insp-body { flex: 1; overflow: auto; padding: 12px 14px 20px; }
.insp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.insp-head h3 { margin: 0; font-size: 15px; flex: 1; min-width: 0; }
.inp.title { font-weight: 700; font-size: 15px; flex: 1; }
.insp-sec { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.insp-sec h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin: -4px 0 8px; line-height: 1.5; }
.form { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12.5px; color: var(--muted); }
.field.off { opacity: .55; }
.num { display: flex; align-items: center; gap: 6px; }
.num .unit { color: var(--muted); font-size: 12px; min-width: 40px; }
.range { width: 100%; accent-color: var(--accent); margin-top: 4px; }
.live { display: grid; gap: 4px; }
.live > div { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 7px; background: var(--sunken); font-size: 13px; }
.live b { font-family: var(--mono); font-size: 12.5px; }
.faults { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.4; cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--err); }
.insp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tips { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.taglist { display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow: auto; }
.tagrow { display: grid; grid-template-columns: 16px 1fr auto auto; gap: 6px; align-items: center; padding: 4px 6px; border-radius: 6px; font-size: 12.5px; }
.tagrow:nth-child(odd) { background: var(--panel2); }
.tagrow .val { font: 600 12px var(--mono); min-width: 30px; text-align: right; }

/* 앱 페이지 */
.app-page { position: absolute; inset: 0; display: flex; flex-direction: column; }
.app-bar { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 12px; border-bottom: 1px solid var(--line); background: var(--panel2); font-size: 13px; flex: none; }
.app-title { font-weight: 600; }
.app-status { font-size: 12px; color: var(--muted); }
.app-status::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: 1px; }
.app-status.ok::before { background: var(--ok); }
.app-status.err { color: var(--err); }
.app-status.err::before { background: var(--err); }
.app-status.loading::before { background: var(--warn); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.app-frame { flex: 1; min-height: 0; }
.app-frame iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

/* 아래 패널 */
.dock { --dock-h: 220px; height: var(--dock-h); flex: none; display: flex; flex-direction: column; border-top: 1px solid var(--line); background: var(--panel); position: relative; }
.dock.closed { height: 34px; }
.dock.closed .dock-body, .dock.closed .dock-grip { display: none; }
.dock-grip { position: absolute; top: -4px; left: 0; right: 0; height: 8px; cursor: ns-resize; z-index: 3; }
.dock-tabs { display: flex; align-items: center; gap: 2px; height: 34px; padding: 0 6px; border-bottom: 1px solid var(--line); flex: none; }
.dock.closed .dock-tabs { border-bottom: 0; }
.dock-tab { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 13px; }
.dock-tab:hover { background: var(--sunken); color: var(--text); }
.dock-tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.dock-tab .ic { width: 15px; height: 15px; }
.count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--line2); color: var(--text); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.count.warn { background: var(--warn); color: #fff; }
.count.err { background: var(--err); color: #fff; }
.dock-body { flex: 1; min-height: 0; overflow: auto; }
.dock-tools { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; font-size: 12.5px; }
.dock-tools .inp { width: 200px; }
.tag-table .tr { display: grid; grid-template-columns: minmax(140px, 1.2fr) 70px 1.4fr 1.4fr 70px; gap: 10px; align-items: center; padding: 4px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.tag-table .tr.th, .link-table .lr.th { font-size: 11.5px; color: var(--muted); font-weight: 600; background: var(--panel2); position: sticky; top: 45px; }
.tag-table .tr.forced { background: color-mix(in srgb, var(--warn) 9%, transparent); }
.tag-table .val { font: 600 12px var(--mono); }
.link-table { padding-bottom: 10px; }
.link-table .lr { display: grid; grid-template-columns: 220px 24px 220px 70px 34px; gap: 8px; align-items: center; padding: 6px 12px; }
.link-table .arrow { color: var(--muted); text-align: center; }
.link-table .val { font: 600 12px var(--mono); }

.t-trend { display: flex; }
.trend-side { width: 260px; flex: none; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 8px; gap: 6px; overflow: hidden; }
.sig-list { overflow: auto; flex: 1; }
.sig { display: grid; grid-template-columns: 16px 10px 1fr auto; gap: 6px; align-items: center; padding: 3px 4px; font-size: 12.5px; border-radius: 5px; cursor: pointer; }
.sig:hover { background: var(--panel2); }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; border: 1px solid var(--line2); }
.trend-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 6px 10px; }
.trend-tools { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
canvas.trend { flex: 1; width: 100%; min-height: 60px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; padding: 2px 0; }
.lg { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 11.5px; }

.t-faults { display: grid; grid-template-columns: 1.2fr 1fr; gap: 0; }
.fault-col { padding: 10px 14px; overflow: auto; }
.fault-col + .fault-col { border-left: 1px solid var(--line); }
.fault-col h4 { margin: 12px 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.train-head { display: flex; gap: 12px; align-items: center; }
.train-head p { margin: 2px 0 0; font-size: 12.5px; }
.callout { display: flex; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 9px; background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--text); }
.callout .ic { color: var(--warn); }
.callout p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.diag { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center; }
.diag h4 { grid-column: 1 / -1; }
.fault-list { display: flex; flex-direction: column; gap: 3px; }
.fault-row { display: grid; grid-template-columns: 16px auto 1fr 28px; gap: 6px; align-items: center; padding: 4px 6px; border-radius: 6px; background: var(--panel2); font-size: 13px; }
.row-tools { display: flex; gap: 6px; margin-top: 8px; }
.row-tools .inp { width: auto; flex: 1; }
.train-log { font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.check-list { padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.check-row { display: grid; grid-template-columns: 18px 130px 1fr; gap: 8px; align-items: center; padding: 6px 8px; border: 0; border-radius: 6px; background: none; text-align: left; font-size: 13px; }
.check-row:hover { background: var(--panel2); }
.check-row.warn .ic { color: var(--warn); }
.check-row.err .ic { color: var(--err); }
.check-row.info .ic { color: var(--muted); }
.ok-msg { display: flex; align-items: center; gap: 8px; padding: 12px; color: var(--ok); }
.log { padding: 6px 12px; font-size: 12.5px; }
.log-row { display: flex; gap: 12px; padding: 2px 0; }

/* 팝업 메뉴 */
.popup { position: fixed; z-index: 1000; min-width: 200px; padding: 5px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.pop-item { display: flex; justify-content: space-between; align-items: center; gap: 20px; width: 100%; height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: none; text-align: left; font-size: 13.5px; }
.pop-item:hover { background: var(--accent-soft); }
.pop-item.danger { color: var(--err); }
.popup hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* 대화상자 */
.modal-back { position: fixed; inset: 0; z-index: 900; background: rgba(15, 20, 27, .45); display: grid; place-items: center; padding: 20px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(460px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; border-radius: 14px; background: var(--panel); box-shadow: var(--shadow-lg); animation: pop .15s; }
.modal.wide { width: min(900px, 100%); }
@keyframes pop { from { transform: translateY(6px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px 20px; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 6px 20px 16px; overflow: auto; line-height: 1.6; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.cmdk { display: flex; flex-direction: column; gap: 8px; }
.cmd-list { display: flex; flex-direction: column; max-height: 50vh; overflow: auto; }
.cmd { display: flex; justify-content: space-between; align-items: center; height: 36px; padding: 0 10px; border: 0; border-radius: 7px; background: none; text-align: left; }
.cmd.on, .cmd:hover { background: var(--accent-soft); }
.help h4 { margin: 16px 0 4px; }
.keys { border-collapse: collapse; }
.keys td { padding: 3px 14px 3px 0; }

/* 토스트 */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 1100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 10px; background: #1f2937; color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 520px; animation: pop .15s; transition: opacity .3s; }
.toast.ok { background: #166534; }
.toast.err { background: #991b1b; }
.toast.out { opacity: 0; }

@media (max-width: 980px) {
  .sidebar { width: 64px; }
  .sidebar .pname, .sidebar .side-head span, .add-page { font-size: 0; }
  .sidebar .more { display: none; }
  .inspector { position: absolute; right: 0; top: 50px; bottom: 0; z-index: 20; box-shadow: var(--shadow-lg); }
  .save-state, .proj-name { display: none; }
}
@media (max-width: 640px) {
  .home-hero { padding: 24px 16px; }
  .home-body { padding: 0 16px 30px; }
  .types { grid-template-columns: 1fr; }
  .recent-open { grid-template-columns: 20px 1fr auto; }
  .recent-open span:last-child { display: none; }
}
