.kb-manager {
  --kb-blue: #0756a4;
  --kb-cyan: #00a3c7;
  --kb-green: #19b388;
  --kb-ink: #1f2d3d;
  --kb-muted: #64748b;
  --kb-line: #d7e2ee;
  --kb-soft: #eef6ff;
  color: var(--kb-ink);
  font-family: var(--goldrake-font-sans);
}

.kb-manager.kb-font-goldrake {
  font-family: "Goldrake Sans", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

.kb-manager.kb-public-mode {
  --kb-blue: #0756a4;
  --kb-cyan: #00a3c7;
}

.kb-hero {
  position: relative;
  overflow: hidden;
  padding: 1.75rem;
  background:
    radial-gradient(circle at 88% 14%, rgba(8, 168, 201, .18), transparent 26%),
    radial-gradient(circle at 10% 8%, rgba(13, 110, 253, .16), transparent 30%),
    linear-gradient(135deg, #f7fbff 0%, #eaf5ff 100%);
  border: 1px solid var(--kb-line);
  border-radius: 10px;
  box-shadow: 0 16px 42px rgba(30, 64, 105, .08);
  margin-bottom: 1.15rem;
}

.kb-public-mode .kb-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr);
  gap: 1.25rem;
  align-items: center;
  padding: 1.6rem;
  border: 0;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(7,86,164,.96), rgba(0,163,199,.88)),
    linear-gradient(45deg, rgba(255,255,255,.18), rgba(255,255,255,0));
  box-shadow: 0 18px 42px rgba(23, 50, 77, .16);
}

.kb-public-mode .kb-hero-contours {
  position: absolute;
  right: 22%;
  bottom: 5%;
  z-index: 0;
  width: min(50vw, 760px);
  max-height: 86%;
  opacity: .36;
  object-fit: contain;
  pointer-events: none;
  mix-blend-mode: screen;
}

.kb-public-mode .kb-hero-content {
  color: #fff;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.kb-public-mode .kb-hero-logo-wrap {
  align-items: center;
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(23, 50, 77, .1);
  display: inline-flex;
  justify-content: center;
  margin: 0 0 .7rem;
  max-width: min(320px, 100%);
  padding: .38rem .6rem;
  width: fit-content;
}

.kb-public-mode .kb-hero-logo-wrap img {
  display: block;
  max-height: 48px;
  max-width: 235px;
  object-fit: contain;
  width: auto;
}

.kb-public-mode .kb-hero-eyebrow {
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 999px;
  color: rgba(255, 255, 255, .92);
  display: inline-flex;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .03em;
  margin: 0 0 .75rem;
  padding: .35rem .6rem;
  text-transform: uppercase;
}

.kb-public-mode .kb-hero h4 {
  color: #fff;
  font-size: clamp(1.9rem, 3.5vw, 3rem);
  font-weight: 800;
  line-height: 1.04;
  margin-bottom: 0 !important;
  max-width: 760px;
}

.kb-public-mode .kb-hero .text-muted {
  color: rgba(255, 255, 255, .88) !important;
  font-size: 1.08rem;
  line-height: 1.55;
  margin-top: 1rem;
  max-width: 720px;
}

.kb-public-mode .kb-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1rem;
}

.kb-public-mode .kb-hero-btn {
  align-items: center;
  border-radius: 4px;
  display: inline-flex;
  font-size: .92rem;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: .62rem 1.05rem;
  text-decoration: none;
}

.kb-public-mode .kb-hero-btn-primary {
  background: #fff;
  border: 1px solid #fff;
  color: var(--kb-blue);
}

.kb-public-mode .kb-hero-btn-light {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .42);
  color: #fff;
}

.kb-public-mode .kb-hero-btn:hover,
.kb-public-mode .kb-hero-btn:focus {
  filter: brightness(.98);
  text-decoration: none;
}

.kb-public-mode .kb-search {
  align-self: center;
  background: rgba(255, 255, 255, .94);
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(23, 50, 77, .12);
  gap: .55rem;
  margin-top: 0 !important;
  max-width: none;
  padding: 1rem;
  position: relative;
  z-index: 1;
  transition: background-color .2s ease, box-shadow .2s ease, padding .2s ease;
}

.kb-public-mode .kb-search:not(.is-open) {
  display: flex;
  justify-self: end;
  width: fit-content;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.kb-search-toggle {
  display: none;
}

.kb-public-mode .kb-search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, .52);
  border-radius: 999px;
  background: #fff;
  color: var(--kb-blue);
  box-shadow: 0 16px 34px rgba(23, 50, 77, .18);
  font-size: 1.15rem;
  transition: transform .15s ease, box-shadow .15s ease;
}

.kb-public-mode .kb-search-toggle:hover,
.kb-public-mode .kb-search-toggle:focus {
  transform: translateY(-1px);
  box-shadow: 0 18px 38px rgba(23, 50, 77, .24);
}

