:root {
  --app-header-height: 65px;
  --app-sidebar-width: 280px;
  --app-bg: #f5f7fb;
  --app-border: #e6e9ef;
  --app-primary: #0d6efd;
}

html, body { height: 100%; }
body {
  min-height: 100vh;
  background: var(--app-bg);
  color: #1f2937;
  overflow: hidden;
}

.global-header {
  height: var(--app-header-height);
  z-index: 1040;
  flex: 0 0 var(--app-header-height);
}

.main-wrapper {
  height: calc(100vh - var(--app-header-height));
  overflow: hidden;
}

.scrollable-area {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

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

.header-actions {
  min-width: max-content;
}

.sidebar-account {
  margin-top: auto !important;
}

@media (min-width: 768px) {
  .desktop-sidebar { position: relative; }
}

@media (max-width: 767.98px) {
  .global-header {
    padding-left: .75rem !important;
    padding-right: .75rem !important;
  }

  .global-header > .container-fluid {
    min-width: 0;
    flex-wrap: nowrap;
  }

  .brand-text {
    flex: 0 1 auto;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .search-shell {
    flex: 1 1 auto;
    width: auto;
    max-width: 450px;
    min-width: 0;
    margin-left: .35rem !important;
    margin-right: .35rem !important;
    padding: 0;
  }

  .search-input {
    min-width: 0;
  }

  .header-actions {
    flex: 0 0 auto;
  }

  .open-sidebar-button {
    min-width: 42px;
  }

  .mobile-offcanvas {
    width: min(86vw, 330px) !important;
  }

  .mobile-offcanvas .offcanvas-body {
    height: calc(100% - 69px);
  }
}


.content-shell {
  max-width: 1500px;
  margin: 0 auto;
}

.search-shell {
  width: min(450px, 100%);
  flex: 0 1 450px;
  min-width: 0;
}

.search-input:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 .25rem rgba(13,110,253,.12);
}

.sidebar-shell {
  background: #fff;
  border-left: 1px solid var(--app-border);
}

.sidebar-section-title {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 700;
}

.sidebar-nav .nav-link {
  color: #374151;
  border-radius: .65rem;
  padding: .65rem .8rem;
  font-weight: 500;
}
.sidebar-nav .nav-link:hover { background: #f3f6fa; color: #0d6efd; }
.sidebar-nav .nav-link.active { background: #eaf2ff; color: #0d6efd; }

.metric-card { border: 1px solid var(--app-border); border-radius: .85rem; }

.table-card {
  border: 1px solid var(--app-border);
  border-radius: .85rem;
  overflow: hidden;
  background: #fff;
}
.table-card .table { margin-bottom: 0; }
.table-card thead th { white-space: nowrap; font-size: .78rem; color: #6b7280; text-transform: uppercase; letter-spacing: .03em; }






/* Review thread action controls: self-contained, no Bootstrap Icons dependency. */
.comment-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-width: 72px;
  min-height: 34px;
  padding: .3rem .55rem;
  line-height: 1;
  font-weight: 600;
  white-space: nowrap;
}

.comment-action-icon {
  flex: 0 0 auto;
  display: block;
}

.comment-action-label {
  display: inline-block;
}

.comment-empty-icon {
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
}

@media (max-width: 575.98px) {
  .comment-action-btn {
    min-width: 38px;
    width: 38px;
    height: 34px;
    padding: .3rem;
  }

  .comment-action-label {
    display: none;
  }
}


/* Dynamic clause-number hierarchy */
.clause-tree { font-size: .88rem; min-width: 0; }
.clause-tree-node { margin: .12rem 0; min-width: 0; }
.clause-tree-node > summary {
  cursor: pointer; list-style: revert; padding: .22rem .15rem; border-radius: .35rem;
  overflow-wrap: anywhere; color: #334155; font-weight: 600;
}
.clause-tree-node > summary:hover { background: #f3f6fa; color: var(--app-primary); }
.clause-tree-children { margin-left: .45rem; padding-left: .55rem; border-left: 1px solid var(--app-border); min-width: 0; }
.clause-tree-document { margin: .25rem 0 .35rem .25rem; padding: .35rem .45rem; border-radius: .4rem; background: #f8fafc; overflow-wrap: anywhere; }
.clause-tree-document a { color: #0d6efd; text-decoration: none; font-weight: 600; }
.clause-tree-document a:hover { text-decoration: underline; }
.clause-tree-document small { line-height: 1.35; }
