/**
 * Gaya halaman /docs/aws-api.
 *
 * Dulu dua blok <style> di dalam resources/views/documents/aws-api.blade.php
 * (sekitar 2.700 baris), yang bikin view-nya susah dibaca. Isinya dipindah apa
 * adanya ke sini dengan urutan yang sama persis — bagian kedua tetap di bawah
 * karena memuat lapisan tema gelap yang harus menimpa aturan di atasnya.
 */

/* ============================ TATA LETAK & KOMPONEN ============================ */

:root {
    --grab-green: #00B14F;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --border-light: #e5e7eb;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
    background: var(--bg-page);
    font-size: 14px;
    overflow: hidden;
}

/* Top bar (glass style — matches tutorial page) */
.topbar {
    height: 60px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: #1f2937;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    z-index: 10;
    position: relative;
}

.topbar .brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: -0.2px;
    color: #1f2937;
    text-decoration: none;
}

.topbar .brand .logo-dot {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #00B14F, #008b3d);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 2px 6px rgba(0, 177, 79, 0.35);
}

.topbar .brand small {
    opacity: 0.7;
    font-weight: 500;
    margin-left: 4px;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Kotak cari di kepala halaman: pil, sebentuk dengan sakelar tema dan
   roda bahasa di sebelahnya, dan ikut token --gm-* jadi otomatis benar
   di tema terang maupun gelap. */
.head-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--gm-surface);
    border: 1px solid var(--gm-line);
    transition: border-color 0.18s, box-shadow 0.18s;
}
.head-search:focus-within {
    border-color: var(--gm-green);
    box-shadow: 0 0 0 3px rgba(0, 177, 79, 0.16);
}
.head-search > i { color: var(--gm-muted); font-size: 0.85rem; }
.head-search input {
    width: 220px;
    border: 0;
    background: transparent;
    outline: none;
    color: var(--gm-ink);
    font-size: 0.82rem;
    font-weight: 500;
}
.head-search input::placeholder { color: var(--gm-muted); }

@media (max-width: 1180px) {
    .head-search input { width: 140px; }
}

/* Language toggle (glass) */
.lang-toggle {
    display: flex;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    padding: 2px;
    gap: 2px;
}

.lang-toggle button {
    background: transparent;
    border: 0;
    color: #6b7280;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 5px 10px;
    cursor: pointer;
    letter-spacing: 0.5px;
    border-radius: 6px;
    transition: all 0.12s;
}

.lang-toggle button:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #1f2937;
}

.lang-toggle button.active {
    background: #ffffff;
    color: #00B14F;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* === API Key Inspector — topbar button (glass ver.) === */
.key-inspector-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #00B14F;
    color: #ffffff;
    border: 1.5px solid #00B14F;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
    box-shadow: 0 2px 6px rgba(0, 177, 79, 0.25);
    white-space: nowrap;
}

.key-inspector-btn i {
    font-size: 0.95rem;
    color: #ffffff;
}

.key-inspector-btn:hover {
    transform: translateY(-1px);
    background: #008b3d;
    border-color: #008b3d;
    box-shadow: 0 4px 12px rgba(0, 177, 79, 0.35);
}

.key-inspector-btn.has-key {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.2);
}

.key-inspector-btn.has-key:hover {
    background: #fde68a;
    border-color: #fbbf24;
}

.key-inspector-btn.has-key i {
    color: #d97706;
}

.key-inspector-btn .key-pill {
    background: #ef4444;
    color: #fff;
    font-size: 0.66rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    margin-left: 2px;
    line-height: 1.2;
}

.key-inspector-btn .key-pill.ok {
    background: #16a34a;
}

.key-inspector-btn .key-pill.warn {
    background: #f59e0b;
}

/* === API Key Inspector — modal === */
.key-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    /* Ditengahkan seperti modal-dialog-centered milik tester. margin:auto
       dipakai supaya kartu yang lebih tinggi dari layar tetap bisa
       digulir, bukan terpotong di atas. */
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    overflow-y: auto;
}
.key-modal .key-modal-card { margin: auto; }

.key-modal-card {
    background: #fff;
    border-radius: 14px;
    max-width: 680px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.key-modal-header {
    padding: 14px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #00B14F, #008b3d);
    color: #fff;
}

.key-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.key-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.key-modal-body {
    padding: 18px 20px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Menyatu dengan badan modal — di tester tombol Continue memang duduk
   di dalam badan, bukan di pita abu terpisah. */
.key-modal-footer {
    padding: 4px 20px 20px;
    border-top: 0;
    display: flex;
    gap: 8px;
    background: transparent;
}

.key-btn-primary,
.key-btn-secondary {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
}

.key-btn-primary {
    background: #00B14F;
    color: #fff;
}

.key-btn-primary:hover {
    background: #008b3d;
}

.key-btn-secondary {
    background: #fff;
    color: #6b7280;
    border-color: #d1d5db;
}

.key-btn-secondary:hover {
    background: #f3f4f6;
    color: #dc2626;
    border-color: #fca5a5;
}

.key-form-row {
    margin-bottom: 14px;
}

.key-form-row label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.key-form-row input[type="text"],
.key-form-row input[type="datetime-local"],
.key-form-row select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    font-size: 0.85rem;
    background: #fff;
}

.key-form-row input:focus,
.key-form-row select:focus {
    outline: none;
    border-color: #00B14F;
    box-shadow: 0 0 0 3px rgba(0, 177, 79, 0.1);
}

.key-checkbox-row {
    display: flex !important;
    align-items: flex-start;
    gap: 8px;
    font-weight: 500 !important;
    color: #4b5563 !important;
    font-size: 0.74rem !important;
}

.key-actions-group {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.key-actions-group strong {
    font-size: 0.8rem;
    color: #1f2937;
    display: block;
    margin-bottom: 6px;
}

.key-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 4px;
}

.key-actions-grid label {
    font-size: 0.74rem;
    font-weight: 500;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    margin: 0;
    padding: 2px 4px;
    border-radius: 4px;
}

.key-actions-grid label:hover {
    background: #fff;
}

.key-actions-grid input {
    margin: 0;
}

/* Visual badge when response came from direct AWS call */
.resp-body.direct-mode {
    border-left: 3px solid #f59e0b;
}

.resp-body.direct-mode::before {
    content: '🔑 Direct AWS call (your key)';
    display: block;
    background: #fef3c7;
    color: #92400e;
    padding: 6px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    margin: -12px -12px 8px;
    border-radius: 6px 6px 0 0;
}

/* === Sidebar op-link permission indicators === */
.op-link.key-allowed::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    margin-left: 6px;
    vertical-align: middle;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.op-link.key-denied {
    opacity: 0.55;
}

.op-link.key-denied::after {
    content: '⛔';
    display: inline-block;
    font-size: 0.65rem;
    margin-left: 6px;
    vertical-align: middle;
}

/* Layout */
.layout {
    display: flex;
    /* --head-h dikirim skrip komponen; 76px hanya cadangan sebelum skrip jalan. */
    height: calc(100vh - var(--head-h, 76px));
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
    padding: 16px 0;
    flex-shrink: 0;
}

/* Sidebar search */
.sidebar-search-wrap {
    position: relative;
    margin: 0 12px 12px;
}

.sidebar-search-wrap input {
    width: 100%;
    padding: 8px 32px 8px 32px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.82rem;
    background: #f9fafb;
    color: var(--text-primary);
    transition: all 0.15s;
}

.sidebar-search-wrap input:focus {
    outline: none;
    background: #fff;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.sidebar-search-wrap>i.bi-search {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.85rem;
    pointer-events: none;
}

.sidebar-search-wrap>button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}

