:root {
  --bg: #f5f6fa;
  --card: #fff;
  --ink: #1d2433;
  --muted: #6b7280;
  --line: #e4e7ee;
  --brand: #4f46e5;
  --brand-2: #eef2ff;
  --danger: #dc2626;
  --ok: #059669;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
code, pre, textarea#srcText, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }

.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: #111827; color: #fff; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 18px; }
.logo { color: #facc15; }
.tag { color: #9ca3af; flex: 1; }
.pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; background: #374151; }
.pill.on { background: var(--ok); }

.layout { display: grid; grid-template-columns: 250px 1fr; gap: 20px; padding: 20px 24px; max-width: 1400px; margin: 0 auto; }
.sidebar { position: sticky; top: 72px; align-self: start; }
.sidebar h4 { margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; font-size: 12px; letter-spacing: .05em; }
.mylist { list-style: none; padding: 0; margin: 0; }
.mylist li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 6px; }
.mylist li:hover { background: #e9ebf3; }
.mylist li.active { background: var(--brand-2); color: var(--brand); font-weight: 600; }
.mylist .empty { color: var(--muted); cursor: default; }

.main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.card h2 { margin: 0 0 10px; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.card h4 { margin: 18px 0 8px; }
.card-head { display: flex; justify-content: space-between; align-items: center; }
.num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 14px; }
.hint { color: var(--muted); margin: 4px 0 10px; }
.small { font-size: 12px; }
.muted { color: var(--muted); font-weight: 400; }

input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); border-color: var(--brand); }
label { display: block; font-weight: 600; margin-bottom: 10px; }
label input, label textarea, label select { margin-top: 4px; font-weight: 400; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; }
label.check input { width: auto; margin: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.row.actions { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.btn { border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 600; color: var(--ink); }
.btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #4338ca; color: #fff; }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.btn.block { width: 100%; }
.btn.icon { padding: 4px 8px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 8px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 8px 14px; cursor: pointer; font: inherit; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--brand); border-color: var(--brand); font-weight: 600; }

.tool { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.tool.off { opacity: .55; }
.tool-head { display: grid; grid-template-columns: auto 1.2fr 110px 2fr auto auto; gap: 8px; align-items: center; }
.tool textarea { margin-top: 8px; }
.method { font-weight: 700; }
.m-GET { color: #059669; } .m-POST { color: #2563eb; } .m-PUT, .m-PATCH { color: #d97706; } .m-DELETE { color: var(--danger); }
details.params { margin-top: 8px; }
details.params summary { cursor: pointer; color: var(--muted); font-size: 13px; }
table.ptable { width: 100%; border-collapse: collapse; margin-top: 6px; }
table.ptable th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px; }
table.ptable td { padding: 3px 4px; }
table.ptable td:nth-child(4) { text-align: center; }
.kv { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; margin-bottom: 6px; }
.empty-tools { text-align: center; padding: 30px; color: var(--muted); border: 2px dashed var(--line); border-radius: 10px; }

.deploy { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.copybox { display: flex; gap: 8px; align-items: stretch; margin: 6px 0 14px; }
.copybox pre, .copybox input { flex: 1; margin: 0; background: #0f172a; color: #e2e8f0; padding: 10px 12px; border-radius: 8px; overflow-x: auto; white-space: pre; font-size: 12.5px; border: 0; }
.ok { color: var(--ok); font-weight: 600; }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(720px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15,23,42,.45); }
.dlg { padding: 20px 22px; }
.dlg h3 { margin-top: 0; }
pre.out { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; max-height: 360px; overflow: auto; white-space: pre-wrap; font-size: 12.5px; min-height: 40px; }
pre.out:empty { display: none; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.err { background: var(--danger); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .grid2 { grid-template-columns: 1fr; }
  .tool-head { grid-template-columns: auto 1fr; }
}
