html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.logo-navbar{
  width: 32px;
  height: 32px;
}

/* Purple theme color tokens */
:root {
    --purple-primary: #6f42c1;
    --purple-hover: #59339d;
    --purple-subtle: #f3f0ff;
}
.text-purple { color: var(--purple-primary) !important; }
.bg-purple { background-color: var(--purple-primary) !important; }
.bg-purple-subtle { background-color: var(--purple-subtle) !important; }

.btn-purple {
    background-color: var(--purple-primary);
    color: #fff;
    border: 1px solid var(--purple-primary);
}
.btn-purple:hover, .btn-purple:focus {
    background-color: var(--purple-hover);
    color: #fff;
    border-color: var(--purple-hover);
}
.btn-outline-purple {
    color: var(--purple-primary);
    border-color: var(--purple-primary);
}
.btn-outline-purple:hover {
    background-color: var(--purple-primary);
    color: #fff;
}
/* Pagination in the purple theme (Audit Log, Find a Company). */
.pagination {
    --bs-pagination-color: var(--purple-primary);
    --bs-pagination-hover-color: var(--purple-hover);
    --bs-pagination-hover-bg: var(--purple-subtle);
    --bs-pagination-focus-color: var(--purple-hover);
    --bs-pagination-focus-bg: var(--purple-subtle);
    --bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(111, 66, 193, 0.25);
    --bs-pagination-active-bg: var(--purple-primary);
    --bs-pagination-active-border-color: var(--purple-primary);
}
.nav-link:hover {
    color: var(--purple-primary) !important;
}
/* Prevent link color bleed in dark footer */
.text-white-hover {
    transition: color 0.15s ease-in-out;
}
.text-white-hover:hover {
    color: #fff !important;
}

.app-sidebar {
  min-height: calc(100vh - 65px);
  background-color: #f8f9fa;
}
.app-sidebar-inner {
  top: 80px;
}
/* On desktop the sidebar sticks beside the content; cap it to the viewport so
   its own items scroll instead of being reachable only at the page bottom. */
@media (min-width: 768px) {
  .app-sidebar-inner {
    max-height: calc(100vh - 80px - 1rem);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
  }
  /* Scrollbar stays invisible until the pointer is over the sidebar. Only its colour changes,
     so the content doesn't shift sideways when it appears. */
  @supports (scrollbar-color: auto) {
    .app-sidebar-inner {
      scrollbar-width: thin;
      scrollbar-color: transparent transparent;
    }
    .app-sidebar-inner:hover {
      scrollbar-color: #ced4da transparent;
    }
  }
  /* Browsers without scrollbar-color (older Safari). */
  @supports not (scrollbar-color: auto) {
    .app-sidebar-inner::-webkit-scrollbar {
      width: 6px;
    }
    .app-sidebar-inner::-webkit-scrollbar-thumb {
      background-color: transparent;
      border-radius: 3px;
    }
    .app-sidebar-inner:hover::-webkit-scrollbar-thumb {
      background-color: #ced4da;
    }
  }
}
.sidebar-section-header {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8c98a4;
  padding: 0.75rem 1rem 0.35rem 1rem;
}
.app-sidebar .nav-link {
  color: #495057;
  font-weight: 500;
  font-size: 0.88rem;
  padding: 0.55rem 1rem;
  border-radius: 0.5rem;
  margin: 0.1rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.15s ease-in-out;
}
.app-sidebar .nav-link i {
  font-size: 1.05rem;
  color: #6c757d;
  transition: color 0.15s ease-in-out;
}
.app-sidebar .nav-link:hover {
  color: var(--purple-primary);
  background-color: var(--purple-subtle);
}
.app-sidebar .nav-link:hover i {
  color: var(--purple-primary);
}
.app-sidebar .nav-link.active {
  color: var(--purple-primary);
  background-color: var(--purple-subtle);
  font-weight: 600;
}
.app-sidebar .nav-link.active i {
  color: var(--purple-primary);
}

/* Top navbar links (_Layout): the same look as the sidebar's, so the current section reads the same way in both. */
.navbar .navbar-nav .top-nav-link {
  padding: 0.45rem 0.85rem;
  margin: 0.1rem 0.15rem;
  border-radius: 0.5rem;
  transition: all 0.15s ease-in-out;
}
.navbar .navbar-nav .top-nav-link:hover {
  background-color: var(--purple-subtle);
}
.navbar .navbar-nav .top-nav-link.active {
  color: var(--purple-primary) !important;
  background-color: var(--purple-subtle);
  font-weight: 600;
}

