/* API & Kết nối — module riêng: API key, webhook, hướng dẫn */
.zl-api { display: none; }
.zl-app.is-api { grid-template-columns: var(--zl-nav-w) minmax(0, 1fr) !important; }
.zl-app.is-api > .zl-sidebar,
.zl-app.is-api > .zl-chat,
.zl-app.is-api > .zl-profile,
.zl-app.is-api > .zl-board,
.zl-app.is-api > .zl-autopost,
.zl-app.is-api > .zl-cmts,
.zl-app.is-api > .zl-prods,
.zl-app.is-api > .zl-config { display: none !important; }
.zl-app.is-api > .zl-api { display: flex; }
@media (max-width: 820px) {
  .zl-app.is-api { grid-template-columns: minmax(0, 1fr) !important; }
}

.zl-api {
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: #0f172a;
  font-size: 14px;
  background:
    radial-gradient(ellipse 50% 35% at 100% 0%, rgba(99, 102, 241, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 40% at 0% 0%, rgba(96, 165, 250, 0.1), transparent 55%),
    linear-gradient(180deg, #f4f7fb 0%, #eef3f9 100%);
}
.zl-api *, .oa-api-toast { box-sizing: border-box; }
.zl-api button, .zl-api input, .zl-api select { font-family: inherit; }
.zl-api .ph-hero-ico { background: linear-gradient(140deg, #818cf8, #4f46e5 55%, #4338ca); box-shadow: 0 10px 24px -10px rgba(79, 70, 229, .7), inset 0 1px 0 rgba(255, 255, 255, .3); }
.zl-api code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.zl-api .ph-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; animation: phFade .3s ease both; }
.zl-api .ph-stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #fff; border: 1px solid #e8edf4; border-radius: 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.zl-api .ph-stat b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.zl-api .ph-stat small { display: block; font-size: 13px; color: #64748b; margin-top: 2px; }
.zl-api .ph-stat-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.zl-api .ph-stat.blue .ph-stat-ico { background: #eff6ff; color: #2563eb; }
.zl-api .ph-stat.green .ph-stat-ico { background: #ecfdf5; color: #059669; }
.zl-api .ph-stat.violet .ph-stat-ico { background: #f5f3ff; color: #7c3aed; }
.zl-api .ph-stat.amber .ph-stat-ico { background: #fffbeb; color: #d97706; }
@media (max-width: 1024px) { .zl-api .ph-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) { .zl-api .ph-stat { padding: 12px; } .zl-api .ph-stat b { font-size: 17px; } }
.zl-api .ph-stat > div { min-width: 0; }
.oa-api-base b { font-size: 13px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oa-api-base a { color: #4f46e5; font-weight: 700; text-decoration: none; }

.oa-api-alert { margin-bottom: 14px; padding: 11px 14px; border-radius: 12px; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; font-weight: 600; font-size: 13.5px; }
.oa-api-alert.is-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }

.oa-api-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.oa-api-card { background: #fff; border: 1px solid #e8edf4; border-radius: 20px; padding: 18px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -16px rgba(15, 23, 42, .12); margin-bottom: 16px; min-width: 0; animation: phRise .4s cubic-bezier(.2, .8, .2, 1) both; }
.oa-api-grid .oa-api-card { margin-bottom: 0; }
.oa-api-card-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.oa-api-card-head h3 { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.oa-api-card-head p { margin: 2px 0 0; color: #64748b; font-size: 13px; line-height: 1.5; }
.oa-api-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: #eef2ff; color: #4f46e5; flex: none; }

.oa-api-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.oa-api-input { flex: 1 1 200px; min-width: 0; height: 38px; padding: 0 12px; border: 1px solid #e2e8f0; border-radius: 11px; background: #fff; font-size: 13.5px; color: #0f172a; outline: none; transition: border-color .15s, box-shadow .15s; }
.oa-api-input:focus { border-color: #a5b4fc; box-shadow: 0 0 0 4px rgba(99, 102, 241, .12); }
.oa-api-select { flex: 0 0 auto; padding-right: 8px; }

.oa-api-events { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.oa-api-check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; background: #f8fafc; }
.oa-api-check code { color: #64748b; font-weight: 500; }
.oa-api-check input { accent-color: #4f46e5; margin: 0; }
.oa-api-events .ph-btn { margin-left: auto; }

.oa-api-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 11px 0; border-top: 1px solid #eef2f7; }
.oa-api-row-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.oa-api-row-main b { font-size: 13.5px; }
.oa-api-row-main code { color: #475569; font-size: 12px; }
.oa-api-row-main small { color: #64748b; font-size: 12px; }
.oa-api-url { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oa-api-row-act { display: flex; gap: 6px; }
.oa-api-meta { grid-column: 1 / -1; color: #64748b; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.oa-api-row > .ph-btn, .oa-api-row > .oa-api-row-act { grid-row: 1; grid-column: 2; }
.oa-api-row > .oa-api-tag { grid-row: 2; grid-column: 2; justify-self: end; }
.oa-api-row > .oa-api-meta { grid-row: 2; grid-column: 1; }
.oa-api-tag { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #f1f5f9; color: #475569; white-space: nowrap; }
.oa-api-tag.is-write { background: #eef2ff; color: #4338ca; }
.oa-api-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; flex: none; }
.oa-api-dot.is-ok { background: #10b981; }
.oa-api-dot.is-bad { background: #ef4444; }
.oa-api-empty { color: #94a3b8; font-size: 13px; margin: 6px 0 0; padding-top: 10px; border-top: 1px solid #eef2f7; }

.oa-api-reveal { margin-bottom: 12px; padding: 12px; border-radius: 14px; background: #f0fdf4; border: 1px solid #bbf7d0; animation: phFade .3s ease both; }
.oa-api-reveal > b { display: block; font-size: 12.5px; color: #166534; margin-bottom: 8px; }
.oa-api-reveal-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.oa-api-reveal-row code { flex: 1 1 260px; min-width: 0; padding: 8px 10px; border-radius: 9px; background: #fff; border: 1px dashed #86efac; font-size: 12.5px; word-break: break-all; user-select: all; }

.oa-api-out { margin: 0; max-height: 360px; overflow: auto; padding: 14px; border-radius: 14px; background: #0f172a; color: #e2e8f0; font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }

.oa-api-tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; margin-bottom: 16px; background: #f1f5f9; border-radius: 13px; }
.oa-api-tab { appearance: none; border: 0; background: transparent; padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 650; color: #475569; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.oa-api-tab:hover { color: #0f172a; }
.oa-api-tab.is-active { background: #fff; color: #4338ca; box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.oa-api-doc { animation: phFade .25s ease both; }
.oa-api-p { margin: 0 0 14px; color: #334155; line-height: 1.65; }
.oa-api-h5 { margin: 18px 0 8px; font-size: 13.5px; font-weight: 800; }
.oa-api-steps { margin: 0 0 14px; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 10px; }
.oa-api-steps li { counter-increment: s; position: relative; padding-left: 34px; line-height: 1.6; color: #334155; }
.oa-api-steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 8px; background: #eef2ff; color: #4338ca; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.oa-api-doc code, .oa-api-p code { background: #f1f5f9; padding: 1px 5px; border-radius: 5px; color: #334155; }

.oa-api-code { margin: 0 0 14px; border-radius: 14px; overflow: hidden; background: #0f172a; border: 1px solid #1e293b; }
.oa-api-code-bar { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px 7px 14px; background: #1e293b; color: #94a3b8; font-size: 12px; font-weight: 600; }
.oa-api-copy { appearance: none; display: inline-flex; align-items: center; gap: 5px; border: 1px solid #334155; background: transparent; color: #cbd5e1; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 8px; cursor: pointer; }
.oa-api-copy:hover { background: #334155; color: #fff; }
.oa-api-code pre { margin: 0; padding: 14px; overflow-x: auto; }
.oa-api-code pre code { background: none !important; padding: 0 !important; color: #e2e8f0 !important; font-size: 12.5px; line-height: 1.6; white-space: pre; }

.oa-api-table-wrap { overflow-x: auto; margin: 0 0 14px; border: 1px solid #e8edf4; border-radius: 14px; }
.oa-api-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.oa-api-table th { text-align: left; padding: 9px 12px; background: #f8fafc; color: #475569; font-weight: 700; font-size: 12px; border-bottom: 1px solid #e8edf4; white-space: nowrap; }
.oa-api-table td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: top; line-height: 1.55; color: #334155; }
.oa-api-table tr:last-child td { border-bottom: 0; }

.oa-api-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 13px; line-height: 1.55; }
.oa-api-note svg { flex: none; margin-top: 1px; }

.oa-api-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 9999; padding: 10px 16px; border-radius: 12px; background: #0f172a; color: #fff; font-size: 13.5px; font-weight: 600; box-shadow: 0 12px 30px -10px rgba(15, 23, 42, .5); animation: phToastIn .25s ease both; }
.oa-api-toast.is-out { animation: phToastOut .3s ease both; }

@media (max-width: 1024px) {
  .oa-api-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .oa-api-card { padding: 14px; border-radius: 16px; }
  .oa-api-events .ph-btn { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .zl-api *, .oa-api-toast { animation: none !important; transition: none !important; }
}
