/*
 * 보안 분석 워크벤치
 * 헤더 아래를 화면 끝까지 쓰는 작업 앱 레이아웃.
 * [작업 목록] | [레시피] | [입력 / 출력]  — 구분선을 끌어 크기를 바꾼다.
 * 칸 머리 높이 44px · 칸 안쪽 여백 12px · 구분선 1px 로 통일한다.
 */

:root {
    --wb-head: 44px;
    --wb-bar: 52px;
    --wb-pad: 12px;
}

/* ---------- base ---------- */
.suite-page [hidden] {
    display: none !important;
}

.wb-container.container {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
}

.btn.small {
    min-height: 30px;
    padding: 0 10px;
    font-size: 13px;
    gap: 4px;
}

.btn.small .material-symbols-rounded {
    font-size: 17px;
}

.wb-card-title {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 0;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
}

.wb-count {
    color: var(--ink-faint);
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.wb-card-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.wb-hint {
    margin: 0;
    color: var(--ink-faint);
    font-size: 12px;
}

/* ---------- app bar: title · mode tabs · quick recipes in one row ---------- */
.wb-appbar {
    display: flex;
    align-items: center;
    gap: 20px;
    height: var(--wb-bar);
    padding: 0 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.wb-appbar-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.wb-appbar-title .page-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 18px;
}

.wb-appbar-title h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.02em;
    white-space: nowrap;
}

.wb-tabs {
    display: flex;
    align-items: stretch;
    align-self: stretch;
    gap: 4px;
    flex: none;
}

.wb-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--ink-soft);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.wb-tab .material-symbols-rounded {
    font-size: 18px;
}

.wb-tab:hover {
    color: var(--ink);
}

.wb-tab[aria-selected="true"] {
    color: var(--sec);
    border-bottom-color: var(--sec);
}

.wb-presets {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin-left: auto;
    overflow-x: auto;
    scrollbar-width: none;
}

.wb-presets::-webkit-scrollbar {
    display: none;
}

.wb-presets-label {
    flex: none;
    margin-right: 2px;
    color: var(--ink-faint);
    font-size: 12px;
    font-weight: 700;
}

.wb-chip {
    flex: none;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-soft);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.wb-chip:hover,
.wb-chip:focus-visible {
    border-color: var(--sec);
    color: var(--sec);
}

/* ---------- full-bleed layout ---------- */
.wb-layout {
    --wb-ops: 232px;
    --wb-recipe: 360px;
    display: grid;
    grid-template-columns: var(--wb-ops) 5px var(--wb-recipe) 5px minmax(0, 1fr);
    height: calc(100dvh - 60px - var(--wb-bar));
    min-height: 560px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}

.wb-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--surface);
}

/* every pane and io block opens with the same 44px header band */
.wb-pane-head {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: var(--wb-head);
    padding: 0 8px 0 var(--wb-pad);
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}

.wb-pane-head h3 {
    margin: 0;
    font-size: 13px;
}

/* resizers: 5px grab area with a 1px line, accent on hover/drag */
.wb-resizer {
    position: relative;
    z-index: 2;
    background: var(--surface);
    cursor: col-resize;
    touch-action: none;
}

.wb-resizer::before {
    content: "";
    position: absolute;
    inset: 0 2px;
    background: var(--line);
    transition: background-color .15s, inset .15s;
}

.wb-resizer.is-h {
    cursor: row-resize;
}

.wb-resizer.is-h::before {
    inset: 2px 0;
}

.wb-resizer:hover::before,
.wb-resizer:focus-visible::before,
.wb-resizer.is-dragging::before {
    background: var(--sec);
    inset: 0 1px;
}

.wb-resizer.is-h:hover::before,
.wb-resizer.is-h:focus-visible::before,
.wb-resizer.is-h.is-dragging::before {
    inset: 1px 0;
}

.wb-resizer:focus-visible {
    outline: none;
}

body.wb-resizing,
body.wb-resizing * {
    cursor: inherit !important;
    user-select: none !important;
}

/* ---------- operations pane ---------- */
.wb-search {
    display: flex;
    flex: none;
    align-items: center;
    gap: 6px;
    margin: var(--wb-pad) var(--wb-pad) 6px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
}

.wb-search:focus-within {
    border-color: var(--sec);
    box-shadow: 0 0 0 3px var(--sec-soft);
}

.wb-search .material-symbols-rounded {
    color: var(--ink-faint);
    font-size: 18px;
}

html body .tool-page .wb-search input {
    flex: 1;
    min-width: 0;
    height: 34px;
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    box-shadow: none;
    outline: none;
}

.wb-op-list {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 4px 6px var(--wb-pad);
}

.wb-ops .wb-hint {
    flex: none;
    padding: 8px var(--wb-pad);
    border-top: 1px solid var(--line);
}

.wb-op-group + .wb-op-group {
    margin-top: 10px;
}

.wb-op-group p {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 0;
    padding: 4px 0;
    background: var(--color-surface);
    color: var(--color-text-soft);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
}

.wb-op {
    display: block;
    width: 100%;
    padding: 6px 8px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: inherit;
    font: inherit;
    font-size: var(--font-sm);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: grab;
}