.sidebar-search-wrap>button:hover {
    color: #dc2626;
    background: #fef2f2;
}

/* Highlight matched query in op-link */
.op-link .match-hl {
    background: rgba(16, 185, 129, 0.18);
    color: #047857;
    font-weight: 700;
    padding: 0 2px;
    border-radius: 3px;
}

.sidebar .service-group {
    margin-bottom: 4px;
}

.sidebar .service-header {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 8px 18px;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.86rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: background 0.12s;
}

.sidebar .service-header:hover {
    background: #f1f5f9;
}

.sidebar .service-header .caret {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.15s;
}

.sidebar .service-group.collapsed .caret {
    transform: rotate(-90deg);
}

.sidebar .service-group.collapsed .operations {
    display: none;
}

.sidebar .operations {
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
}

.sidebar .op-link {
    display: block;
    padding: 6px 18px 6px 36px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.82rem;
    border-left: 2px solid transparent;
    cursor: pointer;
    transition: all 0.12s;
}

.sidebar .op-link:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.sidebar .op-link.active {
    color: var(--grab-green);
    background: #ecfdf5;
    border-left-color: var(--grab-green);
    font-weight: 600;
}

.sidebar .op-link .badge-v0 {
    display: inline-block;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    letter-spacing: 0.5px;
}

.sidebar .op-link .badge-new {
    display: inline-block;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    letter-spacing: 0.5px;
}

.sidebar .op-link .badge-soon {
    display: inline-block;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Availability dot — depan op name */
.sidebar .op-link .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    flex-shrink: 0;
}

.sidebar .op-link .dot.ok {
    background: #10b981;
    box-shadow: 0 0 0 2px #d1fae5;
}

.sidebar .op-link .dot.no {
    background: #cbd5e1;
}

.sidebar .op-link.unavail {
    color: #94a3b8;
}

.sidebar .op-link.unavail:hover {
    color: #64748b;
}

/* Legend bawah sidebar */
.sidebar .legend {
    margin-top: 16px;
    padding: 12px 18px;
    border-top: 1px solid var(--border-light);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.sidebar .legend .row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.sidebar .legend .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.sidebar .legend .dot.ok {
    background: #10b981;
    box-shadow: 0 0 0 2px #d1fae5;
}

.sidebar .legend .dot.no {
    background: #cbd5e1;
}

/* Main content */
.main {
    flex: 1;
    overflow-y: auto;
    padding: 28px 36px 80px;
}

.op-panel {
    display: none;
    max-width: 960px;
}

.op-panel.active {
    display: block;
}

.op-panel .breadcrumb-mini {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.op-panel h1 {
    font-weight: 800;
    font-size: 1.7rem;
    margin: 0 0 6px;
    letter-spacing: -0.5px;
}

.op-panel .op-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 22px;
    line-height: 1.55;
}

.op-panel h3 {
    font-weight: 700;
    font-size: 1rem;
    margin: 24px 0 10px;
    color: var(--text-primary);
}

.op-panel h4 {
    font-weight: 600;
    font-size: 0.86rem;
    margin: 16px 0 6px;
    color: var(--text-secondary);
}

/* Endpoint pill */
.endpoint-line {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', 'Menlo', monospace;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.endpoint-line .method {
    background: #f59e0b;
    color: #1e293b;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.72rem;
    flex-shrink: 0;
}

.endpoint-line .method.GET {
    background: #10b981;
    color: #fff;
}

.endpoint-line .method.POST {
    background: #3b82f6;
    color: #fff;
}

.endpoint-line .method.PUT {
    background: #f59e0b;
    color: #fff;
}

.endpoint-line .method.DELETE {
    background: #ef4444;
    color: #fff;
}

code {
    background: #f1f5f9;
    color: #d23a3a;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: 'JetBrains Mono', 'Menlo', monospace;
}

pre {
    background: #1e293b !important;
    color: #f1f5f9;
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.55;
    overflow-x: auto;
    margin: 0 0 14px;
}

pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

/* v0 / v2 tabs */
.ver-tabs {
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 14px;
    display: flex;
    gap: 4px;
}

.ver-tabs button {
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 8px 16px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.86rem;
    cursor: pointer;
    transition: all 0.12s;
}

.ver-tabs button:hover {
    color: var(--text-primary);
    background: #f8fafc;
}

.ver-tabs button.active[data-version="v2"] {
    color: var(--grab-green);
    border-bottom-color: var(--grab-green);
}

.ver-tabs button.active[data-version="v0"] {
    color: #ef4444;
    border-bottom-color: #ef4444;
}

.ver-content>div {
    display: none;
}

.ver-content>div.active {
    display: block;
}

/* Info boxes */
.alert-mini {
    font-size: 0.84rem;
    padding: 10px 14px;
    border-radius: 6px;
    margin: 12px 0;
}

.alert-mini.warn {
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
}

.alert-mini.info {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
}

.alert-mini.success {
    background: #ecfdf5;
    border-left: 3px solid #10b981;
}

.alert-mini.danger {
    background: #fef2f2;
    border-left: 3px solid #ef4444;
}

.alert-mini.soon {
    background: linear-gradient(90deg, #fff7ed 0%, #fffbeb 100%);
    border-left: 3px solid #f59e0b;
    color: #78350f;
}

.alert-mini.soon .soon-pill {
    display: inline-block;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

/* Section heading dengan icon */
.doc-section-h {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 28px 0 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border-light);
}

.doc-section-h .ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #f0fdf4;
    color: var(--grab-green);
    font-size: 0.86rem;
}

.doc-section-h .ic.purple {
    background: #faf5ff;
    color: #9333ea;
}

.doc-section-h .ic.blue {
    background: #eff6ff;
    color: #3b82f6;
}

.doc-section-h .ic.orange {
    background: #fff7ed;
    color: #f59e0b;
}

.doc-section-h .ic.amber {
    /* Kartu tier latarnya #fffbeb, jadi kotak ikonnya dibuat setingkat
       lebih pekat supaya tidak lebur dengan kartunya. */
    background: #fde68a;
    color: #92400e;
}

/* Live demo form */
.demo-form {
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 16px;
}

.demo-form .row-form {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.demo-form label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.demo-form label .req {
    color: #ef4444;
    margin-left: 3px;
}

.demo-form input,
.demo-form select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.84rem;
    font-family: inherit;
    background: #fff;
}

.demo-form .row-form-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.demo-form .btn-run {
    background: linear-gradient(90deg, #00B14F, #00d65a);
    color: #fff;
    border: 0;
    padding: 8px 22px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.86rem;
    cursor: pointer;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.12s;
}

.demo-form .btn-run:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 177, 79, 0.3);
}