.kb-public-mode .kb-search.is-open .kb-search-toggle {
  display: none;
}

.kb-public-mode .kb-search:not(.is-open) .kb-search-box,
.kb-public-mode .kb-search:not(.is-open) .kb-search-submit,
.kb-public-mode .kb-search:not(.is-open) .kb-reset-btn {
  width: 0;
  min-width: 0;
  max-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.kb-public-mode .kb-search::before {
  content: "Ricerca";
  color: #566b80;
  font-size: .86rem;
  font-weight: 800;
  grid-column: 1 / -1;
}

.kb-public-mode .kb-search:not(.is-open)::before {
  display: none;
}

.kb-public-mode .kb-search .form-control {
  min-height: 48px;
  border-color: #d2deea;
  box-shadow: none;
}

.kb-public-mode .kb-search-submit,
.kb-public-mode .kb-reset-btn {
  min-height: 48px;
  border-color: var(--kb-blue);
  background: var(--kb-blue);
  color: #fff;
  font-weight: 800;
}

.kb-public-mode .kb-search-submit:hover,
.kb-public-mode .kb-search-submit:focus,
.kb-public-mode .kb-reset-btn:hover,
.kb-public-mode .kb-reset-btn:focus {
  border-color: #064a8d;
  background: #064a8d;
  color: #fff;
}

.kb-public-mode .kb-public-reset-btn {
  background: #fff;
  color: var(--kb-blue);
}

.kb-public-section-head {
  display: grid;
  grid-template-columns: minmax(0, .7fr) minmax(280px, .55fr);
  align-items: center;
  gap: 1.25rem;
  margin: 1.45rem 0 1rem;
  padding: 1.05rem 1.15rem;
  border: 1px solid rgba(7, 86, 164, .12);
  border-radius: 8px;
  background: rgba(255, 255, 255, .66);
  box-shadow: 0 12px 28px rgba(23, 50, 77, .06);
}

.kb-public-section-head span {
  display: inline-flex;
  margin-bottom: .25rem;
  color: var(--kb-blue);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.kb-public-section-head h2 {
  margin: 0;
  color: var(--kb-ink);
  font-size: clamp(1.45rem, 2vw, 1.9rem);
  font-weight: 800;
  line-height: 1.12;
}

.kb-public-section-head p {
  max-width: 560px;
  margin: 0;
  color: var(--kb-muted);
  font-size: .98rem;
  line-height: 1.5;
  text-align: left;
  justify-self: end;
}

.kb-hero h4 {
  color: #13263a;
  font-size: 1.75rem;
  font-weight: 800;
}

.kb-search {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  max-width: 880px;
}

.kb-search-box {
  position: relative;
}

.kb-search .form-control {
  min-height: 52px;
  border-color: #c8d6e5;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(31, 45, 61, .05);
  font-size: 1rem;
  padding-left: 2.75rem;
}

.kb-search-box .fa-search,
.kb-search-box .fa-magnifying-glass {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--kb-muted);
}

.kb-reset-btn {
  min-width: 112px;
  min-height: 52px;
  border-radius: 8px;
}

.kb-scope-toggle {
  display: inline-flex;
  gap: .25rem;
  background: rgba(255, 255, 255, .78);
  border: 1px solid #d4e0eb;
  border-radius: 999px;
  padding: .25rem;
}

.kb-scope-toggle button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  color: var(--kb-muted);
  font-weight: 700;
  padding: .38rem .85rem;
}

.kb-scope-toggle button.active {
  background: var(--kb-blue);
  color: #fff;
  box-shadow: 0 7px 18px rgba(13, 110, 253, .2);
}

.kb-shell {
  display: grid;
  grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
  gap: 1.15rem;
  align-items: start;
}

.kb-panel {
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--kb-line);
  border-radius: 10px;
  box-shadow: 0 18px 45px rgba(15, 35, 55, .08);
}

.kb-sidebar {
  padding: 1.15rem;
  position: sticky;
  top: 1rem;
}

.kb-sidebar-title {
  color: #475569;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .06em;
  margin-bottom: .85rem;
  text-transform: uppercase;
}

.kb-section-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: .65rem;
  align-items: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 9px;
  color: var(--kb-ink);
  margin-bottom: .45rem;
  padding: .72rem .75rem;
  text-align: left;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.kb-section-btn:hover,
.kb-section-btn.active {
  background: #eaf4ff;
  border-color: #cfe4ff;
  color: var(--kb-blue);
  transform: translateY(-1px);
}

.kb-section-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: #eef6ff;
  color: var(--kb-blue);
}

.kb-section-btn.active .kb-section-icon {
  background: var(--kb-blue);
  color: #fff;
}

.kb-section-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-section-count {
  min-width: 28px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #d4e0eb;
  color: #475569;
  font-size: .76rem;
  font-weight: 800;
  padding: .12rem .45rem;
  text-align: center;
}

