/* PriCoSoft Cloud API Explorer
   Same look as the Admin Center (ADMIN/FE/assets/admin.css) and the CRM: dark top bar (64 px), light sidebar, cards.
   Sections: 1 tokens · 2 base · 3 top bar · 4 sidebar and sample queries · 5 content and request bar · 6 cards, tabs,
             badges · 7 tables · 8 forms and buttons · 9 code and documentation · 10 dialog · 11 responsive
   Colors: only the shared tokens of appearance.css (light/dark mode and color schemes); the only literal colors are
   the HTTP method and JSON syntax colors below, with a light and a dark value. */

/* 1 ── Design tokens: aliases of the appearance.css color tokens, sizes, category colors ─────────────── */
:root {
  --blue: var(--accent); /* links, primary buttons, active navigation */
  --ink: var(--text); /* text */
  --muted: var(--text-muted); /* secondary text */
  --line: var(--border); /* borders */
  --canvas: var(--bg); /* page background */
  --nav: var(--sidebar); /* sidebar background */
  --card: var(--surface); /* cards, tables */
  --red: var(--danger);
  --green: var(--success);
  --amber: var(--warning);
  --hover: color-mix(in srgb, var(--accent) 7%, var(--surface)); /* light accent tint: hover, focus */
  --font: "Segoe UI", Inter, system-ui, sans-serif;
  --mono: Consolas, "Cascadia Mono", monospace;
  --bar: 64px; /* top bar height, the same in all PriCoSoft Cloud portals */
  --sidebar-width: 320px; /* sidebar width (wider than in the Admin Center; --sidebar is the color token) */
  --radius: 8px;
  /* HTTP methods (label background and its text) */
  --method-text: #ffffff;
  --get: #2a5ba8;
  --post: #1e7b45;
  --patch: #8a5a00;
  --put: #6b3fa0;
  --delete: #b3261e;
  /* JSON syntax colors */
  --json-key: #18253c;
  --json-string: #1e7b45;
  --json-number: #2a5ba8;
  --json-literal: #6b3fa0;
}
/* Dark mode: lighter category colors, readable on dark surfaces; method labels get dark text. */
:root[data-mode="dark"] {
  --method-text: #0c1420;
  --get: #7aa7f2;
  --post: #5fcb8e;
  --patch: #f0c060;
  --put: #b597ee;
  --delete: #f2877d;
  --json-key: #e5e9f0;
  --json-string: #7fd19b;
  --json-number: #8db4f5;
  --json-literal: #c3a6f0;
}

/* 2 ── Base ─────────────────────────────────────────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.mono {
  font-family: var(--mono);
  font-size: 13px;
}
.boot {
  max-width: 460px;
  margin: 18vh auto 0;
  padding: 0 16px;
  text-align: center;
}
.boot-logo {
  max-width: 100%;
  height: auto;
}

/* 3 ── Top bar ──────────────────────────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  height: var(--bar);
  background: var(--topbar);
  color: var(--topbar-text);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 26px;
  z-index: 30;
}
.icon-button {
  border: 0;
  background: transparent;
  color: inherit;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.icon-button:hover {
  background: var(--topbar-hover);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  white-space: nowrap;
  font-size: 14px;
}
.brand:hover {
  text-decoration: none;
}
.brand strong {
  font-size: 18px;
  letter-spacing: -0.4px;
}
.brand-divider {
  width: 1px;
  height: 23px;
  background: color-mix(in srgb, var(--topbar-text) 19%, transparent);
}
.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-button {
  border: 1px solid color-mix(in srgb, var(--topbar-text) 38%, transparent);
  background: transparent;
  color: var(--topbar-text);
  border-radius: 6px;
  padding: 6px 16px;
  font-weight: 600;
}
.topbar-button:hover {
  background: var(--topbar-hover);
}
.account-button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--topbar-text);
  font-size: 12px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, var(--topbar-text));
  color: var(--topbar);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}
.account-menu {
  position: fixed;
  right: 24px;
  top: calc(var(--bar) + 8px);
  width: 320px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 40px var(--shadow);
  z-index: 50;
  display: grid;
  gap: 8px;
}
.account-menu p {
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 12px;
  margin: 0 0 6px;
}
.mobile-only {
  display: none;
}

/* 4 ── Sidebar: sample queries and history ──────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--bar);
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  background: var(--nav);
  border-right: 1px solid var(--line);
  padding: 12px 12px 14px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 20;
}
.sidebar .tab-list {
  margin-bottom: 12px;
}
.sidebar input[type="search"] {
  margin-bottom: 10px;
}
.sample-list {
  display: grid;
  gap: 2px;
}
.group summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.group summary::-webkit-details-marker {
  display: none;
}
.group summary::before {
  content: "›";
  color: var(--muted);
  width: 10px;
  transition: transform 0.12s;
}
.group[open] summary::before {
  transform: rotate(90deg);
}
.group summary:hover {
  background: var(--surface-2);
}
.count {
  margin-left: auto;
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}
.sample {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: color-mix(in srgb, var(--text) 50%, var(--text-muted));
  padding: 6px 8px 6px 14px;
  border-radius: 6px;
}
.sample:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.sample.active {
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  border-left-color: var(--blue);
}
.sample:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}
.history-item {
  padding-left: 8px;
}
.history-text {
  display: grid;
  min-width: 0;
  flex: 1;
}
.history-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.small-button {
  margin-top: 12px;
  align-self: flex-start;
}

/* HTTP method label (sample list, operation line, documentation) */
.method {
  flex: none;
  min-width: 52px;
  text-align: center;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--method-text);
  background: var(--get);
}
.method.post {
  background: var(--post);
}
.method.patch {
  background: var(--patch);
}
.method.put {
  background: var(--put);
}
.method.delete {
  background: var(--delete);
}

