/* ========== Portal CSS — Komgo API Documentation ========== */

:root {
    --primary: #6C5CE7;
    --primary-light: #a29bfe;
    --primary-bg: #f5f3ff;
    --sidebar-width: 260px;
    --header-height: 56px;
    --text: #2d3436;
    --text-muted: #636e72;
    --border: #e2e8f0;
    --bg: #fafafa;
    --white: #ffffff;
    --code-bg: #1e1e2e;
    --code-text: #cdd6f4;
    --success: #00b894;
    --danger: #e74c3c;
    --warning: #fdcb6e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

/* ========== Header ========== */
.header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}
.header-logo {
    font-size: 1.25rem; font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}
.header-right { display: flex; align-items: center; gap: 16px; }
.badge {
    font-size: 0.75rem; font-weight: 600;
    padding: 4px 12px; border-radius: 20px;
    border: 1.5px solid var(--primary); color: var(--primary);
}
.header-user {
    font-size: 0.85rem; color: var(--text-muted);
    display: flex; align-items: center; gap: 8px;
}
.header-user a {
    color: var(--primary); text-decoration: none; font-weight: 500;
}
.header-user a:hover { text-decoration: underline; }

/* ========== Sidebar ========== */
.sidebar {
    position: fixed; top: var(--header-height); left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 24px 0;
    z-index: 50;
}
.sidebar-section { padding: 0 20px; margin-bottom: 24px; }
.sidebar-section-title {
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--text-muted);
    margin-bottom: 8px;
}
.sidebar-link {
    display: block; padding: 6px 12px; margin: 2px 0;
    font-size: 0.9rem; color: var(--text);
    text-decoration: none; border-radius: 6px;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}
.sidebar-link:hover { background: var(--primary-bg); color: var(--primary); }
.sidebar-link.active {
    color: var(--primary); font-weight: 600;
    background: var(--primary-bg);
    border-left-color: var(--primary);
}

/* ========== Main Content ========== */
.main {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 40px 60px;
    max-width: 1600px;
}
.main h1 {
    font-size: 2.2rem; font-weight: 700;
    color: var(--primary); margin-bottom: 12px;
}
.main h2 {
    font-size: 1.5rem; font-weight: 700;
    color: var(--primary); margin-top: 48px; margin-bottom: 16px;
    padding-top: 24px; border-top: 1px solid var(--border);
}
.main h3 {
    font-size: 1.15rem; font-weight: 600;
    color: var(--text); margin-top: 32px; margin-bottom: 12px;
}
.main p { margin-bottom: 16px; color: var(--text); }
.main ul, .main ol { margin-bottom: 16px; padding-left: 24px; }
.main li { margin-bottom: 6px; }
.main a { color: var(--primary); }
.subtitle {
    font-size: 1.05rem; color: var(--text-muted);
    margin-bottom: 32px;
}

