/* ============================================================
   PlantDoctorAI v2 Web — Dual Theme (Light + Dark)
   Siemens-style industrial aesthetic. Semantic tokens only.
   Requires: design-tokens.css loaded first.
   ============================================================ */
.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }

/* ── Theme Tokens — Light (default) ────────────────────────── */
:root, [data-theme="light"] {
    --surface-base:        #F7FAFC;
    --surface-raised:      #FFFFFF;
    --surface-overlay:     #FFFFFF;
    --surface-sunken:      #EEF2F7;
    --surface-hover:       #F1F5F9;

    --text-strong:         #0F172A;
    --text-base:           #1E293B;
    --text-muted:          #64748B;
    --text-disabled:       #94A3B8;
    --text-inverse:        #FFFFFF;

    --border-subtle:       #E2E8F0;
    --border-strong:       #CBD5E1;

    --accent:              #0891A8;
    --accent-hover:        #0EA5BD;
    --accent-active:       #07758A;
    --accent-muted:        rgba(8, 145, 168, 0.10);
    --accent-border:       rgba(8, 145, 168, 0.40);
    --accent-on-solid:     #FFFFFF;

    --signal-ok:           #047857;
    --signal-warn:         #B45309;
    --signal-err:          #B91C1C;
    --signal-info:         #1D4ED8;
    --signal-ok-muted:     #D1FAE5;
    --signal-warn-muted:   #FEF3C7;
    --signal-err-muted:    #FEE2E2;
    --signal-info-muted:   #DBEAFE;

    --shadow-sm:           0 1px 2px rgba(15, 23, 42, 0.08);
    --shadow-md:           0 4px 12px rgba(15, 23, 42, 0.12);
    --shadow-modal:        0 16px 48px rgba(15, 23, 42, 0.20);

    --mermaid-bg:          #FFFFFF;
    --mermaid-node-bg:     #F8FAFC;
    --mermaid-edge:        #64748B;
    --mermaid-text:        #0F172A;
}

/* ── Theme Tokens — Dark ───────────────────────────────────── */
[data-theme="dark"] {
    --surface-base:        #000B1F;
    --surface-raised:      #061629;
    --surface-overlay:     #142B45;
    --surface-sunken:      #0A1A2E;
    --surface-hover:       #0E2138;

    --text-strong:         #FFFFFF;
    --text-base:           #E0E7F0;
    --text-muted:          #8B9BB0;
    --text-disabled:       #4A5A70;
    --text-inverse:        #000B1F;

    --border-subtle:       #1B2E48;
    --border-strong:       #2A4264;

    --accent:              #00BEDC;
    --accent-hover:        #14D6F2;
    --accent-active:       #00A8C2;
    --accent-muted:        rgba(0, 190, 220, 0.13);
    --accent-border:       rgba(0, 190, 220, 0.45);
    --accent-on-solid:     #000B1F;

    --signal-ok:           #00D084;
    --signal-warn:         #FFB84D;
    --signal-err:          #FF5577;
    --signal-info:         #5BA8FF;
    --signal-ok-muted:     rgba(0, 208, 132, 0.15);
    --signal-warn-muted:   rgba(255, 184, 77, 0.15);
    --signal-err-muted:    rgba(255, 85, 119, 0.15);
    --signal-info-muted:   rgba(91, 168, 255, 0.15);

    --shadow-sm:           0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md:           0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-modal:        0 16px 48px rgba(0, 0, 0, 0.65);

    --mermaid-bg:          #061629;
    --mermaid-node-bg:     #0E2138;
    --mermaid-edge:        #8B9BB0;
    --mermaid-text:        #FFFFFF;
}

/* 인쇄 시 강제 light (종이 출력 적합) */
@media print {
    :root, [data-theme="dark"] {
        --surface-base: #FFFFFF; --surface-raised: #FFFFFF;
        --surface-overlay: #FFFFFF; --surface-sunken: #F5F5F5;
        --text-strong: #000; --text-base: #111; --text-muted: #444;
        --border-subtle: #CCC; --border-strong: #888;
    }
}

