/* JNE API Portal — warna diambil dari logo JNE API (navy, merah, biru badge API) */
:root {
  --navy: #1C3278;
  --navy-deep: #12245A;
  --red: #D7141E;
  --red-hover: #B8101A;
  --blue: #2F6FE0;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #5B6474;
  --line: #E3E6EB;
  --line-strong: #CDD3DC;
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --tint: #EEF2FA;
  --success: #1F7A4D;
  --success-bg: #E7F5EE;
  --warn: #8A5300;
  --warn-bg: #FFF4E0;
  --danger: #B42318;
  --danger-bg: #FDECEC;
  --code-bg: #0E1726;
  --code-line: #22314D;
  --code-ink: #E6EDF3;
  --radius: 12px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 88px; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; font-family: var(--font); font-size: 15px; line-height: 1.6; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--navy); }
a:hover { color: var(--red); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; }
code, pre { font-family: var(--mono); }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
/* Atribut hidden harus menang atas display: flex/block dari class komponen */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1440px; margin: 0 auto; padding: 0 24px; min-height: 68px; display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.brand img { display: block; height: 44px; width: auto; }
.mainnav { display: flex; gap: 4px; flex: 1 1 auto; flex-wrap: wrap; }
.mainnav a { padding: 9px 14px; border-radius: 8px; font-size: 14px; font-weight: 500; text-decoration: none; color: var(--muted); }
.mainnav a:hover { color: var(--navy); background: var(--bg); }
.mainnav a.active { color: var(--navy); background: var(--tint); font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.userbox .name { font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox a { color: var(--muted); }

/* ---------- Layout ---------- */
body > main { flex: 1 0 auto; width: 100%; }
.container { max-width: 1240px; margin: 0 auto; padding: 36px 24px 64px; display: flex; flex-direction: column; gap: 28px; }
.container-wide { max-width: 1440px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 30px; font-weight: 700; letter-spacing: -0.5px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.split { display: flex; gap: 24px; flex-wrap: wrap; }
.split > * { flex: 1 1 380px; min-width: 0; }
.split > .grow { flex: 1.4 1 520px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; border-top: 1px solid var(--line); background: var(--surface); }

/* ---------- Cards & sections ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 26px 28px; display: flex; flex-direction: column; gap: 18px; }
.card h2 { font-size: 18px; font-weight: 600; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.section { display: flex; flex-direction: column; gap: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 20px; font-weight: 600; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted); margin: 8px 0 0; }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0.3px; }
.chip-navy { background: var(--tint); color: var(--navy); }
.chip-sandbox { background: var(--tint); color: var(--navy); }
.chip-pending { background: var(--warn-bg); color: var(--warn); }
.chip-live { background: var(--success-bg); color: var(--success); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-navy::before { display: none; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 10px; font: 600 14px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn svg { flex: none; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); color: #fff; }
.btn-dark { background: var(--navy); color: #fff; }
.btn-dark:hover { background: var(--navy-deep); color: #fff; }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line-strong); font-weight: 500; }
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #F1B5B0; }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.form-stack { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .label-sm { font-size: 14px; font-weight: 500; }
.label-sm { font-size: 12px; font-weight: 600; color: var(--muted); }
.input { width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px; font: 400 15px var(--font); color: var(--ink); background: var(--surface); }
.input:focus { outline: 2px solid var(--navy); outline-offset: 0; border-color: var(--navy); }
.input[readonly] { background: var(--bg); font-family: var(--mono); font-size: 14px; }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1 1 auto; min-width: 0; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }

/* ---------- Alerts ---------- */
.flash-area { max-width: 1240px; margin: 20px auto 0; padding: 0 24px; display: flex; flex-direction: column; gap: 10px; }
.alert { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 10px; font-size: 14px; line-height: 1.5; border: 1px solid transparent; }
.alert p { margin: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.alert-success { background: var(--success-bg); color: #145235; border-color: #B9E2CC; }
.alert-error { background: var(--danger-bg); color: #8E1B13; border-color: #F4C2BD; }
.alert-close { flex: none; width: 28px; height: 28px; border: 0; background: transparent; color: inherit; border-radius: 6px; cursor: pointer; font-size: 18px; line-height: 1; }
.alert-close:hover { background: rgba(0, 0, 0, 0.06); }

/* ---------- Go-live stepper ---------- */
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stepper li { display: flex; flex-direction: column; gap: 8px; }
.stepper .bar { height: 6px; border-radius: 3px; background: var(--line); }
.stepper .title { font-size: 14px; font-weight: 600; color: var(--muted); }
.stepper .desc { font-size: 13px; color: var(--muted); line-height: 1.5; }
.stepper .done .bar { background: var(--navy); }
.stepper .current .bar { background: var(--red); }
.stepper .done .title, .stepper .current .title { color: var(--ink); }
.callout { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 18px; border-radius: 10px; background: var(--bg); font-size: 14px; color: var(--ink-2); }
.callout p { margin: 0; flex: 1 1 260px; }

/* ---------- Credentials ---------- */
.kv { display: flex; flex-direction: column; gap: 6px; }
.kv > span { font-size: 13px; color: var(--muted); }
.secret { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; padding: 0 12px; min-height: 44px; background: var(--bg); border-radius: 8px; font-family: var(--mono); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.danger-zone { margin-top: auto; padding-top: 16px; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.danger-zone strong { display: block; font-size: 13px; color: var(--danger); }
.danger-zone span { font-size: 12px; color: var(--muted); }
.dl { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 12px 24px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---------- Modules & files ---------- */
.module-grid, .file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.module-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.module-card:hover { color: var(--ink); border-color: var(--navy); box-shadow: 0 6px 18px rgba(28, 50, 120, 0.08); }
.module-card .name { font-size: 15px; font-weight: 600; }
.module-card .desc { font-size: 13px; color: var(--muted); line-height: 1.5; flex: 1 1 auto; }
.module-card .more { font-size: 13px; font-weight: 600; color: var(--navy); }
.file-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); }
.file-card:hover { border-color: var(--success); color: var(--ink); }
.file-card .meta { display: flex; flex-direction: column; }
.file-card .meta strong { font-size: 14px; }
.file-card .meta span { font-size: 12px; color: var(--muted); }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* ---------- Docs layout ---------- */
.docs { display: flex; flex-wrap: wrap; align-items: flex-start; background: var(--surface); min-height: calc(100vh - 69px); }
.docs-side { flex: 0 1 280px; min-width: 0; padding: 24px 16px 40px 24px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 20px; position: sticky; top: 69px; max-height: calc(100vh - 69px); overflow-y: auto; }
.docs-main { flex: 999 1 560px; min-width: 0; padding: 32px 48px 64px; display: flex; flex-direction: column; gap: 24px; }
.docs-toc { flex: 0 1 260px; min-width: 0; padding: 32px 24px 40px 0; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 69px; max-height: calc(100vh - 69px); overflow-y: auto; }
#doc-nav { display: flex; flex-direction: column; gap: 20px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group .eyebrow { font-size: 11px; padding: 0 10px 6px; margin: 0; }
.side-link { display: block; padding: 7px 10px; border-radius: 8px; font-size: 14px; color: var(--ink-2); text-decoration: none; line-height: 1.4; }
.side-link:hover { background: var(--bg); color: var(--navy); }
.side-link.active { background: var(--tint); color: var(--navy); font-weight: 600; }
.crumb { font-size: 13px; color: var(--muted); }
.crumb a { color: var(--muted); }
.docs-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.docs-title h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.6px; }
.lead { margin: 0; font-size: 17px; line-height: 1.65; color: var(--ink-2); max-width: 760px; }
.toc { display: flex; flex-direction: column; gap: 2px; }
.toc .eyebrow { font-size: 11px; margin: 0 0 8px; }
.toc a { display: block; padding: 4px 0 4px 12px; border-left: 2px solid var(--line); font-size: 13px; color: var(--muted); text-decoration: none; line-height: 1.45; }
.toc a.lvl-3 { padding-left: 24px; }
.toc a:hover { color: var(--navy); }
.toc a.active { color: var(--navy); font-weight: 600; border-left-color: var(--red); }
.side-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); font-size: 13px; }
.side-card strong { font-size: 13px; }
.side-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.pager { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 24px; border-top: 1px solid var(--line); margin-top: 16px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; min-width: 220px; }
.pager a:hover { border-color: var(--navy); }
.pager a span { font-size: 12px; color: var(--muted); }
.pager a strong { font-size: 15px; color: var(--ink); }
.pager .next { margin-left: auto; text-align: right; }

/* ---------- Docs content (HTML dari DB, sudah dinormalisasi) ---------- */
.doc-content { font-size: 15px; line-height: 1.7; color: var(--ink-2); max-width: 900px; }
.doc-content > * + * { margin-top: 14px; }
.doc-content h2 { font-size: 22px; font-weight: 600; color: var(--ink); margin-top: 36px; padding-top: 8px; }
.doc-content h3 { font-size: 17px; font-weight: 600; color: var(--ink); margin-top: 28px; }
.doc-content h2:first-child, .doc-content h3:first-child { margin-top: 0; }
.doc-content h4 { font-size: 15px; font-weight: 600; color: var(--ink); margin-top: 20px; }
.doc-content p { margin-bottom: 0; }
.doc-content > :first-child { margin-top: 0; }
.doc-content ul, .doc-content ol { margin-bottom: 0; padding-left: 22px; }
.doc-content b, .doc-content strong { color: var(--ink); font-weight: 600; }
.doc-content hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.doc-content blockquote { margin: 0; padding: 12px 16px; border-left: 3px solid var(--blue); background: var(--tint); border-radius: 0 8px 8px 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.doc-content table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc-content th, .doc-content td { padding: 10px 14px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.doc-content tr:first-child > th, .doc-content tr:first-child > td { border-top: 0; }
.doc-content th { background: var(--bg); font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: none; }
.doc-content td:first-child { font-family: var(--mono); font-size: 13px; color: var(--navy); white-space: nowrap; }
.doc-content td:first-child b { color: inherit; }
.doc-content code.token { font-size: 13px; background: var(--tint); color: var(--navy); padding: 2px 8px; border-radius: 6px; overflow-wrap: anywhere; }
/* Dokumentasi format terstruktur (docs/_structured) */
.structured .method { vertical-align: 1px; margin-right: 6px; }
.structured td.type { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.structured .params td:first-child { font-weight: 500; }
.req, .opt { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.req { background: var(--danger-bg); color: var(--danger); }
.opt { background: var(--bg); color: var(--muted); }
.structured h3.response-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 16px; }
.resp-chip { font: 600 12px var(--mono); padding: 2px 9px; border-radius: 6px; }
.resp-chip.ok { background: var(--success-bg); color: var(--success); }
.resp-chip.err { background: var(--danger-bg); color: var(--danger); }
.structured .notes > * + * { margin-top: 14px; }
.pending-chip {display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); }

/* ---------- Request example (toggle Sandbox/Live + bahasa) ---------- */
.try { display: flex; flex-direction: column; gap: 14px; max-width: 900px; padding-bottom: 8px; }
.try-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.try-head h2 { font-size: 22px; font-weight: 600; }
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--tint); border-radius: 10px; }
.seg button { min-height: 36px; padding: 0 16px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: 500 13px var(--font); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--navy); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12); }
.seg button:disabled { cursor: not-allowed; opacity: 0.55; }
.endpoint { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 10px 10px 14px; background: var(--code-bg); border-radius: var(--radius); }
.endpoint .method { font-size: 12px; padding: 4px 10px; border-radius: 6px; }
.endpoint code { flex: 1 1 260px; min-width: 0; font-size: 14px; color: var(--code-ink); overflow-wrap: anywhere; }
.endpoint button, .lang-tabs button { min-height: 32px; padding: 0 12px; border: 1px solid #33425E; background: #18233A; color: var(--code-ink); border-radius: 7px; font: 500 12px var(--font); cursor: pointer; }
.lang-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.try .lang-tabs button { border-color: transparent; background: transparent; color: #8B98A9; }
.try .lang-tabs button:hover { color: var(--code-ink); }
.try .lang-tabs button[aria-selected="true"] { background: #18233A; border-color: #33425E; color: #FFFFFF; font-weight: 600; }
.try .code-head { padding-left: 8px; flex-wrap: wrap; }
.try pre.code { max-height: 520px; overflow: auto; white-space: pre; overflow-wrap: normal; }

/* ---------- Code blocks ---------- */
.code-block { background: var(--code-bg); border-radius: var(--radius); overflow: hidden; }
.code-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px 6px 16px; border-bottom: 1px solid var(--code-line); font: 500 12px var(--mono); color: #8B98A9; }
.code-head button { min-height: 32px; padding: 0 12px; border: 1px solid #33425E; background: #18233A; color: var(--code-ink); border-radius: 7px; font: 500 12px var(--font); cursor: pointer; }
.code-head button:hover { border-color: #5A6C90; }
.code-block pre, pre.code { margin: 0; padding: 18px 20px; font-size: 13px; line-height: 1.7; color: var(--code-ink); background: var(--code-bg); white-space: pre-wrap; overflow-wrap: anywhere; }
.doc-content > pre { border-radius: var(--radius); }
.j-key { color: #8CC8FF; }
.j-str { color: #7EE2B8; }
.j-num { color: #FFB86B; }
.j-lit { color: #C9A2FF; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; background: var(--surface); }
.auth-brand { flex: 1 1 560px; min-width: 0; background: var(--navy-deep); color: #fff; padding: 48px 64px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth-brand .logo { height: 72px; width: auto; align-self: flex-start; }
.auth-brand .intro { display: flex; flex-direction: column; gap: 24px; }
.stack-sm p { margin: 0; }
.auth-brand h1 { font-size: 42px; line-height: 1.12; font-weight: 700; letter-spacing: -0.8px; max-width: 560px; }
.auth-brand .lead { color: #C9D3E3; }
.auth-brand .code-block { border: 1px solid var(--code-line); max-width: 600px; }
.auth-brand .pills { display: flex; gap: 10px; flex-wrap: wrap; }
.auth-brand .pills span { padding: 6px 12px; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 999px; font-size: 13px; color: #DCE3EF; }
.method { font: 500 11px var(--mono); padding: 3px 8px; border-radius: 4px; background: var(--success); color: #fff; }
.auth-form { flex: 1 1 460px; min-width: 0; padding: 48px 64px; display: flex; align-items: center; justify-content: center; }
.auth-form form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 22px; }
.auth-form h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.4px; }
.auth-form .note { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; background: var(--bg); border-radius: 10px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.auth-form .copyright { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .docs-toc { display: none; }
}
@media (max-width: 860px) {
  .docs-side { position: static; max-height: none; flex-basis: 100%; border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; }
  .docs-main { padding: 24px 16px 48px; }
  .container { padding: 24px 16px 48px; }
  .topbar-inner { padding: 8px 16px; gap: 12px; }
  .userbox .name { display: none; }
  .auth-brand, .auth-form { padding: 32px 20px; }
  .auth-brand h1 { font-size: 30px; }
  .stepper { grid-template-columns: 1fr; }
  .page-title, .docs-title h1 { font-size: 26px; }
}
