/* CUSKIN CRM theme — layered on Bootstrap 5.3.
   Brand from shopping-mall: navy #1e3a8a, cream #f9f8f4, Inter + Playfair Display. */

:root {
  --navy: #1e3a8a;
  --navy-700: #172e6e;
  --navy-50: #eef2fb;
  --sky: #93c5fd;
  --cream: #f9f8f4;
  --ink: #18181b;
  --muted: #71717a;
  --line: #e7e5df;
  --card: #ffffff;
  --radius: 10px;

  --bs-body-font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bs-body-bg: var(--cream);
  --bs-body-color: var(--ink);
  --bs-primary: var(--navy);
  --bs-primary-rgb: 30, 58, 138;
  --bs-link-color: var(--navy);
  --bs-link-color-rgb: 30, 58, 138;
  --bs-link-hover-color: var(--navy-700);
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--muted);
  --bs-focus-ring-color: rgba(30, 58, 138, .2);
}

body, body.bg-light { background: var(--cream) !important; font-size: .875rem; -webkit-font-smoothing: antialiased; }
h1, h2, .h1, .h2, .page-title { font-family: "Playfair Display", Georgia, serif; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.page-title { font-size: 1.75rem; margin: 0; }
.page-sub { color: var(--muted); margin: .25rem 0 0; }
.eyebrow { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.text-muted, .text-secondary { color: var(--muted) !important; }

/* ── Top bar ── */
.crm-nav { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 1030; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.crm-nav .inner { display: flex; align-items: center; gap: 1.5rem; height: 56px; padding: 0 1.5rem; }
.crm-brand { color: #fff; text-decoration: none; display: flex; align-items: baseline; gap: .55rem; white-space: nowrap; }
.crm-brand b { font-size: 1.05rem; letter-spacing: .18em; font-weight: 700; }
.crm-brand span { font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; color: var(--sky); }
.crm-brand:hover { color: #fff; }
.crm-links { display: flex; gap: .25rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.crm-links a { color: rgba(255,255,255,.72); text-decoration: none; font-size: .8rem; font-weight: 500; padding: .45rem .7rem; border-radius: 6px; white-space: nowrap; }
.crm-links a:hover { color: #fff; background: rgba(255,255,255,.08); }
.crm-links a.active { color: #fff; background: rgba(255,255,255,.14); }
.crm-actions { display: flex; gap: .5rem; align-items: center; }
.crm-actions .btn-add { background: #fff; color: var(--navy); font-weight: 600; font-size: .78rem; border-radius: 6px; padding: .4rem .8rem; text-decoration: none; white-space: nowrap; }
.crm-actions .btn-add:hover { background: var(--navy-50); }
.crm-actions .logout { color: rgba(255,255,255,.6); font-size: .78rem; text-decoration: none; }
.crm-actions .logout:hover { color: #fff; }
@media (max-width: 767px) {
  .crm-nav .inner { gap: .75rem; padding: 0 1rem; }
  .crm-brand span { display: none; }
  .crm-actions .logout { display: none; }
}

/* ── Page shell ── */
.crm-nav ~ .container, .crm-nav ~ .container-fluid, .crm-nav ~ main { padding-top: 1.5rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin: .25rem 0 1.25rem; }

/* ── Cards ── */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(24,24,27,.04); background: var(--card); }
.card.shadow-sm { box-shadow: 0 1px 2px rgba(24,24,27,.04) !important; }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 600; font-size: .85rem; padding: .85rem 1.1rem; }
.card-body { padding: 1.1rem; }

/* ── Buttons ── */
.btn { font-weight: 500; border-radius: 7px; font-size: .82rem; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn-sm { font-size: .76rem; padding: .3rem .65rem; border-radius: 6px; }
.btn-primary, .btn-dark, .btn-success {
  --bs-btn-bg: var(--navy); --bs-btn-border-color: var(--navy);
  --bs-btn-hover-bg: var(--navy-700); --bs-btn-hover-border-color: var(--navy-700);
  --bs-btn-active-bg: var(--navy-700); --bs-btn-active-border-color: var(--navy-700);
  --bs-btn-color: #fff; --bs-btn-hover-color: #fff;
}
.btn-outline-primary, .btn-outline-dark, .btn-outline-secondary {
  --bs-btn-color: var(--ink); --bs-btn-bg: #fff; --bs-btn-border-color: var(--line);
  --bs-btn-hover-color: var(--navy); --bs-btn-hover-bg: var(--navy-50); --bs-btn-hover-border-color: #c9d3ee;
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--navy); --bs-btn-active-border-color: var(--navy);
}
.btn-outline-primary { --bs-btn-color: var(--navy); }
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(30,58,138,.2); }

/* ── Forms ── */
.form-control, .form-select { border-color: var(--line); border-radius: 7px; font-size: .85rem; }
.form-control:focus, .form-select:focus { border-color: #9fb0dc; box-shadow: 0 0 0 3px rgba(30,58,138,.12); }
.form-label { font-size: .75rem; font-weight: 600; color: #3f3f46; margin-bottom: .3rem; }

/* ── Pipeline cards ── */
.pipeline-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: .6rem; }
.pipeline-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; text-decoration: none; color: inherit; position: relative; transition: border-color .15s, box-shadow .15s; }
.pipeline-card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c, var(--line)); }
.pipeline-card:hover { border-color: #c9d3ee; box-shadow: 0 4px 14px rgba(30,58,138,.08); color: inherit; }
.pipeline-card.is-active { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
.pipeline-card .num { font-family: "Playfair Display", Georgia, serif; font-size: 1.65rem; font-weight: 600; line-height: 1.1; }
.pipeline-card .lbl { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: .2rem; }

/* ── Filters: chips ── */
.filter-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; display: grid; gap: .6rem; }
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.filter-bar .lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; min-width: 92px; }
.filter-bar .btn { border-radius: 999px; padding: .25rem .75rem; font-size: .76rem; background: #fff; color: #3f3f46; border: 1px solid var(--line); }
.filter-bar .btn:hover { background: var(--navy-50); color: var(--navy); border-color: #c9d3ee; }
.filter-bar .btn.btn-dark, .filter-bar .btn.btn-secondary, .filter-bar .btn.btn-danger,
.filter-bar .btn.btn-warning, .filter-bar .btn.btn-success { background: var(--navy); color: #fff; border-color: var(--navy); }
.filter-bar .btn.btn-outline-secondary:not(:hover) { color: var(--muted); }
.filter-bar .btn .badge { background: rgba(24,24,27,.07) !important; color: inherit !important; font-weight: 600; border-radius: 999px; }
.filter-bar .btn.btn-dark .badge, .filter-bar .btn.btn-secondary .badge, .filter-bar .btn.btn-danger .badge,
.filter-bar .btn.btn-warning .badge, .filter-bar .btn.btn-success .badge { background: rgba(255,255,255,.2) !important; }
.filter-research { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.filter-research .form-control { width: 170px; border-radius: 999px; padding: .25rem .8rem; font-size: .76rem; }
.filter-research .form-control.narrow { width: 90px; }

/* ── Tables ── */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: #f6f7fb; margin: 0; }
.table > thead th, .leads-table th { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); background: #fbfaf7; border-bottom: 1px solid var(--line); padding: .7rem .75rem; white-space: nowrap; }
.table > thead th a { color: inherit; text-decoration: none; }
.table > thead th a:hover { color: var(--navy); }
.table > thead th a::after { content: " ↕"; opacity: .45; }
.table > tbody td { padding: .7rem .75rem; border-color: #f0eee9; vertical-align: middle; }
.table-warning { --bs-table-bg: #fffaeb; }
.fit-score { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 600; font-size: .78rem; background: var(--navy-50); color: var(--navy); }
.fit-score.hi { background: var(--navy); color: #fff; }

/* ── Badges ── */
.badge { font-weight: 600; letter-spacing: .02em; }
.status-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; color: var(--c); background: color-mix(in srgb, var(--c) 11%, #fff); }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.tier-badge { display: inline-block; min-width: 22px; text-align: center; padding: .15rem .4rem; border-radius: 5px; font-size: .7rem; font-weight: 700; border: 1px solid var(--line); color: #3f3f46; background: #fff; }

/* ── Social icon buttons ── */
.social-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: #52525b; text-decoration: none; font-size: .8rem; transition: all .15s; }
.social-btn:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ── Alerts ── */
.alert { border-radius: var(--radius); border: 1px solid transparent; }
.alert-warning { background: #fff8e6; border-color: #f5e2b0; color: #7a5300; }
.alert-success { background: #ecf7f0; border-color: #c6e8d2; color: #14532d; }
.alert-danger { background: #fdf0f0; border-color: #f3caca; color: #8a1c1c; }

/* ── Responsive helpers ── */
@media (max-width: 1024px) { .hide-tablet { display: none !important; } }
@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
  .filter-bar .lbl { min-width: 100%; }
  .pipeline-cards { grid-template-columns: repeat(3, 1fr); }
}

/* ── Resources library ── */
.res-tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.res-tools .form-control { width: 240px; border-radius: 999px; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; font-size: .76rem; font-weight: 500; color: var(--muted); padding: .3rem .8rem; border-radius: 999px; }
.seg button.active { background: var(--navy); color: #fff; }
.res-tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.res-tabs a, .res-tabs button { background: none; border: 0; padding: .6rem 0; font-weight: 600; font-size: .9rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.res-tabs a span, .res-tabs button span { font-size: .7rem; font-weight: 600; background: rgba(24,24,27,.06); border-radius: 999px; padding: .1rem .45rem; margin-left: .25rem; }
.res-tabs .active { color: var(--navy); border-bottom-color: var(--navy); }
.res-tabs .active span { background: var(--navy-50); }

.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.res-grid.compact { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.res-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
.res-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(30,58,138,.10); border-color: #c9d3ee; color: inherit; }
.res-card[hidden] { display: none; }
.res-media { position: relative; height: 140px; display: flex; align-items: center; justify-content: center; background: #fff; border-bottom: 1px solid #f0eee9; }
.res-card.brand .res-media img { max-width: 70%; max-height: 64px; object-fit: contain; }
.res-card.device .res-media img { max-width: 80%; max-height: 120px; object-fit: contain; }
.res-card.procedure .res-media { height: 150px; background: var(--navy-50); }
.res-card.procedure .res-media img { width: 100%; height: 100%; object-fit: cover; }
.monogram { width: 64px; height: 64px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--navy-50); color: var(--navy); font-family: "Playfair Display", Georgia, serif; font-size: 1.5rem; font-weight: 600; }
.monogram.lg { width: 120px; height: 120px; font-size: 2.6rem; }
.res-flag { position: absolute; top: 10px; left: 10px; background: var(--navy); color: #fff; font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .2rem .5rem; border-radius: 4px; }
.res-body { padding: .9rem 1rem .6rem; flex: 1; }
.res-name { font-family: "Playfair Display", Georgia, serif; font-size: 1.1rem; font-weight: 600; margin: 0 0 .2rem; line-height: 1.25; }
.res-meta { font-size: .76rem; color: var(--muted); margin-bottom: .55rem; }
.res-desc { font-size: .78rem; color: #52525b; margin: 0 0 .6rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.res-tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.tag { display: inline-block; font-size: .68rem; font-weight: 600; padding: .18rem .5rem; border-radius: 999px; background: #f4f4f5; color: #52525b; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tag.hi { background: #e8f5ee; color: #166534; }
.tag.mid { background: #fdf3e1; color: #92400e; }
.tag.lo { background: #f4f4f5; color: #71717a; }
.res-foot { display: flex; justify-content: space-between; padding: .6rem 1rem; border-top: 1px solid #f0eee9; font-size: .74rem; color: var(--muted); }
.res-foot .go { color: var(--navy); font-weight: 600; opacity: 0; transition: opacity .15s; }
.res-card:hover .go { opacity: 1; }
.rank { display: flex; align-items: center; gap: 3px; margin-bottom: .6rem; }
.rank i { width: 12px; height: 6px; border-radius: 2px; background: #e7e5df; }
.rank i.on { background: var(--navy); }
.rank b { font-size: .7rem; color: var(--muted); margin-left: .4rem; font-weight: 600; }
.res-table th { cursor: pointer; user-select: none; }
.res-table th:hover { color: var(--navy); }

.crumbs { font-size: .76rem; color: var(--muted); margin-bottom: 1rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--navy); }
.res-hero { display: grid; grid-template-columns: 300px 1fr; overflow: hidden; }
.res-hero-media { background: #fff; display: flex; align-items: center; justify-content: center; padding: 1.5rem; border-right: 1px solid var(--line); min-height: 260px; }
.res-hero-media img { max-width: 100%; max-height: 240px; object-fit: contain; }
.res-hero-media.procedure { padding: 0; background: var(--navy-50); }
.res-hero-media.procedure img { width: 100%; height: 100%; max-height: none; object-fit: cover; }
.res-hero-body { padding: 1.5rem 1.75rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem 1.5rem; margin: 0; }
.facts dt { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: .15rem; }
.facts dd { margin: 0; font-size: .82rem; line-height: 1.45; }
.img-credit { font-size: .68rem; color: var(--muted); margin-top: 1rem; }
.img-credit a { color: inherit; }
@media (max-width: 767px) {
  .res-hero { grid-template-columns: 1fr; }
  .res-hero-media { border-right: 0; border-bottom: 1px solid var(--line); min-height: 180px; }
  .res-tools .form-control { width: 100%; }
}

/* Rendered vault notes */
.md-body { padding: 1.75rem 2rem; font-size: .9rem; line-height: 1.7; max-width: 900px; }
.md-body h2 { font-size: 1.35rem; margin: 2rem 0 .75rem; padding-top: 1rem; border-top: 1px solid #f0eee9; }
.md-body h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.md-body h3 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 .5rem; }
.md-body blockquote { border-left: 3px solid var(--navy); background: var(--navy-50); padding: .75rem 1rem; border-radius: 0 8px 8px 0; color: #3f3f46; }
.md-body blockquote p:last-child { margin: 0; }
.md-body table { font-size: .8rem; }
.md-body table td, .md-body table th { padding: .5rem .6rem; }
.md-body code { color: var(--navy); background: var(--navy-50); padding: .1rem .3rem; border-radius: 4px; }
.lead-uses { display: flex; flex-wrap: wrap; gap: .35rem; }
.lead-uses a { text-decoration: none; }
.lead-uses .tag:hover { background: var(--navy-50); color: var(--navy); }