* { box-sizing: border-box; }
html, body {
    margin: 0; height: 100%;
    font-family: 'Pretendard', -apple-system, "Segoe UI", system-ui, sans-serif;
    background: var(--surface-base); color: var(--text-base);
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* 다크 친화 스크롤바 */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--border-strong); border-radius: 5px;
    border: 2px solid var(--surface-base);
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── 글로벌 input/textarea/select 베이스 + 포커스 ring ── */
input, textarea, select {
    font-family: inherit;
    background: var(--surface-sunken);
    color: var(--text-base);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input:focus, textarea:focus, select:focus,
button:focus-visible, a:focus-visible {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}
input::placeholder, textarea::placeholder { color: var(--text-disabled); }

/* ── 공용 Buttons (Siemens-style primary/secondary) ── */
.btn-primary, button.primary {
    background: var(--accent); color: var(--accent-on-solid);
    border: 0; padding: 8px 18px; border-radius: 6px;
    font-weight: 600; cursor: pointer;
    transition: background 0.15s;
}
.btn-primary:hover, button.primary:hover { background: var(--accent-hover); }
.btn-primary:active, button.primary:active { background: var(--accent-active); }
.btn-primary:disabled, button.primary:disabled {
    background: var(--text-disabled); color: var(--surface-raised);
    cursor: not-allowed;
}
.btn-secondary {
    background: transparent; color: var(--text-base);
    border: 1px solid var(--border-strong); padding: 7px 17px;
    border-radius: 6px; cursor: pointer; font-weight: 500;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-secondary:hover {
    background: var(--surface-hover); border-color: var(--accent); color: var(--accent);
}

/* ── App shell (v1 pd-app) ── */
.pd-app { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Header ── */
.pd-header {
    display: flex; align-items: center; gap: 14px;
    padding: 0 18px; height: 54px;
    background: var(--surface-raised); border-bottom: 1px solid var(--border-subtle);
}
.pd-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.pd-logo { width: 32px; height: 32px; border-radius: 7px; object-fit: cover; }
.pd-title { font-size: 15px; font-weight: 700; color: var(--text-strong); }
.pd-ver {
    font-size: 10px; background: var(--signal-info-muted); color: var(--signal-info);
    padding: 2px 8px; border-radius: 12px; font-weight: 700; letter-spacing: 0.5px;
}
.pd-nav { display: flex; gap: 4px; margin-left: 4px; }
.pd-nav-link {
    padding: 8px 12px; color: var(--text-muted); text-decoration: none; font-size: 13px;
    border-radius: 6px; transition: 0.15s; white-space: nowrap;
    border: 0; background: transparent; cursor: pointer; font-family: inherit;
}
.pd-nav-link:hover { color: var(--text-strong); background: var(--surface-hover); }
.pd-nav-link.active { color: var(--accent); background: var(--signal-ok-muted); font-weight: 700; }

.pd-header-right {
    margin-left: auto; display: flex; align-items: center; gap: 8px;
}
.pd-mode-toggle {
    display: flex; border: 1px solid var(--border-subtle); border-radius: 8px; overflow: hidden;
}
.pd-mode-btn {
    background: var(--surface-raised); color: var(--text-muted); border: 0;
    padding: 6px 10px; font-size: 11.5px; font-weight: 700;
    cursor: pointer; white-space: nowrap;
}
.pd-mode-btn:hover { background: var(--surface-hover); color: var(--text-strong); }
.pd-mode-btn.active { background: var(--accent); color: var(--surface-raised); }
.pd-mode-btn + .pd-mode-btn { border-left: 1px solid var(--border-subtle); }
/* 동적 활동 배지 — Idle / RuleBased / Llm 3-state */
.pd-activity-badge {
    display: flex; align-items: center; gap: 7px;
    padding: 5px 12px; border-radius: 14px;
    font-size: 12px; font-weight: 700; border: 1px solid;
    transition: background-color .15s, color .15s, border-color .15s;
}
.pd-activity-badge.ok   { color: var(--signal-ok); background: var(--signal-ok-muted); border-color: var(--accent-border); }
.pd-activity-badge.err  { color: var(--signal-err); background: var(--signal-err-muted); border-color: var(--accent-border); }
.pd-activity-badge.rule { color: var(--accent); background: var(--accent-muted); border-color: var(--accent-border); }
.pd-activity-badge.llm  { color: var(--accent); background: var(--accent-muted); border-color: var(--accent-border); }
.pd-activity-badge .pd-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pd-activity-badge .pd-dot.spin {
    animation: pd-pulse 1s ease-in-out infinite;
}
@keyframes pd-pulse {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%      { opacity: .35; transform: scale(1.6); }
}

.upload-hint { font-size: 12px; color: var(--text-muted); }
.upload-hint b { color: var(--signal-ok); }

/* ── Chat header bar (새 챗봇 친화형 헤더) ── */
.chat-header-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: var(--surface-sunken);
    border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.chat-header-left { display: flex; align-items: center; gap: 10px; }
.chat-avatar-bot {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--signal-info), var(--signal-info));
    color: var(--surface-raised); font-size: 11px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
}
.chat-header-title { font-size: 13px; font-weight: 700; color: var(--text-strong); }
.chat-header-sub { font-size: 11px; margin-top: 1px; }
.chat-status-ok  { color: var(--accent); }
.chat-status-warn { color: var(--signal-warn); }
.chat-header-right { display: flex; gap: 6px; }
.chat-stop-btn {
    padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 700;
    background: var(--signal-err-muted); color: var(--signal-err); border: 1px solid var(--signal-err-muted); cursor: pointer;
}
.chat-stop-btn:hover { background: var(--signal-err-muted); }
.chat-reset-btn {
    padding: 5px 12px; border-radius: 6px; font-size: 12px;
    background: var(--surface-hover); color: var(--text-muted); border: 1px solid var(--border-subtle); cursor: pointer;
}
.chat-reset-btn:hover { background: var(--border-subtle); }

/* ── Avatar-based message rows ── */
.msg-row { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; }
.msg-row-user { align-self: flex-end; flex-direction: row-reverse; margin-left: auto; }
.msg-row-assistant { align-self: flex-start; }
.msg-avatar {
    width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 800;
}
.msg-avatar-bot  { background: linear-gradient(135deg, var(--signal-info), var(--signal-info)); color: var(--surface-raised); }
.msg-avatar-user { background: var(--accent); color: var(--surface-raised); }
.msg-user     { background: var(--accent); color: var(--surface-raised); border-radius: 16px 16px 4px 16px; position: relative; }
.msg-assistant { background: var(--surface-hover); color: var(--text-strong); border-radius: 16px 16px 16px 4px; border: 1px solid var(--border-subtle); }
.msg-resend-btn {
    display: none; position: absolute; bottom: 4px; left: 4px;
    background: rgba(0,0,0,.25); border: none; border-radius: 50%;
    color: inherit; cursor: pointer; font-size: 13px; line-height: 1;
    width: 22px; height: 22px; padding: 0; opacity: .8;
    transition: opacity .12s, background .12s;
}
.msg-resend-btn:hover:not(:disabled) { background: rgba(0,0,0,.4); opacity: 1; }
.msg-resend-btn:disabled { cursor: not-allowed; opacity: .35; }
.msg-user:hover .msg-resend-btn { display: flex; align-items: center; justify-content: center; }
.msg-copy-btn {
    display: none; position: absolute; bottom: 4px; right: 4px;
    background: rgba(0,0,0,.18); border: none; border-radius: 4px;
    color: inherit; cursor: pointer; font-size: 12px; line-height: 1.4;
    padding: 1px 5px; opacity: .8;
    transition: opacity .12s, background .12s;
}
.msg-copy-btn:hover { background: rgba(0,0,0,.35); opacity: 1; }
.msg-user:hover .msg-copy-btn,
.msg-assistant:hover .msg-copy-btn { display: flex; align-items: center; justify-content: center; }
.msg-time {
    display: block; font-size: .68rem; opacity: .55; margin-top: 3px;
    text-align: right; pointer-events: none; user-select: none;
}

/* ── Thinking dots animation ── */
.thinking-bubble {
    display: flex; align-items: center; gap: 5px;
    padding: 12px 16px; background: var(--surface-hover);
    border-radius: 16px 16px 16px 4px; border: 1px solid var(--border-subtle);
}
.thinking-dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--text-disabled);
    animation: thinking-bounce 1.4s ease-in-out infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%           { transform: translateY(-6px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .pd-dot.spin          { animation: none; }  /* WCAG 2.3.3: pd-pulse 무한루프 정지 */
    .thinking-dot         { animation: none; }  /* WCAG 2.3.3: thinking-bounce 무한루프 정지 */
    .status-bar-progress  { animation: none; }  /* WCAG 2.3.3: status-progress-slide 정지 */
    .ai-conv-spinner      { animation: none; }  /* WCAG 2.3.3: pulse 정지 */
    .loading-bar-fill     { animation: none; }  /* WCAG 2.3.3: loading-slide 정지 */
    .wiz-ps-spin          { animation: none; }  /* WCAG 2.3.3: wiz-spin 정지 */
}
.thinking-elapsed {
    margin-left: 8px; font-size: 11px; color: var(--accent);
    font-family: ui-monospace, monospace; font-weight: 600; opacity: 0.9;
}

/* ── Welcome state ── */
.chat-welcome {
    display: flex; flex-direction: column; align-items: center;
    margin: auto; padding: 40px 20px; text-align: center; max-width: 460px;
}
.chat-welcome-icon {
    width: 56px; height: 56px; border-radius: 16px; margin-bottom: 16px;
    background: linear-gradient(135deg, var(--signal-info), var(--signal-info));
    color: var(--surface-raised); font-size: 16px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
}
.chat-welcome-title { font-size: 20px; font-weight: 700; color: var(--text-strong); margin: 0 0 8px; }
.chat-welcome-desc { font-size: 13px; color: var(--text-muted); line-height: 1.7; margin: 0 0 20px; }
.chat-welcome-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chat-welcome-chips button {
    padding: 7px 14px; background: var(--surface-hover); border: 1px solid var(--border-subtle);
    border-radius: 20px; font-size: 12px; color: var(--text-base); cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.chat-welcome-chips button:hover { background: var(--signal-info-muted); border-color: var(--signal-info); color: var(--signal-info); }

/* PlcViewer 의 AI 어시스턴트 탭 — chat 인라인 패널 */
.ai-tab-host {
    height: calc(100vh - 280px); min-height: 480px;
    display: flex; flex-direction: column;
}
.chat-panel-inline {
    display: flex; flex-direction: column;
    flex: 1; min-height: 0;
    background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: 8px;
    overflow: hidden;
}
.chat-panel-inline .messages-inline {
    flex: 1; min-height: 0; overflow-y: auto;
    padding: 18px; display: flex; flex-direction: column; gap: 10px;
}
.chat-panel-inline .quick-bar {
    display: flex; gap: 6px; flex-wrap: wrap;
    padding: 8px 14px; background: var(--surface-sunken);
    border-bottom: 1px solid var(--border-subtle);
}
.chat-panel-inline .quick-bar button {
    padding: 5px 10px; background: var(--surface-raised); border: 1px solid var(--border-strong);
    border-radius: 14px; font-size: 11px; cursor: pointer; color: var(--text-strong);
}
.chat-panel-inline .quick-bar button:hover { background: var(--surface-hover); }
.chat-panel-inline .quick-bar button.ghost {
    margin-left: auto; background: transparent; color: var(--signal-err); border-color: var(--signal-err-muted);
}
.chat-panel-inline .quick-bar .quick-bar-label {
    font-size: 10px; font-weight: 700; color: var(--text-disabled); letter-spacing: 0.5px;
    align-self: center; padding: 0 2px; user-select: none;
}
.chat-panel-inline .quick-bar .quick-bar-divider {
    width: 1px; background: var(--border-subtle); align-self: stretch; margin: 2px 2px;
}
.chat-panel-inline .quick-bar button.quick-btn-p2-disabled {
    opacity: 0.45; cursor: default;
}
.chat-panel-inline .quick-bar button.quick-btn-p2-disabled:hover { background: var(--surface-raised); }
.phase-chip {
    display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
    padding: 2px 7px; border-radius: 10px; margin-left: 6px; vertical-align: middle;
}
.phase-chip-p1 { background: var(--signal-info-muted); color: var(--signal-info); }
.phase-chip-p2 { background: var(--signal-ok-muted); color: var(--signal-ok); }

/* ── Status bar (footer) ── */
.pd-statusbar {
    display: flex; align-items: center; gap: 8px;
    padding: 0 20px; height: 26px;
    background: var(--surface-raised); border-top: 1px solid var(--border-subtle);
    font-size: 11px; color: var(--text-muted);
}
.pd-statusbar-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.pd-statusbar-sep { color: var(--border-strong); }

/* ── Main content area ── */
.pd-main { flex: 1; min-height: 0; padding: 16px 20px; }

/* ============================================================
   PlcViewer — vendor 상단 + 메인 하단 (#21 배치개선)
   ============================================================ */
.viewer-root {
    display: flex; flex-direction: column;
    gap: 8px; align-items: stretch;
    max-width: 1500px; margin: 0 auto;
}
/* 콤팩트 한 줄 상단 바: [파일 열기] + chip 들 */
.vendor-side {
    background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: 8px;
    padding: 6px 10px;
    display: flex; flex-direction: row; flex-wrap: wrap; gap: 10px; align-items: center;
}
.ctx-empty-inline { font-size: 12px; color: var(--text-muted); }
.ctx-empty-inline b { color: var(--text-strong); }
.ctx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ctx-chip {
    display: inline-flex; gap: 6px; align-items: baseline;
    background: var(--surface-sunken); border: 1px solid var(--border-subtle); border-radius: 4px;
    padding: 3px 10px; font-size: 12px; color: var(--text-strong); font-weight: 600;
    font-family: ui-monospace, monospace;
}
.ctx-chip b {
    color: var(--text-muted); font-weight: 600; font-family: inherit;
    text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px;
}
.ctx-chip.warn {
    border-color: color-mix(in srgb, var(--signal-warn) 40%, transparent);
    background: var(--signal-warn-muted); color: var(--signal-warn);
}
.ctx-chip-btn { cursor: pointer; border: inherit; font: inherit; }
.ctx-parse-warn-wrap { position: relative; display: inline-block; }
.ctx-parse-popover {
    position: absolute; top: 100%; left: 0; z-index: 200; min-width: 300px; max-width: 480px;
    background: var(--surface-raised); border: 1px solid var(--border-strong);
    border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.15); margin-top: 4px;
    outline: none;
}
.ctx-parse-popover-hd {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; font-size: 12px; font-weight: 700;
    border-bottom: 1px solid var(--border-subtle);
}
.ctx-parse-hd-actions { display: flex; gap: 4px; align-items: center; }
.ctx-parse-close {
    background: none; border: none; cursor: pointer; font-size: 14px;
    color: var(--text-muted); line-height: 1;
}
.ctx-parse-close:hover { color: var(--text-strong); }
.ctx-parse-list { margin: 0; padding: 6px 0; list-style: none; max-height: 220px; overflow-y: auto; }
.ctx-parse-item { padding: 4px 12px; font-size: 11px; font-family: ui-monospace, monospace; color: var(--signal-warn); word-break: break-all; }

.vendor-browse-btn {
    display: inline-flex; padding: 6px 14px;
    background: var(--accent); color: var(--surface-raised);
    border: 0; border-radius: 6px; text-align: center;
    font-size: 13px; font-weight: 700; font-family: inherit;
    cursor: pointer;
    transition: 0.15s;
}
.vendor-browse-btn:hover { background: var(--accent); }

/* ── 벤더 선택 모달 ── */
.vendor-modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(15, 23, 42, 0.45);
    display: flex; align-items: center; justify-content: center;
}
.vendor-modal {
    background: var(--surface-raised); border-radius: 12px; padding: 0;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
    width: clamp(260px, 90vw, 660px);
    max-height: 80vh; display: flex; flex-direction: column;
    overflow: hidden;
}
.vendor-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border-subtle);
}
.vendor-modal-header h3 { margin: 0; font-size: 16px; color: var(--text-strong); }
.vendor-modal-close {
    background: none; border: 0; font-size: 16px; color: var(--text-muted);
    cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
.vendor-modal-close:hover { background: var(--signal-err-muted); color: var(--signal-err); }
.vendor-modal-grid {
    padding: 16px 20px; display: grid;
    grid-template-columns: repeat(2, 1fr); gap: 10px;
    overflow-y: auto;
}
.vendor-modal-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px; cursor: pointer;
    border: 1.5px solid var(--border-subtle);
    border-left: 4px solid var(--vc, var(--border-subtle));
    background: linear-gradient(90deg, color-mix(in srgb, var(--vc, var(--border-subtle)) 8%, transparent), transparent);
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.vendor-modal-item:hover {
    background: linear-gradient(90deg, color-mix(in srgb, var(--vc, var(--border-subtle)) 20%, transparent), var(--surface-sunken));
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.vendor-modal-item.active {
    border-color: var(--vc, var(--accent));
    background: linear-gradient(90deg, color-mix(in srgb, var(--vc, var(--border-subtle)) 28%, transparent), var(--surface-sunken));
    box-shadow: 0 0 0 1px var(--vc, var(--accent));
}
.vendor-modal-footer {
    padding: 10px 20px; border-top: 1px solid var(--border-subtle);
    text-align: center;
}
.vendor-modal-hint { font-size: 11px; color: var(--text-disabled); }

.vendor-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 52px; height: 32px; flex-shrink: 0;
    background: var(--surface-raised); padding: 3px 5px; border-radius: 5px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    font-size: 10.5px; font-weight: 700;
    transition: transform 0.15s;
}
.vendor-logo img {
    max-width: 100%; max-height: 100%; object-fit: contain;
}
.vendor-logo.txt-fb {
    background: var(--fbg, var(--surface-overlay));
    color: var(--surface-raised); font-size: 11px; font-weight: 800;
}
.vendor-logo.txt-fb::after { content: attr(data-fb); }
.vendor-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.vendor-info strong { color: var(--text-strong); font-size: 12.5px; font-weight: 700; }
.vendor-info span { color: var(--text-muted); font-size: 10.5px; }
.vendor-info code {
    color: var(--signal-info); background: none; padding: 0;
    font-family: ui-monospace, monospace; font-size: 10.5px;
}

/* ── Main viewer content (우측) ── */
.viewer-main { min-width: 0; }
section {
    background: var(--surface-raised); border: 1px solid var(--border-subtle);
    border-radius: 8px; padding: 14px 18px; margin-bottom: 14px;
}
section h2 { font-size: 15px; margin: 0 0 10px; color: var(--text-strong); }
.section-hd { display: flex; align-items: center; gap: 4px; margin: 0 0 10px; }
.section-hd h2 { margin: 0; font-size: 15px; color: var(--text-strong); }
.upload {
    display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.upload-label { font-size: 13px; color: var(--text-muted); }
.upload-label b { color: var(--text-strong); }
.error { color: var(--signal-err); font-weight: 600; font-size: 13px; }
.retry-btn { margin-left: 8px; padding: 2px 10px; font-size: 12px; background: var(--surface-hover); border: 1px solid var(--border-strong); border-radius: 4px; cursor: pointer; color: var(--signal-info); }
.retry-btn:hover { background: var(--border-subtle); }

/* ── 상단 콤팩트 상태 바 (이전 .upload + .loading-progress 통합) ── */
.status-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 6px 12px; margin-bottom: 8px;
    background: var(--surface-sunken); border: 1px solid var(--border-subtle); border-radius: 6px;
    font-size: 12px; color: var(--text-muted); min-height: 32px;
}
.status-bar.active { background: var(--signal-info-muted); border-color: var(--signal-info-muted); }
.status-vendor b { color: var(--text-strong); }
.status-hint { color: var(--text-disabled); }
.status-bar-inline {
    display: flex; align-items: center; gap: 10px; flex: 1; min-width: 280px;
}
.status-bar-fill { flex: 0 0 120px; height: 4px; background: var(--signal-info-muted); border-radius: 2px; overflow: hidden; position: relative; }
.status-bar-progress {
    position: absolute; left: 0; top: 0; height: 100%; width: 30%;
    background: linear-gradient(90deg, var(--signal-info), var(--signal-info));
    border-radius: 2px;
    animation: status-progress-slide 1.4s ease-in-out infinite;
}
@keyframes status-progress-slide {
    0%   { left: 0; width: 30%; }
    50%  { left: 40%; width: 40%; }
    100% { left: 100%; width: 30%; }
}
.status-step { color: var(--signal-info); font-weight: 600; }
.status-elapsed { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.status-log-details { margin-left: auto; }
.status-log-details summary {
    cursor: pointer; padding: 2px 8px; background: var(--surface-raised); border: 1px solid var(--border-strong);
    border-radius: 4px; font-size: 11px; color: var(--text-muted);
}
.status-log-details[open] summary { background: var(--surface-hover); }
.status-log {
    position: absolute; right: 12px; top: 38px; z-index: 5;
    list-style: none; padding: 8px 12px; margin: 4px 0 0;
    font-size: 11px; font-family: ui-monospace, monospace;
    color: var(--text-muted); max-height: 200px; min-width: 240px; max-width: calc(100vw - 24px); overflow-y: auto;
    background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.status-log li { padding: 1px 0; line-height: 1.5; }
.status-error { color: var(--signal-err); font-weight: 600; }

/* ── AI 대화 패널 (로딩 중) ── */
.ai-conv-panel {
    flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0;
    border-top: 1px solid var(--border-subtle);
    font-size: 12.5px; font-family: 'Consolas', 'Menlo', monospace;
}
.ai-conv-waiting {
    padding: 12px 16px; color: var(--text-muted);
    display: flex; flex-direction: column; gap: 2px;
}
.ai-conv-log-line { padding: 1px 0; line-height: 1.6; white-space: pre-wrap; }
.ai-conv-block {
    display: flex; flex-direction: column; border-bottom: 1px solid var(--border-subtle);
}
.ai-conv-role {
    padding: 5px 14px; font-size: 11px; font-weight: 700; letter-spacing: .04em;
    background: var(--surface-sunken); border-bottom: 1px solid var(--border-subtle);
    position: sticky; top: 0; z-index: 1;
}
.ai-conv-system .ai-conv-role  { color: #6d28d9; background: #f5f3ff; }
.ai-conv-user .ai-conv-role    { color: #1d4ed8; background: #eff6ff; }
.ai-conv-assistant .ai-conv-role { color: #065f46; background: #ecfdf5; }
.ai-conv-pending .ai-conv-role { color: var(--text-muted); background: var(--surface-sunken); }
.ai-conv-text {
    margin: 0; padding: 10px 16px; white-space: pre-wrap; word-break: break-all;
    font-size: 12px; line-height: 1.6; color: var(--text); background: var(--surface);
    max-height: 320px; overflow-y: auto;
}
.ai-conv-spinner { padding: 10px 16px; color: var(--text-muted); display: block; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* 처음 사용자 안내 가이드 */
.welcome-guide {
    display: flex; align-items: stretch; gap: 0;
    background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: 8px;
    padding: 16px 20px; margin-bottom: 14px; flex-wrap: wrap;
}
.welcome-step {
    display: flex; align-items: flex-start; gap: 10px;
    flex: 1; min-width: 160px;
    padding: 10px 14px; border-radius: 7px;
    background: var(--surface-sunken); border: 1px solid var(--border-subtle);
    opacity: 0.55;
    transition: box-shadow 0.15s;
}
.welcome-step.active {
    opacity: 1;
    border-color: var(--accent); background: var(--signal-ok-muted);
    box-shadow: 0 0 0 2px var(--signal-ok-muted);
}
.welcome-step.done {
    opacity: 0.8;
    border-color: var(--text-disabled);
}
.ws-num {
    font-size: 22px; font-weight: 800; line-height: 1;
    color: var(--text-disabled); flex-shrink: 0; padding-top: 2px;
}
.welcome-step.active .ws-num { color: var(--accent); }
.welcome-step.done .ws-num { color: var(--text-muted); }
.ws-body { display: flex; flex-direction: column; gap: 4px; }
.ws-title { font-size: 13px; font-weight: 700; color: var(--text-strong); }
.ws-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.ws-desc code { background: var(--surface-hover); color: var(--signal-info); padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, monospace; font-size: 11px; }
.ws-arrow {
    display: flex; align-items: center; justify-content: center;
    color: var(--border-strong); font-size: 18px; font-weight: 700;
    padding: 0 8px; flex-shrink: 0; align-self: center;
}
@media (max-width: 700px) {
    .welcome-guide { flex-direction: column; }
    .ws-arrow { transform: rotate(90deg); align-self: center; }
}

/* ── 새 Welcome (P1 정적 분석 + P2 로그 안내) ─── */
.welcome {
    background: linear-gradient(135deg, var(--surface-sunken) 0%, var(--signal-info-muted) 100%);
    border: 1px solid var(--signal-info-muted); border-radius: 12px;
    padding: 28px 36px; margin: 8px 0 14px;
}
.welcome-hero { text-align: center; margin-bottom: 24px; }
.welcome-hero-icon { font-size: 42px; line-height: 1; margin-bottom: 8px; }
.welcome-hero h2 { margin: 0 0 8px; font-size: 20px; color: var(--text-strong); font-weight: 700; }
.welcome-hero p { margin: 4px 0; font-size: 13px; color: var(--text-muted); }
.welcome-hero .hl { color: var(--accent); background: var(--signal-ok-muted); padding: 2px 8px; border-radius: 4px; }
.welcome-vendor code { background: var(--surface-raised); color: var(--signal-info); padding: 1px 6px; border-radius: 3px; font-family: ui-monospace, monospace; font-size: 11px; border: 1px solid var(--border-subtle); }
.welcome-flow {
    display: flex; align-items: stretch; gap: 16px; margin: 0 auto;
    max-width: 980px; flex-wrap: wrap;
}
.flow-stage {
    flex: 1; min-width: 320px;
    background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.flow-stage.optional { background: var(--surface-hover); opacity: 0.92; }
.flow-stage-badge {
    display: inline-block; padding: 3px 10px; border-radius: 12px;
    background: var(--accent); color: var(--surface-raised); font-size: 11px; font-weight: 700;
    letter-spacing: 0.5px; margin-bottom: 8px;
}
.flow-stage-badge.p2 { background: var(--text-muted); }
.flow-stage-title { font-size: 15px; font-weight: 700; color: var(--text-strong); margin-bottom: 10px; }
.flow-stage-steps { list-style: none; padding: 0; margin: 0; }
.flow-stage-steps li {
    padding: 6px 0; font-size: 12px; color: var(--text-muted); line-height: 1.5;
    border-bottom: 1px dashed var(--surface-hover);
}
.flow-stage-steps li:last-child { border-bottom: 0; }
.flow-stage-steps b { color: var(--signal-info); font-weight: 700; }
.flow-warn { display: inline-block; margin-left: 6px; padding: 1px 8px;
    background: var(--signal-warn-muted); color: var(--signal-warn); border-radius: 4px; font-size: 11px; font-weight: 600; }
.flow-arrow {
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: var(--text-disabled); padding: 0 4px; flex-shrink: 0;
}
.welcome-tabs-hint {
    text-align: center; margin-top: 22px; font-size: 12px; color: var(--text-muted);
}
.welcome-tabs-hint code {
    background: var(--surface-raised); padding: 2px 8px; border-radius: 4px;
    font-family: ui-monospace, monospace; font-size: 11px;
    border: 1px solid var(--border-subtle); color: var(--text-base); margin: 0 2px;
}
@media (max-width: 760px) {
    .welcome-flow { flex-direction: column; }
    .flow-arrow { transform: rotate(90deg); align-self: center; }
}

/* 진행 상태 (로딩 + 단계 메시지) */
.loading-progress { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 260px; padding: 8px 0; }
.loading-bar { width: 100%; height: 4px; background: var(--border-subtle); border-radius: 2px; overflow: hidden; position: relative; }
.loading-bar-fill {
    position: absolute; left: -30%; width: 30%; height: 100%;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    animation: loading-slide 1.4s linear infinite;
}
@keyframes loading-slide { 0% { left: -30%; } 100% { left: 100%; } }
.loading-status { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.loading-step { color: var(--text-strong); font-weight: 600; }
.loading-elapsed { color: var(--text-muted); font-size: 11px; font-family: ui-monospace, monospace; }
.loading-log { list-style: none; padding: 0; margin: 4px 0 0; font-size: 11px; font-family: ui-monospace, monospace; color: var(--text-muted); max-height: 100px; overflow-y: auto; background: var(--surface-sunken); border-radius: 4px; padding: 6px 10px; }
.loading-log li { padding: 1px 0; line-height: 1.5; }

/* 벤더 확장자 안내 */
.vendor-ext-hint { font-size: 10.5px; color: var(--text-muted); padding: 4px 6px; margin: 0; width: 220px; align-self: flex-start; }
.vendor-ext-hint code { background: var(--surface-hover); color: var(--signal-info); padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, monospace; font-size: 10px; }

/* ── meta ── */
section .meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px 16px; }
section .meta details { grid-column: 1 / -1; }
.meta-copy-btn { margin-left: 8px; padding: 0 6px; font-size: 11px; background: none; border: 1px solid var(--border-subtle); border-radius: 3px; cursor: pointer; color: var(--text-muted); vertical-align: middle; }
.meta-copy-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Tabs (Siemens-style 밑줄 강조) ── */
.tabs {
    display: flex; gap: 0; margin-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
}
.tabs button {
    padding: 10px 18px; background: transparent;
    border: 0; border-bottom: 2px solid transparent;
    cursor: pointer; font-size: 13px; font-weight: 500;
    color: var(--text-muted);
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}
.tabs button:hover { color: var(--text-base); }
.tabs button.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}
.tabs.sub { margin-top: 16px; }
.tabs.sub button.active { color: var(--text-strong); border-bottom-color: var(--text-strong); }

/* ── Tag Table ── */
.tag-table-section { padding: 0; background: transparent; border: 0; }
.tag-toolbar {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    margin-bottom: 10px; padding: 10px 14px;
    background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: 6px;
}
.tag-search { flex: 1; min-width: 260px; padding: 6px 12px; border: 1px solid var(--border-subtle); border-radius: 4px; font-size: 13px; }
.tag-search:focus { outline: none; border-color: var(--accent); }
.tag-toolbar select { padding: 6px 10px; border: 1px solid var(--border-subtle); border-radius: 4px; font-size: 12px; }
.tag-summary { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.tag-toolbar .dl-btn { background: var(--accent); color: var(--surface-raised); border: 0; padding: 6px 14px; font-size: 12px; border-radius: 4px; cursor: pointer; }
.tag-table-wrap { background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: 6px; overflow: auto; max-height: calc(100vh - 280px); }
table.tag-table { width: 100%; border-collapse: collapse; font-size: 12px; }
table.tag-table thead { position: sticky; top: 0; background: var(--surface-overlay); color: var(--surface-raised); z-index: 1; }
table.tag-table th { padding: 8px 10px; text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; }
table.tag-table th.sortable { cursor: pointer; user-select: none; }
table.tag-table th.sortable:hover { background: var(--surface-sunken); }
table.tag-table th.sortable.active { color: var(--accent, #2563eb); border-bottom: 2px solid var(--accent, #2563eb); }
table.tag-table td { padding: 5px 10px; border-bottom: 1px solid var(--surface-hover); }
table.tag-table tbody tr:hover { background: var(--surface-sunken); }
.ladder-header { display:flex; align-items:center; gap:4px; margin-bottom:4px; }
.ladder-header h2 { margin:0; flex:1; }
.addr-copyable { cursor: pointer; }
.addr-copyable:hover { background: var(--accent-muted, rgba(37,99,235,.08)); color: var(--accent, #2563eb); }
.addr-copy-inner { display:inline; background:none; border:none; padding:0; cursor:pointer; font:inherit; color:inherit; }
.addr-copied { color: var(--signal-ok, #16a34a); font-weight: 600; }
table.tag-table .num { color: var(--text-muted); text-align: right; font-size: 11px; }
table.tag-table .mono { font-family: ui-monospace, monospace; font-size: 11px; }
table.tag-table .io { font-weight: 600; font-size: 10px; text-align: center; }
table.tag-table .io.out { color: var(--signal-err); }
table.tag-table .io.in { color: var(--signal-ok); }
table.tag-table .io.mem { color: var(--text-muted); }
/* Class column (BitClassifier 분류 결과) */
table.tag-table .cls { font-size: 10.5px; font-weight: 700; white-space: nowrap; padding: 3px 8px; border-radius: 10px; display: inline-block; }
table.tag-table .cls.cmd      { background: var(--signal-err-muted); color: var(--signal-err); }   /* DeviceCommand   - 빨강 */
table.tag-table .cls.fb       { background: var(--signal-ok-muted); color: var(--signal-ok); }   /* DeviceFeedback  - 초록 */
table.tag-table .cls.out      { background: var(--signal-warn-muted); color: var(--signal-warn); }   /* DeviceOutput    - 주황 */
table.tag-table .cls.in       { background: var(--signal-info-muted); color: var(--signal-info); }   /* DeviceInput     - 파랑 */
table.tag-table .cls.ws       { background: var(--accent-muted); color: var(--accent); }   /* WorkState       - 보라 */
table.tag-table .cls.mem      { background: var(--border-subtle); color: var(--text-muted); }   /* Memory          - 회색 */
table.tag-table .cls.aux      { background: var(--surface-hover); color: var(--text-muted); }   /* Aux             - 연회색 */
table.tag-table .cls.internal { background: var(--signal-warn-muted); color: var(--signal-warn); }   /* Internal        - 호박 */
table.tag-table .cls.tc       { background: var(--signal-err-muted); color: var(--signal-err); }   /* TimerCounter    - 분홍 */
table.tag-table .cls.data     { background: var(--accent-muted); color: var(--accent); }   /* Data            - 시안 */
table.tag-table .cls.unknown  { background: var(--signal-err-muted); color: var(--signal-err); border: 1px dashed var(--signal-err); }
.tag-truncated { padding: 10px 14px; background: var(--signal-warn-muted); color: var(--signal-warn); font-size: 12px; border-top: 1px solid var(--signal-warn); display: flex; align-items: center; gap: 8px; }
.tag-page-btn { padding: 2px 10px; font-size: 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; color: var(--fg-1); }
.tag-page-btn:disabled { opacity: .4; cursor: default; }
.tag-page-btn:not(:disabled):hover { background: var(--bg-3); }

/* Mapper 제안 섹션 (Tag Table 탭) */
.mapper-suggest {
    background: var(--signal-warn-muted); border: 1px solid var(--signal-warn); border-radius: 7px;
    margin-bottom: 12px; padding: 0;
}
.mapper-suggest > summary {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px; font-size: 12.5px; font-weight: 700;
    color: var(--signal-warn); cursor: pointer; list-style: none;
    user-select: none;
}
.mapper-suggest > summary::-webkit-details-marker { display: none; }
.mapper-suggest > summary::before { content: "▶ "; font-size: 10px; }
.mapper-suggest[open] > summary::before { content: "▼ "; }
.mapper-suggest .mapper-dl-btn {
    margin-left: auto; background: var(--signal-warn); color: var(--surface-raised);
    border: 0; padding: 4px 10px; font-size: 11px; border-radius: 4px; cursor: pointer;
}
.mapper-suggest .mapper-dl-btn:hover { background: var(--signal-warn); }
.mapper-json {
    margin: 0; padding: 10px 14px; font-size: 11.5px;
    font-family: ui-monospace, monospace; background: var(--signal-warn-muted);
    border-top: 1px solid var(--signal-warn); max-height: 260px; overflow-y: auto;
    white-space: pre-wrap; word-break: break-all;
}
.mapper-hint {
    padding: 8px 14px; margin: 0; font-size: 11.5px; color: var(--signal-warn);
    border-top: 1px dashed var(--signal-warn);
}
.mapper-hint code { background: var(--signal-warn-muted); color: var(--signal-warn); padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, monospace; font-size: 11px; }

/* ── POU / Ladder ── */
.split { display: grid; grid-template-columns: 260px 1fr; gap: 14px; }
.pou-list { max-height: 600px; overflow-y: auto; }
.pou-search { width: 100%; box-sizing: border-box; margin-bottom: 6px; padding: 5px 8px; font-size: 12px; border: 1px solid var(--border-subtle); border-radius: 4px; background: var(--surface-raised); color: var(--text-base); }
.pou-list > ul { list-style: none; padding: 0; margin: 0; }
.pou-group { margin-bottom: 3px; border: 1px solid var(--border-subtle); border-radius: 4px; }
.pou-group summary { cursor: pointer; padding: 5px 10px; background: var(--surface-hover); border-radius: 3px; font-size: 12px; font-weight: 600; color: var(--text-base); list-style: none; user-select: none; }
.pou-group summary:hover { background: var(--border-subtle); }
.pou-group summary small { font-weight: 400; color: var(--text-muted); margin-left: 4px; }
.pou-group ul { list-style: none; padding: 0 0 0 4px; margin: 0; }
.pou-list button {
    width: 100%; text-align: left; padding: 6px 10px;
    background: var(--surface-sunken); border: 1px solid var(--border-subtle);
    cursor: pointer; margin-bottom: 4px; border-radius: 3px; font-size: 12px;
    color: var(--text-strong);
}
.pou-list button:hover { background: var(--surface-hover); }
.pou-list button.active { background: var(--accent); color: var(--surface-raised); border-color: var(--accent); }
.pou-list button.no-ladder { opacity: 0.45; }
.pou-list button.no-ladder:hover { opacity: 0.75; }
.pou-lad-dot { color: var(--accent); font-size: 9px; vertical-align: middle; margin-right: 3px; }
.pou-list button.active .pou-lad-dot { color: var(--surface-raised); }
.il pre { background: var(--text-strong); color: var(--border-strong); padding: 10px; border-radius: 4px; overflow: auto; font-size: 12px; max-height: 400px; }
.ladder { overflow: auto; }
.ladder svg { background: var(--surface-raised); }
.pou-placeholder { padding: 16px; color: var(--text-muted); font-size: 13px; }

/* ── Pipeline controls ── */
.pipeline-controls { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.pipeline-controls select { padding: 4px 8px; border: 1px solid var(--border-subtle); border-radius: 4px; }
button.primary {
    background: var(--accent); color: var(--surface-raised); border: 0;
    padding: 7px 16px; font-size: 12.5px; border-radius: 4px;
    cursor: pointer; font-weight: 600;
}
button.primary:disabled { background: var(--text-disabled); cursor: wait; }

/* ── KPI grid ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--surface-raised); padding: 12px; border-radius: 6px; border: 1px solid var(--border-subtle); }
.kpi .lbl { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi .val { font-size: 22px; font-weight: 700; color: var(--text-strong); margin-top: 4px; }
.kpi .hint { font-size: 11px; color: var(--signal-err); margin-top: 4px; }
.kpi.ok { border-color: var(--accent); }
.kpi.ok .val { color: var(--signal-ok); }
.kpi.fail { border-color: var(--signal-err); }
.kpi.fail .val { color: var(--signal-err); }
.kpi.warn { border-color: var(--signal-warn); }
.kpi.warn .val { color: var(--signal-warn); }
.kpi.warn .hint { color: var(--signal-warn); }
.kpi .warn-details { font-size: 11px; color: var(--signal-warn); margin-top: 4px; }
.kpi .warn-details summary { cursor: pointer; }
.kpi .warn-details .warn-msg { margin-top: 2px; word-break: break-word; }
.kpi .mono { font-family: ui-monospace, monospace; font-size: 13px; }

table.histogram { border-collapse: collapse; }
table.histogram th, table.histogram td { padding: 4px 12px; border-bottom: 1px solid var(--border-subtle); text-align: left; font-size: 13px; }
.timings { display: flex; gap: 12px; flex-wrap: wrap; }
.timings .tm { background: var(--surface-hover); padding: 4px 10px; border-radius: 4px; font-size: 12px; }

.banner-p1 { background: var(--signal-warn-muted); border: 1px solid var(--signal-warn); color: var(--signal-warn); padding: 6px 12px; border-radius: 4px; font-size: 12px; margin-bottom: 8px; }
.adb-path-banner { display: flex; align-items: center; gap: 8px; background: var(--surface-sunken); border: 1px solid var(--border-subtle); border-radius: 4px; padding: 6px 12px; margin-top: 10px; font-size: 12px; }
.adb-icon { font-size: 14px; }
.adb-label { color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.adb-path { font-family: ui-monospace, monospace; font-size: 11px; color: var(--accent); word-break: break-all; }
.adb-copy-btn { margin-left: auto; padding: 2px 8px; font-size: 11px; background: none; border: 1px solid var(--border-subtle); border-radius: 3px; cursor: pointer; color: var(--text-muted); white-space: nowrap; }
.adb-copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.dl { margin-bottom: 10px; }
.dl button { background: var(--accent); color: var(--surface-raised); border: 0; padding: 6px 14px; font-size: 12px; border-radius: 4px; cursor: pointer; }
.json-out { background: var(--text-strong); color: var(--border-strong); padding: 12px; border-radius: 4px; font-size: 11px; overflow: auto; max-height: 500px; line-height: 1.4; }
.mermaid-host { overflow: auto; max-height: 700px; padding: 10px; background: var(--surface-sunken); border: 1px solid var(--border-subtle); border-radius: 4px; }
.mermaid-host svg { max-width: none; }
.mermaid-fs-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; }
.mermaid-fs-dialog { background: var(--surface); border-radius: 8px; width: 92vw; height: 88vh; overflow: auto; position: relative; padding: 1rem; }
.mermaid-fs-close { position: absolute; top: .5rem; right: .75rem; background: transparent; border: 0; font-size: 1.25rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.mermaid-fs-close:hover { color: var(--text-base); }
.mermaid-host-fs { max-height: calc(88vh - 3rem); border: 0; }
.pipe-truncate-banner { display: flex; align-items: center; gap: 6px; padding: 6px 12px; margin-bottom: 6px; background: var(--signal-warn-bg, #fef3c7); border: 1px solid var(--signal-warn, #d97706); border-radius: 4px; font-size: .82rem; color: var(--signal-warn, #d97706); font-weight: 600; }
.pipe-truncate-dl { background: none; border: none; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; text-decoration: underline; }

/* ── AI Chat (인라인 패널) ── */
.msg { max-width: 100%; padding: 10px 14px; font-size: 13px; line-height: 1.6; }
.msg .content code { background: var(--surface-sunken); padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, monospace; font-size: 12px; }
.msg-user .content code { background: rgba(255, 255, 255, 0.18); }
.msg .content pre.code { background: var(--text-strong); color: var(--border-strong); padding: 10px; border-radius: 4px; font-size: 11px; overflow: auto; margin: 6px 0; }
.msg-system { align-self: center; max-width: 90%; padding: 6px 14px; background: var(--signal-warn-muted); border: 1px dashed var(--signal-warn); border-radius: 16px; font-size: 11px; color: var(--signal-warn); text-align: center; }

.composer { display: flex; gap: 8px; padding: 14px; border-top: 1px solid var(--border-subtle); background: var(--surface-sunken); }
.composer textarea {
    flex: 1; padding: 8px 12px; border: 1px solid var(--border-subtle);
    border-radius: 6px; font-family: inherit; font-size: 13px; resize: none;
}
.composer textarea:focus { outline: none; border-color: var(--accent); }
.btn.primary {
    background: var(--accent); color: var(--surface-raised); border: 0;
    padding: 0 22px; border-radius: 6px; cursor: pointer;
    font-weight: 600; min-width: 80px;
}
.btn.primary:disabled { background: var(--text-disabled); cursor: wait; }

/* ============================================================
   Settings Modal (우상단 ⚙)
   ============================================================ */
.settings-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); z-index: 1000;
    display: flex; align-items: flex-start; justify-content: flex-end;
    padding: 60px 24px 24px 24px;
}
.settings-modal {
    background: var(--surface-raised); border-radius: 8px; width: min(480px, 100%); max-height: calc(100vh - 80px);
    display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
    animation: slideDown 0.2s ease-out;
}
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.settings-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); }
.settings-header h2 { margin: 0; font-size: 15px; color: var(--text-strong); }
.settings-header .x { background: none; border: 0; font-size: 18px; cursor: pointer; color: var(--text-muted); padding: 0 6px; }
.settings-header .x:hover { color: var(--signal-err); }
.settings-body { padding: 14px 18px; overflow-y: auto; flex: 1; }
.setting-row { display: grid; grid-template-columns: 100px 1fr; gap: 10px; align-items: center; margin-bottom: 12px; }
.setting-row label:first-child, .setting-row .sm-lbl { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.setting-row input[type=text], .setting-row input[type=password], .setting-row input[type=number], .setting-row select {
    width: 100%; padding: 6px 8px; border: 1px solid var(--border-subtle); border-radius: 4px; font-size: 12.5px;
}
.setting-row input:focus, .setting-row select:focus { outline: none; border-color: var(--accent); }
.setting-row input[type=checkbox] { width: auto; }
.cli-status { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 4px; font-size: 12px; flex-wrap: wrap; }
.cli-status.ok { background: var(--signal-ok-muted); color: var(--signal-ok); border: 1px solid var(--accent); }
.cli-status.fail { background: var(--signal-err-muted); color: var(--signal-err); border: 1px solid var(--signal-err-muted); }
.cli-status code { background: var(--surface-sunken); padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, monospace; font-size: 11px; }
.cli-status button { padding: 3px 8px; font-size: 11px; background: var(--surface-raised); color: inherit; border: 1px solid currentColor; border-radius: 3px; cursor: pointer; }
.cli-status button.primary { background: var(--accent); color: var(--surface-raised); border-color: var(--accent); }
.diag-detail { background: var(--signal-warn-muted); padding: 8px 10px; border-radius: 4px; font-size: 11.5px; line-height: 1.5; }
.diag-detail strong { color: var(--signal-warn); margin-right: 6px; }
.diag-detail pre { margin: 6px 0 0; white-space: pre-wrap; font-family: inherit; font-size: 11px; }
.diag-fix-wrap { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; }
.diag-fix-wrap pre { flex: 1; margin: 0; }
.credentials-expiry-warning { background: var(--signal-warn-muted); color: var(--signal-warn); border: 1px solid var(--signal-warn); border-radius: 4px; padding: 8px 10px; font-size: 11.5px; line-height: 1.5; }
.credentials-expiry-warning code { background: var(--surface-sunken); padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, monospace; font-size: 11px; color: var(--text-strong); }
.apikey-row { display: flex; gap: 6px; align-items: center; }
.apikey-row input { flex: 1; }
.apikey-row .btn { padding: 5px 10px; font-size: 11px; white-space: nowrap; background: var(--accent); color: var(--surface-raised); border: 1px solid var(--accent); border-radius: 4px; cursor: pointer; }
.apikey-row .btn:disabled { opacity: 0.5; cursor: default; }
.apikey-test-result { font-size: 11.5px; padding: 4px 8px; border-radius: 4px; }
.apikey-test-result.ok { background: var(--signal-ok-muted); color: var(--signal-ok); }
.apikey-test-result.fail { background: var(--signal-err-muted); color: var(--signal-err); }
.setup-log { background: var(--surface-hover); padding: 8px; border-radius: 4px; font-size: 10.5px; max-height: 160px; overflow-y: auto; line-height: 1.5; margin: 0; white-space: pre-wrap; }
.settings-footer { padding: 10px 18px; border-top: 1px solid var(--border-subtle); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.settings-footer .btn { padding: 6px 14px; font-size: 12px; background: var(--surface-hover); color: var(--text-strong); border: 1px solid var(--border-subtle); border-radius: 4px; cursor: pointer; }
.settings-footer .btn.primary { background: var(--accent); color: var(--surface-raised); border-color: var(--accent); }
.settings-footer .saved { color: var(--signal-ok); font-size: 11px; margin-right: auto; }
.sm-toast {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 99999;
    padding: .55rem 1.1rem; border-radius: 8px; font-size: .85rem;
    box-shadow: 0 4px 16px rgba(0,0,0,.35);
    pointer-events: none;
    animation: sm-toast-in .18s ease;
}
.sm-toast-ok  { background: #1a3a2a; color: #4ade80; border: 1px solid rgba(74,222,128,.3); }
.sm-toast-err { background: #3a1a1a; color: #f85149; border: 1px solid rgba(248,81,73,.3); }
@@keyframes sm-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* /log-analysis P2 UI */
.log-root { max-width: 860px; margin: 0 auto; padding: 24px 16px; }
.log-root h2 { font-size: 18px; margin: 0 0 20px; color: var(--text-strong); }
.log-root h2 small { font-size: 14px; color: var(--text-muted); font-weight: 400; }
.log-root h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--text-base); }
.log-hint { padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 14px; }
.log-upload-section, .log-timeline, .cycle-input-section, .cycle-stats-section, .p2-result-section {
    background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: 8px;
    padding: 16px 20px; margin-bottom: 16px;
}
.log-upload-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.log-file-input { font-size: 13px; }
.log-status { font-size: 12px; color: var(--signal-ok); margin-left: 10px; }
.log-error { font-size: 12px; color: var(--signal-warn); margin-top: 6px; }
.log-event-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cycle-chip { display: inline-block; font-size: 11px; padding: 3px 10px;
    background: var(--signal-ok-muted); border: 1px solid var(--signal-ok); border-radius: 12px; color: var(--signal-ok); }
.cycle-chip.stat { background: var(--signal-info-muted); border-color: var(--signal-info); color: var(--signal-info); }
.cycle-hint { font-size: 11px; color: var(--text-muted); margin: 0 0 6px; }
.cycle-textarea { width: 100%; padding: 8px; font-size: 12px; font-family: monospace;
    border: 1px solid var(--border-subtle); border-radius: 4px; resize: vertical; box-sizing: border-box; }
.p2-badge { display: inline-block; font-size: 12px; padding: 3px 10px;
    background: var(--signal-ok-muted); border: 1px solid var(--signal-ok); border-radius: 4px; color: var(--signal-ok); font-weight: 600; }

/* ── DS2 Table ─────────────────────────────────────────────── */
.ds2-toolbar-top { padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center;
    background: var(--surface-sunken); border-bottom: 1px solid var(--border-subtle); }
/* 단계별 버튼 공통 */
.ds2-toolbar-top .btn-step {
    padding: 5px 13px; font-size: 12.5px; font-weight: 600; border-radius: 4px;
    cursor: pointer; white-space: nowrap; transition: opacity .15s;
    border: 1px solid var(--border);
}
.ds2-toolbar-top .btn-step:disabled { opacity: .38; cursor: not-allowed; }
/* ① AI 룰 재생성 — 강조 (primary action) */
.ds2-toolbar-top .btn-step-1 {
    background: var(--accent); color: #fff; border-color: var(--accent);
}
.ds2-toolbar-top .btn-step-1:not(:disabled):hover { filter: brightness(1.1); }
/* ② Mapping Config 편집 — 보조 (secondary) */
.ds2-toolbar-top .btn-step-2 {
    background: var(--accent-muted); color: var(--accent); border-color: var(--accent);
}
.ds2-toolbar-top .btn-step-2:not(:disabled):hover { background: var(--accent); color: #fff; }
/* ③ 품질 측정 — 기본 (tertiary) */
.ds2-toolbar-top .btn-step-3 {
    background: var(--surface); color: var(--text); border-color: var(--border);
}
.ds2-toolbar-top .btn-step-3:not(:disabled):hover { background: var(--surface-raised); }
/* 단계 구분 화살표 */
.ds2-toolbar-top .step-sep { font-size: 14px; color: var(--text-disabled); user-select: none; }
/* 상태 뱃지 */
.ds2-toolbar-top .hint { font-size: 11.5px; color: var(--text-disabled); }
.ds2-toolbar-top .hint.warn { color: var(--signal-warn); font-weight: 600; }
.ds2-toolbar-top .hint.ok { color: var(--signal-ok); font-weight: 600; }
/* 하위 호환 (btn-edit 참조 잔재 대비) */
.ds2-toolbar-top .btn-edit { padding: 5px 13px; font-size: 12.5px; font-weight: 600;
    border: 1px solid var(--accent); background: var(--accent-muted); color: var(--accent); border-radius: 4px; cursor: pointer; }
/* Flow 수 입력 + 출력 Head 목록 (#662) */
.flow-count-label { display: flex; align-items: center; gap: 4px; font-size: 12px;
    color: var(--text-muted); white-space: nowrap; }
.flow-count-input { width: 54px; padding: 3px 6px; font-size: 12px; text-align: center;
    border: 1px solid var(--border-strong); border-radius: 4px;
    background: var(--surface); color: var(--text-base); }
.ds2-heads-details { font-size: 12px; color: var(--text-muted); }
.ds2-heads-summary { cursor: pointer; user-select: none; white-space: nowrap;
    padding: 2px 4px; border-radius: 3px; list-style: none; }
.ds2-heads-summary:hover { background: var(--accent-muted); color: var(--accent); }
.ds2-heads-list { max-width: 480px; padding: 4px 8px; font-size: 11px;
    line-height: 1.6; color: var(--text-base); background: var(--surface);
    border: 1px solid var(--border-subtle); border-radius: 4px; margin-top: 2px; }
/* AI 룰 재생성 다이얼로그 */
.regen-dialog-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 1200;
    display: flex; align-items: center; justify-content: center;
}
.regen-dialog {
    background: var(--surface-raised); border-radius: 8px; width: min(640px, 94vw);
    box-shadow: var(--shadow-modal); animation: slideDown 0.18s ease-out;
    display: flex; flex-direction: column;
}
.regen-dialog-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid var(--border-subtle);
    font-size: 14px; font-weight: 600; color: var(--text-strong);
}
.regen-dialog-header .x {
    background: none; border: 0; font-size: 16px; cursor: pointer;
    color: var(--text-muted); padding: 0 4px; line-height: 1;
}
.regen-dialog-header .x:hover { color: var(--signal-err); }
.regen-dialog-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.regen-hint { margin: 0; font-size: 11.5px; color: var(--text-muted); }
.regen-hint-rec { color: var(--accent); margin-left: 4px; }
.regen-flow-preview { background: var(--surface-sunken); border-radius: 5px; padding: 10px 12px; }
.regen-flow-preview-title { font-size: 11.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 7px;
    display: flex; justify-content: space-between; align-items: center; }
.regen-flow-count { font-size: 11px; background: var(--accent-muted); color: var(--accent);
    padding: 1px 7px; border-radius: 10px; font-weight: 700; }
.regen-flow-sel-all { margin-left: auto; display: flex; align-items: center; gap: 3px; }
.regen-flow-sel-all .sep { color: var(--text-disabled); font-size: 11px; }
.btn-link-sm { background: none; border: none; cursor: pointer; font-size: 11px;
    color: var(--accent); padding: 0 2px; text-decoration: underline;
    text-underline-offset: 2px; opacity: 0.85; }
.btn-link-sm:hover { opacity: 1; }
.regen-flow-listbox {
    width: 100%; max-height: 160px; border-radius: 4px;
    border: 1px solid var(--border-subtle); background: var(--surface);
    color: var(--text); font-size: 12px; padding: 2px; outline: none;
}
.regen-flow-listbox option { padding: 3px 6px; }

/* ── 신호 트리 ── */
.regen-flow-tree {
    max-height: 280px; overflow-y: auto;
    border: 1px solid var(--border-subtle); border-radius: 5px;
    background: var(--surface);
}
.regen-tree-group { border-bottom: 1px solid var(--border-subtle); }
.regen-tree-group:last-child { border-bottom: none; }
.regen-tree-hdr {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 10px; cursor: pointer; user-select: none;
    background: var(--surface-sunken); font-size: 12.5px;
}
.regen-tree-hdr:hover { background: var(--surface-hover, #f3f4f6); }
.regen-tree-hdr.exp { background: var(--accent-muted, #eff6ff); }
.regen-tree-chev { font-size: 10px; color: var(--text-muted); min-width: 10px; }
.regen-tree-name { flex: 1; font-weight: 500; color: var(--text); }
.regen-tree-badge {
    font-size: 10.5px; color: var(--text-muted);
    background: var(--border-subtle); padding: 1px 5px; border-radius: 9px;
}
.regen-tree-sigs { background: var(--surface); }
.regen-tree-sig {
    display: flex; align-items: center; gap: 6px;
    padding: 3px 10px 3px 22px; font-size: 11.5px;
    border-top: 1px solid var(--border-subtle);
}
.regen-sig-lbl { flex: 1; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; } /* 폭 확대(#1828) + 최대 2줄 표기로 라벨/코멘트 잘림 완화 */
.regen-sig-addr { flex: 0 0 62px; font-family: monospace; font-size: 11px; color: var(--text-muted); }
.regen-sig-kind { flex: 0 0 28px; font-size: 10px; font-weight: 700; text-align: center;
    padding: 1px 3px; border-radius: 3px; }
.regen-sig-kind.out { background: #fef3c7; color: #92400e; }
.regen-sig-kind.in  { background: #dbeafe; color: #1e40af; }

.regen-dialog-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 10px 16px; border-top: 1px solid var(--border-subtle);
}

/* ── Mapper Flow 구성 — count bar ── */
.regen-count-bar {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface-sunken); border-radius: 6px; padding: 10px 16px;
}
.regen-count-sel, .regen-count-target {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.regen-count-n {
    font-size: 24px; font-weight: 700; color: var(--accent); line-height: 1;
}
.regen-count-lbl { font-size: 10.5px; color: var(--text-muted); white-space: nowrap; }
.regen-count-lbl small { font-size: 9px; opacity: 0.8; }
.regen-count-arrow {
    font-size: 20px; color: var(--text-disabled); flex: 1; text-align: center;
    transition: color 0.15s;
}
.regen-count-arrow.expand { color: var(--signal-warn); font-weight: 700; }
.regen-count-input {
    width: 64px; text-align: center; font-size: 20px; font-weight: 700;
    color: var(--text-strong); border: 1.5px solid var(--border-strong);
    border-radius: 5px; padding: 3px 4px; background: var(--surface);
    outline: none; line-height: 1;
}
.regen-count-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-muted); }
.regen-hint-expand { color: var(--signal-warn); font-weight: 500; }

/* ── 선택된 그룹 강조 ── */
.regen-tree-group.sel > .regen-tree-hdr { background: var(--accent-muted); }
.regen-tree-hdr.chk .regen-tree-name { color: var(--accent); font-weight: 600; }

/* ── 확장 미리보기 ── */
.regen-expand-preview {
    background: var(--signal-warn-muted); border: 1px solid rgba(180,83,9,0.25);
    border-radius: 5px; padding: 8px 12px;
}
.regen-expand-hdr {
    font-size: 11px; font-weight: 600; color: var(--signal-warn);
    display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
}
.regen-expand-badge {
    background: var(--signal-warn); color: #fff;
    border-radius: 9px; padding: 1px 6px; font-size: 10px; font-weight: 700;
}
.regen-expand-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.regen-expand-chip {
    background: var(--surface); border: 1px solid var(--signal-warn);
    border-radius: 4px; padding: 2px 7px; font-size: 11px;
    color: var(--signal-warn); font-weight: 500; font-family: monospace;
}

.ds2-table-section { padding: 0; }
.ds2-toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between;
    padding: 8px 12px; background: white; border-bottom: 1px solid var(--border-subtle); }
.ds2-summary { display: flex; gap: 8px; font-size: 13px; color: var(--text-muted); }
.ds2-summary .sep { color: var(--border-strong); }
.ds2-summary b { color: var(--text-strong); }
.ds2-actions { display: flex; gap: 8px; align-items: center; }
.ds2-search { padding: 6px 10px; font-size: 12px; border: 1px solid var(--border-strong);
    border-radius: 4px; width: 320px; }
.ds2-table-wrap { overflow: auto; max-height: calc(100vh - 280px); }
.ds2-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ds2-table thead th { position: sticky; top: 0; background: var(--text-base); color: white;
    padding: 6px 8px; text-align: left; font-weight: 600; z-index: 1; }
.ds2-table th.sortable { cursor: pointer; user-select: none; }
.ds2-table th.sortable:hover { background: var(--surface-sunken); color: var(--text-strong); }
.ds2-table th.sortable.active { color: var(--accent, #2563eb); border-bottom: 2px solid var(--accent, #2563eb); }
.ds2-table tbody td { padding: 4px 8px; border-bottom: 1px solid var(--surface-hover); }
.ds2-table tbody tr:hover { background: var(--surface-sunken); }
.ds2-table .num { color: var(--text-disabled); text-align: right; font-variant-numeric: tabular-nums; }
.ds2-table .mono { font-family: monospace; font-size: 11px; }
.ds2-table .row-sentinel { background: var(--signal-warn-muted); font-weight: 600; }
.ds2-table .row-sentinel.clear { background: var(--signal-err-muted); }
.ds2-table .row-no-out { background: var(--signal-err-muted); }
.ds2-table .row-no-in { background: var(--signal-warn-muted); }
.ds2-empty { padding: 40px 24px; text-align: center; color: var(--text-muted); }
.ds2-empty .hint { font-size: 12px; color: var(--text-disabled); margin-top: 6px; }
.ds2-empty.ds2-warn { color: var(--signal-warn); background: var(--signal-warn-muted, #fff8e1); border-radius: 6px; border: 1px solid var(--signal-warn, #f9a825); }
.ds2-truncated { padding: 8px 12px; text-align: center; font-size: 12px; color: var(--text-disabled);
    background: var(--surface-sunken); border-top: 1px solid var(--border-subtle); }
.dl-btn .dl-count { font-weight: 400; opacity: 0.85; margin-left: 4px; }

/* ── DS2 출력 대상 필터 칩 바 ──────────────────────────────── */
.ds2-filter-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 6px 12px; background: var(--surface-sunken); border-bottom: 1px solid var(--border-subtle); }
.ds2-filter-bar .filter-label { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-right: 4px; }
.ds2-filter-bar .filter-sep { color: var(--border-strong); margin: 0 4px; }
.ds2-filter-bar .chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; font-size: 12px; border-radius: 14px; cursor: pointer;
    background: var(--surface-raised); color: var(--text-disabled); border: 1px solid var(--border-subtle);
    transition: all 0.12s;
}
.ds2-filter-bar .chip:hover { border-color: var(--border-strong); color: var(--text-muted); }
.ds2-filter-bar .chip .chip-count {
    font-variant-numeric: tabular-nums; font-size: 11px;
    padding: 1px 6px; border-radius: 8px; background: var(--surface-hover); color: var(--text-muted);
}
.ds2-filter-bar .chip.active { font-weight: 600; }
.ds2-filter-bar .chip.ok.active        { background: var(--signal-ok-muted); border-color: var(--signal-ok); color: var(--signal-ok); }
.ds2-filter-bar .chip.ok.active .chip-count       { background: var(--signal-ok-muted); color: var(--signal-ok); }
.ds2-filter-bar .chip.warn.active      { background: var(--signal-warn-muted); border-color: var(--signal-warn); color: var(--signal-warn); }
.ds2-filter-bar .chip.warn.active .chip-count     { background: var(--signal-warn-muted); color: var(--signal-warn); }
.ds2-filter-bar .chip.danger.active    { background: var(--signal-err-muted); border-color: var(--signal-err-muted); color: var(--signal-err); }
.ds2-filter-bar .chip.danger.active .chip-count   { background: var(--signal-err-muted); color: var(--signal-err); }
.ds2-filter-bar .chip.sentinel.active  { background: var(--signal-warn-muted); border-color: var(--signal-warn); color: var(--signal-warn); }
.ds2-filter-bar .chip.sentinel.active .chip-count { background: var(--signal-warn); color: var(--signal-warn); }
.ds2-filter-bar .quick-btn {
    padding: 3px 10px; font-size: 11px; border-radius: 4px; cursor: pointer;
    background: var(--surface-raised); color: var(--text-muted); border: 1px solid var(--border-subtle);
}
.ds2-filter-bar .quick-btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }

/* ── 공용 Modal Dialog (Siemens-style) ───────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: color-mix(in srgb, var(--surface-base) 70%, transparent);
    backdrop-filter: blur(4px);
    z-index: 1000; display: flex; align-items: center; justify-content: center;
}
.modal-dialog {
    background: var(--surface-overlay);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    box-shadow: var(--shadow-modal);
    max-width: 90vw; max-height: 90vh;
    display: flex; flex-direction: column;
    color: var(--text-base);
}
.modal-header {
    padding: 14px 20px; border-bottom: 1px solid var(--border-subtle);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-strong); }
.modal-close {
    background: transparent; border: 0; font-size: 18px; cursor: pointer;
    color: var(--text-muted); padding: 4px 10px; border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--signal-err-muted); color: var(--signal-err); }
.modal-body { padding: 12px 20px; overflow: auto; flex: 1; }
.modal-footer {
    padding: 12px 20px; border-top: 1px solid var(--border-subtle);
    display: flex; justify-content: flex-end; gap: 8px; align-items: center;
}
.modal-footer .btn-primary {
    padding: 8px 20px; background: var(--accent); color: var(--accent-on-solid);
    border: 0; border-radius: 6px; font-weight: 600; cursor: pointer;
    transition: background 0.15s;
}
.modal-footer .btn-primary:hover { background: var(--accent-hover); }
.modal-footer .btn-primary:active { background: var(--accent-active); }
.modal-footer .btn-secondary {
    padding: 8px 20px; background: transparent; color: var(--text-base);
    border: 1px solid var(--border-strong); border-radius: 6px; cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.modal-footer .btn-secondary:hover {
    background: var(--surface-hover); border-color: var(--accent); color: var(--accent);
}

/* ── DeviceApiReviewDialog ─────────────────────────────────── */
.dapi-dialog { width: 1100px; height: 80vh; }
.dapi-body { display: flex; flex-direction: column; padding: 0; }
.dapi-toolbar { display: flex; gap: 10px; align-items: center; padding: 10px 20px;
    background: var(--surface-sunken); border-bottom: 1px solid var(--border-subtle); }
.dapi-search { flex: 1; padding: 6px 10px; font-size: 12px; border: 1px solid var(--border-strong); border-radius: 4px; }
.dapi-filter { font-size: 12px; color: var(--text-muted); display: flex; gap: 4px; align-items: center; }
.dapi-summary { font-size: 12px; color: var(--text-muted); margin-right: auto; }
.dapi-table-wrap { overflow: auto; flex: 1; padding: 0; }
.dapi-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dapi-table thead th { position: sticky; top: 0; background: var(--text-base); color: white;
    padding: 6px 8px; text-align: left; font-weight: 600; z-index: 1; }
.dapi-table tbody td { padding: 4px 6px; border-bottom: 1px solid var(--surface-hover); vertical-align: middle; }
.dapi-table .num { color: var(--text-disabled); text-align: right; }
.dapi-table .mono { font-family: monospace; font-size: 11px; }
.dapi-table .dim { color: var(--text-disabled); }
.dapi-table .ai { color: var(--accent); background: var(--accent-muted); }
.dapi-table .row-changed { background: var(--signal-warn-muted); }
.dapi-input { width: 100%; padding: 3px 6px; font-size: 11px; font-family: monospace;
    border: 1px solid var(--border-strong); border-radius: 3px; }
.dapi-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.dapi-status { font-size: 12px; color: var(--text-muted); margin-right: auto; }
.dapi-restore-cell { width: 28px; padding: 2px 4px; text-align: center; }
.dapi-restore-btn { background: none; border: 1px solid var(--border-strong); border-radius: 4px; cursor: pointer; font-size: 13px; color: var(--accent); padding: 1px 5px; transition: background .1s; }
.dapi-restore-btn:hover { background: var(--accent-muted); }
.dapi-truncated { padding: 8px 12px; text-align: center; font-size: 12px; color: var(--text-disabled);
    background: var(--surface-sunken); border-top: 1px solid var(--border-subtle); }
.dapi-empty { padding: 20px; text-align: center; color: var(--text-disabled); font-size: .85rem; }
.btn-small { padding: 4px 12px; font-size: 11px; background: var(--border-subtle); color: var(--text-muted);
    border: 0; border-radius: 4px; cursor: pointer; }
.btn-small:hover { background: var(--border-strong); }
.btn-small.btn-warn { background: rgba(239,68,68,.12); color: #ef4444; }
.btn-small.btn-warn:hover { background: rgba(239,68,68,.22); }

/* ── MapperConfigEditDialog (룰 편집 + DS2 미리보기 split) ─── */
.mcfg-dialog { width: 1400px; height: 86vh; }
.mcfg-body { display: flex; gap: 0; padding: 0; flex: 1; overflow: hidden; }
.mcfg-left { flex: 0 0 420px; overflow-y: auto; padding: 12px; border-right: 1px solid var(--border-subtle); background: var(--surface-sunken); }
.mcfg-right { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.mcfg-preview-header {
    padding: 10px 16px; background: var(--text-base); color: var(--surface-hover);
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; font-weight: 600;
}
.mcfg-preview-stats { font-size: 12px; color: var(--border-strong); font-weight: 400; }
.mcfg-preview-stats b { color: var(--surface-raised); font-weight: 700; }
.mcfg-preview-wrap { flex: 1; overflow: auto; }
.mcfg-preview-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.mcfg-preview-table thead th { position: sticky; top: 0; z-index: 1;
    background: var(--text-base); color: var(--surface-raised); padding: 6px 8px; text-align: left;
    font-weight: 600; font-size: 11px; }
.mcfg-preview-table tbody td { padding: 3px 8px; border-bottom: 1px solid var(--surface-hover); }
.mcfg-preview-table tbody tr:hover { background: var(--surface-sunken); }
.mcfg-preview-table .mono { font-family: ui-monospace, monospace; font-size: 10px; }
.mcfg-preview-table .row-sentinel { background: var(--signal-warn-muted); font-weight: 600; }
.mcfg-preview-table .row-sentinel.clear { background: var(--signal-err-muted); }
.mcfg-preview-table .row-no-out { background: var(--signal-err-muted); }
.mcfg-preview-table .row-no-in  { background: var(--signal-warn-muted); }
.mcfg-preview-empty { padding: 24px; text-align: center; color: var(--text-disabled); font-size: .85rem; }
.mcfg-truncated { padding: 6px 12px; text-align: center; font-size: 11px;
    color: var(--text-disabled); background: var(--surface-sunken); border-top: 1px solid var(--border-subtle); }
.mcfg-dl-btn { display: block; width: 100%; margin-top: 6px; padding: 4px 0; font-size: 12px; background: none; border: 1px solid var(--border-subtle); border-radius: 4px; cursor: pointer; color: var(--text-muted); text-align: center; }
.mcfg-dl-btn:hover { border-color: var(--accent); color: var(--accent); }
.mcfg-status { font-size: 11px; color: var(--text-muted); margin-right: auto; }
.badge-count { display: inline-block; margin-left: 6px; padding: 1px 7px;
    background: var(--surface-raised); color: var(--accent); border-radius: 10px; font-size: 10px;
    font-weight: 600; }

/* ── MapperConfigEditDialog v2 (3-tab + 미리보기) ─── */
.mcfg-dialog-v2 { width: 1500px; height: 90vh; }
.mcfg-subtitle { font-size: 11px; color: var(--text-disabled); margin-left: 8px; }
.mcfg-body-v2 { display: flex; gap: 0; padding: 0; flex: 1; overflow: hidden; }

.mcfg-left-v2 { flex: 0 0 720px; overflow-y: auto; background: var(--surface-sunken); }
.mcfg-tabs {
    display: flex; background: var(--text-base); padding: 0;
}
.mcfg-tabs button {
    background: transparent; border: 0; color: var(--border-strong); padding: 10px 18px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    border-bottom: 2px solid transparent;
}
.mcfg-tabs button:hover { background: var(--text-base); color: var(--surface-raised); }
.mcfg-tabs button.active { color: var(--surface-raised); border-bottom-color: var(--accent); background: var(--text-base); }

.mcfg-section { padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); }
.mcfg-section h4 { margin: 0 0 8px; font-size: 13px; color: var(--text-strong); font-weight: 700; }
.mcfg-section-hd { display: flex; align-items: center; gap: 4px; margin: 0 0 8px; }
.mcfg-section-hd h4 { margin: 0; font-size: 13px; color: var(--text-strong); font-weight: 700; }
.mcfg-section label { display: block; font-size: 11px; color: var(--text-muted); font-weight: 600;
    margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.mcfg-section .hint, .mcfg-section p.mcfg-hint { font-size: 11px; color: var(--text-muted); margin: 4px 0 8px; line-height: 1.5; }
.mcfg-section p.mcfg-hint code { background: var(--surface-raised); padding: 1px 5px; border-radius: 3px;
    font-family: ui-monospace, monospace; font-size: 10px; color: var(--signal-info); }

.mcfg-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mcfg-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.mcfg-row label { margin-bottom: 0; min-width: 80px; }
.mcfg-text {
    width: 100%; padding: 6px 8px; font-size: 11px; font-family: ui-monospace, monospace;
    border: 1px solid var(--border-strong); border-radius: 4px; resize: vertical; box-sizing: border-box;
    background: var(--surface-raised);
}
.mcfg-ta-wrap { display: flex; flex-direction: column; }
.mcfg-ta-meta { display: flex; gap: 8px; align-items: center; margin-top: 3px; min-height: 16px; }
.mcfg-item-count { font-size: 10.5px; color: var(--text-muted); }
.mcfg-space-warn { font-size: 10.5px; color: #d97706; font-weight: 600; }
.btn-ta-copy { margin-left: auto; padding: 0 5px; font-size: 10px; background: transparent; border: 1px solid var(--border-subtle); border-radius: 3px; cursor: pointer; color: var(--text-muted); line-height: 1.4; }
.btn-ta-copy:hover { background: var(--surface-hover); }
.mcfg-input {
    padding: 5px 8px; font-size: 12px; border: 1px solid var(--border-strong); border-radius: 4px;
    box-sizing: border-box; background: var(--surface-raised); width: 100%;
}
.mcfg-input.mono { font-family: ui-monospace, monospace; font-size: 11px; }
.mcfg-num { width: 60px; padding: 5px 8px; font-size: 13px; border: 1px solid var(--border-strong);
    border-radius: 4px; text-align: center; font-weight: 600; }

.mcfg-rule-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 4px; }
.mcfg-rule-table thead th { background: var(--text-base); color: var(--surface-raised); padding: 5px 8px;
    text-align: left; font-weight: 600; font-size: 11px; }
.mcfg-rule-table tbody td { padding: 3px 4px; border-bottom: 1px solid var(--surface-hover); vertical-align: middle; }
.mcfg-rule-table .mcfg-input { padding: 3px 6px; font-size: 11px; }
.btn-add-sm {
    margin-top: 6px; padding: 4px 12px; font-size: 11px; font-weight: 600;
    background: var(--accent-muted); color: var(--accent); border: 1px solid var(--accent-border); border-radius: 4px; cursor: pointer;
}
.btn-add-sm:hover { background: var(--accent-muted); }
.btn-remove-sm {
    padding: 2px 8px; font-size: 11px; background: var(--signal-err-muted); color: var(--signal-err);
    border: 0; border-radius: 3px; cursor: pointer;
}
.btn-remove-sm:hover { background: var(--signal-err-muted); }
.mcfg-pending-delete { background: color-mix(in srgb, var(--signal-warn) 8%, transparent); }
.mcfg-del-cell { white-space: nowrap; }
.btn-confirm-del { padding: 2px 6px; font-size: 11px; background: var(--signal-ok-muted); color: var(--signal-ok); border: 0; border-radius: 3px; cursor: pointer; margin-right: 2px; }
.btn-cancel-del  { padding: 2px 6px; font-size: 11px; background: var(--surface-hover); color: var(--text-muted); border: 0; border-radius: 3px; cursor: pointer; }
.btn-move-sm { padding: 2px 5px; font-size: 10px; background: var(--surface-hover); color: var(--text-muted); border: 0; border-radius: 3px; cursor: pointer; margin-right: 2px; }
.btn-move-sm:disabled { opacity: .3; cursor: default; }
.btn-move-sm:not(:disabled):hover { background: var(--accent-muted); color: var(--accent); }
.btn-dup-sm { padding: 2px 5px; font-size: 10px; background: var(--surface-hover); color: var(--text-muted); border: 0; border-radius: 3px; cursor: pointer; margin-right: 2px; }
.btn-dup-sm:hover { background: var(--accent-muted); color: var(--accent); }

.mcfg-json-edit {
    width: 100%; min-height: 500px; padding: 10px;
    font-family: ui-monospace, monospace; font-size: 11px;
    background: var(--text-base); color: var(--border-subtle); border: 0; border-radius: 4px;
    resize: vertical; box-sizing: border-box;
}
.btn-apply-sm {
    margin-top: 8px; padding: 5px 14px; font-size: 12px; font-weight: 600;
    background: var(--accent); color: var(--surface-raised); border: 0; border-radius: 4px; cursor: pointer;
}
.btn-apply-sm:hover { background: var(--accent); }
.mcfg-json-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.btn-restore-sm { padding: 5px 12px; font-size: 12px; background: var(--surface-hover); color: var(--text-base); border: 1px solid var(--border-subtle); border-radius: 4px; cursor: pointer; }
.btn-restore-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-restore-sm.highlight { border-color: var(--signal-warn); color: var(--signal-warn); font-weight: 600; }
.btn-copy-sm { padding: 5px 12px; font-size: 12px; background: var(--surface-hover); color: var(--text-base); border: 1px solid var(--border-subtle); border-radius: 4px; cursor: pointer; }
.btn-copy-sm:hover { border-color: var(--accent); color: var(--accent); }
.mcfg-status.ok { color: var(--signal-ok); font-size: 11px; }
.mcfg-status.err { color: var(--signal-err); font-size: 11px; }

/* 우측 미리보기 */
.mcfg-right-v2 { flex: 1; display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface-raised); border-left: 1px solid var(--border-subtle); }
.mcfg-preview-section { padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); }
.mcfg-preview-section:last-child { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.mcfg-preview-section h4 {
    margin: 0 0 8px; font-size: 13px; color: var(--text-strong); font-weight: 700;
    display: flex; justify-content: space-between; align-items: baseline;
}
.mcfg-preview-stats { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.mcfg-sample-input {
    width: 100%; padding: 8px 12px; font-size: 13px;
    background: var(--surface-sunken); border: 2px solid var(--accent); border-radius: 6px;
    box-sizing: border-box; margin-bottom: 10px;
}
.mcfg-sample-input.mono { font-family: ui-monospace, monospace; }
.mcfg-parsed { background: var(--surface-sunken); border: 1px solid var(--border-subtle); border-radius: 6px; padding: 10px 14px; }
.mcfg-parsed-row { display: flex; gap: 12px; padding: 3px 0; font-size: 12px; }
.mcfg-parsed-row b {
    min-width: 60px; color: var(--text-muted); font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.mcfg-parsed-row span { color: var(--text-strong); font-weight: 600; font-family: ui-monospace, monospace; }
.mcfg-parsed-val-copyable { cursor: pointer; }
.mcfg-parsed-val-copyable:hover { text-decoration: underline; color: var(--accent); }

.mcfg-preview-wrap-v2 { flex: 1; overflow: auto; border: 1px solid var(--border-subtle); border-radius: 4px; }
.mcfg-status-line { font-size: 11px; color: var(--text-muted); margin-right: auto; font-family: ui-monospace, monospace; }
.mcfg-delta-pos  { color: var(--signal-ok);  font-weight: 600; }
.mcfg-delta-neg  { color: var(--signal-err); font-weight: 600; }
.mcfg-delta-zero { display: none; }
.mcfg-validation-errors { display: flex; flex-direction: column; gap: 2px; margin-right: auto; }
.mcfg-validation-hd     { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--signal-err, #f85149); }
.mcfg-validation-err    { font-size: 11px; color: var(--signal-err, #f85149); }
.mcfg-confirm-err       { font-size: 11px; color: var(--signal-err, #f85149); padding: 4px 0 0 4px; }

/* ============================================================
   PlcOpenWizard — 4-step wizard (벤더 선택 → 파일 → 분석 → 완료)
   ============================================================ */

/* Layout: when wizard is active, viewer-root goes full-width (no sidebar) */
.viewer-root.wiz-layout { grid-template-columns: 1fr; }
.viewer-main-wiz {
    display: flex; align-items: flex-start; justify-content: center;
    padding: 12px 20px; overflow: hidden;
}

/* Root container */
.wiz-root {
    display: flex; flex-direction: column;
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.07);
    width: 100%; max-width: 900px;
    max-height: calc(100vh - 120px);
    overflow: hidden;
}

/* ── Stepper ── */
.wiz-stepper {
    display: flex; align-items: center;
    padding: 22px 32px 18px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-sunken);
    gap: 0; flex-wrap: nowrap; overflow-x: auto;
}
.wiz-si {
    display: flex; align-items: center; gap: 10px;
    cursor: default; flex-shrink: 0;
}
.wiz-si.done { cursor: pointer; }
.wiz-si-dot {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; flex-shrink: 0;
    background: var(--surface-raised);
    border: 2px solid var(--border-strong);
    color: var(--text-muted);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.wiz-si.active .wiz-si-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.wiz-si.done   .wiz-si-dot { background: var(--signal-ok); border-color: var(--signal-ok); color: #fff; }
.wiz-si-info { display: flex; flex-direction: column; gap: 0; }
.wiz-si-icon { display: inline-flex; align-items: center; line-height: 1; color: var(--text-muted); }
.wiz-si.active .wiz-si-icon { color: var(--accent); }
.wiz-si.done   .wiz-si-icon { color: var(--signal-ok); }
.wiz-si-label {
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    white-space: nowrap;
}
.wiz-si.active .wiz-si-label { color: var(--accent); }
.wiz-si.done   .wiz-si-label { color: var(--signal-ok); }
.wiz-si-line {
    flex: 1; height: 2px; min-width: 24px; max-width: 80px;
    background: var(--border-strong); border-radius: 1px;
    transition: background 0.3s;
}
.wiz-si-line.done { background: var(--signal-ok); }

/* ── Body ── */
.wiz-body {
    flex: 1; overflow-y: auto;
    padding: 24px 32px;
    display: flex; flex-direction: column; gap: 18px;
}
.wiz-head h2 {
    margin: 0 0 6px; font-size: 20px; font-weight: 700; color: var(--text-strong);
}
.wiz-head p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.wiz-head code { font-size: 12px; background: var(--surface-sunken); padding: 1px 6px; border-radius: 4px; }
.wiz-multi-hint { color: var(--signal-info); font-size: 12px; }
.wiz-head-done { text-align: center; }
.wiz-done-badge { display: flex; justify-content: center; line-height: 1.2; }

/* ── Vendor Grid ── */
.wiz-vendor-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}
.wiz-vc {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 10px; cursor: pointer;
    border: 2px solid var(--border-subtle);
    border-left: 4px solid var(--vc, var(--border-subtle));
    background: linear-gradient(90deg, color-mix(in srgb, var(--vc, #888) 6%, transparent), transparent);
    transition: transform 0.1s, box-shadow 0.15s, border-color 0.15s;
    position: relative;
}
.wiz-vc:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.09);
    border-color: var(--vc, var(--accent));
}
.wiz-vc.sel {
    border-color: var(--vc, var(--accent));
    background: linear-gradient(90deg, color-mix(in srgb, var(--vc, #888) 18%, transparent), var(--surface-sunken));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--vc, var(--accent)) 35%, transparent);
}
.wiz-vc.wip { opacity: 0.72; }
.wiz-vc-wip-badge {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; font-weight: 800; letter-spacing: .08em;
    color: #fff; background: rgba(0,0,0,.38);
    border-radius: inherit; pointer-events: none;
}
.wiz-vc-logo {
    width: 44px; height: 44px; border-radius: 8px;
    background: var(--surface-sunken);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
    font-size: 13px; font-weight: 700;
    color: var(--fbg, var(--text-muted));
}
.wiz-vc-logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.wiz-vc-logo.txt-fb::after { content: attr(data-fb); }
.wiz-vc-info { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.wiz-vc-info strong { font-size: 13px; font-weight: 700; color: var(--text-strong); }
.wiz-vc-info span  { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wiz-vc-info code  { font-size: 10px; color: var(--text-disabled); background: var(--surface-sunken); padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, monospace; }
.wiz-vc-check {
    position: absolute; top: 8px; right: 10px;
    font-size: 15px; color: var(--signal-ok); font-weight: 700;
}

/* ── Drop Zone ── */
.wiz-dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; padding: 52px 32px;
    border: 2px dashed var(--border-strong); border-radius: 14px;
    background: var(--surface-sunken); cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative; min-height: 200px;
}
.wiz-dropzone:hover, .wiz-dropzone.drag-active {
    border-color: var(--accent);
    background: var(--accent-muted);
}
.wiz-dropzone.drag-active {
    border-style: solid;
    box-shadow: 0 0 0 3px var(--accent-muted);
}
.wiz-dz-icon  { font-size: 40px; line-height: 1; }
.wiz-dz-title { font-size: 16px; font-weight: 700; color: var(--text-strong); }
.wiz-dz-sub   { font-size: 13px; color: var(--text-muted); }
.wiz-dz-ext   { font-size: 12px; color: var(--text-disabled); background: var(--surface-raised); padding: 3px 12px; border-radius: 12px; font-family: ui-monospace, monospace; }

/* ── Pipeline Timeline ── */
.wiz-pipeline {
    display: flex; flex-direction: column;
    background: var(--surface-sunken); border-radius: 12px;
    border: 1px solid var(--border-subtle); overflow: hidden;
}
.wiz-ps {
    display: flex; align-items: flex-start;
    padding: 12px 18px; gap: 0;
    transition: background 0.2s;
}
.wiz-ps.running { background: color-mix(in srgb, var(--signal-info-muted) 60%, transparent); }
.wiz-ps.done    { opacity: 0.72; }
.wiz-ps.error   { background: var(--signal-err-muted); }

.wiz-ps-left {
    display: flex; flex-direction: column; align-items: center;
    width: 30px; flex-shrink: 0; margin-right: 14px;
}
.wiz-ps-dot {
    width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    background: var(--surface-raised); border: 2px solid var(--border-subtle);
    color: var(--text-muted); flex-shrink: 0;
    transition: all 0.2s;
}
.wiz-ps.running .wiz-ps-dot { border-color: var(--signal-info); color: var(--signal-info); background: var(--surface-raised); }
.wiz-ps.done    .wiz-ps-dot { background: var(--signal-ok); border-color: var(--signal-ok); color: #fff; }
.wiz-ps.error   .wiz-ps-dot { background: var(--signal-err); border-color: var(--signal-err); color: #fff; }
.wiz-ps-connector { flex: 1; width: 2px; background: var(--border-subtle); min-height: 10px; margin: 4px 0; }
.wiz-ps-spin {
    width: 12px; height: 12px; border-radius: 50%;
    border: 2px solid var(--signal-info); border-top-color: transparent;
    animation: wiz-spin 0.75s linear infinite;
}
@keyframes wiz-spin { to { transform: rotate(360deg); } }

.wiz-ps-right  { flex: 1; min-width: 0; }
.wiz-ps-label  { font-size: 13px; font-weight: 700; color: var(--text-strong); line-height: 1.5; }
.wiz-ps.done .wiz-ps-label { color: var(--text-muted); }
.wiz-ps-desc   { font-size: 11px; color: var(--text-muted); margin-top: 1px; line-height: 1.5; }
.wiz-ps-detail { font-size: 11px; color: var(--signal-info); margin-top: 5px; font-family: ui-monospace, monospace; word-break: break-all; }
.wiz-ps-summary { font-size: 11px; color: var(--signal-ok); margin-top: 4px; }
.wiz-ps-time   { font-size: 12px; color: var(--text-disabled); flex-shrink: 0; margin-left: 10px; font-family: ui-monospace, monospace; padding-top: 5px; }

/* ── AI Panel ── */
.wiz-ai-panel {
    border: 1px solid var(--border-subtle); border-radius: 10px;
    overflow: hidden; background: var(--surface-raised);
}
.wiz-ai-hdr {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; background: var(--surface-sunken);
    border-bottom: 1px solid var(--border-subtle);
}
.wiz-ai-badge { font-size: 12px; font-weight: 700; color: var(--text-strong); }
.wiz-ai-name  { font-size: 12px; color: var(--text-muted); flex: 1; }
.wiz-ai-cache-tag {
    background: var(--signal-ok-muted); color: var(--signal-ok);
    padding: 1px 8px; border-radius: 10px; font-size: 10px; font-weight: 700;
}
.wiz-ai-resp {
    margin: 0; padding: 12px 16px; font-size: 11px; line-height: 1.6;
    color: var(--text); white-space: pre-wrap; word-break: break-all;
    max-height: 220px; overflow-y: auto; background: var(--surface);
    font-family: ui-monospace, monospace;
}
.wiz-ai-expand-btn { background: none; border: none; color: var(--accent); font-size: 11px; cursor: pointer; padding: 4px 16px 8px; text-decoration: underline; display: block; }
.wiz-ai-expand-btn:hover { opacity: .75; }
.wiz-ai-copy-btn { margin-left: auto; padding: 2px 8px; font-size: 11px; background: none; border: 1px solid var(--border-subtle); border-radius: 3px; cursor: pointer; color: var(--text-muted); }
.wiz-ai-copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.wiz-error-copy { margin-left: 8px; padding: 0 6px; font-size: 11px; background: none; border: 1px solid currentColor; border-radius: 3px; cursor: pointer; color: inherit; opacity: .7; vertical-align: middle; }
.wiz-error-copy:hover { opacity: 1; }
.wiz-ai-wait { padding: 12px 16px; font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.wiz-spin-inline {
    display: inline-block; width: 12px; height: 12px; border-radius: 50%;
    border: 2px solid var(--text-muted); border-top-color: transparent;
    animation: wiz-spin 0.75s linear infinite; vertical-align: middle;
}

/* ── Error Box ── */
.wiz-error-box {
    background: var(--signal-err-muted); color: var(--signal-err);
    border: 1px solid color-mix(in srgb, var(--signal-err) 30%, transparent);
    border-radius: 8px; padding: 12px 16px;
    font-size: 13px; font-weight: 600;
}

/* ══ Analysis Progress — Redesign ══════════════════════════════════════════ */
.wiz-an-hero {
    text-align: center; padding: 20px 0 12px;
}
.wiz-an-orb {
    display: inline-flex; align-items: center; justify-content: center;
    width: 72px; height: 72px; border-radius: 50%;
    background: conic-gradient(from 0deg, #0891a8, #7c3aed, #059669, #0891a8);
    animation: wiz-an-rotate 3s linear infinite;
    box-shadow: 0 0 32px rgba(8,145,168,.45);
    margin-bottom: 14px;
}
.wiz-an-orb-inner {
    font-size: 28px; animation: wiz-an-rotate-rev 3s linear infinite;
}
@keyframes wiz-an-rotate     { to { transform: rotate(360deg);  } }
@keyframes wiz-an-rotate-rev { to { transform: rotate(-360deg); } }

.wiz-an-title {
    font-size: 18px; font-weight: 800; color: var(--text-strong);
    margin: 0 0 6px; line-height: 1.3;
}
.wiz-an-dots::after {
    content: ''; animation: wiz-an-ellipsis 1.5s steps(4, end) infinite;
}
@keyframes wiz-an-ellipsis {
    0%   { content: '';    }
    25%  { content: '.';   }
    50%  { content: '..';  }
    75%  { content: '...'; }
}
.wiz-an-sub { font-size: 13px; color: var(--text-muted); margin: 0; }

/* Progress bar */
.wiz-an-bar-wrap {
    position: relative; height: 10px; background: var(--border-subtle);
    border-radius: 8px; margin: 16px 0 6px; overflow: hidden;
}
.wiz-an-bar {
    height: 100%; border-radius: 8px; min-width: 4px;
    background: linear-gradient(90deg, #0891a8, #7c3aed, #059669);
    background-size: 200% 100%;
    animation: wiz-an-shimmer 2s linear infinite;
    transition: width .5s ease;
    box-shadow: 0 0 10px rgba(8,145,168,.5);
}
@keyframes wiz-an-shimmer {
    0%   { background-position: 200% center; }
    100% { background-position: 0%   center; }
}
.wiz-an-bar-pct {
    position: absolute; right: 0; top: 14px;
    font-size: 11px; color: var(--text-muted); font-family: ui-monospace, monospace;
}

/* Step cards */
.wiz-an-steps {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 8px; margin: 22px 0 14px;
}
.wiz-an-card {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; padding: 14px 8px 12px;
    border-radius: 12px; border: 1.5px solid var(--border-subtle);
    background: var(--surface-raised);
    transition: all .3s ease;
}
.wiz-an-card-done {
    border-color: rgba(5,150,105,.45);
    background: color-mix(in srgb, rgba(5,150,105,.12) 100%, var(--surface-raised));
    opacity: .8;
}
.wiz-an-card-running {
    border-color: rgba(8,145,168,.7);
    background: color-mix(in srgb, rgba(8,145,168,.12) 100%, var(--surface-raised));
    box-shadow: 0 0 18px rgba(8,145,168,.25);
}
.wiz-an-card-error {
    border-color: rgba(220,38,38,.5);
    background: color-mix(in srgb, rgba(220,38,38,.1) 100%, var(--surface-raised));
}
.wiz-an-card-icon { font-size: 22px; line-height: 1; }
.wiz-an-card-label {
    font-size: 11px; font-weight: 700; color: var(--text-base);
    text-align: center; line-height: 1.3;
}
.wiz-an-card-done .wiz-an-card-label  { color: var(--text-muted); }
.wiz-an-card-pending .wiz-an-card-label { color: var(--text-disabled); }
.wiz-an-card-glow {
    position: absolute; inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(8,145,168,.2) 0%, transparent 70%);
    animation: wiz-an-pulse 1.6s ease-in-out infinite;
    pointer-events: none;
}
@keyframes wiz-an-pulse {
    0%, 100% { opacity: .4; }
    50%      { opacity: 1;  }
}
.wiz-an-spin { display: inline-block; animation: wiz-an-rotate 1s linear infinite; }

/* Current step status */
.wiz-an-current {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--text-muted);
    background: var(--surface-sunken);
    border-radius: 8px; padding: 8px 14px; margin-bottom: 12px;
}
.wiz-an-current-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--accent); flex-shrink: 0;
    animation: wiz-an-pulse 1s ease-in-out infinite;
}
.wiz-an-elapsed {
    margin-left: auto; font-family: ui-monospace, monospace;
    font-size: 11px; color: var(--text-disabled);
}

/* Rotating tip */
.wiz-an-tip {
    display: flex; align-items: flex-start; gap: 10px;
    background: color-mix(in srgb, var(--accent-muted) 70%, transparent);
    border: 1px solid var(--accent-border); border-radius: 10px;
    padding: 10px 14px; margin-bottom: 10px;
    animation: wiz-an-fadein .5s ease;
}
@keyframes wiz-an-fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
.wiz-an-tip-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.wiz-an-tip-text { font-size: 12px; color: var(--text-base); line-height: 1.6; }

/* Data notice */
.wiz-an-notice {
    font-size: 11px; color: var(--text-muted); line-height: 1.6;
    border-top: 1px solid var(--border-subtle); padding-top: 10px; margin-top: 4px;
}
.wiz-an-notice strong { color: var(--text-base); }

/* ── SVG Analysis Progress Screen (wiz-pro) ── */
.wiz-pro {
    background: var(--surface-sunken); border-radius: 10px;
    border: 1px solid var(--border-subtle);
    padding: 18px 22px 16px;
    display: flex; flex-direction: column; gap: 16px;
}
/* 헤더 */
.wiz-pro-hdr {
    display: flex; align-items: center; gap: 7px;
    padding-bottom: 12px; border-bottom: 1px solid var(--border-subtle);
}
.wiz-pro-hdr-brand { font-size: 12px; font-weight: 700; color: var(--text-strong); }
.wiz-pro-hdr-sep   { color: var(--border-strong); }
.wiz-pro-hdr-sub   { font-size: 12px; color: var(--text-muted); }
.wiz-pro-hdr-tag   {
    background: var(--accent-muted); color: var(--accent); border: 1px solid var(--accent-border);
    font-size: 8px; font-weight: 700; letter-spacing: 1px;
    border-radius: 3px; padding: 1px 4px; margin-left: auto;
}
.wiz-pro-hdr-time  {
    font-size: 11px; color: var(--text-muted);
    font-family: ui-monospace, monospace;
}
/* 메인 영역 (2컬럼) */
.wiz-pro-main {
    display: flex; align-items: stretch; gap: 0;
}
/* 왼쪽: 진행률 */
.wiz-pro-left {
    flex: 0 0 160px; padding-right: 22px;
    border-right: 1px solid var(--border-subtle);
    display: flex; flex-direction: column; gap: 10px;
}
.wiz-pro-pct-row { display: flex; align-items: baseline; gap: 4px; }
.wiz-pro-pct {
    font-size: 52px; font-weight: 800; line-height: 1;
    color: var(--text-strong); font-family: ui-monospace, monospace;
}
.wiz-pro-pct-u {
    font-size: 22px; font-weight: 600;
    color: var(--text-muted); font-family: ui-monospace, monospace;
}
.wiz-pro-bar {
    height: 6px; background: var(--border-subtle);
    border-radius: 4px; overflow: hidden;
}
.wiz-pro-bar-fill {
    height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, #00c080 0%, #00c8f0 55%, #6020d0 100%);
    transition: width .7s cubic-bezier(.4,0,.2,1);
    position: relative; overflow: hidden;
}
.wiz-pro-bar-fill::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent);
    animation: wiz-pro-shimmer 2s linear infinite;
}
@keyframes wiz-pro-shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(200%); }
}
.wiz-pro-cnt {
    font-size: 10px; color: var(--text-muted);
    font-family: ui-monospace, monospace;
}
/* 오른쪽: 단계 정보 */
.wiz-pro-right {
    flex: 1; padding-left: 22px;
    display: flex; flex-direction: column;
    justify-content: center; gap: 7px; min-height: 72px;
}
.wiz-pro-step-lbl {
    display: flex; align-items: center; gap: 8px;
    font-size: 15px; font-weight: 700; color: var(--text-base);
}
.wiz-pro-step-ok  { color: var(--signal-ok); }
.wiz-pro-step-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.wiz-pro-pulse {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--accent); flex-shrink: 0;
    animation: wiz-an-pulse 1s ease-in-out infinite;
}
/* 팁 */
.wiz-pro-tip {
    display: flex; align-items: flex-start; gap: 9px;
    background: var(--surface-raised); border: 1px solid var(--border-subtle);
    border-radius: 7px; padding: 9px 13px;
    font-size: 12px; color: var(--text-muted); line-height: 1.6;
}
.wiz-pro-tip-icon { flex-shrink: 0; margin-top: 2px; }
.wiz-pro-tip-txt { flex: 1; animation: wiz-an-fadein .5s ease; }
/* 안내 */
.wiz-pro-notice {
    display: flex; align-items: flex-start; gap: 8px;
    font-size: 10px; color: var(--text-disabled); line-height: 1.5;
    padding-top: 8px; border-top: 1px solid var(--border-subtle);
}
/* SVG 타임라인 */
.wiz-pro-svg { width: 100%; height: auto; display: block; }
/* SVG 타임라인 노드 — 테마 적응형 (dark default, light override) */
.svg-wait-node { fill: #050d1a; stroke: #0d2540; stroke-width: 1.5; }
.svg-run-node  { fill: #04121f; }
.svg-err-node  { fill: #180404; }
.svg-conn-wait { stroke: #0d2040; stroke-width: 1.5; }
.svg-wait-icon { color: #0d3060; }
.svg-label-done { fill: #00c896; }
.svg-label-run  { fill: #00d4ff; }
.svg-label-wait { fill: #6080a0; }

[data-theme="light"] .svg-wait-node { fill: #dde8f5; stroke: #8baac8; }
[data-theme="light"] .svg-run-node  { fill: #cce4ff; }
[data-theme="light"] .svg-err-node  { fill: #ffecec; }
[data-theme="light"] .svg-conn-wait { stroke: #a0b8cc; }
[data-theme="light"] .svg-wait-icon { color: #4a70a0; }
[data-theme="light"] .svg-label-wait { fill: #3a5878; }
/* 대기 상태 */
.wiz-pro-step-wait { font-size: 14px; font-weight: 600; color: var(--text-muted); }
/* AI 로그 패널 */
.wiz-pro-log {
    background: var(--surface-base); border: 1px solid var(--border-subtle);
    border-radius: 7px; overflow: hidden;
}
.wiz-pro-log-hdr {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 12px; border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-sunken);
}
.wiz-pro-log-title {
    font-size: 10px; font-weight: 700; color: var(--text-muted);
    letter-spacing: 1px; font-family: ui-monospace, monospace;
}
.wiz-pro-log-cnt {
    margin-left: auto; font-size: 10px;
    color: var(--text-disabled); font-family: ui-monospace, monospace;
}
.wiz-pro-log-body {
    max-height: 120px; overflow-y: auto;
    padding: 8px 12px; display: flex; flex-direction: column; gap: 3px;
}
.wiz-pro-log-line {
    font-size: 11px; font-family: ui-monospace, monospace;
    color: var(--text-muted); line-height: 1.4;
    white-space: pre-wrap; word-break: break-all;
}
.wiz-pro-log-line-step { color: var(--signal-ok); }
.wiz-pro-log-prefix { opacity: .5; margin-right: 6px; }

/* ── Result Grid ── */
.wiz-result-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}
.wiz-rc {
    background: var(--surface-raised); border: 1px solid var(--border-subtle);
    border-radius: 10px; padding: 18px 14px; text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.wiz-rc.accent { border-color: var(--accent-border); background: var(--accent-muted); }
.wiz-rc.warn   { border-color: color-mix(in srgb, var(--signal-warn) 40%, transparent); background: var(--signal-warn-muted); }
.wiz-rc-val {
    font-size: 26px; font-weight: 800; color: var(--text-strong);
    margin-bottom: 5px; word-break: break-all;
}
.wiz-rc.accent .wiz-rc-val { color: var(--accent); }
.wiz-rc.warn   .wiz-rc-val { color: var(--signal-warn); }
.wiz-rc-key {
    font-size: 10px; color: var(--text-muted); font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.6px;
}

/* ── Log ── */
.wiz-log {
    background: var(--surface-sunken); border-radius: 8px;
    border: 1px solid var(--border-subtle); overflow: hidden; position: relative;
}
.wiz-log summary {
    padding: 10px 14px; font-size: 12px; color: var(--text-muted);
    cursor: pointer; user-select: none;
}
.wiz-log-body { padding: 6px 14px 10px; max-height: 180px; overflow-y: auto; }
.wiz-log-line {
    font-size: 11px; color: var(--text-muted); font-family: ui-monospace, monospace;
    padding: 1px 0; white-space: pre-wrap; line-height: 1.6;
}

.wiz-parse-errors {
    background: var(--surface-sunken); border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--signal-warn) 40%, transparent); overflow: hidden; margin-top: 8px; position: relative;
}
.wiz-parse-errors > .meta-copy-btn, .wiz-log > .meta-copy-btn { position: absolute; top: 7px; right: 14px; }
.wiz-parse-errors summary {
    padding: 10px 14px; font-size: 12px; color: var(--signal-warn);
    cursor: pointer; user-select: none;
}
.wiz-parse-errors ul { margin: 0; padding: 4px 14px 10px 30px; max-height: 180px; overflow-y: auto; }
.wiz-parse-errors li { font-size: 11px; color: var(--text-muted); font-family: ui-monospace, monospace; padding: 1px 0; }

/* ACD L5K export 권장 힌트 */
.wiz-l5k-hint {
    margin: 8px 0 4px; padding: 8px 14px; border-radius: 6px;
    background: var(--signal-warn-muted); border: 1px solid color-mix(in srgb, var(--signal-warn) 40%, transparent);
    color: var(--signal-warn); font-size: 13px; line-height: 1.5;
}

/* ── AASX Export Options ── */
.wiz-aasx-opts {
    margin-top: 16px; padding: 14px 16px;
    background: var(--surface-sunken); border: 1px solid var(--border-subtle);
    border-radius: 8px; display: flex; flex-direction: column; gap: 10px;
}
.wiz-aasx-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wiz-aasx-label { font-size: 12px; font-weight: 600; color: var(--text-muted); min-width: 72px; }
.wiz-aasx-iri {
    flex: 1; min-width: 200px; padding: 5px 10px;
    border: 1px solid var(--border-strong); border-radius: 6px;
    background: var(--surface-base); color: var(--text-base);
    font-size: 12px; font-family: ui-monospace, monospace;
}
.wiz-aasx-iri:focus { outline: none; border-color: var(--accent); }
.wiz-aasx-check { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.wiz-aasx-check input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }
.wiz-aasx-hint { font-size: 11px; color: var(--text-disabled); font-family: ui-monospace, monospace; }
.wiz-aasx-error {
    padding: 6px 10px; border-radius: 6px; font-size: 12px;
    background: var(--signal-error-muted, #fee); color: var(--signal-error, #c00);
    border: 1px solid color-mix(in srgb, var(--signal-error, #c00) 30%, transparent);
    word-break: break-all;
}

.result-aasx-bar {
    margin-top: 0; margin-bottom: 4px; border-radius: 0;
    border-left: 0; border-right: 0; border-top: 1px solid var(--border-subtle); border-bottom: 0;
    background: var(--surface-base); padding: 8px 16px;
}
.result-aasx-summary {
    display: flex; align-items: center; gap: 10px;
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    cursor: pointer; list-style: none; user-select: none;
}
.result-aasx-summary::-webkit-details-marker { display: none; }
.result-aasx-summary::before { content: "▸"; font-size: 10px; transition: transform 0.15s; }
details[open] .result-aasx-summary::before { transform: rotate(90deg); }
.result-aasx-busy { font-size: 11px; color: var(--text-disabled); font-family: ui-monospace, monospace; }
.result-aasx-bar .wiz-aasx-row { margin-top: 8px; }
.result-aasx-dl-btn { padding: 5px 14px; font-size: 12px; }

/* ── Footer Nav ── */
.wiz-footer {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 32px; border-top: 1px solid var(--border-subtle);
    background: var(--surface-sunken);
}
.wiz-fhint { flex: 1; font-size: 12px; color: var(--text-muted); }
.wiz-fhint-status { display: flex; align-items: center; gap: 6px; }
.wiz-fhint-msg  { font-family: ui-monospace, monospace; font-size: 11px; color: var(--text-muted); }
.wiz-fhint-time { font-size: 11px; color: var(--text-disabled); font-family: ui-monospace, monospace; }

.wiz-btn-pri {
    padding: 9px 22px; background: var(--accent); color: var(--accent-on-solid);
    border: 0; border-radius: 8px; font-size: 13px; font-weight: 700;
    cursor: pointer; font-family: inherit; transition: background 0.15s;
    white-space: nowrap;
}
.wiz-btn-pri:hover:not(:disabled) { background: var(--accent-hover); }
.wiz-btn-pri:disabled { opacity: 0.38; cursor: not-allowed; }

.wiz-btn-sec {
    padding: 9px 18px; background: var(--surface-raised);
    color: var(--text-muted); border: 1px solid var(--border-strong);
    border-radius: 8px; font-size: 13px; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: background 0.15s;
    white-space: nowrap;
}
.wiz-btn-sec:hover { background: var(--surface-hover); }

/* chatbot slide-in overlay panel */
.chatbot-overlay-panel {
    position: fixed; right: 0; top: 0; bottom: 0; width: 440px; z-index: 900;
    display: flex; flex-direction: column;
    background: var(--surface-base); border-left: 1px solid var(--border-subtle);
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    animation: chatbot-slide-in 0.22s ease;
}
@keyframes chatbot-slide-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}
.chatbot-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border-subtle);
    font-size: 14px; font-weight: 600; color: var(--text-base);
    background: var(--surface-raised); flex-shrink: 0;
}
.chatbot-close-btn {
    padding: 4px 8px; background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 16px; border-radius: 4px;
    transition: background 0.12s; font-family: inherit;
}
.chatbot-close-btn:hover { background: var(--surface-hover); color: var(--text-base); }
.chatbot-iframe { flex: 1; width: 100%; border: none; }
.pd-nav-link.active { color: var(--accent); font-weight: 700; }
