html, body {
    height: 100%;
}

body {
    font-family: "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

.app-shell {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-body {
    flex: 1;
    min-height: 0;
}

.app-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bs-body-bg);
    border-right: 1px solid var(--bs-border-color);
    overflow-y: auto;
}

.app-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    padding: 1rem 1.5rem;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

@media (max-width: 767.98px) {
    .app-shell { height: auto; overflow: visible; }
    .app-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--bs-border-color);
    }
    .app-body {
        flex-direction: column !important;
    }
    .app-main { overflow: visible; }
}

.split-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 0.75rem;
}

.split-page > .page-header { flex-shrink: 0; }

.split-page > section.card {
    flex: 1 1 0;
    min-height: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.split-page > section.card > .card-body {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.split-page .pane-row {
    flex: 1 1 0;
    min-height: 0;
    margin: 0;
}

.split-page .pane-row > [class*="col-"] {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.split-page textarea.code-input {
    flex: 1 1 0;
    min-height: 80px;
    resize: none;
}

/* When cards live inside a column of pane-row (e.g. SAML left/right),
   make them fill the column height. */
.split-page .pane-row section.card,
.split-page .pane-row > [class*="col-"] > .card {
    flex: 1 1 0;
    min-height: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}
.split-page .pane-row section.card > .card-body,
.split-page .pane-row > [class*="col-"] > .card > .card-body {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.split-page .scroll-fill {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
}

.split-page .markdown-preview {
    flex: 1 1 0;
    min-height: 80px;
    max-height: none;
    margin: 0;
}

.md-drop-host {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
}
.md-drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 110, 253, 0.08);
    border: 2px dashed var(--bs-primary);
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-primary);
    font-weight: 600;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.12s ease;
}
.md-drop-overlay.active { opacity: 1; }

.split-page .saml-xml {
    margin: 0;
    max-height: none;
    flex: 1 1 0;
    min-height: 0;
}

.code-input {
    font-family: 'Cascadia Code', 'Consolas', 'Menlo', monospace;
    font-size: 13px;
}

.markdown-preview {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 12px 16px;
    min-height: 480px;
    max-height: 720px;
    overflow-y: auto;
    background: var(--bs-tertiary-bg);
}

.markdown-preview h1, .markdown-preview h2, .markdown-preview h3 {
    border-bottom: 1px solid var(--bs-border-color);
    padding-bottom: 4px;
}

.markdown-preview code {
    background: var(--bs-secondary-bg);
    padding: 0 4px;
    border-radius: 3px;
}

.markdown-preview pre {
    background: var(--bs-secondary-bg);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
}

.markdown-preview pre code {
    background: transparent;
    padding: 0;
}

.markdown-preview table {
    border-collapse: collapse;
    width: 100%;
}

.markdown-preview th, .markdown-preview td {
    border: 1px solid var(--bs-border-color);
    padding: 6px 10px;
}

.markdown-preview blockquote {
    border-left: 4px solid var(--bs-primary);
    margin: 0;
    padding: 4px 12px;
    color: var(--bs-secondary-color);
}

.jwt-segments {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--bs-border-color);
    border-radius: 4px;
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 12px;
    word-break: break-all;
    background: var(--bs-tertiary-bg);
}
.jwt-dot { color: var(--bs-secondary-color); }
.jwt-seg.jwt-header { color: #d63384; }
.jwt-seg.jwt-payload { color: #6f42c1; }
.jwt-seg.jwt-signature { color: #0d6efd; }

.jwt-block {
    margin: 4px 0;
    padding: 8px 12px;
    border-radius: 4px;
    background: var(--bs-tertiary-bg);
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 13px;
    max-height: 200px;
    overflow: auto;
    border: 1px solid var(--bs-border-color);
}
.jwt-block.jwt-header { border-left: 3px solid #d63384; }
.jwt-block.jwt-payload { border-left: 3px solid #6f42c1; }

.saml-xml {
    margin: 0;
    padding: 12px 16px;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 4px;
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.45;
    max-height: 600px;
    overflow: auto;
    white-space: pre;
}

/* Syntax-highlighted code blocks (highlight.js) */
pre.highlighted {
    margin: 0;
    overflow: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    font-family: 'Cascadia Code', 'Consolas', 'Menlo', monospace;
    font-size: 13px;
    line-height: 1.45;
    min-height: 80px;
}
pre.highlighted code.hljs {
    display: block;
    padding: 0.5rem 0.75rem;
}

.split-page pre.highlighted {
    flex: 1 1 0;
    min-height: 80px;
}