.demo-form .btn-run:disabled {
    opacity: 0.6;
    cursor: wait;
}

.demo-output {
    background: #1e293b;
    color: #f1f5f9;
    padding: 14px 16px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.55;
    max-height: 420px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.demo-output.empty {
    color: #64748b;
    font-style: italic;
    padding: 40px;
    text-align: center;
}

.demo-output.error {
    background: #450a0a;
    color: #fecaca;
}

.demo-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: 6px;
}

.demo-status.ok {
    background: #dcfce7;
    color: #166534;
}

.demo-status.bad {
    background: #fee2e2;
    color: #991b1b;
}

/* Try It Live — Postman-style 2-column layout */
.try-it {
    border: 1px solid var(--border-light);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    margin-bottom: 16px;
}

.try-it-grid {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(300px, 1.3fr);
}

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

.try-it-pane {
    padding: 16px 18px;
}

.try-it-pane.left {
    background: #f8fafc;
    border-right: 1px solid var(--border-light);
}

.try-it-pane.right {
    background: #1e293b;
}

@media (max-width: 900px) {
    .try-it-pane.left {
        border-right: 0;
        border-bottom: 1px solid var(--border-light);
    }
}

.try-it-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 12px;
}

.try-it-pane.left .try-it-pane-header {
    color: var(--text-muted);
}

.try-it-pane.right .try-it-pane-header {
    color: #94a3b8;
}

.try-it-pane.right .try-it-method {
    display: inline-block;
    background: #3b82f6;
    color: #fff;
    padding: 1px 7px;
    border-radius: 3px;
    font-size: 0.65rem;
    margin-right: 6px;
}

.try-it-pane.right .try-it-url {
    color: #cbd5e1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.74rem;
    margin-bottom: 10px;
    word-break: break-all;
}

.try-it-body {
    background: #0f172a;
    color: #f1f5f9;
    padding: 12px 14px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.55;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
}

.try-it form .field {
    margin-bottom: 12px;
}

.try-it form label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.try-it form label .req {
    color: #ef4444;
    margin-left: 3px;
}

.try-it form input,
.try-it form select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.86rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.12s;
}

.try-it form input:focus,
.try-it form select:focus {
    outline: 0;
    border-color: var(--grab-green);
    box-shadow: 0 0 0 3px rgba(0, 177, 79, 0.12);
}

.try-it form .two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.try-it .send-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.try-it .btn-send {
    background: linear-gradient(90deg, #00B14F, #00d65a);
    color: #fff;
    border: 0;
    padding: 9px 22px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.86rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.12s;
}

.try-it .btn-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 177, 79, 0.3);
}

.try-it .btn-send:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

.try-it .btn-copy {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.12s;
}

.try-it .btn-copy:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Response section */
.resp-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: 8px 8px 0 0;
    border-bottom: 0;
    font-size: 0.78rem;
}

.resp-bar .status-pill {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.74rem;
}

.resp-bar .status-pill.ok {
    background: #dcfce7;
    color: #15803d;
}

.resp-bar .status-pill.bad {
    background: #fee2e2;
    color: #b91c1c;
}

.resp-bar .status-pill.idle {
    background: #e2e8f0;
    color: #64748b;
}

.resp-bar .meta {
    color: var(--text-muted);
    font-size: 0.74rem;
}

.resp-bar .meta b {
    color: var(--text-primary);
    font-weight: 700;
}

.resp-body {
    background: #1e293b;
    color: #f1f5f9;
    padding: 14px 16px;
    border-radius: 0 0 8px 8px;
    border: 1px solid var(--border-light);
    border-top: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.55;
    max-height: 460px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 16px;
}

.resp-body.empty {
    color: #64748b;
    font-style: italic;
    padding: 36px;
    text-align: center;
    background: #1e293b;
}

.resp-body.error {
    background: #450a0a;
    color: #fecaca;
}

/* Preset buttons row */
.preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: #f1f5f9;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.preset-row .preset-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    margin-right: 4px;
}

.preset-btn {
    background: #fff;
    border: 1px solid #cbd5e1;
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.preset-btn:hover {
    background: var(--grab-green);
    color: #fff;
    border-color: var(--grab-green);
}

.preset-btn .pico {
    font-size: 0.72rem;
    opacity: 0.7;
}

/* Editable JSON textarea */
.json-editor {
    width: 100%;
    min-height: 320px;
    background: #0f172a;
    color: #f1f5f9;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 12px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.55;
    resize: vertical;
    outline: none;
    tab-size: 2;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}

.json-editor:focus {
    border-color: var(--grab-green);
    box-shadow: 0 0 0 2px rgba(0, 177, 79, 0.2);
}

.json-editor.invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.json-status {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 3px;
    margin-left: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.json-status.ok {
    background: #16a34a;
    color: #fff;
}

.json-status.invalid {
    background: #dc2626;
    color: #fff;
}

/* Field rules card */
.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.rule-card {
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 14px 16px;
    background: #fff;
}

.rule-card .rule-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.rule-card .rule-header .ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    font-size: 0.78rem;
}

.rule-card.required {
    border-color: #fde68a;
    background: #fffbeb;
}

.rule-card.required .ic {
    background: #fef3c7;
    color: #d97706;
}

.rule-card.exclusive {
    border-color: #fecaca;
    background: #fef2f2;
}

.rule-card.exclusive .ic {
    background: #fee2e2;
    color: #dc2626;
}

.rule-card.combo {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.rule-card.combo .ic {
    background: #dcfce7;
    color: #15803d;
}

.rule-card .field-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.rule-card .field-list code {
    background: #fff;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 0.74rem;
    padding: 3px 8px;
    border-radius: 4px;
}

.rule-card .field-list .sep {
    color: #94a3b8;
    font-weight: 700;
    padding: 3px 0;
    font-size: 0.74rem;
}

.rule-card .rule-note {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.5;
}

.rule-card .rule-note code {
    font-size: 0.72rem;
    background: rgba(0, 0, 0, 0.05);
}

/* Error table */
.error-table {
    width: 100%;
    font-size: 0.82rem;
    border-collapse: collapse;
    margin-bottom: 14px;
}

.error-table th {
    text-align: left;
    background: #fef2f2;
    color: #991b1b;
    padding: 8px 12px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #fecaca;
}

.error-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #fee2e2;
    vertical-align: top;
}

.error-table .err-code {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    background: #fee2e2;
    color: #991b1b;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
}

/* Param table */
.param-table {
    width: 100%;
    font-size: 0.84rem;
    border-collapse: collapse;
    margin-bottom: 14px;
}

.param-table th {
    text-align: left;
    background: #f8fafc;
    padding: 8px 12px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
}

.param-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}