.wb-op:hover,
.wb-op:focus-visible {
    background: var(--color-surface-alt);
    color: var(--color-accent);
}

.wb-empty-small {
    margin: 8px 0;
    color: var(--color-text-soft);
    font-size: var(--font-sm);
}

/* recipe */
.wb-recipe.is-drop {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent) 25%, transparent);
}

.wb-steps {
    flex: 0 1 auto;
    min-height: 0;
    overflow: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 8px;
    margin: 0;
    padding: var(--wb-pad);
    list-style: none;
}

.wb-steps.drop-end::after {
    content: "";
    height: 3px;
    border-radius: 2px;
    background: var(--color-accent);
}

.wb-step {
    position: relative;
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-accent);
    border-radius: var(--radius-md);
    background: var(--color-surface-alt);
    padding: 8px 8px 10px;
}

.wb-step.drop-before::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -6px;
    height: 3px;
    border-radius: 2px;
    background: var(--color-accent);
}

.wb-step.is-dragging {
    opacity: .4;
}

.wb-step.is-off {
    opacity: .5;
    border-left-color: var(--color-border);
}

.wb-step.has-error {
    border-left-color: #dc2626;
    background: rgba(220, 38, 38, .06);
}

.wb-step.is-viewing {
    box-shadow: 0 0 0 2px var(--color-accent);
}

.wb-step-head {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wb-step-head strong {
    flex: 1;
    min-width: 0;
    font-size: var(--font-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wb-grip {
    color: var(--color-text-soft);
    font-size: 18px;
    cursor: grab;
}

.wb-step-no {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--color-accent);
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.wb-step-no:hover {
    outline: 2px solid color-mix(in srgb, var(--color-accent) 40%, transparent);
}

.wb-step-tools {
    display: flex;
}

.wb-step-tools button {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--color-text-soft);
    cursor: pointer;
}

.wb-step-tools button:hover:not(:disabled) {
    background: var(--color-surface);
    color: inherit;
}

.wb-step-tools button:disabled {
    opacity: .3;
    cursor: default;
}

.wb-step-tools .material-symbols-rounded {
    font-size: 17px;
}

.wb-step-opts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: 8px;
}

.wb-opt {
    display: grid;
    gap: 3px;
    flex: 1 1 110px;
    min-width: 0;
    color: var(--color-text-soft);
    font-size: 11px;
    font-weight: 600;
}

.wb-opt-wide {
    flex-basis: 100%;
}

.wb-opt select,
.wb-opt input,
.wb-search input {
    min-height: 0;
    box-shadow: none;
}

.wb-opt select,
.wb-opt input {
    width: 100%;
    min-width: 0;
    padding: 5px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    font-size: var(--font-xs);
    font-weight: 500;
}

.wb-opt input {
    font-family: var(--font-mono);
}

.wb-opt-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--font-xs);
    cursor: pointer;
}

.wb-step-error {
    margin: 6px 0 0;
    color: #dc2626;
    font-size: var(--font-xs);
    font-weight: 600;
}

.wb-empty {
    display: grid;
    place-items: center;
    gap: 6px;
    flex: 1;
    margin: var(--wb-pad);
    padding: 16px;
    border: 2px dashed var(--line);
    border-radius: var(--radius-md);
    color: var(--color-text-soft);
    font-size: var(--font-sm);
    text-align: center;
    line-height: 1.6;
}

.wb-empty .material-symbols-rounded {
    font-size: 28px;
}


/* ---------- input / output pane ---------- */
.wb-io {
    display: grid;
    grid-template-rows: var(--wb-in, minmax(0, 1fr)) 5px auto minmax(0, 1fr);
}

.wb-io-block {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* editors run edge to edge inside their block */
html body .tool-page .wb-editor {
    flex: 1;
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: var(--wb-pad) 14px;
    border: 0;
    border-radius: 0;
    background: var(--surface);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    box-shadow: none;
    resize: none;
    tab-size: 4;
}

html body .tool-page .wb-editor:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--sec) 35%, transparent);
}

.wb-file {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 8px;
    margin: var(--wb-pad);
    padding: 12px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-md);
    font-size: 14px;
}

.wb-file span:nth-child(2) {
    flex: 1;
    overflow-wrap: anywhere;
}

.wb-viewbar {
    display: flex;
    flex: none;
    align-items: center;
    gap: 8px;
    padding: 6px var(--wb-pad);
    border-bottom: 1px solid var(--line);
    background: var(--sec-soft);
    font-size: 12px;
}

.wb-viewbar span:nth-child(2) {
    flex: 1;
}

.wb-viewbar .material-symbols-rounded {
    color: var(--sec);
    font-size: 18px;
}

/* magic */
.wb-magic {
    display: grid;
    gap: 6px;
    max-height: 40%;
    overflow: auto;
    margin: 0;
    border-width: 1px 0;
    border-radius: 0;
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--color-accent) 40%, var(--color-border));
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--color-accent) 7%, var(--color-surface));
}

.wb-magic-title,
.wb-magic-empty {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: var(--font-xs);
    font-weight: 700;
}