/* 5 ── Content and request bar ──────────────────────────────────────────────────────────────────── */
.workspace {
  margin: var(--bar) 0 0 var(--sidebar-width);
  padding: 24px 32px 36px;
  max-width: 1440px;
  display: grid;
  gap: 16px;
}
.request-bar {
  display: flex;
  gap: 8px;
}
.request-bar select {
  width: 112px;
  flex: none;
  font-weight: 600;
}
.request-bar input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 13px;
  height: 37px;
}
.operation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -6px 0 0;
  min-height: 24px;
}
.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 30%, var(--surface));
  border-radius: 6px;
  padding: 8px 12px;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.toolbar.end {
  justify-content: flex-end;
}
.spacer {
  flex: 1;
}
.status {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 26px;
  margin-bottom: 8px;
}

/* 6 ── Cards, tabs, chips, badges ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 20px 18px;
  min-width: 0;
}
.card h3,
.card h2 {
  font-size: 15px;
  margin: 18px 0 8px;
}
.tab-list {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 0 0 14px;
  flex-wrap: wrap;
}
.tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  padding: 8px 12px;
  margin-bottom: -1px;
  font-weight: 600;
  white-space: nowrap;
}
.tab:hover {
  color: var(--ink);
}
.tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}
.tab:focus {
  outline: none;
}
.tab:focus-visible {
  background: var(--hover);
  color: var(--ink);
  border-radius: 6px 6px 0 0;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  border-radius: 14px;
  padding: 2px 12px;
  font-size: 13px;
}
.chip-remove {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0 2px;
  font-size: 16px;
  line-height: 1;
}
.badge {
  display: inline-block;
  border-radius: 10px;
  padding: 1px 10px;
  font-size: 12px;
  background: var(--surface-3);
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok {
  background: var(--success-soft);
  color: var(--green);
}
.badge.warn {
  background: var(--warning-soft);
  color: var(--amber);
}
.badge.error {
  background: var(--danger-soft);
  color: var(--red);
}
ul.scope-sets {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
ul.scope-sets li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
ul.scope-sets li:last-child {
  border-bottom: 0;
}
ul.scope-sets .chips {
  flex: 1;
}
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin: 12px 0;
}
.facts dt {
  color: var(--muted);
  white-space: nowrap;
}
.facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.empty {
  padding: 12px 8px;
  margin: 0;
  color: var(--muted);
}

/* 7 ── Tables ───────────────────────────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 8px 0 12px;
}
.grid {
  width: 100%;
  border-collapse: collapse;
}
.grid th,
.grid td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.grid tbody tr:last-child td {
  border-bottom: 0;
}
.grid th {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}
.grid td.narrow {
  width: 44px;
}
.grid td.wrap {
  overflow-wrap: anywhere;
}
.form-table td {
  vertical-align: middle;
}

/* 8 ── Forms and buttons ────────────────────────────────────────────────────────────────────────── */
.primary,
.secondary,
.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  border-radius: 6px;
  padding: 7px 16px;
  border: 1px solid var(--blue);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  flex: none;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color 0.12s,
    border-color 0.12s,
    color 0.12s;
}
.primary {
  background: var(--blue);
  color: var(--on-accent);
}
.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.secondary {
  background: var(--surface);
  color: var(--blue);
}
.secondary:hover:not(:disabled) {
  background: var(--hover);
}
.danger {
  background: var(--surface);
  color: var(--red);
  border-color: var(--red);
}
.danger:hover:not(:disabled) {
  background: var(--danger-soft);
}
.primary:focus-visible,
.secondary:focus-visible,
.danger:focus-visible,
.icon-close:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.primary:disabled,
.secondary:disabled,
.danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
a.primary:hover,
a.secondary:hover {
  text-decoration: none;
}
input,
select,
textarea {
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--input-bg);
  color: var(--ink);
  width: 100%;
}
select {
  height: 37px;
  padding: 6px 10px;
}
textarea {
  resize: vertical;
}
textarea:disabled {
  background: var(--surface-2);
  color: var(--muted);
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--focus) 35%, var(--surface));
  border-color: var(--blue);
}
/* The file input stays reachable through its label ("Send a file instead"). */
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.file-input:focus-visible + .chip,
.file-input:focus-visible {
  outline: 2px solid var(--blue);
}
.icon-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}
.icon-close:hover {
  background: var(--surface-3);
  color: var(--ink);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 18px;
}
.check input {
  width: auto;
}
/* Language switch of the code snippets */
.segmented {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
}
.segmented button {
  border: 0;
  border-right: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--muted);
  padding: 6px 14px;
  font-weight: 600;
}
.segmented button:last-child {
  border-right: 0;
}
.segmented button.active {
  background: var(--accent-soft);
  color: var(--accent-soft-text);
}
.segmented button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

