:root {
  --primary: #961622;
  --primary-dark: #78121b;
  --primary-light: #b8222e;
  --primary-soft: #fff1f3;
  --primary-line: #eab9c1;
  --navy: #061b38;
  --blue: #1458d4;
  --blue-soft: #edf5ff;
  --gold: #c9a44c;
  --bg: #f7faff;
  --card: #ffffff;
  --border: #dde6f2;
  --text: #071a36;
  --text-soft: #64748b;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 18px 45px rgba(15, 30, 60, 0.08);
  --radius: 8px;
  --radius-lg: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 0; }
body {
  background:
    radial-gradient(circle at top left, rgba(20, 88, 212, 0.08), transparent 32rem),
    linear-gradient(135deg, #fbfdff 0%, var(--bg) 48%, #ffffff 100%);
  font-family: 'Rubik', sans-serif;
  color: var(--text);
  min-height: 0;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5 {
  font-family: 'Rubik', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0;
}

/* SHELL: full width, breathable */
.kb-shell {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem clamp(.85rem, 1.7vw, 1.65rem) .85rem;
}

/* HEADER */
.kb-header {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(.95rem, 2vw, 1.25rem);
  margin-bottom: .85rem;
  box-shadow: var(--shadow-lg);
}
.kb-header::before {
  content: "";
  position: absolute; inset: -2px;
  background:
    linear-gradient(90deg, rgba(150, 22, 34, 0.09), transparent 42%),
    radial-gradient(500px 160px at 0% 0%, rgba(20, 88, 212, 0.08), transparent 68%);
  pointer-events: none;
}
.kb-header-top {
  position: relative;
  display: flex;
  align-items: center;
  gap: .9rem;
  min-width: 0;
}
.kb-logo {
  flex: 0 0 auto;
  width: 124px;
  height: 54px;
  object-fit: contain;
  background: rgba(255,255,255,0.96);
  border-radius: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(221, 230, 242, 0.95);
  box-shadow: 0 10px 24px rgba(15, 30, 60, 0.08);
}

body.kb-embedded .kb-logo {
  display: none;
}
.kb-title-block {
  min-width: 0;
}
.kb-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-bottom: .25rem;
}
.kb-suite-link {
  min-height: 26px;
  border: 1px solid rgba(221, 230, 242, 0.92);
  border-radius: 8px;
  padding: 0 .55rem;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-size: .62rem;
  font-weight: 300;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.kb-suite-link:hover {
  color: var(--blue);
  border-color: rgba(20, 88, 212, 0.26);
}
.kb-breadcrumb {
  min-height: 26px;
  border: 1px solid rgba(221, 230, 242, 0.92);
  border-radius: 8px;
  padding: 0 .6rem;
  color: #53657d;
  background: #f7fbff;
  font-size: .62rem;
  font-weight: 300;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.kb-header h1 {
  color: var(--text);
  font-size: clamp(1.05rem, 1.5vw, 1.35rem);
  font-weight: 300;
  margin: 0 0 .2rem;
}
.kb-header p {
  margin: 0;
  color: var(--text-soft);
  font-size: .68rem;
  font-weight: 300;
  line-height: 1.45;
  max-width: 780px;
}

/* SEARCH BAR */
.kb-search-wrap {
  margin-top: .8rem;
  position: relative;
  max-width: 820px;
}
.kb-search-wrap i.bi-search {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: #8a9ab3; font-size: .78rem;
}
.kb-search-wrap input {
  width: 100%;
  min-height: 34px;
  padding: .45rem .8rem .45rem 2.35rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: .68rem;
  font-weight: 300;
  color: var(--text);
  box-shadow: 0 8px 18px rgba(15, 30, 60, 0.05);
  outline: none;
  transition: box-shadow .2s ease, transform .2s ease;
}
.kb-search-wrap input:focus {
  box-shadow: 0 0 0 3px rgba(20, 88, 212, 0.14), var(--shadow-md);
}

/* LAYOUT: wider sidebar + spacious main */
.kb-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: .85rem;
  align-items: start;
}
@media (max-width: 1024px) {
  .kb-layout { grid-template-columns: 1fr; }
}

/* SIDEBAR */
.kb-side {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem;
  position: sticky; top: 1rem;
  height: fit-content;
  box-shadow: var(--shadow-lg);
}
.kb-side h6 {
  text-transform: uppercase;
  font-size: .56rem;
  color: var(--text-soft);
  letter-spacing: .08em;
  font-weight: 300;
  margin: .1rem .3rem .55rem;
}
.kb-cat-btn {
  display: flex; align-items: center; gap: .5rem;
  width: 100%;
  background: transparent; border: none;
  border-radius: 8px;
  padding: .45rem .5rem;
  font-size: .66rem;
  font-weight: 300;
  color: #425672;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.kb-cat-btn:hover { background: #f4f8ff; }
.kb-cat-btn.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 300;
}
.kb-cat-btn i { font-size: .76rem; opacity: .9; }
.kb-cat-btn .kb-count {
  margin-left: auto;
  font-size: .56rem;
  background: #eef3f9; color: #53657d;
  padding: 1px 7px; border-radius: 999px;
  font-weight: 300;
}
.kb-cat-btn.active .kb-count { background: var(--blue); color: #fff; }

/* MAIN: results grid (2 columns on wide screens, 1 on mid/small) */
.kb-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: .75rem;
}
@media (max-width: 720px) {
  .kb-results { grid-template-columns: 1fr; }
}

/* CARD */
.kb-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem .95rem;
  box-shadow: 0 10px 24px rgba(15, 30, 60, 0.05);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
  position: relative;
  overflow: hidden;
}
.kb-card::before {
  content: "";
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--primary), var(--blue));
  opacity: .72;
}
.kb-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: rgba(20, 88, 212, 0.24);
}
.kb-card.kb-focus {
  border-color: rgba(150, 22, 34, 0.46);
  box-shadow: 0 0 0 3px rgba(150, 22, 34, 0.08), var(--shadow-md);
}
.kb-card h5 {
  margin: 0 0 .42rem 0;
  font-size: .78rem;
  font-weight: 300;
  display: flex; align-items: center; gap: .5rem;
  color: var(--text);
  padding-left: .25rem;
  line-height: 1.35;
}
.kb-card h5 i { color: var(--blue); font-size: .74rem; }
.kb-card .kb-tags {
  display: flex; gap: .3rem; flex-wrap: wrap;
  margin: .2rem 0 .55rem;
  padding-left: .25rem;
}
.kb-tag {
  font-size: .52rem;
  font-weight: 300;
  text-transform: none;
  letter-spacing: 0;
  padding: 2px 7px; border-radius: 999px;
  background: #f7fbff; color: #425672;
  border: 1px solid #dbe7f7;
}
.kb-card details { cursor: pointer; padding-left: .25rem; }
.kb-card details summary {
  list-style: none; outline: none;
  color: var(--blue);
  font-size: .64rem; font-weight: 300;
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .15rem 0;
}
.kb-card details summary::-webkit-details-marker { display: none; }
.kb-card details summary i { transition: transform .2s ease; }
.kb-card details[open] summary i { transform: rotate(90deg); }

.kb-body {
  padding: .65rem .25rem 0;
  color: #425672;
  font-size: .68rem;
  font-weight: 300;
  line-height: 1.58;
}
.kb-body p { margin: 0 0 .55rem; }
.kb-body ul, .kb-body ol { padding-left: 1rem; margin: .2rem 0 .55rem; }
.kb-body li { margin-bottom: .28rem; }
.kb-body strong, .kb-body b { color: var(--text); font-weight: 400; }
.kb-body code {
  background: #f3f6fb; padding: 1px 5px; border-radius: 6px;
  font-size: .9em; color: var(--primary-dark);
}

/* HIGHLIGHT */
mark {
  background: linear-gradient(180deg, transparent 55%, #ffe28a 55%);
  padding: 0 2px; border-radius: 3px; color: inherit;
}

/* EMPTY STATE */
.kb-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-soft);
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: .72rem;
  font-weight: 300;
}
.kb-empty i { color: #cbd5e1; }

/* SCROLLBARS */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

@media (max-width: 720px) {
  .kb-header-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .kb-logo {
    width: 118px;
    height: 52px;
  }
}