/* Sidebar collapse toggle (_AppLayout). Only offered from md up; on phones the sidebar stacks above the content. */
.sidebar-toggle-row {
  justify-content: flex-end;
  padding: 0.5rem 0.75rem 0.25rem;
}
.sidebar-toggle {
  color: #6c757d;
  line-height: 1;
}
.sidebar-toggle:hover {
  color: var(--purple-primary);
  background-color: var(--purple-subtle);
}
.app-sidebar .nav-link {
  position: relative;
}
/* Collapsed: a narrow icon rail; the content column takes the rest of the width. */
@media (min-width: 768px) {
  .app-shell.sidebar-collapsed > .app-sidebar {
    width: 4.5rem;
  }
  .app-shell.sidebar-collapsed > main {
    flex: 1 1 0;
    width: auto;
    max-width: none;
  }
  /* The scrollbar's space is on the right only; reserve the same on the left so the icons stay centred. */
  .app-shell.sidebar-collapsed .app-sidebar-inner {
    scrollbar-gutter: stable both-edges;
  }
  .app-shell.sidebar-collapsed .sidebar-toggle-row {
    justify-content: center;
    padding: 0.5rem 0 0.25rem;
  }
  .app-shell.sidebar-collapsed .sidebar-toggle i {
    display: inline-block;
    transform: scaleX(-1);
  }
  /* Section names become a thin divider between groups. */
  .app-shell.sidebar-collapsed .sidebar-section-header {
    font-size: 0;
    padding: 0;
    margin: 0.5rem 1rem;
    border-top: 1px solid #dee2e6;
  }
  .app-shell.sidebar-collapsed .app-sidebar .nav-link {
    justify-content: center;
    padding: 0.55rem 0;
    margin: 0.1rem 0.5rem;
  }
  .app-shell.sidebar-collapsed .app-sidebar .nav-link > span:not(.badge) {
    display: none;
  }
  /* Counters sit on the icon's corner. */
  .app-shell.sidebar-collapsed .app-sidebar .nav-link > .badge {
    position: absolute;
    top: 0.1rem;
    right: 0.35rem;
    font-size: 0.6rem;
    padding: 0.2em 0.45em;
  }
}

/* Trust-profile section forms (Pages/App/Profile). */
.section-icon { width: 32px; height: 32px; flex: 0 0 auto; }