.param-table .req {
    color: #ef4444;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 4px;
}

.param-table .type-tag {
    display: inline-block;
    font-size: 0.7rem;
    background: #f1f5f9;
    color: #64748b;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
}

/* Welcome panel */
.welcome-panel {
    text-align: center;
    padding: 60px 40px;
}

.welcome-panel .icon {
    font-size: 3rem;
    color: var(--grab-green);
    margin-bottom: 12px;
}

.welcome-panel h2 {
    font-weight: 800;
    margin-bottom: 6px;
}

.welcome-panel p {
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto 16px;
}

/* Sidebar scroll */
.sidebar::-webkit-scrollbar,
.main::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-thumb,
.main::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* === No-key banner (sticky notice when user hasn't set API key) === */
.no-key-banner {
    position: sticky;
    top: var(--head-h, 76px);
    z-index: 9;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-bottom: 1px solid #f59e0b;
    padding: 10px 24px;
    display: none;
    align-items: center;
    gap: 12px;
    font-size: 0.82rem;
    color: #78350f;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
    animation: slideDownBanner 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.no-key-banner.visible {
    display: flex;
}

.no-key-banner .nkb-icon {
    font-size: 1.1rem;
    animation: gentleShake 3s ease-in-out infinite;
}

.no-key-banner .nkb-text {
    flex: 1;
}

.no-key-banner .nkb-text b {
    color: #92400e;
}

.no-key-banner .nkb-btn {
    background: #d97706;
    color: #fff;
    border: none;
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.35);
    white-space: nowrap;
}

.no-key-banner .nkb-btn:hover {
    background: #b45309;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(217, 119, 6, 0.5);
}

@keyframes slideDownBanner {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes gentleShake {

    0%,
    100% {
        transform: rotate(0deg);
    }

    10% {
        transform: rotate(-8deg);
    }

    20% {
        transform: rotate(8deg);
    }

    30% {
        transform: rotate(-6deg);
    }

    40% {
        transform: rotate(6deg);
    }

    50% {
        transform: rotate(0deg);
    }
}

/* Pulse-alert for My Key button */
.key-inspector-btn.pulse-alert {
    animation: pulseAlert 0.6s cubic-bezier(0.4, 0, 0.2, 1) 3;
}

@keyframes pulseAlert {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
        box-shadow: 0 8px 24px rgba(239, 68, 68, 0.5), 0 0 0 6px rgba(239, 68, 68, 0.15);
    }
}

/* No-key state on My Key button (needs-key) */
.key-inspector-btn.needs-key {
    background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
    color: #78350f !important;
    border-color: #f59e0b !important;
    animation: subtleBreathe 2.5s ease-in-out infinite;
}

.key-inspector-btn.needs-key i {
    color: #d97706 !important;
}

@keyframes subtleBreathe {

    0%,
    100% {
        box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    }

    50% {
        box-shadow: 0 4px 16px rgba(245, 158, 11, 0.5);
    }
}

/* Direct-mode indicator on response */
.resp-body.direct-mode::before {
    content: '🔑 Direct call — your API Key';
    display: inline-block;
    background: #dcfce7;
    color: #166534;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
    margin-bottom: 8px;
}

/* Mobile: hide button label on banner */
@media (max-width: 640px) {
    .no-key-banner {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .no-key-banner .nkb-btn {
        padding: 6px 10px;
        font-size: 0.72rem;
    }

    .no-key-banner .nkb-text b {
        display: block;
    }
}

/* ===================== LAPISAN KEDUA: KARTU TIER, BUILDER, TEMA GELAP ===================== */

                    @keyframes spin {
                        from {
                            transform: rotate(0)
                        }

                        to {
                            transform: rotate(360deg)
                        }
                    }

                    /* Tombol API Key versi ikon: pil masa berlaku menempel di bawah tombol,
   bukan mendorong lebarnya seperti waktu tombolnya masih berlabel. */
                    .head-btn.is-icon .key-pill {
                        position: absolute;
                        top: calc(100% + 6px);
                        right: 0;
                        white-space: nowrap;
                    }

                    .visually-hidden {
                        position: absolute !important;
                        width: 1px;
                        height: 1px;
                        padding: 0;
                        margin: -1px;
                        overflow: hidden;
                        clip: rect(0, 0, 0, 0);
                        white-space: nowrap;
                        border: 0;
                    }

                    /* === Modal API Key — sebentuk dengan gerbang key di /tester-api === */
                    .key-modal-header {
                        background: linear-gradient(135deg, #00B14F 0%, #009543 100%);
                        color: #fff;
                        border: none;
                        padding: 20px 22px;
                        display: flex;
                        align-items: flex-start;
                        justify-content: space-between;
                        gap: 12px;
                    }

                    .key-modal-header strong {
                        display: block;
                        font-size: 1.02rem;
                        font-weight: 700;
                    }

                    .key-modal-header small {
                        display: block;
                        opacity: 0.85;
                        font-size: 0.75rem;
                        margin-top: 2px;
                    }

                    .key-modal-header .key-modal-close {
                        color: #fff;
                        opacity: 0.9;
                    }

                    .key-note {
                        display: flex;
                        gap: 10px;
                        align-items: flex-start;
                        padding: 12px 14px;
                        border-radius: 10px;
                        background: #f5f3ff;
                        border: 1px solid #ddd6fe;
                        font-size: 0.78rem;
                        line-height: 1.5;
                        color: #4b5563;
                        margin-bottom: 16px;
                    }

                    .key-note i {
                        color: #00B14F;
                        font-size: 1rem;
                        margin-top: 1px;
                    }

                    .key-input-wrap {
                        position: relative;
                        display: flex;
                        align-items: center;
                    }

                    .key-input-wrap .key-input-icon {
                        position: absolute;
                        left: 1px;
                        width: 40px;
                        height: calc(100% - 2px);
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        color: #00B14F;
                        background: #f3f4f6;
                        border-radius: 9px 0 0 9px;
                        pointer-events: none;
                    }

                    .key-input-wrap input {
                        width: 100%;
                        padding-left: 50px !important;
                        padding-right: 42px !important;
                        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
                        font-size: 0.78rem;
                    }

                    .key-peek {
                        position: absolute;
                        right: 6px;
                        width: 30px;
                        height: 30px;
                        border: 0;
                        background: transparent;
                        border-radius: 8px;
                        color: #6b7280;
                        cursor: pointer;
                    }

                    .key-peek:hover {
                        background: #f3f4f6;
                        color: #1f2937;
                    }

                    .key-help-link {
                        display: inline-flex;
                        align-items: center;
                        margin-top: 8px;
                        font-size: 0.74rem;
                        font-weight: 600;
                        color: #00B14F;
                        text-decoration: none;
                    }

                    .key-help-link:hover {
                        text-decoration: underline;
                    }


                    /* Penanda versi: v2 yang disarankan, v0 yang ditinggalkan. */
                    .ver-tag {
                        display: inline-block;
                        margin-left: 6px;
                        padding: 2px 7px;
                        border-radius: 999px;
                        font-size: 0.62rem;
                        font-weight: 800;
                        letter-spacing: 0.03em;
                        text-transform: uppercase;
                        vertical-align: middle;
                    }

                    .ver-tag.ver-rec {
                        background: #dcfce7;
                        color: #166534;
                    }

                    .ver-tag.ver-legacy {
                        background: #f3f4f6;
                        color: #6b7280;
                    }

                    th.cmp-rec {
                        background: #f0fdf4;
                    }

                    /* === Kartu tier harga di tiap operasi === */
                    .tier-card {
                        margin: 18px 0 22px;
                        border: 1px solid #fde68a;
                        background: #fffbeb;
                        border-radius: 12px;
                        padding: 14px 16px 12px;
                    }

                    .tier-card .doc-section-h {
                        margin-top: 0;
                    }

                    .tier-table {
                        width: 100%;
                        border-collapse: collapse;
                        font-size: 0.8rem;
                    }

                    .tier-table th {
                        text-align: left;
                        font-size: 0.68rem;
                        text-transform: uppercase;
                        letter-spacing: 0.05em;
                        color: #92400e;
                        padding: 4px 8px;
                        border-bottom: 1px solid #fde68a;
                    }

                    .tier-table td {
                        padding: 8px;
                        border-bottom: 1px solid #fef3c7;
                        vertical-align: top;
                        line-height: 1.5;
                    }

                    .tier-table tr:last-child td {
                        border-bottom: 0;
                    }

                    .tier-table code {
                        font-size: 0.74rem;
                    }

                    .tier-note {
                        margin: 8px 0 0;
                        font-size: 0.74rem;
                        color: #92400e;
                        line-height: 1.5;
                    }

                    .tier-pill {
                        display: inline-block;
                        padding: 2px 9px;
                        border-radius: 999px;
                        font-size: 0.68rem;
                        font-weight: 800;
                        white-space: nowrap;
                    }

                    .tier-pill.tier-label {
                        background: #f3f4f6;
                        color: #4b5563;
                    }

                    .tier-pill.tier-core {
                        background: #dbeafe;
                        color: #1e40af;
                    }

                    .tier-pill.tier-advanced {
                        background: #ede9fe;
                        color: #5b21b6;
                    }

                    .tier-pill.tier-stored {
                        background: #fef3c7;
                        color: #92400e;
                    }

                    .tier-pill.tier-premium {
                        background: #fce7f3;
                        color: #9d174d;
                    }

                    /* Penanda tier di dalam blok Request Syntax. Baris yang menentukan harga
                       ditulis sebagai komentar "// tier: X"; Prism menandainya sebagai token
                       comment lalu skrip di akhir halaman menukarnya jadi pil. Kalau Prism
                       gagal dimuat, komentarnya tetap terbaca apa adanya. */
                    .syn-tier {
                        font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
                        opacity: 1;
                    }

                    .syn-tier .tier-pill {
                        padding: 1px 8px;
                        font-size: 0.62rem;
                        letter-spacing: 0.02em;
                    }

                    .tier-pill + .tier-pill {
                        margin-left: 4px;
                    }

                    .syn-legend {
                        display: flex;
                        gap: 8px;
                        align-items: flex-start;
                        margin: -4px 0 18px;
                        font-size: 0.74rem;
                        line-height: 1.6;
                        color: #6b7280;
                    }

                    .syn-legend i {
                        color: #9ca3af;
                        line-height: 1.5;
                    }

                    .syn-legend code {
                        font-size: 0.7rem;
                    }

                    /* ================= TEMA GELAP =================
   Halaman ini memakai 322 warna terang yang dipatok langsung di tiap
   aturan, jadi mode gelapnya dipasang sebagai lapisan penimpa di akhir
   berkas — pola yang sama dengan /tester-api. Warna merek dan blok kode
   yang memang sudah gelap tidak diutak-atik. */
                    :root {
                        --d-page: #f8fafc;
                        --d-card: #ffffff;
                        --d-surface: #f3f4f6;
                        --d-line: #e5e7eb;
                        --d-ink: #1f2937;
                        --d-muted: #6b7280;
                        --d-faint: #9ca3af;
                    }

                    :root[data-theme="dark"] {
                        color-scheme: dark;
                        --d-page: #0e1210;
                        --d-card: #191e1b;
                        --d-surface: #232926;
                        --d-line: #2b322e;
                        --d-ink: #eaf0ec;
                        --d-muted: #9aa5a0;
                        --d-faint: #6b7671;

                        /* Kepala halaman bersama ikut token halaman ini. */
                        --gm-card: #191e1b;
                        --gm-page: #0e1210;
                        --gm-surface: #232926;
                        --gm-line: #2b322e;
                        --gm-ink: #eaf0ec;
                        --gm-muted: #9aa5a0;
                        --gm-glass: rgba(25, 30, 27, 0.94);

                        /* Token bawaan halaman. Sebagian elemen memakainya langsung di atribut
                           style — label "Response" di bilah Try It salah satunya — sehingga
                           warnanya cuma bisa dibalik dari sini, bukan dari aturan kelas. */
                        --text-primary: #eaf0ec;
                        --text-secondary: #b6c0ba;
                        --text-muted: #9aa5a0;
                        --bg-page: #0e1210;
                        --bg-sidebar: #191e1b;
                        --bg-surface: #191e1b;
                        --border-light: #2b322e;
                    }

                    [data-theme="dark"] body {
                        background: var(--d-page);
                        color: var(--d-ink);
                    }

                    [data-theme="dark"] .sidebar,
                    [data-theme="dark"] .op-panel,
                    [data-theme="dark"] .try-it,
                    [data-theme="dark"] .try-it-pane,
                    [data-theme="dark"] .rule-card,
                    [data-theme="dark"] .demo-form,
                    [data-theme="dark"] .key-modal-card,
                    [data-theme="dark"] .welcome-panel {
                        background: var(--d-card);
                        border-color: var(--d-line);
                        color: var(--d-ink);
                    }

                    [data-theme="dark"] .content,
                    [data-theme="dark"] .layout {
                        background: var(--d-page);
                    }

                    [data-theme="dark"] .sidebar .service-header {
                        color: var(--d-ink);
                    }

                    [data-theme="dark"] .sidebar .op-link {
                        color: var(--d-muted);
                    }

                    [data-theme="dark"] .sidebar .op-link:hover {
                        background: var(--d-surface);
                        color: var(--d-ink);
                    }

                    [data-theme="dark"] .sidebar .op-link.active {
                        background: rgba(0, 177, 79, 0.16);
                        color: #45d67f;
                    }

                    [data-theme="dark"] .sidebar-search-wrap {
                        background: var(--d-card);
                        border-color: var(--d-line);
                    }

                    [data-theme="dark"] .breadcrumb-mini,
                    [data-theme="dark"] .op-desc,
                    [data-theme="dark"] .text-muted {
                        color: var(--d-muted) !important;
                    }

                    [data-theme="dark"] h1,
                    [data-theme="dark"] h2,
                    [data-theme="dark"] h3,
                    [data-theme="dark"] h4 {
                        color: var(--d-ink);
                    }

                    [data-theme="dark"] .endpoint-line,
                    [data-theme="dark"] .resp-bar,
                    [data-theme="dark"] .resp-body,
                    [data-theme="dark"] .alert-mini,
                    [data-theme="dark"] .key-form-row input,
                    [data-theme="dark"] .key-actions-group {
                        background: var(--d-surface);
                        border-color: var(--d-line);
                        color: var(--d-ink);
                    }

                    /* Pil status hasil Try It: latar terang aslinya menyala di bilah gelap,
                       jadi diganti tint tembus pandang seperti pil tier. */
                    [data-theme="dark"] .resp-bar .status-pill.ok {
                        background: rgba(34, 197, 94, 0.18);
                        color: #86efac;
                    }

                    [data-theme="dark"] .resp-bar .status-pill.bad {
                        background: rgba(239, 68, 68, 0.18);
                        color: #fca5a5;
                    }

                    [data-theme="dark"] .resp-bar .status-pill.idle {
                        background: rgba(148, 163, 184, 0.16);
                        color: var(--d-muted);
                    }

                    /* Chip nama field di kartu Field Rules: latarnya dipatok putih, sementara
                       warna teksnya ikut token halaman — begitu token dibalik untuk tema gelap,
                       tulisannya jadi terang di atas putih dan hilang. */
                    /* Chip tipe di tabel parameter tetap putih di tema gelap — menyilaukan dan
                       tidak sejalan dengan chip nama field di sebelahnya yang sudah gelap. */
                    /* Kotak ikon di kepala tiap bagian. Tint pastelnya dibuat untuk latar putih;
                       di tema gelap ia jadi kotak putih yang menyilaukan, jadi diganti tint
                       tembus pandang dengan warna ikon yang lebih terang — pola yang sama
                       dengan pil tier dan pil status. */
                    [data-theme="dark"] .doc-section-h .ic {
                        background: rgba(0, 177, 79, 0.16);
                        color: #6ee7a8;
                    }

                    [data-theme="dark"] .doc-section-h .ic.blue {
                        background: rgba(59, 130, 246, 0.18);
                        color: #93c5fd;
                    }

                    [data-theme="dark"] .doc-section-h .ic.purple {
                        background: rgba(147, 51, 234, 0.20);
                        color: #d8b4fe;
                    }

                    [data-theme="dark"] .doc-section-h .ic.orange,
                    [data-theme="dark"] .doc-section-h .ic.amber {
                        background: rgba(245, 158, 11, 0.18);
                        color: #fbbf24;
                    }

                    /* Ikon di kartu Field Rules ikut aturan yang sama. */
                    [data-theme="dark"] .rule-card.required .ic {
                        background: rgba(245, 158, 11, 0.18);
                        color: #fbbf24;
                    }

                    [data-theme="dark"] .rule-card.exclusive .ic {
                        background: rgba(239, 68, 68, 0.18);
                        color: #fca5a5;
                    }

                    [data-theme="dark"] .rule-card.combo .ic {
                        background: rgba(34, 197, 94, 0.18);
                        color: #86efac;
                    }

                    /* Ikon peringatan warnanya dipatok di atribut style. */
                    [data-theme="dark"] .doc-section-h .ic[style*="background:#fef2f2"] {
                        background: rgba(239, 68, 68, 0.18) !important;
                        color: #fca5a5 !important;
                    }

                    [data-theme="dark"] .param-table .type-tag {
                        background: var(--d-surface);
                        color: var(--d-muted);
                    }

                    /* Tombol salin yang latarnya dipatok di atribut style. Warna teksnya sempat
                       ikut token gelap sementara latarnya tetap abu terang, jadi nyaris tak
                       terbaca; keduanya disamakan di sini. */
                    [data-theme="dark"] .btn-copy[style*="background:#e2e8f0"] {
                        background: var(--d-surface) !important;
                        border-color: var(--d-line) !important;
                        color: var(--d-ink) !important;
                    }

                    [data-theme="dark"] [style*="background:#f8fafc"] {
                        background: var(--d-surface) !important;
                        border-color: var(--d-line) !important;
                    }

                    [data-theme="dark"] .rule-card .field-list code {
                        background: var(--d-surface);
                        border-color: var(--d-line);
                        color: var(--d-ink);
                    }

                    [data-theme="dark"] .rule-card .field-list .sep {
                        color: var(--d-faint);
                    }

                    [data-theme="dark"] .ver-tabs button:hover {
                        background: var(--d-surface);
                        color: var(--d-ink);
                    }

                    [data-theme="dark"] .ver-tabs {
                        border-color: var(--d-line);
                    }

                    [data-theme="dark"] .ver-tabs button {
                        color: var(--d-muted);
                    }

                    [data-theme="dark"] .ver-tabs button.active {
                        color: #45d67f;
                    }

                    [data-theme="dark"] table th {
                        color: var(--d-muted);
                        border-color: var(--d-line);
                    }

                    [data-theme="dark"] table td {
                        border-color: var(--d-line);
                        color: var(--d-ink);
                    }

                    /* Kartu tier: kuning muda terlalu menyilaukan di tema gelap. */
                    [data-theme="dark"] .tier-card {
                        background: rgba(245, 158, 11, 0.10);
                        border-color: rgba(245, 158, 11, 0.28);
                    }

                    [data-theme="dark"] .tier-table th,
                    [data-theme="dark"] .tier-note {
                        color: #fbbf24;
                    }

                    [data-theme="dark"] .tier-table td {
                        border-color: rgba(245, 158, 11, 0.18);
                    }

                    [data-theme="dark"] .tier-pill.tier-core {
                        background: rgba(59, 130, 246, 0.18);
                        color: #93c5fd;
                    }

                    [data-theme="dark"] .tier-pill.tier-advanced {
                        background: rgba(139, 92, 246, 0.18);
                        color: #c4b5fd;
                    }

                    [data-theme="dark"] .tier-pill.tier-stored {
                        background: rgba(245, 158, 11, 0.18);
                        color: #fbbf24;
                    }

                    [data-theme="dark"] .syn-legend {
                        color: var(--d-muted);
                    }

                    [data-theme="dark"] .syn-legend i {
                        color: var(--d-faint);
                    }

                    [data-theme="dark"] .tier-pill.tier-premium {
                        background: rgba(236, 72, 153, 0.18);
                        color: #f9a8d4;
                    }

                    [data-theme="dark"] .tier-pill.tier-label {
                        background: var(--d-surface);
                        color: var(--d-muted);
                    }

                    [data-theme="dark"] .ver-tag.ver-rec {
                        background: rgba(0, 177, 79, 0.18);
                        color: #6ee7a8;
                    }

                    [data-theme="dark"] .ver-tag.ver-legacy {
                        background: var(--d-surface);
                        color: var(--d-muted);
                    }

                    [data-theme="dark"] th.cmp-rec {
                        background: rgba(0, 177, 79, 0.10);
                    }

                    /* Modal kunci dan catatannya */
                    [data-theme="dark"] .key-note {
                        background: rgba(139, 92, 246, 0.14);
                        border-color: rgba(139, 92, 246, 0.28);
                        color: var(--d-ink);
                    }

                    [data-theme="dark"] .key-input-wrap .key-input-icon {
                        background: var(--d-line);
                    }

                    [data-theme="dark"] .key-modal {
                        background: rgba(0, 0, 0, 0.6);
                    }

                    [data-theme="dark"] .key-btn-secondary {
                        background: var(--d-surface);
                        border-color: var(--d-line);
                        color: var(--d-ink);
                    }

                    /* Panel bernuansa yang warnanya ditulis di atribut style markup. */
                    [data-theme="dark"] [style*="background:#f3f4f6"] {
                        background: var(--d-surface) !important;
                        color: var(--d-ink);
                    }

                    [data-theme="dark"] [style*="background:#f8f9fa"] {
                        background: var(--d-surface) !important;
                    }

                    [data-theme="dark"] [style*="background:#fef3c7"] {
                        background: rgba(245, 158, 11, 0.16) !important;
                    }

                    /* Tombol lanjut di modal kunci: selebar modal, sama seperti gerbang key
   di /tester-api. */
                    .key-modal-footer {
                        justify-content: stretch;
                    }

                    .key-modal-footer .key-btn-primary {
                        width: 100%;
                        border-radius: 999px;
                        padding: 11px 18px;
                        font-weight: 700;
                    }

/* --- Perbaikan kontras mode gelap --- */
/* Judul seksi memakai --text-primary yang tetap gelap; ditimpa di sini. */
[data-theme="dark"] .doc-section-h { color: var(--d-ink); border-color: var(--d-line); }
[data-theme="dark"] .breadcrumb-mini { color: var(--d-faint); }

/* Chip <code> di dalam kalimat: latar terang dan merah muda terlalu
   menyala di tema gelap. */
[data-theme="dark"] code {
    background: var(--d-surface);
    color: #f0a3a3;
}
[data-theme="dark"] pre code { background: transparent; color: inherit; }

/* Banner tanpa-kunci: kuning penuh terlalu menyilaukan. */
[data-theme="dark"] .no-key-banner {
    background: rgba(245, 158, 11, 0.14);
    border-bottom-color: rgba(245, 158, 11, 0.35);
    color: #fbbf24;
}
[data-theme="dark"] .no-key-banner .nkb-text b { color: #fcd34d; }
[data-theme="dark"] .no-key-banner .nkb-btn { background: #b45309; color: #fff; border-color: transparent; }

/* Panel isi dan kartu di dalamnya */
[data-theme="dark"] .op-panel { background: var(--d-page); }
[data-theme="dark"] .rule-card,
[data-theme="dark"] .alert-mini { color: var(--d-ink); }
[data-theme="dark"] .method { filter: saturate(0.9); }
[data-theme="dark"] a { color: #45d67f; }
[data-theme="dark"] .sidebar { border-right-color: var(--d-line); }

/* Modal kunci di tema gelap: pita bawah dan label ikut gelap. */
[data-theme="dark"] .key-modal-footer { background: transparent; }
[data-theme="dark"] .key-modal-body { background: var(--d-card); }
[data-theme="dark"] .key-form-row label { color: var(--d-ink); }
[data-theme="dark"] .key-peek { color: var(--d-muted); }
[data-theme="dark"] .key-peek:hover { background: var(--d-line); color: var(--d-ink); }
[data-theme="dark"] .key-note { color: var(--d-ink); }
[data-theme="dark"] .key-input-wrap input { background: var(--d-surface); color: var(--d-ink); border-color: var(--d-line); }

/* === Modal API Key — disamakan dengan gerbang di /tester-api ===
   Halaman ini tidak memakai Bootstrap, jadi tampilan input-group dan
   tombol pilnya ditulis ulang dengan ukuran dan warna yang sama. */
.key-modal-card {
    max-width: 520px;
    border-radius: 18px;
    overflow: hidden;
    border: none;
}
.key-modal-header {
    background: linear-gradient(135deg, #00B14F 0%, #009543 100%);
    color: #fff;
    padding: 22px 24px;
    border: none;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.key-modal-header .kmh-title { display: flex; align-items: center; gap: 10px; }
.key-modal-header .kmh-title > i { font-size: 1.4rem; }
.key-modal-header strong { display: block; font-size: 1.05rem; font-weight: 700; }
.key-modal-header small { display: block; opacity: 0.85; font-size: 0.75rem; }
.key-modal-header .key-modal-close { color: #fff; opacity: 0.9; background: none; border: 0; font-size: 1.4rem; cursor: pointer; }

.key-modal-body { padding: 24px; }

.key-note {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #00713a;
}
.key-note > i { color: #00B14F; font-size: 1rem; margin-top: 2px; }

.key-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.key-label .key-req { color: #dc3545; }

.key-input-group { display: flex; align-items: stretch; margin-bottom: 8px; }
.key-input-group .kig-prefix {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-right: 0;
    border-radius: 10px 0 0 10px;
    color: #00B14F;
}
.key-input-group input {
    flex: 1;
    min-width: 0;
    border: 1px solid #e5e7eb;
    border-radius: 0;
    padding: 9px 12px;
    font-size: 0.85rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    outline: none;
    background: #fff;
    color: #1f2937;
}
.key-input-group input:focus { border-color: #00B14F; }
.key-input-group .kig-peek {
    border: 1px solid #e5e7eb;
    border-left: 0;
    border-radius: 0 10px 10px 0;
    background: #fff;
    color: #6b7280;
    padding: 0 14px;
    cursor: pointer;
}
.key-input-group .kig-peek:hover { background: #f3f4f6; color: #1f2937; }

.key-how { margin-top: 14px; }
.key-how > summary {
    cursor: pointer;
    color: #00B14F;
    font-weight: 600;
    font-size: 0.8rem;
}
.key-how-body {
    margin-top: 8px;
    padding: 14px;
    border-radius: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    font-size: 0.75rem;
    line-height: 1.6;
}
.key-how-body ol { margin: 0; padding-left: 18px; }
.key-how-body a { color: #00B14F; }

.key-modal-footer { border: none; padding: 0 24px 24px; display: flex; }
.key-modal-footer .key-btn-primary {
    width: 100%;
    border: 0;
    border-radius: 999px;
    padding: 11px 20px;
    background: #00B14F;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}
.key-modal-footer .key-btn-primary:hover { background: #009543; }

/* Tema gelap */
[data-theme="dark"] .key-modal-card { background: var(--d-card); }
[data-theme="dark"] .key-modal-body { background: var(--d-card); }
[data-theme="dark"] .key-label { color: var(--d-ink); }
[data-theme="dark"] .key-note { background: rgba(139, 92, 246, 0.14); border-color: rgba(139, 92, 246, 0.3); color: #a7f3d0; }
[data-theme="dark"] .key-input-group .kig-prefix { background: var(--d-line); border-color: var(--d-line); }
[data-theme="dark"] .key-input-group input { background: var(--d-surface); border-color: var(--d-line); color: var(--d-ink); }
[data-theme="dark"] .key-input-group .kig-peek { background: var(--d-surface); border-color: var(--d-line); color: var(--d-muted); }
[data-theme="dark"] .key-how-body { background: var(--d-surface); border-color: var(--d-line); color: var(--d-muted); }

/* Kotak "Region Caveats" dan sejenisnya menaruh warna teksnya di atribut
   style markup. Latarnya sudah digelapkan, tapi teks cokelat tuanya ikut
   tertinggal sehingga nyaris tak terbaca — ditimpa di sini. */
[data-theme="dark"] [style*="color:#92400e"] { color: #fcd34d !important; }
[data-theme="dark"] [style*="color:#78350f"] { color: #fde68a !important; }
[data-theme="dark"] [style*="color:#334155"],
[data-theme="dark"] [style*="color:#64748b"] { color: var(--d-muted) !important; }
[data-theme="dark"] [style*="background:#fef3c7"] {
    background: rgba(245, 158, 11, 0.14) !important;
    border-color: rgba(245, 158, 11, 0.35) !important;
}

/* Kotak catatan kecil di seluruh dokumen. */
[data-theme="dark"] .alert-mini { color: var(--d-ink); }
[data-theme="dark"] .alert-mini.warn { background: rgba(245, 158, 11, 0.12); }
[data-theme="dark"] .alert-mini.info { background: rgba(59, 130, 246, 0.12); }
[data-theme="dark"] .alert-mini.success { background: rgba(16, 185, 129, 0.12); }
[data-theme="dark"] .alert-mini.danger { background: rgba(239, 68, 68, 0.12); }
[data-theme="dark"] .alert-mini.soon { background: rgba(245, 158, 11, 0.12); color: #fde68a; }

/* Sorot tetikus di sidebar masih memakai abu terang — di tema gelap itu
   jadi pita putih dengan teks pucat yang tidak terbaca. */
[data-theme="dark"] .sidebar .service-header:hover { background: var(--d-surface); color: var(--d-ink); }
[data-theme="dark"] .sidebar .service-header:focus-visible { outline-color: var(--d-line); }
[data-theme="dark"] .sidebar .service-header .caret { color: var(--d-muted); }
[data-theme="dark"] .sidebar-search-wrap input {
    background: var(--d-surface);
    border-color: var(--d-line);
    color: var(--d-ink);
}
[data-theme="dark"] .sidebar-search-wrap input::placeholder { color: var(--d-faint); }
[data-theme="dark"] #sidebarSearchEmpty { color: var(--d-muted) !important; }

/* Judul tabel masih memakai latar terang di semua panel operasi — di tema
   gelap itu jadi pita putih. Termasuk tabel galat yang latarnya merah muda. */
[data-theme="dark"] thead,
[data-theme="dark"] thead tr,
[data-theme="dark"] table th {
    background: var(--d-surface) !important;
    color: var(--d-muted) !important;
    border-color: var(--d-line) !important;
}
[data-theme="dark"] table { border-color: var(--d-line); }
[data-theme="dark"] table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .err-code { background: rgba(239, 68, 68, 0.18); color: #f5a3a3; }

/* Kartu tier punya judul kolomnya sendiri — jangan ikut disamarkan. */
[data-theme="dark"] .tier-table th {
    background: transparent !important;
    color: #fbbf24 !important;
    border-color: rgba(245, 158, 11, 0.28) !important;
}

/* Panel "Try it Live": baris preset dan tombolnya masih berlatar terang. */
[data-theme="dark"] .preset-row {
    background: var(--d-surface);
    border-color: var(--d-line);
}
[data-theme="dark"] .preset-row .preset-label { color: var(--d-muted); }
[data-theme="dark"] .preset-btn {
    background: var(--d-card);
    border-color: var(--d-line);
    color: var(--d-ink);
}
[data-theme="dark"] .preset-btn:hover { background: var(--d-line); }
[data-theme="dark"] .preset-btn.active { background: rgba(0, 177, 79, 0.18); color: #6ee7a8; border-color: rgba(0, 177, 79, 0.35); }

/* Kolom isian di baris preset memakai gaya sebaris (border #cbd5e1). */
[data-theme="dark"] .preset-row input,
[data-theme="dark"] .preset-row select {
    background: var(--d-card) !important;
    border-color: var(--d-line) !important;
    color: var(--d-ink) !important;
}

[data-theme="dark"] .demo-form input,
[data-theme="dark"] .demo-form select,
[data-theme="dark"] .demo-form textarea {
    background: var(--d-surface);
    border-color: var(--d-line);
    color: var(--d-ink);
}
[data-theme="dark"] .demo-form label { color: var(--d-ink); }
[data-theme="dark"] .try-it,
[data-theme="dark"] .try-it-pane { color: var(--d-ink); }

/* Tombol aksi di baris preset (mis. Apply) — dibedakan dari chip preset
   biasa supaya jelas mana yang menjalankan sesuatu. */
.preset-btn.is-primary {
    background: var(--brand-green, #00B14F);
    border-color: transparent;
    color: #fff;
    font-weight: 700;
    padding: 5px 16px;
}
.preset-btn.is-primary:hover { background: #009543; color: #fff; }
[data-theme="dark"] .preset-btn.is-primary { background: #00B14F; color: #fff; border-color: transparent; }
[data-theme="dark"] .preset-btn.is-primary:hover { background: #45d67f; color: #0e1210; }
