/* Merchant API docs2 — human-friendly reference */

.md2-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 1.25rem 4rem;
}

.md2-hero {
    margin: 1.5rem 0 1.75rem;
}

.md2-hero h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.6rem, 2.5vw, 2.1rem);
    font-weight: 700;
    color: var(--ex-text-primary);
    letter-spacing: -0.02em;
}

.md2-lead {
    margin: 0;
    max-width: 42rem;
    color: var(--ex-muted);
    font-size: 1.05rem;
    line-height: 1.55;
}

.md2-base {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: var(--ex-accent-muted);
    border: 1px solid var(--ex-success-border);
    font-size: 0.85rem;
    color: var(--ex-text-primary);
}

.md2-base code {
    font-family: var(--ex-mono);
    font-size: 0.82rem;
}

.md2-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 1.75rem;
    align-items: start;
}

.md2-sidebar {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow: auto;
    padding: 0.85rem;
    border-radius: var(--ex-radius-card);
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    box-shadow: var(--ex-shadow-sm);
}

.md2-sidebar-title {
    margin: 0 0 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ex-dim);
}

.md2-search {
    width: 100%;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--ex-border);
    border-radius: 0.55rem;
    background: var(--ex-surface-elevated);
    color: var(--ex-text);
    font: inherit;
    font-size: 0.88rem;
}

.md2-search:focus {
    outline: none;
    border-color: var(--ex-border-focus);
    box-shadow: 0 0 0 3px var(--ex-accent-glow);
}

.md2-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.md2-nav > li {
    margin: 0.1rem 0;
}

.md2-nav a {
    display: block;
    padding: 0.35rem 0.55rem;
    border-radius: 0.45rem;
    color: var(--ex-muted);
    text-decoration: none;
    font-size: 0.88rem;
    line-height: 1.35;
    transition: background var(--ex-transition), color var(--ex-transition);
}

.md2-nav a:hover {
    color: var(--ex-text-primary);
    background: var(--ex-surface-hover);
}

.md2-nav a.is-active {
    color: var(--ex-accent-hover);
    background: var(--ex-accent-muted);
    font-weight: 600;
}

.md2-nav-children {
    list-style: none;
    margin: 0.15rem 0 0.35rem;
    padding: 0 0 0 0.7rem;
}

.md2-nav-children a {
    font-size: 0.82rem;
    padding: 0.25rem 0.5rem;
}

.md2-content {
    min-width: 0;
}

.md2-section {
    margin-bottom: 2.25rem;
    scroll-margin-top: 1.25rem;
}

.md2-section > h2 {
    margin: 0 0 0.85rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ex-text-primary);
    letter-spacing: -0.015em;
}

.md2-section > h3,
.md2-h3 {
    margin: 1.35rem 0 0.65rem;
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--ex-text-primary);
}

.md2-prose {
    color: var(--ex-text);
    line-height: 1.6;
    font-size: 0.96rem;
}

.md2-prose p {
    margin: 0 0 0.85rem;
}

.md2-prose ul,
.md2-list {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
}

.md2-prose li,
.md2-list li {
    margin: 0.3rem 0;
}

.md2-card {
    margin-bottom: 1rem;
    padding: 1.1rem 1.2rem;
    border-radius: var(--ex-radius-card);
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    box-shadow: var(--ex-shadow-sm);
}

.md2-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.85rem;
}

.md2-concept {
    padding: 0.95rem 1rem;
    border-radius: var(--ex-radius);
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
}

.md2-concept h3 {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
    color: var(--ex-text-primary);
}

.md2-concept p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--ex-muted);
    line-height: 1.5;
}

.md2-steps {
    counter-reset: md2step;
    list-style: none;
    margin: 0;
    padding: 0;
}

.md2-steps > li {
    position: relative;
    margin: 0 0 0.85rem;
    padding: 1rem 1rem 1rem 3.1rem;
    border-radius: var(--ex-radius);
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
}

.md2-steps > li::before {
    counter-increment: md2step;
    content: counter(md2step);
    position: absolute;
    left: 0.85rem;
    top: 1rem;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
    background: var(--ex-accent);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.md2-table-wrap {
    overflow-x: auto;
    margin: 0.75rem 0 1rem;
    border-radius: var(--ex-radius);
    border: 1px solid var(--ex-border);
    background: var(--ex-surface);
}

.md2-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.md2-table th,
.md2-table td {
    padding: 0.55rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--ex-border);
    vertical-align: top;
}