/* ========== Code Blocks ========== */
.code-block {
    position: relative;
    background: var(--code-bg);
    border-radius: 10px;
    margin: 20px 0;
    overflow: hidden;
}
.code-block-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 16px;
    font-size: 0.8rem; color: #888;
    border-bottom: 1px solid #313244;
}
.code-block pre {
    padding: 16px 20px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem; line-height: 1.7;
    color: var(--code-text);
}
.copy-btn {
    background: transparent; border: 1px solid #555;
    color: #aaa; padding: 4px 12px; border-radius: 4px;
    cursor: pointer; font-size: 0.78rem;
    transition: all 0.15s;
}
.copy-btn:hover { background: #313244; color: #fff; }
.copy-btn.copied { background: var(--success); color: #fff; border-color: var(--success); }

/* Inline code */
code:not(pre code) {
    background: #f0ecfe; color: var(--primary);
    padding: 2px 6px; border-radius: 4px;
    font-size: 0.88em; font-family: 'JetBrains Mono', monospace;
}

/* Syntax colors */
.kw { color: #cba6f7; } /* keywords: import, public, class, new, return */
.str { color: #a6e3a1; } /* strings */
.cls { color: #89b4fa; } /* class names */
.cmt { color: #6c7086; } /* comments */
.num { color: #fab387; } /* numbers */
.fn { color: #89dceb; }  /* function/method names */

/* ========== Callout Boxes ========== */
.callout {
    border-left: 4px solid var(--primary);
    background: var(--primary-bg);
    border-radius: 0 8px 8px 0;
    padding: 16px 20px;
    margin: 20px 0;
}
.callout-title {
    font-weight: 600; color: var(--primary);
    margin-bottom: 6px; font-size: 0.95rem;
}
.callout-title span { margin-right: 6px; }
.callout p { margin: 0; font-size: 0.9rem; }
.callout.warning { border-left-color: #fdcb6e; background: #fef9e7; }
.callout.warning .callout-title { color: #f39c12; }
.callout.tip { border-left-color: var(--success); background: #e8f8f5; }
.callout.tip .callout-title { color: var(--success); }
.callout.danger { border-left-color: var(--danger); background: #fde8e8; }
.callout.danger .callout-title { color: var(--danger); }

/* ========== Tables ========== */
.doc-table {
    width: 100%; border-collapse: collapse;
    margin: 20px 0; font-size: 0.85rem;
    table-layout: fixed;
}
.doc-table th {
    text-align: left; padding: 8px 10px;
    background: var(--primary-bg); color: var(--primary);
    font-weight: 600; border-bottom: 2px solid var(--primary-light);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-table td {
    padding: 8px 10px; border-bottom: 1px solid var(--border);
    vertical-align: top; overflow: hidden; text-overflow: ellipsis;
}
/* Column widths for message field tables (8 columns inside msg-body) */
.msg-body .doc-table th:nth-child(1) { width: 18%; }  /* Field */
.msg-body .doc-table th:nth-child(2) { width: 5%; text-align: center; }  /* Access */
.msg-body .doc-table th:nth-child(3) { width: 4%; text-align: center; }  /* Mandatory */
.msg-body .doc-table th:nth-child(4) { width: 13%; }  /* Type */
.msg-body .doc-table th:nth-child(5) { width: 5%; }   /* SWIFT */
.msg-body .doc-table th:nth-child(6) { width: 22%; }  /* Description */
.msg-body .doc-table th:nth-child(7) { width: 20%; }  /* Values */
.msg-body .doc-table th:nth-child(8) { width: 13%; }  /* Depends On */
.msg-body .doc-table td:nth-child(2),
.msg-body .doc-table td:nth-child(3) { text-align: center; }
/* Columns 1-5: no wrapping */
.msg-body .doc-table td:nth-child(1),
.msg-body .doc-table td:nth-child(2),
.msg-body .doc-table td:nth-child(3),
.msg-body .doc-table td:nth-child(4),
.msg-body .doc-table td:nth-child(5) { white-space: nowrap; }
.msg-body .doc-table td code {
    font-size: 0.8rem;
}
.col-desc, .col-depends, .col-values {
    font-size: 0.78rem; color: var(--text-muted);
    white-space: normal; word-break: break-word;
}
.col-values code {
    font-size: 0.72rem; white-space: pre-line;
    background: #f8f8f8; padding: 2px 6px; border-radius: 3px;
    display: inline-block; line-height: 1.5;
}
.col-depends {
    font-style: italic; color: #e17055;
}

/* ========== Login Page ========== */
.login-page {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
}
.login-card {
    background: var(--white); border-radius: 16px;
    padding: 48px 40px; width: 420px;
    box-shadow: 0 4px 24px rgba(108, 92, 231, 0.1);
}
.login-card h1 {
    color: var(--primary); font-size: 1.8rem;
    text-align: center; margin-bottom: 8px;
}
.login-card .subtitle {
    text-align: center; margin-bottom: 32px;
}
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; font-size: 0.85rem; font-weight: 600;
    margin-bottom: 6px; color: var(--text);
}
.form-group input {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border); border-radius: 8px;
    font-size: 0.95rem; transition: border-color 0.15s;
}
.form-group input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}
.btn {
    display: inline-block; padding: 10px 20px;
    border-radius: 8px; font-size: 0.9rem; font-weight: 600;
    cursor: pointer; border: none; transition: all 0.15s;
    text-decoration: none;
}
.btn-primary {
    background: var(--primary); color: #fff; width: 100%;
}
.btn-primary:hover { background: #5b4bd5; }
.btn-microsoft {
    display: flex; align-items: center; justify-content: center;
    width: 100%; padding: 10px 16px;
    background: #fff; color: #5e5e5e;
    border: 1px solid #8c8c8c; border-radius: 8px;
    font-size: 0.95rem; font-weight: 500;
    cursor: pointer; text-decoration: none;
    transition: all 0.15s;
}
.btn-microsoft:hover { background: #f5f5f5; border-color: var(--primary); color: #333; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-outline {
    background: transparent; border: 1.5px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover { background: var(--primary-bg); }

.alert {
    padding: 12px 16px; border-radius: 8px;
    margin-bottom: 20px; font-size: 0.9rem;
}
.alert-error { background: #fde8e8; color: var(--danger); border: 1px solid #f5c6cb; }
.alert-success { background: #e8f8f5; color: var(--success); border: 1px solid #b2dfdb; }

/* ========== Admin ========== */
.admin-table {
    width: 100%; border-collapse: collapse;
    margin: 20px 0; font-size: 0.9rem;
}
.admin-table th {
    text-align: left; padding: 12px 16px;
    background: var(--primary-bg); color: var(--primary);
    font-weight: 600;
}
.admin-table td {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.admin-table tr:hover td { background: #fafafa; }
.admin-card {
    background: var(--white); border-radius: 12px;
    padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}
.admin-card h3 { margin-top: 0; color: var(--primary); }
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px; margin-bottom: 32px;
}
.stat-card {
    background: var(--white); border-radius: 12px;
    padding: 24px; text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.stat-card .stat-value {
    font-size: 2.5rem; font-weight: 700; color: var(--primary);
}
.stat-card .stat-label {
    font-size: 0.85rem; color: var(--text-muted); margin-top: 4px;
}
.actions { display: flex; gap: 8px; }

/* ========== Language Tabs ========== */
.lang-tabs {
    display: flex; gap: 0;
    margin-top: 20px; margin-bottom: 0;
}
.lang-tab {
    padding: 8px 20px;
    font-size: 0.82rem; font-weight: 600;
    background: #2a2a3e; color: #888;
    border: none; cursor: pointer;
    border-top-left-radius: 8px; border-top-right-radius: 8px;
    transition: all 0.15s;
    font-family: 'JetBrains Mono', monospace;
}
.lang-tab:hover { color: #ccc; }
.lang-tab.active {
    background: var(--code-bg); color: var(--code-text);
}
.lang-tabs + .code-block,
.lang-tabs + .code-block + .code-block {
    margin-top: 0;
    border-top-left-radius: 0;
}
.code-block.lang-hidden { display: none; }

/* ========== Step Badges ========== */
.step-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    background: var(--primary); color: #fff;
    border-radius: 50%; font-size: 0.8rem; font-weight: 700;
    margin-right: 8px;
}

/* ========== Tree Diagram ========== */
.tree-diagram {
    background: var(--white); border: 1px solid var(--border);
    border-radius: 12px; padding: 24px; margin: 16px 0 24px;
}
.tree-node {
    padding: 12px 16px; border-radius: 8px; margin: 4px 0;
    border-left: 4px solid var(--primary);
    background: var(--primary-bg);
}
.tree-node.root { border-left-color: var(--primary); background: #f0ecff; }
.tree-node.topic { border-left-color: var(--success); background: #e6f9f1; }
.tree-node.reply { border-left-color: var(--warning); background: #fef9e7; }
.tree-label { font-weight: 600; font-size: 0.95rem; }
.tree-detail { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }
.tree-badge {
    display: inline-block; margin-top: 4px;
    font-size: 0.7rem; font-family: 'JetBrains Mono', monospace;
    background: rgba(0,0,0,0.06); padding: 2px 8px; border-radius: 4px;
    color: var(--text-muted);
}
.tree-children { padding-left: 32px; border-left: 2px dashed var(--border); margin-left: 16px; }
.tree-branch { margin: 8px 0; }

/* ========== Scenario Cards ========== */
.scenario-card {
    background: var(--white); border: 1px solid var(--border);
    border-radius: 12px; padding: 24px; margin: 16px 0 24px;
}
.scenario-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.scenario-header h3 { margin: 0; font-size: 1.1rem; }
.scenario-desc { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.scenario-flow {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 12px 16px; background: #f8f9fa; border-radius: 8px; margin-bottom: 16px;
    font-size: 0.8rem; font-family: 'JetBrains Mono', monospace;
}
.flow-step {
    padding: 4px 10px; border-radius: 6px;
    background: var(--white); border: 1px solid var(--border);
}
.flow-step.highlight { background: #fde8e8; border-color: #e74c3c; color: #c0392b; font-weight: 600; }
.flow-step.result { background: #e6f9f1; border-color: #00875a; color: #00875a; font-weight: 600; }
.flow-arrow { color: var(--text-muted); font-size: 1rem; }

/* ========== Playground ========== */
.playground-tabs {
    display: flex; gap: 0; margin-top: 16px;
}
.playground-tab {
    padding: 10px 24px; font-size: 0.85rem; font-weight: 600;
    background: var(--white); color: var(--text-muted);
    border: 1px solid var(--border); border-bottom: none;
    cursor: pointer; border-top-left-radius: 8px; border-top-right-radius: 8px;
    transition: all 0.15s;
}
.playground-tab:hover { color: var(--primary); }
.playground-tab.active { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); }
.playground-tab.tab-root.active { background: #f0ecff; color: var(--primary); border-color: var(--primary); }
.playground-tab.tab-topic.active { background: #e6f9f1; color: var(--success); border-color: var(--success); }
.playground-tab.tab-reply.active { background: #fef9e7; color: #f39c12; border-color: var(--warning); }
.playground-panel {
    display: none;
    border: 1px solid var(--border); border-top: 2px solid var(--primary);
    border-radius: 0 0 12px 12px; padding: 24px;
    background: var(--white); margin-bottom: 24px;
}
.playground-panel.panel-root { border-top-color: var(--primary); }
.playground-panel.panel-topic { border-top-color: var(--success); }
.playground-panel.panel-reply { border-top-color: var(--warning); }
.playground-panel.active { display: block; }
.playground-panel h3 { font-size: 1rem; margin-bottom: 8px; font-family: 'JetBrains Mono', monospace; }

/* Scenario accordion cards */
.scenario-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}
.scenario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--bg);
    cursor: pointer;
    user-select: none;
}
.scenario-header:hover { background: #f0f0f5; }
.scenario-header h4 { margin: 0; font-size: 0.95rem; }
.scenario-endpoint {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 12px;
}
.scenario-toggle { font-size: 0.8rem; color: var(--text-muted); }
.scenario-body { padding: 20px; }
.playground-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.form-row { display: flex; flex-direction: column; }
.form-row label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.field-badge {
    font-size: 0.6rem; font-weight: 700; text-transform: uppercase;
    padding: 1px 6px; border-radius: 3px; letter-spacing: 0.04em;
}
.field-badge.required { background: #fde8e8; color: var(--danger); }
.field-badge.optional { background: #f0f0f0; color: var(--text-muted); }
.form-row input, .form-row select {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.9rem; font-family: 'JetBrains Mono', monospace;
}
.form-row input:focus, .form-row select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,92,231,0.1); }
.playground-btn {
    grid-column: 1 / -1;
    padding: 10px 24px; border: none; border-radius: 8px;
    background: var(--primary); color: #fff;
    font-size: 0.9rem; font-weight: 600; cursor: pointer;
    transition: background 0.15s;
}
.playground-btn:hover { background: #5a4bd1; }
.playground-btn:disabled { background: #999; cursor: not-allowed; }
.playground-result { margin-top: 16px; }

/* Playground: Create Message */
.pg-loading { padding: 16px; color: var(--text-muted); font-style: italic; }
.pg-section-title { font-size: 0.95rem; font-weight: 600; margin: 20px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.pg-count { font-weight: 400; font-size: 0.82rem; color: var(--text-muted); }
.pg-field-group { margin-bottom: 20px; }
.pg-field-group-title {
    font-size: 0.88rem; font-weight: 600; text-transform: capitalize;
    color: var(--primary); margin: 16px 0 8px; padding: 4px 0;
    border-bottom: 1px solid var(--border);
}
.pg-field-row {
    display: grid; grid-template-columns: 300px 1fr; gap: 8px;
    align-items: start; padding: 6px 0; border-bottom: 1px solid #f0f0f0;
}
.pg-field-label {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    font-size: 0.82rem; min-height: 32px;
}
.pg-field-label code { font-size: 0.8rem; color: #333; }
.pg-field-type { font-size: 0.7rem; color: var(--text-muted); font-style: italic; }
.pg-mandatory-badge {
    font-size: 0.65rem; font-weight: 700; padding: 1px 5px; border-radius: 3px;
    color: #fff; flex-shrink: 0;
}
.pg-mandatory-M { background: #dc3545; }
.pg-mandatory-O { background: #6c757d; }
.pg-mandatory-M-O { background: #fd7e14; }
.pg-field-input-wrapper { min-width: 0; }
.pg-input {
    width: 100%; padding: 6px 10px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 0.85rem; font-family: inherit;
    transition: border-color 0.15s;
}
.pg-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px rgba(106, 90, 205, 0.15); }
.pg-textarea { resize: vertical; min-height: 60px; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
.pg-input-ccy { width: 80px; flex-shrink: 0; }
.pg-amount-group { display: flex; gap: 6px; }
.pg-amount-group .pg-input:not(.pg-input-ccy) { flex: 1; }
.pg-field-desc { grid-column: 1 / -1; font-size: 0.75rem; color: var(--text-muted); padding: 2px 0 0 0; }
.pg-skip-notice { font-size: 0.8rem; color: var(--text-muted); font-style: italic; padding: 6px 0; }
/* List fields (ListOfIdenticalFields) */
.pg-list-field { display: flex; flex-direction: column; gap: 8px; }
.pg-list-items { display: flex; flex-direction: column; gap: 8px; }
.pg-list-item {
    background: #f8fafc; border: 1px solid var(--border); border-radius: 6px;
    padding: 10px 12px; position: relative;
}
.pg-list-item-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px; font-size: 0.82rem; font-weight: 600; color: var(--primary);
}
.pg-list-rm-btn {
    background: transparent; border: 1px solid #ddd; color: var(--danger);
    width: 22px; height: 22px; border-radius: 4px; cursor: pointer;
    font-size: 0.9rem; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.pg-list-rm-btn:hover { background: #fde8e8; border-color: var(--danger); }
.pg-list-item-fields { display: flex; flex-direction: column; gap: 4px; }
.pg-list-add-btn {
    align-self: flex-start; background: var(--primary-bg); color: var(--primary);
    border: 1.5px dashed var(--primary-light); border-radius: 6px;
    padding: 6px 14px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
    transition: all 0.15s;
}
.pg-list-add-btn:hover { background: var(--primary); color: #fff; border-style: solid; }
/* Sub-field groups (CompanyInformation / BankInformation) */
.pg-subfield-group {
    background: #f8fafc; border: 1px solid var(--border); border-radius: 6px;
    padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
}
.pg-subfield-row { display: flex; align-items: center; gap: 8px; }
.pg-subfield-label { min-width: 90px; font-size: 0.78rem; font-weight: 500; color: var(--text-muted); }
.pg-subfield-row .pg-input { flex: 1; font-size: 0.82rem; padding: 4px 8px; }
.result-status-ok { background: #d1fae5; color: #065f46; padding: 2px 8px; border-radius: 4px; font-weight: 600; font-size: 0.85rem; }
.result-success {
    background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 16px;
}
.result-error {
    background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 16px;
    color: var(--danger); font-weight: 500;
}
.result-header { font-weight: 700; margin-bottom: 12px; color: #166534; }
.result-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.result-table td { padding: 6px 8px; border-bottom: 1px solid #e5e7eb; }
.result-table td:first-child { width: 180px; }
.result-table code { background: #e0e7ff; padding: 2px 6px; border-radius: 4px; font-size: 0.78rem; }
.result-table tr.result-highlight td { background: #ecfdf5; }
.result-table .result-note { font-size: 0.78rem; color: var(--text-muted); font-style: italic; }
.result-table tr.result-same td { background: #ede9fe; }

/* ========== LC Import Message Details ========== */
.msg-details {
    background: var(--white); border: 1px solid var(--border);
    border-radius: 10px; margin: 12px 0; overflow: hidden;
    border-left: 4px solid var(--border);
}
.msg-details.msg-positive { border-left-color: #00875a; }
.msg-details.msg-negative { border-left-color: #e74c3c; }
.msg-details.msg-not-final { border-left-color: var(--border); }
.msg-details summary {
    padding: 14px 20px; cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    font-size: 0.9rem; font-weight: 600; color: var(--text);
    list-style: none; transition: background 0.15s;
}
.msg-details summary::-webkit-details-marker { display: none; }
.msg-details summary::before {
    content: '\25B6'; font-size: 0.65rem; color: var(--text-muted);
    transition: transform 0.2s;
}
.msg-details[open] summary::before { transform: rotate(90deg); }
.msg-details[open] summary { background: var(--primary-bg); }
.msg-details .msg-body { padding: 16px 20px; }
.msg-details .msg-body .doc-table { margin-top: 8px; }

/* Issuer badge */
.badge-issuer {
    font-size: 0.7rem; font-weight: 600; padding: 2px 10px;
    border-radius: 12px; border: 1.5px solid;
}
.badge-issuer.bank { border-color: #0984e3; color: #0984e3; }
.badge-issuer.corporate { border-color: #f39c12; color: #f39c12; }

/* Summary right-side badge group — fixed width for column alignment */
.summary-badges {
    display: flex; align-items: center; gap: 6px;
    margin-left: auto; flex-shrink: 0;
}

/* Root & Topic badges */
.badge-root, .badge-topic {
    font-size: 0.65rem; font-weight: 600; padding: 2px 8px;
    border-radius: 4px;
    width: 44px; text-align: center; flex-shrink: 0;
}
.badge-root {
    background: #f0ecff; color: var(--primary);
    border: 1px solid var(--primary-light);
}
.badge-topic {
    background: #f0ecff; color: var(--primary);
    border: 1px solid var(--primary-light);
}

/* Final type badge */
.badge-final {
    font-size: 0.65rem; font-weight: 600; padding: 2px 8px;
    border-radius: 4px;
    width: 105px; text-align: center; flex-shrink: 0;
}
.badge-final.positive { background: #e6f9f1; color: #00875a; }
.badge-final.negative { background: #fde8e8; color: #e74c3c; }
.badge-final.not-final { background: #f0f0f0; color: #636e72; }

/* Hidden badge — reserves space but invisible */
.hidden-badge { visibility: hidden; }

/* Reply messages list */
.reply-list {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 12px;
}
.reply-tag {
    display: inline-block; font-size: 0.75rem; font-weight: 500;
    padding: 3px 10px; border-radius: 4px;
    text-decoration: none; cursor: pointer;
    border: 1px solid #ddd; background: #fafafa; color: #333;
    transition: background 0.15s;
}
.reply-tag:hover { background: #f0ecfe; }
.reply-tag.reply-bank { border-color: #0984e3; color: #0984e3; }
.reply-tag.reply-bank:hover { background: #e8f4fd; }
.reply-tag.reply-corporate { border-color: #f39c12; color: #f39c12; }
.reply-tag.reply-corporate:hover { background: #fef9e7; }
.reply-tag.reply-positive { background: #e6f9f1; border-color: #00875a; color: #00875a; }
.reply-tag.reply-positive:hover { background: #d0f0e0; }
.reply-tag.reply-negative { background: #fde8e8; border-color: #e74c3c; color: #e74c3c; }
.reply-tag.reply-negative:hover { background: #fcd0d0; }
.reply-subtype { font-size: 0.68rem; opacity: 0.7; }

/* Access badge */
.access-badge {
    display: inline-block; font-size: 0.7rem; font-weight: 700;
    padding: 1px 8px; border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
}
.access-badge.read { background: #e8f8f5; color: #00b894; }
.access-badge.write { background: #fff3e0; color: #e17055; }

/* Field rules (description, values, default, depends on) */
.field-rule {
    font-size: 0.75rem; color: var(--text-muted);
    margin-top: 4px; line-height: 1.4;
    word-break: break-word;
}
.field-rule strong {
    color: var(--text); font-size: 0.72rem;
}
.field-depends {
    font-style: italic; color: #e17055;
}

/* Export button */
.btn-export {
    display: inline-block; padding: 6px 16px;
    font-size: 0.8rem; font-weight: 600;
    color: var(--primary); background: var(--primary-bg);
    border: 1.5px solid var(--primary-light);
    border-radius: 6px; text-decoration: none;
    transition: all 0.15s;
}
.btn-export:hover {
    background: var(--primary); color: #fff;
    border-color: var(--primary);
}

/* ========== Products Page ========== */
.products-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    display: flex; flex-direction: column;
}
.products-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 40px;
}
.products-komgo-logo { height: 32px; }
.products-user {
    font-size: 0.85rem; color: var(--text-muted);
    display: flex; align-items: center; gap: 8px;
}
.products-user a {
    color: var(--primary); text-decoration: none; font-weight: 500;
}
.products-user a:hover { text-decoration: underline; }
.products-content {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 0 40px 60px;
}
.products-title {
    font-size: 1.6rem; font-weight: 700; color: var(--primary);
    margin-bottom: 40px;
}
.products-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 24px; max-width: 900px; width: 100%;
}
.product-card {
    background: var(--white); border-radius: 16px;
    padding: 32px 24px; text-align: center;
    box-shadow: 0 4px 24px rgba(108, 92, 231, 0.08);
    border: 2px solid transparent;
    transition: all 0.2s; cursor: pointer;
    text-decoration: none; color: var(--text);
    display: flex; flex-direction: column; align-items: center;
    position: relative;
}
.product-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 32px rgba(108, 92, 231, 0.15);
    transform: translateY(-4px);
}
.product-card.disabled {
    opacity: 0.5; cursor: default;
    pointer-events: none;
}
.product-card.disabled:hover {
    border-color: transparent;
    box-shadow: 0 4px 24px rgba(108, 92, 231, 0.08);
    transform: none;
}
.product-logo {
    width: 72px; height: 72px; object-fit: contain;
    margin-bottom: 16px;
}
.product-logo-wide {
    width: 110px; height: 72px; object-fit: contain;
    margin-bottom: 16px;
}
.product-name {
    font-size: 1.1rem; font-weight: 700; color: var(--text);
    margin-bottom: 6px;
}
.product-desc {
    font-size: 0.82rem; color: var(--text-muted);
    line-height: 1.4;
}
.product-badge {
    position: absolute; top: 12px; right: 12px;
    font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 10px; border-radius: 12px;
    background: #f0f0f0; color: var(--text-muted);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main { margin-left: 0; padding: 24px 20px; }
    .playground-form { grid-template-columns: 1fr; }
    .scenario-flow { flex-direction: column; align-items: flex-start; }
    .products-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .products-grid { grid-template-columns: 1fr; }
}

/* HTTP method badges for API reference */
.method-get, .method-post, .method-patch, .method-delete, .method-put,
.badge-get, .badge-post, .badge-patch, .badge-delete, .badge-put {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 0.75rem; font-weight: 600; color: #fff; font-family: 'JetBrains Mono', monospace;
}
.method-get, .badge-get { background: #27ae60; }
.method-post, .badge-post { background: #2980b9; }
.method-patch, .badge-patch { background: #f39c12; }
.method-delete, .badge-delete { background: #e74c3c; }
.method-put, .badge-put { background: #8e44ad; }

/* Reference tables */
.ref-table {
    width: 100%; border-collapse: collapse; margin: 16px 0 24px;
    font-size: 0.9rem;
}
.ref-table th, .ref-table td {
    padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border);
}
.ref-table th {
    background: var(--bg); font-weight: 600; color: var(--text);
    border-bottom: 2px solid var(--border);
}
.ref-table td { color: var(--text-secondary); }
.ref-table td:first-child { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; }
.ref-table tr:hover { background: #f8f8fc; }
