/* ===========================================================
   Client Portal
   Palette: Teal #213A39 · Off-White #EEE9DF · Peach-Rose #E0A79D · Blue-Gray #8FA2A2
   Type: Outfit (100..900)
   =========================================================== */

:root {
  --brand-teal: #213A39;
  --brand-teal-soft: #2C4948;
  --brand-off-white: #EEE9DF;
  --brand-off-white-deep: #E5DFD2;
  --brand-peach-rose: #E0A79D;
  --brand-peach-rose-deep: #C98E84;
  --brand-blue-gray: #8FA2A2;
  --brand-blue-gray-soft: #B8C4C4;
  /* text-safe variants: --brand-blue-gray and --brand-peach-rose-deep both fail
     4.5:1 as small text on off-white/white; these darker siblings pass and stay
     in-family. Use for any muted/label TEXT; keep the originals for chips/borders/fills. */
  --brand-blue-gray-text: #556766;
  --brand-peach-rose-text: #9C5348;
  --ink: #1A2D2C;
  --rule: rgba(33, 58, 57, 0.12);
  --shadow: 0 1px 2px rgba(33,58,57,.04), 0 8px 24px rgba(33,58,57,.06);
  --shadow-lg: 0 2px 6px rgba(33,58,57,.06), 0 30px 60px rgba(33,58,57,.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* ============== Shared: logo mark ============== */
.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--brand-teal);
  color: var(--brand-off-white);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  flex: none;
}

/* ============== Shared: buttons ============== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, color .2s ease, border-color .2s ease, opacity .15s ease;
  text-decoration: none;
}
.btn:focus-visible {
  outline: 3px solid var(--brand-peach-rose-deep);
  outline-offset: 2px;
}
.btn-primary { background: var(--brand-peach-rose); color: var(--brand-teal); }
.btn-primary:hover { background: var(--brand-peach-rose-deep); color: var(--brand-off-white); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn-secondary { background: transparent; color: var(--brand-teal); border-color: var(--brand-teal); }
.btn-secondary:hover { background: var(--brand-teal); color: var(--brand-off-white); transform: translateY(-1px); }

.btn-block { width: 100%; }
.btn-small { padding: 9px 18px; font-size: 14px; }

/* spinner shown inside the sign-in button while a request is in flight */
.spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(33,58,57,.3);
  border-top-color: var(--brand-teal);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============== Shared: form fields ============== */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field label { font-size: 14px; font-weight: 600; color: var(--brand-teal); }
.field input {
  font-family: inherit; font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: #fcfbf8;
  color: var(--ink);
  transition: border .15s, box-shadow .15s;
}
.field input:focus-visible {
  outline: none;
  border-color: var(--brand-peach-rose);
  box-shadow: 0 0 0 3px rgba(224,167,157,.28);
}

/* ===========================================================
   Login page
   =========================================================== */
.login-body {
  background: var(--brand-teal);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.login-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  gap: 28px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--brand-off-white);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 30px 70px rgba(0,0,0,.28);
  text-align: center;
}

.login-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.login-logo .logo-mark { width: 44px; height: 44px; font-size: 15px; }

.login-eyebrow {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-blue-gray-text);
  margin-bottom: 30px;
}

.login-form { text-align: left; }

.login-error {
  background: #fdeeee;
  border: 1px solid #f0c4c4;
  color: #7a2020;
  font-size: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 18px;
  line-height: 1.5;
}

.login-note {
  margin-top: 18px;
  font-size: 13px;
  color: var(--brand-blue-gray-text);
  text-align: center;
}

.login-footer-link {
  font-size: 13px;
  color: rgba(238,233,223,.65);
  transition: color .15s ease;
}
.login-footer-link:hover { color: var(--brand-off-white); }
.login-footer-link:focus-visible { outline: 2px solid var(--brand-off-white); outline-offset: 3px; }

/* ===========================================================
   Dashboard shell (sidebar + content column)
   =========================================================== */
.dashboard-body {
  background: var(--brand-off-white);
  min-height: 100vh;
}

