/* ==========================================================================
   Entrance Admin, design 1 "sidebar workspace" (design-mockups/design-1-sidebar-workspace).
   On top of the bundled Bootstrap 5.1: use 5.1 classes in views; the few 5.3 ones are shimmed below.
   ========================================================================== */
:root {
  --acc: #2563eb; --acc-hover: #1d4ed8; --acc-soft: #eef3ff;
  --ink: #111827; --muted: #6b7280; --line: #e7e9ee; --bg: #f6f7f9; --side-w: 252px;
  --ok: #15803d; --ok-soft: #e7f6ec; --warn: #92400e; --warn-soft: #fff3d6; --bad: #b91c1c; --bad-soft: #fdecec;
  --info: #0369a1; --info-soft: #e0f2fe; --grey: #4b5563; --grey-soft: #f1f2f5;
}
html { font-size: 14px; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--acc); text-decoration: none; }
a:hover { color: var(--acc-hover); }
.text-muted, .text-secondary { color: var(--muted) !important; }
.min-w-0 { min-width: 0; }

/* ---------------------------------------------------------------- sidebar */
.side { position: fixed; top: 0; bottom: 0; left: 0; width: var(--side-w); background: #fff; border-right: 1px solid var(--line);
        display: flex; flex-direction: column; padding: 18px 14px 12px; z-index: 1040; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--ink); margin: 0 6px 6px; }
