:root {
  --tm-bg: #f6f8fb;
  --tm-sidebar: #182433;
  --tm-sidebar-active: #206bc4;
  --tm-line: #e6e8ee;
  --tm-card-shadow: 0 10px 30px rgba(24, 36, 51, 0.06);
}

body {
  background: var(--tm-bg);
}

.tm-page {
  min-height: 100vh;
}

.tm-sidebar {
  background: var(--tm-sidebar);
  box-shadow: 8px 0 28px rgba(24, 36, 51, 0.12);
}

.tm-sidebar .navbar-brand {
  min-height: 4.5rem;
  justify-content: flex-start;
  font-size: 1rem;
  letter-spacing: 0;
}

.tm-sidebar .nav-link {
  border-radius: 8px;
  margin: 2px 10px;
  color: rgba(255, 255, 255, 0.74);
}

.tm-sidebar .nav-link:hover,
.tm-sidebar .nav-item.active .nav-link {
  background: rgba(32, 107, 196, 0.18);
  color: #ffffff;
}

.tm-sidebar .nav-item.active .nav-link {
  box-shadow: inset 3px 0 0 var(--tm-sidebar-active);
}

.tm-topbar {
  min-height: 76px;
  border-bottom: 1px solid var(--tm-line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.page-body {
  padding: 1.5rem 0 2.5rem;
}

.card {
  border-color: var(--tm-line);
  border-radius: 10px;
  box-shadow: var(--tm-card-shadow);
}

.card .card,
.accordion .card {
  box-shadow: none;
}

.card-header,
.card-footer {
  border-color: var(--tm-line);
}

.card-header:first-child {
  border-radius: 10px 10px 0 0;
}

.tm-stat-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 1.25rem;
}

.tm-login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 14%, rgba(32, 107, 196, 0.16), transparent 34%),
    radial-gradient(circle at 88% 18%, rgba(45, 179, 74, 0.12), transparent 30%),
    var(--tm-bg);
}

.tm-login-card {
  width: min(100%, 460px);
}

.tm-login-brand {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-weight: 800;
}

.tm-login-logo {
  display: block;
  width: 112px;
  height: 112px;
  object-fit: contain;
}

.tm-brand-logo {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  object-fit: contain;
}