.dashboard-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  flex: none;
  width: 260px;
  background: var(--brand-teal);
  color: var(--brand-off-white);
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand { display: flex; align-items: center; gap: 12px; }
.sidebar-brand-text { color: var(--brand-off-white); font-size: 16px; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.sidebar-nav-item {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  color: rgba(238,233,223,.78);
  transition: background .15s ease, color .15s ease;
}
.sidebar-nav-item:hover { background: rgba(238,233,223,.10); color: var(--brand-off-white); }
.sidebar-nav-item.active { background: var(--brand-off-white); color: var(--brand-teal); font-weight: 600; }
.sidebar-nav-item:focus-visible { outline: 2px solid var(--brand-off-white); outline-offset: 2px; }

/* Parent item with an active child below it: subtly marked, not fully
   highlighted — the child carries the solid highlight instead. */
.sidebar-nav-item.parent-active { background: rgba(238,233,223,.14); color: var(--brand-off-white); font-weight: 600; }

/* Nested children (e.g. Market Intelligence's 3 leaves), shown indented
   only while the parent or one of its children is the active route. */
.sidebar-nav-children {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 6px;
}
.sidebar-nav-item-child { padding: 9px 14px 9px 30px; font-size: 13.5px; }

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(238,233,223,.14);
}
.sidebar-firm { color: rgba(238,233,223,.78); font-size: 13.5px; font-weight: 500; }
.sidebar-bottom .btn-secondary { color: var(--brand-off-white); border-color: rgba(238,233,223,.38); }
.sidebar-bottom .btn-secondary:hover { background: var(--brand-off-white); color: var(--brand-teal); }
#logout-form { margin: 0; }

.dashboard-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dashboard-container { max-width: 1080px; margin: 0 auto; padding: 0 32px; width: 100%; }

.dashboard-main { flex: 1; padding: 48px 0 64px; }

.hub-greeting h1 {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--brand-teal);
  margin-bottom: 32px;
}

.engagement-strip {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 28px 30px;
  box-shadow: var(--shadow);
  margin-bottom: 40px;
}
.status-chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
  background: var(--brand-off-white-deep);
  color: var(--brand-teal);
}
.status-active { background: rgba(33,58,57,.10); color: var(--brand-teal); }
.status-prospect { background: rgba(224,167,157,.22); color: var(--brand-peach-rose-text); }
.status-paused { background: rgba(143,162,162,.22); color: var(--brand-teal-soft); }

.engagement-headline {
  font-size: 22px;
  font-weight: 600;
  color: var(--brand-teal);
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.engagement-line { font-size: 15px; color: var(--brand-teal-soft); margin-bottom: 6px; }
.engagement-line strong { color: var(--brand-teal); }
.engagement-contact { color: var(--brand-blue-gray-text); font-size: 14px; }

/* ============== Category tiles (dashboard landing) ============== */
.category-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.category-tile {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.category-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.category-tile:focus-visible { outline: 3px solid var(--brand-peach-rose-deep); outline-offset: 2px; }

.category-tile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.category-tile-title { font-size: 19px; font-weight: 600; color: var(--brand-teal); letter-spacing: -0.01em; }
.category-tile-desc { font-size: 14.5px; color: var(--brand-teal-soft); flex: 1; }

/* ============== Shared chip ============== */
.chip {
  display: inline-block;
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 999px;
}
.chip-count { background: var(--brand-off-white-deep); color: var(--brand-teal-soft); text-transform: none; }
.chip-dev { background: rgba(224,167,157,.22); color: var(--brand-peach-rose-text); text-transform: uppercase; letter-spacing: 0.06em; flex: none; }

/* ============== Category subpage ============== */
.back-link {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  color: var(--brand-teal-soft);
  margin-bottom: 20px;
  transition: color .15s ease;
}
.back-link:hover { color: var(--brand-teal); }
.back-link:focus-visible { outline: 2px solid var(--brand-teal); outline-offset: 2px; }

.subpage-header { margin-bottom: 32px; }
.subpage-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.subpage-header-top .section-title { margin-bottom: 0; }

.subpage-block { margin-bottom: 40px; }
.subpage-block:last-child { margin-bottom: 0; }
.subpage-block-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--brand-teal);
  margin-bottom: 14px;
}
.subpage-overview {
  font-size: 16px;
  color: var(--brand-teal-soft);
  max-width: 680px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 22px 26px;
  box-shadow: var(--shadow);
}

.outcomes-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 680px;
}
.outcomes-list li {
  position: relative;
  padding-left: 26px;
  font-size: 15px;
  color: var(--brand-teal-soft);
  line-height: 1.55;
}
.outcomes-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-peach-rose-deep);
}