/* 9 ── Code, JSON and documentation ─────────────────────────────────────────────────────────────── */
.code {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
}
pre.code {
  margin: 0;
  padding: 14px 16px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: auto;
  max-height: 70vh;
  white-space: pre;
  tab-size: 2;
}
textarea.code {
  white-space: pre;
  overflow-wrap: normal;
}
.j-key {
  color: var(--json-key);
  font-weight: 600;
}
.j-string {
  color: var(--json-string);
}
.j-number {
  color: var(--json-number);
}
.j-boolean,
.j-null {
  color: var(--json-literal);
}
.preview-image {
  max-width: 100%;
  max-height: 60vh;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.route {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}
.route code,
.doc code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--code-bg);
  border-radius: 4px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
}
.doc {
  max-width: 980px;
}
.doc h1,
.doc h2,
.doc h3,
.doc h4,
.doc h5 {
  font-size: 15px;
  margin: 18px 0 6px;
}
.doc h2 {
  font-size: 17px;
}
.doc p,
.doc ul,
.doc ol {
  margin: 6px 0 10px;
}
.doc pre.code code {
  background: none;
  padding: 0;
}
.confirm-request {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  background: var(--code-bg);
  border-radius: 6px;
  padding: 8px 10px;
  overflow-wrap: anywhere;
}

/* 10 ── Confirmation dialog ─────────────────────────────────────────────────────────────────────── */
.confirm {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  width: min(520px, calc(100% - 32px));
  box-shadow: 0 10px 40px var(--shadow);
  color: var(--ink);
  background: var(--surface);
}
.confirm::backdrop {
  background: var(--overlay);
}
.confirm h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

/* 11 ── Narrow screens: the sidebar slides in from the left (☰), like in the other portals ──────────── */
@media (max-width: 900px) {
  .topbar {
    padding: 0 14px;
  }
  .mobile-only {
    display: inline-flex;
  }
  .brand-divider,
  .brand span,
  .account-name {
    display: none;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.15s;
    box-shadow: 10px 0 30px var(--shadow);
    width: min(var(--sidebar-width), 88vw);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .workspace {
    margin-left: 0;
    padding: 16px;
  }
  .card {
    padding: 12px 14px 16px;
  }
}
@media (max-width: 560px) {
  .request-bar {
    flex-wrap: wrap;
  }
  .request-bar select {
    width: 100px;
  }
  .request-bar input {
    flex-basis: calc(100% - 108px);
  }
  .request-bar .primary {
    width: 100%;
  }
  .facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .facts dd {
    margin-bottom: 8px;
  }
}