.wb-magic-empty {
    font-weight: 500;
    color: var(--color-text-soft);
}

.wb-magic .material-symbols-rounded {
    color: var(--color-accent);
    font-size: 17px;
}

.wb-magic-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 10px;
    align-items: center;
}

.wb-magic-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 4px;
    font-size: var(--font-xs);
    font-weight: 700;
}

.wb-magic-path .material-symbols-rounded {
    font-size: 14px;
    color: var(--color-text-soft);
}

.wb-magic-row code {
    grid-column: 1;
    overflow: hidden;
    color: var(--color-text-soft);
    font-family: var(--font-mono);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wb-magic-row button {
    grid-column: 2;
    grid-row: 1 / span 2;
}

/* notes */
.wb-notes {
    display: grid;
    gap: 4px;
    flex: none;
    max-height: 30%;
    overflow: auto;
    margin: 0;
    padding: 8px var(--wb-pad);
    border-top: 1px solid var(--line);
    list-style: none;
}

.wb-notes:empty {
    display: none;
}

.wb-notes li {
    padding: 5px 9px;
    border-left: 3px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-alt);
    font-size: var(--font-xs);
}

.wb-notes li.is-warn {
    border-left-color: #dc2626;
    background: rgba(220, 38, 38, .08);
}

.wb-notes li.is-ok {
    border-left-color: #1fa968;
}

.wb-notes li.is-info {
    border-left-color: var(--color-accent);
}

/* ---------- generator ---------- */
.wb-checks {
    display: grid;
    gap: 8px;
    font-size: var(--font-sm);
}

.wb-checks label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.gen-opts {
    display: grid;
    gap: 12px;
}

.wb-gen-out {
    display: grid;
    gap: 14px;
}

.wb-gen-block {
    display: grid;
    gap: 6px;
}

.wb-gen-text {
    width: 100%;
    min-height: 0;
    font-family: var(--font-mono);
    font-size: 13px;
}

/* ---------- guide ---------- */
.wb-guide {
    margin: 36px 0 24px;
}

.wb-guide h2 {
    margin: 0 0 6px;
    font-size: var(--font-lg, 1.25rem);
}

.wb-guide-lead {
    margin: 0 0 16px;
    color: var(--color-text-soft);
    font-size: var(--font-sm);
}

.wb-recipes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.wb-recipe-card {
    display: grid;
    align-content: start;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: inherit;
    text-decoration: none;
}

.wb-recipe-card:hover,
.wb-recipe-card:focus-visible {
    border-color: var(--color-accent);
}

.wb-recipe-card strong {
    font-size: var(--font-sm);
}

.wb-recipe-card span {
    color: var(--color-accent);
    font-size: var(--font-xs);
    font-weight: 600;
}

.wb-recipe-card p {
    margin: 4px 0 0;
    color: var(--color-text-soft);
    font-size: var(--font-xs);
    line-height: 1.6;
}

.wb-recipe-card code,
.wb-faq code {
    font-family: var(--font-mono);
}

.wb-faq {
    max-width: 820px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.wb-recipes + .wb-faq {
    margin-top: 20px;
}

.wb-faq summary {
    font-size: var(--font-sm);
    font-weight: 700;
    cursor: pointer;
}

.wb-faq p {
    margin: 8px 0 0;
    color: var(--color-text-soft);
    font-size: var(--font-sm);
    line-height: 1.7;
}

/* ---------- responsive: stack panes, input/output first ---------- */
@media (max-width: 1180px) {
    .wb-layout {
        grid-template-columns: 220px minmax(0, 1fr);
        height: auto;
        min-height: 0;
    }

    .wb-resizer {
        display: none;
    }

    .wb-io {
        grid-column: 1 / -1;
        grid-template-rows: auto auto auto;
        order: -1;
        border-bottom: 1px solid var(--line);
    }

    html body .tool-page .wb-io-block .wb-editor {
        min-height: 200px;
    }

    .wb-ops,
    .wb-recipe {
        height: 480px;
    }

    .wb-ops {
        border-right: 1px solid var(--line);
    }
}

@media (max-width: 760px) {
    .wb-appbar {
        flex-wrap: wrap;
        height: auto;
        gap: 4px 12px;
        padding: 10px 16px 0;
    }

    .wb-tabs {
        height: 40px;
    }

    .wb-presets {
        order: 3;
        width: 100%;
        margin: 0 -16px;
        padding: 0 16px 10px;
    }

    .wb-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .wb-recipe {
        order: 0;
        height: auto;
        max-height: 560px;
        border-bottom: 1px solid var(--line);
    }

    .wb-ops {
        order: 1;
        height: 360px;
        border-right: 0;
    }
}

/* ---------- content below the app keeps the site column ---------- */
.wb-container #panelGen,
.wb-container .wb-guide,
.wb-container .related {
    max-width: var(--page-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
}

.wb-container #panelGen {
    padding-top: 20px;
}

.wb-container .wb-guide {
    margin-top: 48px;
}

/* the site header spans the full width too, so the logo lines up with the panes */
body[data-page="workbench"] .header-container {
    max-width: none;
    padding: 0 16px;
}