.section-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--brand-teal);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.section-description {
  font-size: 15px;
  color: var(--brand-teal-soft);
  margin-bottom: 22px;
  max-width: 640px;
}

.hub-empty {
  color: var(--brand-teal-soft);
  font-size: 15px;
  background: #fff;
  border: 1px dashed var(--brand-blue-gray-soft);
  border-radius: 14px;
  padding: 28px;
  text-align: center;
}

.hub-empty-teaser { color: var(--brand-blue-gray-text); }

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.resource-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.resource-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.resource-type {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-peach-rose-text);
  margin-bottom: 12px;
}
.resource-title { font-size: 19px; font-weight: 600; color: var(--brand-teal); margin-bottom: 8px; letter-spacing: -0.01em; }
.resource-description { font-size: 14.5px; color: var(--brand-teal-soft); flex: 1; margin-bottom: 16px; }

.resource-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--brand-teal-soft);
  background: var(--brand-off-white-deep);
  padding: 4px 10px;
  border-radius: 999px;
}

.resource-open { align-self: flex-start; }

/* ============== "Coming soon" preview cards ============== */
.resource-grid-preview { margin-top: 20px; }
.resource-card-preview {
  background: transparent;
  border: 1px dashed var(--brand-blue-gray-soft);
  box-shadow: none;
}
.resource-card-preview:hover { transform: none; box-shadow: none; }
.resource-card-preview .resource-title,
.resource-card-preview .resource-description { color: var(--brand-blue-gray-text); }
.chip-preview {
  background: var(--brand-off-white-deep);
  color: var(--brand-blue-gray-text);
  margin-bottom: 12px;
}

.hub-footer {
  border-top: 1px solid var(--rule);
  padding: 24px 0;
}
.hub-footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--brand-blue-gray-text);
}
.hub-footer-inner a:hover { color: var(--brand-teal-soft); }
.hub-footer-inner a:focus-visible { outline: 2px solid var(--brand-teal); outline-offset: 2px; }

/* ===========================================================
   Error page
   =========================================================== */
.error-body {
  background: var(--brand-off-white);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.error-wrap {
  text-align: center;
  max-width: 440px;
}
.error-wrap .logo-mark { margin: 0 auto 24px; }
.error-code {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-peach-rose-text);
  margin-bottom: 12px;
}
.error-message {
  font-size: 26px;
  font-weight: 600;
  color: var(--brand-teal);
  letter-spacing: -0.01em;
  margin-bottom: 28px;
}

/* ===========================================================
   Responsive (down to 375px)
   =========================================================== */
@media (max-width: 768px) {
  /* Sidebar collapses to a top bar: brand + logout on one row,
     horizontal-scroll nav pills below. No JS toggle needed. */
  .dashboard-shell { flex-direction: column; }
  .sidebar {
    position: relative;
    top: auto;
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 20px;
    padding: 16px 20px;
  }
  .sidebar-brand { order: 1; }
  .sidebar-bottom {
    order: 2;
    flex: 1 1 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    border-top: none;
    padding-top: 0;
    gap: 12px;
  }
  .sidebar-firm { display: none; }
  .sidebar-bottom .btn-block { width: auto; }
  .sidebar-nav {
    order: 3;
    flex: 1 1 100%;
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 2px;
  }
  .sidebar-nav-item { white-space: nowrap; flex: none; }
  /* Nested children ride inline with the horizontal scroll row on mobile —
     display:contents un-nests the wrapper so children become siblings in
     the same single scrollable row instead of a second wrapped row
     (flex-wrap here would clip items past the viewport edge). */
  .sidebar-nav-children { display: contents; }
  .sidebar-nav-item-child { padding: 9px 14px; }
  .dashboard-container { padding: 0 20px; }
}

@media (max-width: 640px) {
  .login-card { padding: 32px 24px; }
  .resource-grid { grid-template-columns: 1fr; }
  .category-tile-grid { grid-template-columns: 1fr; }
  .engagement-strip { padding: 22px 20px; }
  .subpage-overview { padding: 18px 20px; }
}

@media (max-width: 400px) {
  .login-card { padding: 26px 18px; }
  .dashboard-main { padding: 32px 0 48px; }
}