.md2-table th {
    background: var(--ex-surface-elevated);
    color: var(--ex-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.md2-table tr:last-child td {
    border-bottom: none;
}

.md2-table code {
    font-family: var(--ex-mono);
    font-size: 0.8rem;
    background: var(--ex-bg-alt);
    padding: 0.1rem 0.35rem;
    border-radius: 0.3rem;
}

.md2-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.4;
}

.md2-badge-get { background: #dbeafe; color: #1d4ed8; }
.md2-badge-post { background: #d1fae5; color: #047857; }
.md2-badge-put { background: #fef3c7; color: #b45309; }
.md2-badge-delete { background: #fee2e2; color: #b91c1c; }
.md2-badge-legacy { background: #f3e8ff; color: #7e22ce; }
.md2-badge-scope { background: var(--ex-info-bg); color: var(--ex-info-text); border: 1px solid var(--ex-info-border); text-transform: none; font-weight: 600; }
.md2-badge-idem { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; text-transform: none; }
.md2-badge-terminal { background: var(--ex-success-bg); color: #047857; border: 1px solid var(--ex-success-border); text-transform: none; }
.md2-badge-warn { background: var(--ex-danger-bg); color: var(--ex-danger-text); border: 1px solid var(--ex-danger-border); text-transform: none; }

.md2-endpoint {
    margin-bottom: 1.25rem;
    border-radius: var(--ex-radius-card);
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    box-shadow: var(--ex-shadow-sm);
    overflow: hidden;
}

.md2-endpoint[hidden] {
    display: none !important;
}

.md2-endpoint-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem 0.75rem;
    padding: 0.95rem 1.15rem;
    border-bottom: 1px solid var(--ex-border);
    background: linear-gradient(180deg, var(--ex-surface-elevated), var(--ex-surface));
}

.md2-endpoint-path {
    font-family: var(--ex-mono);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ex-text-primary);
}

.md2-endpoint-title {
    margin: 0;
    flex: 1 1 100%;
    font-size: 1.05rem;
    color: var(--ex-text-primary);
}

.md2-endpoint-body {
    padding: 1rem 1.15rem 1.2rem;
}

.md2-endpoint-plain {
    margin: 0 0 0.65rem;
    color: var(--ex-text);
    line-height: 1.55;
}

.md2-endpoint-when {
    margin: 0 0 0.85rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.5rem;
    background: var(--ex-info-bg);
    border: 1px solid var(--ex-info-border);
    font-size: 0.88rem;
    color: var(--ex-info-text);
}

.md2-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.9rem;
}

.md2-note {
    margin: 0.75rem 0 0;
    padding: 0.65rem 0.8rem;
    border-radius: 0.5rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    font-size: 0.88rem;
    color: #92400e;
}

.md2-note-danger {
    background: var(--ex-danger-bg);
    border-color: var(--ex-danger-border);
    color: var(--ex-danger-text);
}

.md2-tabs {
    display: flex;
    gap: 0.35rem;
    margin: 1rem 0 0.65rem;
    border-bottom: 1px solid var(--ex-border);
    padding-bottom: 0.35rem;
}

.md2-tab {
    appearance: none;
    border: none;
    background: transparent;
    padding: 0.4rem 0.75rem;
    border-radius: 0.45rem;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--ex-muted);
    cursor: pointer;
}

.md2-tab:hover {
    color: var(--ex-text-primary);
    background: var(--ex-surface-hover);
}

.md2-tab.is-active {
    color: var(--ex-accent-hover);
    background: var(--ex-accent-muted);
}

.md2-tabpanel[hidden] {
    display: none;
}

.md2-code {
    position: relative;
    margin: 0.5rem 0 0.85rem;
    border-radius: 0.65rem;
    background: #0f172a;
    color: #e2e8f0;
    overflow: hidden;
}

.md2-code-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.65rem;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.72rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.md2-copy {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    border-radius: 0.4rem;
    padding: 0.25rem 0.55rem;
    font: inherit;
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}

.md2-copy:hover {
    background: rgba(255, 255, 255, 0.12);
}

.md2-code pre {
    margin: 0;
    padding: 0.9rem 1rem;
    overflow-x: auto;
    font-family: var(--ex-mono);
    font-size: 0.8rem;
    line-height: 1.55;
}

.md2-code code {
    font-family: inherit;
}

.md2-tok-key { color: #7dd3fc; }
.md2-tok-str { color: #86efac; }
.md2-tok-num { color: #fcd34d; }
.md2-tok-bool { color: #f9a8d4; }
.md2-tok-null { color: #94a3b8; }
.md2-tok-comment { color: #7b8ba3; font-style: italic; }

.md2-lead-text {
    margin: 0 0 1.25rem;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--ex-text);
}

.md2-h4 {
    margin: 1.1rem 0 0.5rem;
    font-size: 0.92rem;
    font-weight: 650;
    color: var(--ex-text-primary);
}

.md2-flows {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.85rem;
    margin: 1.1rem 0;
}

.md2-flow {
    padding: 0.95rem 1.05rem;
    border-radius: var(--ex-radius);
    background: var(--ex-surface-elevated);
    border: 1px solid var(--ex-border);
}

.md2-flow-title {
    margin: 0 0 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ex-dim);
}

.md2-flow-list {
    margin: 0;
    padding-left: 1.15rem;
}

.md2-flow-list li {
    margin: 0.3rem 0;
    font-size: 0.85rem;
    color: var(--ex-muted);
}

.md2-flow-list code {
    font-family: var(--ex-mono);
    font-size: 0.8rem;
    color: var(--ex-text-primary);
}

.md2-rule {
    margin-bottom: 1rem;
    padding: 1rem 1.15rem;
    border-radius: var(--ex-radius-card);
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-left: 3px solid var(--ex-accent);
}

.md2-rule h3 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
    color: var(--ex-text-primary);
}

.md2-rule p {
    margin: 0;
    color: var(--ex-text);
    line-height: 1.55;
    font-size: 0.93rem;
}

.md2-rule .md2-code {
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.md2-sgroup {
    margin-bottom: 2rem;
    scroll-margin-top: 1.25rem;
}

.md2-scenario {
    margin-bottom: 1.5rem;
    border-radius: var(--ex-radius-card);
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    box-shadow: var(--ex-shadow-sm);
    overflow: hidden;
    scroll-margin-top: 1.25rem;
}

.md2-scenario-head {
    padding: 1rem 1.25rem;
    background: linear-gradient(180deg, var(--ex-accent-muted), var(--ex-surface));
    border-bottom: 1px solid var(--ex-border);
}

.md2-scenario-head h4 {
    margin: 0 0 0.3rem;
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--ex-text-primary);
    letter-spacing: -0.01em;
}

.md2-scenario-goal {
    margin: 0;
    font-size: 0.9rem;
    color: var(--ex-muted);
}

.md2-scenario-body {
    padding: 1.15rem 1.25rem 1.25rem;
}

.md2-scenario-context {
    margin: 0 0 1.25rem;
    padding: 0.7rem 0.9rem;
    border-radius: 0.5rem;
    background: var(--ex-surface-elevated);
    border: 1px solid var(--ex-border);
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--ex-text);
}

.md2-step {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0.85rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px dashed var(--ex-border);
}

.md2-step:last-of-type {
    border-bottom: none;
    margin-bottom: 0.25rem;
    padding-bottom: 0;
}

.md2-step-num {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--ex-accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.md2-step-main {
    min-width: 0;
}

.md2-step-main h5 {
    margin: 0.25rem 0 0.4rem;
    font-size: 1rem;
    font-weight: 650;
    color: var(--ex-text-primary);
}

.md2-step-why {
    margin: 0 0 0.65rem;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--ex-text);
}

.md2-breakdown {
    margin: 0.5rem 0 0.85rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.55rem;
    background: var(--ex-info-bg);
    border: 1px solid var(--ex-info-border);
}

.md2-breakdown-title {
    margin: 0 0 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ex-info-text);
}

.md2-breakdown dl {
    margin: 0;
}

.md2-breakdown-row {
    display: grid;
    grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
    gap: 0.5rem 0.85rem;
    padding: 0.3rem 0;
}

.md2-breakdown-row + .md2-breakdown-row {
    border-top: 1px solid rgba(59, 130, 246, 0.12);
}

.md2-breakdown dt {
    margin: 0;
}

.md2-breakdown dt code {
    font-family: var(--ex-mono);
    font-size: 0.78rem;
    color: var(--ex-text-primary);
    background: rgba(255, 255, 255, 0.6);
    padding: 0.1rem 0.35rem;
    border-radius: 0.3rem;
    word-break: break-word;
}

.md2-breakdown dd {
    margin: 0;
    font-size: 0.87rem;
    line-height: 1.5;
    color: var(--ex-text);
}

.md2-pitfalls {
    margin-top: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: var(--ex-radius);
    background: var(--ex-danger-bg);
    border: 1px solid var(--ex-danger-border);
}

.md2-pitfalls-title {
    margin: 0 0 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ex-danger-text);
}

.md2-pitfalls ul {
    margin: 0;
    padding-left: 1.15rem;
}

.md2-pitfalls li {
    margin: 0.3rem 0;
    font-size: 0.89rem;
    line-height: 1.5;
    color: var(--ex-text);
}

@media (max-width: 900px) {
    .md2-layout {
        grid-template-columns: 1fr;
    }

    .md2-step {
        grid-template-columns: 1.6rem minmax(0, 1fr);
        gap: 0.6rem;
    }

    .md2-step-num {
        width: 1.6rem;
        height: 1.6rem;
        font-size: 0.8rem;
    }

    .md2-breakdown-row {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }

    .md2-sidebar {
        position: relative;
        top: 0;
        max-height: none;
    }

    .md2-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .md2-nav > li {
        margin: 0;
    }

    .md2-nav-children {
        display: none;
    }
}