.brand:hover { color: var(--ink); }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--acc); color: #fff; display: grid; place-items: center; font-size: 15px; flex: none; }
.side-nav { overflow-y: auto; flex: 1; margin: 0 -6px; padding: 0 6px; }
.sec { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: #9ca3af; margin: 14px 10px 4px; font-weight: 600; }
.nav-i { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 9px; color: #374151; font-size: 13.5px; }
.nav-i i { width: 18px; text-align: center; color: #9ca3af; }
.nav-i:hover { background: #f6f7f9; color: var(--ink); }
.nav-i.on { background: var(--acc-soft); color: var(--acc); font-weight: 600; }
.nav-i.on i { color: var(--acc); }
.cnt { margin-left: auto; font-size: 11.5px; background: var(--grey-soft); color: var(--grey); border-radius: 999px; padding: 1px 8px; font-weight: 600; }
.cnt.warn { background: var(--warn-soft); color: var(--warn); }
.side-foot { border-top: 1px solid var(--line); padding: 10px 10px 0; font-size: 11.5px; color: #9ca3af; }
.me { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 8px 4px 4px; border-radius: 999px; text-align: left; color: var(--muted); }
.me:hover, .me[aria-expanded="true"] { background: #f3f4f6; }
.me .av { width: 34px; height: 34px; }
.me-menu { min-width: 220px; border-color: var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(17,24,39,.12); }
.me-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.me-name { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 12px; color: var(--muted); }
.av { width: 36px; height: 36px; border-radius: 50%; background: var(--acc-soft); color: var(--acc); display: inline-grid; place-items: center;
      font-weight: 700; font-size: 12.5px; flex: none; }
.av.sm { width: 32px; height: 32px; font-size: 11.5px; }
.av.lg { width: 56px; height: 56px; font-size: 19px; }

/* ---------------------------------------------------------------- top bar + page */
.main { margin-left: var(--side-w); min-width: 0; min-height: 100vh; }
.top { position: sticky; top: 0; z-index: 1030; height: 64px; background: #fff; border-bottom: 1px solid var(--line);
       display: flex; align-items: center; gap: 14px; padding: 0 28px; }
.search { flex: 0 1 480px; display: flex; align-items: center; gap: 10px; background: #f3f4f6; border-radius: 10px; padding: 0 12px 0 14px; color: #9ca3af; }
.search input { flex: 1; border: 0; background: transparent; outline: none; padding: 9px 0; min-width: 0; color: var(--ink); font-size: 13.5px; }
.search:focus-within { background: #fff; box-shadow: 0 0 0 2px var(--acc-soft), 0 0 0 1px var(--acc); }
.kbd { border: 1px solid #d1d5db; border-radius: 6px; font-size: 11px; padding: 0 6px; color: var(--muted); background: #fff; white-space: nowrap; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; color: #4b5563; flex: none; }
.menu-btn { display: none; }
.content { padding: 20px 28px 40px; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.crumbs i { font-size: 9px; color: #c0c4cc; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--acc); }
.side-backdrop { display: none; }

/* Every page starts with a header row: <div class="d-flex justify-content-between ..."><h3 class="mb-0">… */
.page > .d-flex:first-child h3.mb-0, .page > .d-flex:first-child h3, .h-title { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.page > .d-flex:first-child { margin-bottom: 1rem !important; align-items: flex-end !important; gap: 12px; flex-wrap: wrap; }
.page-head { margin-bottom: 1rem; }
.page h4 { font-weight: 700; }

@media (max-width: 991.98px) {
  .side { transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .side-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(17,24,39,.35); z-index: 1035; }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .top { padding: 0 14px; gap: 10px; }
  .search .kbd { display: none; }
  .content { padding: 16px 14px 32px; }
}

/* ---------------------------------------------------------------- sign-in */
.anon-main { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.lcard { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 36px; }
.lcard .brand { justify-content: center; margin-bottom: 22px; }

/* ---------------------------------------------------------------- cards, tables, forms */
.card { border: 1px solid var(--line); border-radius: 14px; }
.card.shadow-sm, .shadow-sm { box-shadow: none !important; }
.card-h { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; margin-bottom: 10px; }
.filter-bar { background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.filter-bar .form-label { color: #4b5563; font-weight: 600; font-size: 12px; }
.form-label { font-weight: 600; font-size: 12.5px; color: #374151; }
.form-control, .form-select { border-color: #d9dce3; border-radius: 9px; }
.form-control-sm, .form-select-sm { border-radius: 8px; }
.form-control:focus, .form-select:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.form-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: #9ca3af; font-weight: 700;
                      border-bottom: 0; padding-bottom: 0; margin: 1.25rem 0 .7rem; }
.select2-container { width: 100% !important; }
.select2-container--bootstrap-5 .select2-selection { border-color: #d9dce3; border-radius: 9px; }

.table { --bs-table-striped-bg: #fafbfc; --bs-table-hover-bg: #f5f7fb; border-color: var(--line); }
.table > thead th, table.dataTable thead th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; border-bottom: 1px solid var(--line) !important; white-space: nowrap; }
table.dataTable { font-size: 13.5px; border-collapse: collapse !important; }
table.dataTable td, .table td { vertical-align: middle; border-color: var(--line); }
table.dataTable > tbody > tr > td { padding-top: 10px; padding-bottom: 10px; }
.dataTables_wrapper .dataTables_processing { background: rgba(255,255,255,.9); font-weight: 600; border-radius: 10px; }
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_info { color: var(--muted); font-size: 13px; }
.page-link { border-radius: 8px !important; margin: 0 2px; border-color: var(--line); color: #374151; }
.page-item.active .page-link { background: var(--acc); border-color: var(--acc); }
.code-pill { font-family: var(--bs-font-monospace); font-size: .8rem; background: var(--grey-soft); color: #374151; padding: .1rem .45rem; border-radius: 6px; }

/* ---------------------------------------------------------------- buttons */
.btn { border-radius: 9px; font-weight: 500; }
.btn-sm { border-radius: 8px; }
.btn-primary { background: var(--acc); border-color: var(--acc); }
.btn-primary:hover, .btn-primary:focus { background: var(--acc-hover); border-color: var(--acc-hover); }
.btn-outline-primary { color: var(--acc); border-color: var(--acc); }
.btn-outline-primary:hover { background: var(--acc); border-color: var(--acc); }
.btn-outline-secondary { color: #374151; border-color: #d9dce3; background: #fff; }
.btn-outline-secondary:hover { background: #f3f4f6; color: var(--ink); border-color: #c9cdd6; }
.btn:focus, .btn:active:focus, .form-check-input:focus { box-shadow: 0 0 0 3px var(--acc-soft); }

/* ---------------------------------------------------------------- badges = soft pills */
.badge { border-radius: 999px; font-weight: 600; padding: .3em .75em; font-size: 11.5px; }
.badge.bg-primary { background: var(--acc-soft) !important; color: var(--acc-hover) !important; }
.badge.bg-success { background: var(--ok-soft) !important; color: var(--ok) !important; }
.badge.bg-warning { background: var(--warn-soft) !important; color: var(--warn) !important; }
.badge.bg-danger { background: var(--bad-soft) !important; color: var(--bad) !important; }
.badge.bg-info { background: var(--info-soft) !important; color: var(--info) !important; }
.badge.bg-secondary { background: var(--grey-soft) !important; color: var(--grey) !important; }
.badge.bg-dark { background: #374151 !important; color: #fff !important; }
.badge.bg-light { background: #fff !important; }

/* ---------------------------------------------------------------- dashboard pieces */
.kpi { padding: 16px 18px; position: relative; height: 100%; }
.kpi-ic { position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }
.kpi-l { color: var(--muted); font-size: 13px; }
.kpi-n { font-size: 28px; font-weight: 700; line-height: 1.2; margin-top: 4px; color: var(--ink); }
.kpi-s { font-size: 12.5px; font-weight: 600; }
.t-red { color: #dc2626; } .bg-red { background: var(--bad-soft); color: #dc2626; }
.t-amber { color: #b45309; } .bg-amber { background: var(--warn-soft); color: #b45309; }
.t-blue { color: var(--acc); } .bg-blue { background: var(--acc-soft); color: var(--acc); }
.t-green { color: var(--ok); } .bg-green { background: var(--ok-soft); color: var(--ok); }
.li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink); }
.card-h + .li { border-top: 0; }
a.li:hover { background: #fafbfc; margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 8px; }
.sq { width: 34px; height: 34px; border-radius: 10px; background: var(--grey-soft); color: #4b5563; display: grid; place-items: center; flex: none; }
.call, .wa { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; flex: none; }
.call { background: var(--ok-soft); color: var(--ok); } .wa { background: #eafaf0; color: #16a34a; }
.call:hover { background: #d3efdc; color: var(--ok); } .wa:hover { background: #d7f5e2; color: #16a34a; }
.due { font-size: 12px; font-weight: 600; border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.due.late { background: var(--bad-soft); color: var(--bad); } .due.today { background: var(--warn-soft); color: var(--warn); } .due.new { background: var(--acc-soft); color: var(--acc); }
.prow { display: grid; grid-template-columns: 170px 1fr 44px; gap: 12px; align-items: center; padding: 6px 0; font-size: 13px; }
.bar { height: 8px; background: var(--grey-soft); border-radius: 4px; display: flex; overflow: hidden; }
.bar span { background: #22c55e; } .bar .chg { background: #f59e0b; }
.legend { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 400; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin: 0 4px 0 10px; }
.big-ic { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 22px; flex: none; }

/* chips: filters with counts, quick picks, outcome choices */
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 13px;
        font-size: 13px; color: #374151; cursor: pointer; user-select: none; white-space: nowrap; }
.chip b { font-weight: 700; }
.chip:hover { border-color: #c9cdd6; }
.chip.on, .btn-check:checked + .chip { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.pick.on, .btn-check:checked + .chip.pick { background: var(--acc); border-color: var(--acc); }
.btn-check:focus-visible + .chip { box-shadow: 0 0 0 3px var(--acc-soft); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg label { flex: 1; text-align: center; padding: 8px; font-size: 13px; color: #4b5563; cursor: pointer; margin: 0; }
.seg .btn-check:checked + label { background: var(--acc); color: #fff; font-weight: 600; }
.kv { display: flex; gap: 10px; font-size: 13px; padding: 3px 0; } .kv > span:first-child { color: var(--muted); width: 120px; flex: none; }

/* stat cards on older pages */
.stat-card { border: 1px solid var(--line); border-radius: 14px; }
.stat-card .stat-num { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { color: var(--muted); font-size: .8rem; }

/* Bootstrap 5.3 utilities used in views, missing from the bundled 5.1. */
.fw-semibold { font-weight: 600 !important; }
.bg-success-subtle { background-color: var(--ok-soft) !important; }
.bg-info-subtle    { background-color: var(--info-soft) !important; }
.bg-warning-subtle { background-color: var(--warn-soft) !important; }
.bg-danger-subtle  { background-color: var(--bad-soft) !important; }

/* leads */
table.dataTable tr.row-late > td { background: #fff8f8; }
.li .btn, .page > .d-flex:first-child .btn { white-space: nowrap; }
/* An empty validation summary is rendered on every form; show it only once it has errors. */
.validation-summary-valid { display: none !important; }
/* Top bar on a phone: search gives way; Sign out stays in the profile menu. */
.search { min-width: 0; }
@media (max-width: 575.98px) { .top .signout-btn { display: none; } }