.request-card {
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.request-card:hover {
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}
.org-avatar {
  width: 42px;
  height: 42px;
  font-weight: 600;
  font-size: 1.05rem;
}
/* Smaller avatar for dense lists (directory search results). */
.org-avatar-sm {
  width: 36px;
  height: 36px;
  font-size: 0.95rem;
}
.message-quote {
  background-color: var(--bs-light);
  border-left: 3px solid var(--purple-primary);
}
/* Round icon badge on empty states: fixed square so the circle doesn't follow the glyph's shape. */
.empty-state-icon {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
}
.empty-state-icon > .bi {
  line-height: 1;
}
/* Organization name that opens its trust profile. */
.org-link {
  color: var(--purple-primary);
  text-decoration: none;
}
.org-link:hover, .org-link:focus {
  color: var(--purple-hover);
  text-decoration: underline;
}
/* Sign-in and registration pages (Pages/Account/Login, Register). */
.auth-wrapper {
  max-width: 560px;
  margin: 2.5rem auto;
}
.auth-card {
  border: 1px solid var(--bs-border-color-translucent);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
}
.auth-card .form-control:focus {
  border-color: var(--purple-primary);
  box-shadow: 0 0 0 0.25rem rgba(111, 66, 193, 0.12);
}
/* Help pages (Pages/Help). */
.help-doc { font-size: 0.95rem; line-height: 1.7; color: #343a40; }
.help-doc h2 { font-size: 1.1rem; font-weight: 700; margin-top: 1.75rem; margin-bottom: 0.6rem; color: #212529; }
.help-doc > h2:first-child { margin-top: 0; }
.help-doc p, .help-doc li { margin-bottom: 0.5rem; }
.help-doc .list-group-item, .help-doc .row > li { margin-bottom: 0; }
.help-doc table { font-size: 0.88rem; }
.help-ui { font-weight: 600; color: #212529; }
.help-toc { position: sticky; top: 90px; font-size: 0.85rem; }
.help-toc a { color: #495057; text-decoration: none; display: block; padding: 0.25rem 0.5rem; border-radius: 0.375rem; }
.help-toc a:hover { color: var(--purple-primary); }
.help-toc a.active { color: var(--purple-primary); background-color: var(--purple-subtle); font-weight: 600; }
@media print {
  header.sticky-top, footer, .help-nav { display: none !important; }
}

/* Admin panel's platform-wide announcement bar under the navbar (_Layout). Long words or links in the text wrap
   instead of widening the page. */
.site-announcement {
    overflow-wrap: anywhere;
}

/* Stage tracker: where something stands in a fixed flow (Approvals, Deal Room). Steps before the current one are done, the
   current one is highlighted, later ones are dimmed. */
    .stage-track { display: flex; list-style: none; padding: 0; margin: 0; }
    .stage-track li { flex: 1 1 0; position: relative; text-align: center; font-size: 0.78rem; color: #8c98a4; }
    .stage-track li::before {
        content: ''; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px; background: #e9ecef; z-index: 0;
    }
    .stage-track li:first-child::before { display: none; }
    .stage-track .stage-dot {
        position: relative; z-index: 1; width: 32px; height: 32px; margin: 0 auto 0.35rem;
        display: flex; align-items: center; justify-content: center;
        border-radius: 50%; background: #fff; border: 2px solid #dee2e6; color: #adb5bd;
    }
    .stage-track li.done { color: #495057; }
    .stage-track li.done::before, .stage-track li.current::before { background: var(--purple-primary); }
    .stage-track li.done .stage-dot { background: var(--purple-primary); border-color: var(--purple-primary); color: #fff; }
    .stage-track li.current { color: var(--purple-primary); font-weight: 600; }
    .stage-track li.current .stage-dot { border-color: var(--purple-primary); color: var(--purple-primary); background: var(--purple-subtle); }

/* Expandable history rows (Approvals version history, Deal Room offer history): a summary line per item, details below. */
    .version-history summary { list-style: none; cursor: pointer; }
    .version-history summary::-webkit-details-marker { display: none; }
    .version-history details[open] .bi-chevron-right { transform: rotate(90deg); }
    .version-history .bi-chevron-right { transition: transform 0.15s ease-in-out; display: inline-block; }

/* Inner navigation of a deal room: a vertical list beside the content on wide screens, a row of pills above it on narrow ones. */
.room-nav { top: 5rem; z-index: 2; }
.room-nav .nav-link { border-radius: .5rem; padding: .5rem .75rem; font-size: .9rem; }
.room-nav .nav-link:not(.active):not(.disabled):hover { background: var(--bs-tertiary-bg); }
.room-nav .nav-link.active { background: var(--purple-primary); color: #fff; }
.room-nav .nav-link.active .badge { background: #fff !important; color: var(--purple-primary) !important; }
@media (max-width: 991.98px) { .room-nav { position: static !important; } }

/* Filter pills above a list of deals or conditions: the chosen one is filled. */
.deal-filter.active { background: var(--purple-primary); border-color: var(--purple-primary); color: #fff; }

/* Dashboard */
.text-purple-primary { color: var(--purple-primary) !important; }
.border-purple-subtle { border-color: var(--purple-subtle) !important; }
.stat-card {
    transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08) !important;
}
.dash-bars { display: flex; align-items: flex-end; gap: 2px; height: 96px; border-bottom: 1px solid var(--bs-border-color); }
.dash-bar { flex: 1 1 0; min-width: 2px; display: flex; align-items: flex-end; height: 100%; }
.dash-bar span { display: block; width: 100%; background: var(--purple-primary); border-radius: 3px 3px 0 0; }
.dash-bar:hover span { background: var(--purple-hover); }
.dash-share { height: 6px; background: var(--bs-secondary-bg); border-radius: 3px; overflow: hidden; }
.dash-share span { display: block; height: 100%; background: var(--purple-primary); border-radius: 3px; }
.dash-num { font-variant-numeric: tabular-nums; }