.table thead th {
  color: #667085;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.table td,
.table th {
  vertical-align: middle;
}

.table-responsive {
  min-height: 1px;
}

.input-group-text {
  background: #f8fafc;
  color: #667085;
}

.badge {
  border-radius: 999px;
}

.btn {
  border-radius: 8px;
}

.modal-content,
.accordion-item {
  border-color: var(--tm-line);
  border-radius: 10px;
}

.alert {
  border-radius: 10px;
}

@media (min-width: 992px) {
  .tm-sidebar {
    width: 17rem;
  }

  .tm-sidebar + .page-wrapper {
    margin-left: 17rem;
  }
}

@media (max-width: 991.98px) {
  .tm-sidebar {
    position: sticky;
    top: 0;
    z-index: 1030;
  }

  .page-body {
    padding-top: 1rem;
  }
}

.tm-data-card .card-header {
  background: #ffffff;
}

.tm-data-card .table {
  --bs-table-striped-bg: #f8fafc;
}


/* UI/UX Sprint 1 */
.tm-ui {
  color: #172033;
  -webkit-font-smoothing: antialiased;
}

.tm-sidebar {
  transition: width .18s ease, transform .18s ease;
}

.tm-brand .avatar {
  box-shadow: 0 8px 18px rgba(32, 107, 196, .26);
}

.tm-nav .nav-link {
  min-height: 44px;
  gap: .7rem;
  font-weight: 600;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.tm-nav .nav-link:hover {
  transform: translateX(2px);
}

.tm-nav .nav-link-icon {
  width: 1.35rem;
  opacity: .92;
}

.tm-sidebar .nav-item.active .nav-link {
  background: linear-gradient(90deg, rgba(32, 107, 196, .35), rgba(32, 107, 196, .16));
  color: #fff;
}

.tm-topbar .container-xl {
  gap: 1rem;
}

.tm-page-heading {
  min-width: 0;
}

.tm-userbar .avatar {
  width: 36px;
  height: 36px;
}

.page-body .container-xl > .d-flex:first-child,
.page-body .container-xl > #connections-module > .card:first-child,
.page-body .container-xl > .card.bg-primary:first-child {
  margin-bottom: 1.25rem !important;
}

.page-body h1.h4,
.page-body h1.h2,
.page-body .page-title {
  letter-spacing: 0;
}

.card {
  overflow: hidden;
}

.card:not(.bg-primary):not(.tm-login-card) > .card-body,
.card:not(.bg-primary):not(.tm-login-card) > .card-header,
.card:not(.bg-primary):not(.tm-login-card) > .card-footer {
  padding: 1.05rem 1.15rem;
}

.tm-kpi-card,
.row.g-3 > [class*="col"] > .card.h-100,
.row.g-3.mb-4 > [class*="col"] > .card {
  border: 0;
  box-shadow: var(--tm-card-shadow);
}

.row.g-3 > [class*="col"] > .card .display-6,
.row.g-3.mb-4 > [class*="col"] > .card .display-6,
.row.g-3 > [class*="col"] > .card .h3,
.row.g-3 > [class*="col"] > .card .h4 {
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.table-responsive {
  border-radius: 0 0 10px 10px;
}

.table {
  --bs-table-hover-bg: #eef5ff;
  --bs-table-striped-bg: #f9fbfd;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid var(--tm-line);
}

.table tbody tr {
  transition: background .15s ease;
}

.table td .btn,
.table th .btn,
.btn-sm {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
}

.form-control,
.form-select,
.input-group-text {
  min-height: 40px;
  border-color: #d9dee8;
}

.form-control:focus,
.form-select:focus {
  border-color: #8bb8ee;
  box-shadow: 0 0 0 .2rem rgba(32, 107, 196, .12);
}

.form-label {
  font-weight: 650;
  color: #344054;
  margin-bottom: .4rem;
}

.form-label:has(+ input[required])::after,
.form-label:has(+ select[required])::after,
.form-label:has(+ textarea[required])::after {
  content: " *";
  color: #d63939;
}

.btn-primary {
  box-shadow: 0 8px 18px rgba(32, 107, 196, .18);
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger,
.btn-outline-warning {
  background: #fff;
}

.alert {
  border: 0;
  box-shadow: var(--tm-card-shadow);
}

.alert-success {
  background: #ecfdf3;
  color: #067647;
}

.alert-danger {
  background: #fff1f3;
  color: #b42318;
}

.tm-empty-state {
  padding: 2.25rem 1rem;
  text-align: center;
  color: #667085;
}

.tm-empty-state .bi {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: #eef5ff;
  color: #206bc4;
  font-size: 1.35rem;
  margin-bottom: .75rem;
}

.nav-tabs {
  border-bottom-color: var(--tm-line);
  gap: .35rem;
}

.nav-tabs .nav-link {
  border-radius: 10px 10px 0 0;
  border-color: transparent;
  color: #475467;
  font-weight: 600;
}

.nav-tabs .nav-link.active {
  color: #206bc4;
  border-color: var(--tm-line) var(--tm-line) #fff;
  box-shadow: 0 -8px 18px rgba(24, 36, 51, .04);
}

.pagination .page-link {
  border-radius: 8px;
  margin: 0 2px;
}

.htmx-request .tm-submit-spinner,
form.is-submitting .tm-submit-spinner {
  display: inline-block !important;
}

.htmx-request button[type="submit"],
form.is-submitting button[type="submit"] {
  pointer-events: none;
  opacity: .82;
}

.tm-sidebar-collapsed .tm-sidebar {
  width: 5.25rem;
}

.tm-sidebar-collapsed .tm-sidebar + .page-wrapper {
  margin-left: 5.25rem;
}

.tm-sidebar-collapsed .tm-brand-text,
.tm-sidebar-collapsed .tm-nav-title {
  display: none;
}

.tm-sidebar-collapsed .tm-sidebar .nav-link {
  justify-content: center;
  margin-left: 12px;
  margin-right: 12px;
}

.tm-sidebar-collapsed .tm-sidebar .navbar-brand {
  justify-content: center;
}

@media (max-width: 991.98px) {
  .tm-sidebar + .page-wrapper,
  .tm-sidebar-collapsed .tm-sidebar + .page-wrapper {
    margin-left: 0;
  }

  .tm-sidebar-collapsed .tm-brand-text,
  .tm-sidebar-collapsed .tm-nav-title {
    display: inline;
  }

  .tm-sidebar-collapsed .tm-sidebar {
    width: auto;
  }

  .tm-topbar {
    min-height: 68px;
  }

  .page-body {
    padding-left: .25rem;
    padding-right: .25rem;
  }

  .table-responsive {
    border-radius: 10px;
  }

  .card:not(.bg-primary):not(.tm-login-card) > .card-body,
  .card:not(.bg-primary):not(.tm-login-card) > .card-header,
  .card:not(.bg-primary):not(.tm-login-card) > .card-footer {
    padding: .9rem;
  }
}

@media (max-width: 575.98px) {
  .btn {
    width: 100%;
  }

  .btn-list .btn,
  .table .btn,
  .pagination .page-link,
  .navbar .btn {
    width: auto;
  }

  .d-flex.justify-content-between,
  .card-header.d-flex {
    align-items: flex-start !important;
  }
}