.kb-content {
  min-width: 0;
}

.kb-article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1rem;
}

.kb-article-card {
  position: relative;
  overflow: hidden;
  min-height: 188px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--kb-line);
  border-radius: 10px;
  color: var(--kb-ink);
  padding: 1.15rem;
  text-decoration: none;
  box-shadow: 0 12px 34px rgba(15, 35, 55, .08);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.kb-article-card:before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--kb-blue), var(--kb-cyan), var(--kb-green));
}

.kb-article-card-glow {
  position: absolute;
  right: -34px;
  top: -34px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: rgba(13, 110, 253, .08);
  pointer-events: none;
}

.kb-article-card:hover {
  border-color: #9fcbff;
  box-shadow: 0 18px 45px rgba(13, 110, 253, .14);
  color: var(--kb-ink);
  transform: translateY(-2px);
}

.kb-article-card-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}

.kb-doc-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #ecf5ff;
  color: var(--kb-blue);
}

.kb-section-tag {
  background: #f7fafc;
  border: 1px solid #d9e3ef;
  color: #1f2d3d;
}

.kb-article-card-title {
  position: relative;
  z-index: 1;
  color: #172536;
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: .5rem;
}

.kb-article-card-text {
  position: relative;
  z-index: 1;
  color: var(--kb-muted);
  flex: 1;
  font-size: .95rem;
  line-height: 1.48;
}

.kb-article-card-action {
  position: relative;
  z-index: 1;
  color: var(--kb-blue);
  font-weight: 800;
  margin-top: 1rem;
}

.kb-article {
  padding: 1.35rem;
}

.kb-article-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.kb-article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 250px);
  gap: 1.35rem;
  align-items: start;
}

.kb-article-body {
  color: var(--kb-ink);
  line-height: 1.65;
  font-size: 1rem;
  min-width: 0;
  scroll-behavior: smooth;
}

.kb-article-body h1,
.kb-article-body h2,
.kb-article-body h3 {
  scroll-margin-top: 1rem;
  margin-top: 1.25rem;
  margin-bottom: .65rem;
}

.kb-article-toc {
  position: sticky;
  top: 1rem;
  border-left: 3px solid #d7e8ff;
  background: #f7fbff;
  border-radius: 8px;
  padding: 1rem;
}

.kb-article-toc-title {
  color: #475569;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .06em;
  margin-bottom: .7rem;
  text-transform: uppercase;
}

.kb-article-toc a {
  display: block;
  color: #31506f;
  font-size: .9rem;
  line-height: 1.25;
  margin-bottom: .48rem;
  text-decoration: none;
}

.kb-article-toc a:hover {
  color: var(--kb-blue);
}

.kb-article-toc a.level-2 {
  padding-left: .65rem;
}

.kb-article-toc a.level-3 {
  font-size: .84rem;
  padding-left: 1.25rem;
}

.kb-article-body pre {
  background: #15202b;
  color: #f8fafc;
  padding: 1rem;
  border-radius: 6px;
  overflow: auto;
}

.kb-article-body code {
  background: #eef2f7;
  padding: .1rem .3rem;
  border-radius: 4px;
}

.kb-article-body pre code {
  background: transparent;
  padding: 0;
}

.kb-editor {
  border-top: 1px solid var(--kb-line);
  background: #fbfdff;
  padding: 1rem;
}

.kb-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}

.kb-markdown-input {
  min-height: 420px;
  font-family: Consolas, "Courier New", monospace;
  resize: vertical;
}

.kb-preview {
  min-height: 420px;
  background: #fff;
  border: 1px solid var(--kb-line);
  border-radius: 6px;
  padding: 1rem;
  overflow: auto;
}

.kb-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .6rem;
}

.kb-empty {
  padding: 2rem;
  text-align: center;
  color: var(--kb-muted);
  border: 1px dashed var(--kb-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .74);
}

@media (max-width: 991.98px) {
  .kb-public-mode .kb-hero {
    grid-template-columns: 1fr;
    padding: 1.2rem;
  }

  .kb-public-mode .kb-hero-contours {
    right: -8%;
    bottom: 4%;
    width: min(86vw, 620px);
    opacity: .16;
  }

  .kb-public-section-head {
    display: block;
  }

  .kb-public-section-head p {
    max-width: none;
    margin-top: .35rem;
    text-align: left;
  }

  .kb-shell,
  .kb-editor-grid,
  .kb-article-layout {
    grid-template-columns: 1fr;
  }

  .kb-sidebar {
    position: static;
  }

  .kb-article-toc {
    position: static;
    order: -1;
  }

  .kb-search {
    grid-template-columns: 1fr;
  }

  .kb-reset-btn {
    width: 100%;
  }

  .kb-public-mode .kb-search:not(.is-open) {
    justify-self: start;
  }
}
