/* Reach Portal theme - IP Partners palette
   navy #201f5e | deep navy #01003d | red #cf2027 | grey #6e7273 | light #f5f5f5 */

:root {
  --reach-navy: #201f5e;
  --reach-navy-deep: #01003d;
  --reach-red: #cf2027;
  --reach-grey: #6e7273;
  --reach-light: #f5f5f5;
  --reach-tint: #dfe1ec;
  --reach-sidebar-width: 240px;
  --reach-topbar-height: 60px;

  --bs-primary: #201f5e;
  --bs-primary-rgb: 32, 31, 94;
  --bs-link-color: #201f5e;
  --bs-link-color-rgb: 32, 31, 94;
  --bs-link-hover-color: #01003d;
  --bs-link-hover-color-rgb: 1, 0, 61;
  --bs-body-bg: #f5f5f5;
  --bs-secondary-color: #6e7273;
  --bs-danger: #cf2027;
  --bs-danger-rgb: 207, 32, 39;
}

body { background: var(--reach-light); }

/* ---- Buttons ---- */
.btn-primary {
  --bs-btn-bg: var(--reach-navy);
  --bs-btn-border-color: var(--reach-navy);
  --bs-btn-hover-bg: var(--reach-navy-deep);
  --bs-btn-hover-border-color: var(--reach-navy-deep);
  --bs-btn-active-bg: var(--reach-navy-deep);
  --bs-btn-active-border-color: var(--reach-navy-deep);
  --bs-btn-disabled-bg: var(--reach-navy);
  --bs-btn-disabled-border-color: var(--reach-navy);
  --bs-btn-focus-shadow-rgb: 32, 31, 94;
}
.btn-outline-primary {
  --bs-btn-color: var(--reach-navy);
  --bs-btn-border-color: var(--reach-navy);
  --bs-btn-hover-bg: var(--reach-navy);
  --bs-btn-hover-border-color: var(--reach-navy);
  --bs-btn-active-bg: var(--reach-navy-deep);
  --bs-btn-active-border-color: var(--reach-navy-deep);
  --bs-btn-disabled-color: var(--reach-navy);
  --bs-btn-disabled-border-color: var(--reach-navy);
  --bs-btn-focus-shadow-rgb: 32, 31, 94;
}
.btn-danger {
  --bs-btn-bg: var(--reach-red);
  --bs-btn-border-color: var(--reach-red);
  --bs-btn-hover-bg: #a8191f;
  --bs-btn-hover-border-color: #a8191f;
  --bs-btn-active-bg: #a8191f;
  --bs-btn-active-border-color: #a8191f;
}

/* ---- Forms ---- */
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: #7d7cb3;
  box-shadow: 0 0 0 .25rem rgba(32, 31, 94, .2);
}
.form-check-input:checked {
  background-color: var(--reach-navy);
  border-color: var(--reach-navy);
}

/* ---- Cards / tables ---- */
.card { border-color: var(--reach-tint); }
.card-header {
  background: var(--reach-tint);
  color: var(--reach-navy);
  font-weight: 600;
}
.table > thead > tr > th {
  background: var(--reach-tint);
  color: var(--reach-navy);
  border-bottom: 2px solid var(--reach-navy);
}
.page-link { color: var(--reach-navy); }
.active > .page-link, .page-link.active {
  background-color: var(--reach-navy);
  border-color: var(--reach-navy);
}

h1, h2, h3, h4, h5 { color: var(--reach-navy); }

/* ---- Brand wordmark ---- */
.reach-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: .02em;
}
.reach-brand:hover { color: #fff; }
.reach-brand-mark {
  width: 6px;
  height: 1.6rem;
  background: var(--reach-red);
  border-radius: 2px;
}
.reach-brand small {
  display: block;
  font-size: .65rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .6);
}

/* ---- Sidebar ---- */
.reach-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--reach-sidebar-width);
  background: var(--reach-navy-deep);
  color: #fff;
  overflow-y: auto;
  z-index: 1030;
  display: flex;
  flex-direction: column;
}
.reach-sidebar-header {
  height: var(--reach-topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  flex-shrink: 0;
}

.reach-nav { padding: .75rem 0 1.5rem; }
.reach-nav-group {
  margin: 1.1rem 1.25rem .35rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .5);
}
.reach-nav-link {
  display: block;
  padding: .5rem 1.25rem .5rem calc(1.25rem - 3px);
  border-left: 3px solid transparent;
  color: rgba(255, 255, 255, .85);
  text-decoration: none;
  font-size: .95rem;
}
.reach-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, .07);
}
.reach-nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border-left-color: var(--reach-red);
  font-weight: 600;
}

/* Offcanvas (mobile) reuses the sidebar look */
.reach-offcanvas {
  --bs-offcanvas-width: var(--reach-sidebar-width);
  background: var(--reach-navy-deep);
  color: #fff;
}

/* ---- Top bar ---- */
.reach-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  height: var(--reach-topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--reach-tint);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
}
.reach-topbar-title {
  font-weight: 600;
  color: var(--reach-navy);
  font-size: 1.05rem;
}
.reach-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .9rem;
}
.reach-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--reach-navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .9rem;
  flex-shrink: 0;
}
.reach-user-name { font-weight: 600; color: var(--reach-navy); line-height: 1.2; }
.reach-user-email { font-size: .8rem; color: var(--reach-grey); line-height: 1.2; }
.reach-logout {
  font-size: .85rem;
  color: var(--reach-red);
  text-decoration: none;
  border: 1px solid var(--reach-red);
  border-radius: 4px;
  padding: .25rem .65rem;
}
.reach-logout:hover { background: var(--reach-red); color: #fff; }

.reach-menu-toggle {
  border: none;
  background: none;
  color: var(--reach-navy);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
}

/* ---- Main content ---- */
.reach-main { margin-left: var(--reach-sidebar-width); min-height: 100vh; }
.reach-content { padding: 1.5rem; }

@media (max-width: 991.98px) {
  .reach-sidebar { display: none; }
  .reach-main { margin-left: 0; }
  .reach-user-email { display: none; }
  .reach-topbar { padding: 0 1rem; }
  .reach-content { padding: 1rem; }
}

/* ---- Logged-out / login ---- */
.reach-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--reach-navy-deep) 0%, var(--reach-navy) 100%);
  padding: 1rem;
}
.reach-login-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
}
.reach-login-card-header {
  background: var(--reach-navy-deep);
  padding: 1.75rem;
  border-bottom: 4px solid var(--reach-red);
}
.reach-login-card-body { padding: 2rem 1.75rem; text-align: center; }
