/* CallDesk for Manning Personnel Group, styled after manningpg.com: the navy
   header and footer, the royal-blue hero, the orange of the job tags, Montserrat
   for menus and labels, light Mukta for big headings and Varela Round for
   reading text, with softly rounded buttons. (--olive is the accent colour; the
   name is kept from the original CallDesk stylesheet.) */
:root {
  --navy: #182942;
  --navy-2: #1b3663;
  --ink-navy: #0a112d;
  --blue: #154799;
  --blue-dark: #103a7d;
  --olive: #f08d3c;
  --olive-dark: #d9772a;
  --red: #790000;
  --ink: #222222;
  --text: #404040;
  --muted: #6b7280;
  --line: #e2e5ea;
  --panel: #ffffff;
  --page: #f4f5f7;
  --wash: #f1f1f1;
  --good: #1d6b3f;
  --bad: #a11d1d;
  --accent: var(--navy);
  --accent-2: var(--blue);
  --radius: 4px;
  --ui: Montserrat, Helvetica, Arial, sans-serif;
  --display: Mukta, Montserrat, Helvetica, Arial, sans-serif;
  --reading: "Varela Round", Montserrat, Helvetica, Arial, sans-serif;
  --shadow: 0 1px 2px rgba(24, 41, 66, .06), 0 2px 8px rgba(24, 41, 66, .04);
}

html { font-size: 15px; }
body {
  background: var(--page);
  color: var(--text);
  font-family: var(--ui);
  overflow-x: clip;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
a { color: var(--blue); }
a:hover { color: var(--navy); }
h1, h2, h3 { color: var(--navy); }
h2 { font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- Top bar and main navigation ---------- */
.topbar { background: var(--ink-navy); color: #fff; font-size: .8rem; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 2.2rem; }
.topbar-tag { letter-spacing: .08em; text-transform: uppercase; font-weight: 600; opacity: .85; }
.topbar-user { display: flex; align-items: center; gap: 1rem; }
.topbar-user a, .topbar-link { color: #fff; text-decoration: none; background: none; border: 0; padding: 0; font: inherit; }
.topbar-user a:hover, .topbar-link:hover { color: var(--olive); }
.topbar-user form { margin: 0; }
.topbar-role { display: inline-block; margin-left: .35rem; padding: 0 .4rem; border: 1px solid rgba(255,255,255,.4); border-radius: 2px; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }

.mainnav { background: var(--navy); box-shadow: var(--shadow); padding: .6rem 0; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; margin-right: 1rem; }
.brand-mark { font-family: "Bodoni MT", Didot, "Playfair Display", Georgia, "Times New Roman", serif; font-weight: 400; font-size: 2.1rem; line-height: 1; color: #fff; letter-spacing: -.06em; }
.brand-name { display: flex; flex-direction: column; font-family: Georgia, "Times New Roman", serif; font-size: .58rem; line-height: 1.25; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.85); }
.brand-divider { width: 1px; height: 1.9rem; background: rgba(255,255,255,.3); }
.brand-product { font-size: 1.05rem; color: #fff; letter-spacing: .14em; text-transform: uppercase; font-weight: 300; }
.brand-product strong { font-weight: 800; }
.mainnav .nav-link { color: #fff; font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; padding: .6rem .55rem !important; border-bottom: 3px solid transparent; }
.mainnav .nav-link:hover, .mainnav .nav-link:focus { color: rgba(255,255,255,.7); }
.mainnav .nav-link.active { color: #fff; border-bottom-color: var(--olive); }
.nav-cta { margin-left: .75rem; white-space: nowrap; }
.nav-count { display: inline-block; min-width: 1.25rem; padding: 0 .35rem; margin-left: .35rem; border-radius: 999px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; text-align: center; line-height: 1.25rem; }
.mainnav .navbar-toggler { border: 2px solid rgba(255,255,255,.8); border-radius: 2px; padding: .3rem .5rem; }
.mainnav .navbar-toggler-icon { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-width='2.4' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); }
@media (max-width: 1199px) { .brand-name { display: none; } }
@media (max-width: 600px) {
  .topbar-tag { display: none; }
  .topbar-inner { justify-content: flex-end; }
  .brand-mark { font-size: 1.7rem; }
  .brand-name { display: none; }
  .brand-product { font-size: .9rem; }
}
@media (max-width: 991px) {
  .nav-cta { margin: .5rem 0 .25rem; }
  .mainnav .nav-link { border-bottom: 0; border-left: 3px solid transparent; }
  .mainnav .nav-link.active { border-left-color: var(--olive); }
}

.sample-banner { background: #fdf1e4; color: #7a4310; border-bottom: 1px solid #f6d9b8; text-align: center; font-size: .78rem; letter-spacing: .04em; padding: .3rem 1rem; }

.site-footer { background: var(--navy); color: rgba(255,255,255,.75); font-size: .8rem; margin-top: 3rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding: 1.1rem .75rem; }
.site-footer strong { color: #fff; }

/* ---------- Page title band (full width, like the manningpg.com hero) ---------- */
.app-main { padding-bottom: 1rem; }
.page-head {
  margin: 0 calc(50% - 50vw) 1.5rem;
  padding: 2rem calc(50vw - 50% + .75rem) 1.75rem;
  background: linear-gradient(160deg, var(--blue) 0%, #2a5cae 100%);
  color: #fff;
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem;
}
.page-head h1 { color: #fff; font-family: var(--display); font-size: 2.5rem; font-weight: 300; margin: 0 0 .2rem; line-height: 1.1; }
.page-head p { margin: 0; color: rgba(255,255,255,.9); max-width: 50rem; font-family: var(--reading); }
.page-head .crumbs { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.75); margin-bottom: .35rem; font-weight: 700; }
.page-head .crumbs a { color: #fff; text-decoration: none; }
.page-head .crumbs a:hover { text-decoration: underline; }
.page-head .btn-outline-primary, .page-head .btn-outline-secondary { color: #fff; border-color: rgba(255,255,255,.7); background: transparent; }
.page-head .btn-outline-primary:hover, .page-head .btn-outline-secondary:hover { background: #fff; color: var(--navy); border-color: #fff; }
.page-head .btn-primary { background: var(--navy); border-color: var(--navy); }
.page-head .btn-primary:hover { background: var(--ink-navy); border-color: var(--ink-navy); }

/* ---------- Buttons and form controls (Bootstrap overrides) ---------- */
.btn { border-radius: 3px; font-weight: 600; font-size: .85rem; padding: .5rem 1.1rem; }
.btn-sm { font-size: .76rem; padding: .35rem .75rem; }
.btn-primary { background: var(--navy); border-color: var(--navy); }
.btn-primary:hover, .btn-primary:focus { background: var(--blue); border-color: var(--blue); }
.btn-outline-primary { color: var(--blue); border: 2px solid var(--blue); }
.btn-outline-primary:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-outline-secondary { color: var(--navy); border: 2px solid #c8ced6; }
.btn-outline-secondary:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-accent { background: var(--olive); border: 2px solid var(--olive); color: var(--ink-navy); }
.btn-accent:hover { background: #fff; border-color: #fff; color: var(--navy); }
.btn-success { background: var(--good); border-color: var(--good); }
.btn-outline-danger { border-width: 2px; }
.form-control, .form-select { border-radius: 3px; border-color: #cfd5dc; font-size: .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--blue); box-shadow: 0 0 0 .2rem rgba(21, 71, 153, .15); }
.btn:focus-visible, .form-control:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.alert { border-radius: 2px; border-left-width: 4px; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem .9rem; margin-bottom: 1.25rem; background: var(--panel); border: 1px solid var(--line); padding: .8rem 1rem; box-shadow: var(--shadow); border-radius: var(--radius); }
.card .filters { box-shadow: none; border: 0; padding: 0; background: none; }
.filters label { display: flex; flex-direction: column; font-size: .68rem; color: var(--muted); gap: .2rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.filters .form-control, .filters .form-select { min-width: 9.5rem; text-transform: none; letter-spacing: 0; font-weight: 400; }

/* ---------- Cards and layout ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; min-width: 0; box-shadow: var(--shadow); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); gap: 1rem; margin-bottom: 1rem; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .9rem; margin-bottom: 1.25rem; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi-value { font-size: 1.6rem; } }
.kpi { display: flex; flex-direction: column; gap: .2rem; border-top: 3px solid var(--navy); }
.kpi:nth-child(4) { border-top-color: var(--olive); }
.kpi-label { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.kpi-value { font-family: var(--display); font-size: 2.3rem; font-weight: 300; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-delta { font-size: .78rem; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.kpi-delta.good { color: var(--good); }
.kpi-delta.good::before { content: "▲ "; font-size: .65rem; }
.kpi-delta.bad { color: var(--bad); }
.kpi-delta.bad::before { content: "▼ "; font-size: .65rem; }
.kpi-note { font-size: .72rem; color: var(--muted); }

/* ---------- Charts ---------- */
svg.chart { display: block; max-height: 260px; }
svg.chart .grid { stroke: #e9ecf0; stroke-width: 1; }
svg.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--ui); }
svg.chart g:hover rect:first-of-type { opacity: .8; }

.funnel { display: flex; flex-direction: column; gap: .6rem; }
.funnel-row { display: grid; grid-template-columns: 7.5rem 1fr auto; align-items: center; gap: .7rem; font-size: .88rem; }
.funnel-label { font-weight: 600; color: var(--navy); }
.funnel-track { background: #eef0f3; height: 1.4rem; overflow: hidden; border-radius: 2px; }
.funnel-bar { display: block; height: 100%; background: var(--navy); }
.funnel-row:nth-child(2) .funnel-bar { background: var(--navy-2); }
.funnel-row:nth-child(3) .funnel-bar { background: var(--blue); }
.funnel-row:nth-child(4) .funnel-bar { background: var(--olive); }
.funnel-bar.worst { background: var(--red) !important; }
.funnel-value { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; color: var(--ink); }
.funnel-value .muted { font-weight: 400; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: .55rem .7rem; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child, table.data .left { text-align: left; }
table.data thead th { background: var(--wash); color: var(--navy); font-weight: 700; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; border-bottom: 2px solid var(--navy); }
table.data th a { color: inherit; text-decoration: none; }
table.data th a.sorted { color: var(--blue); }
table.data th a.sorted::after { content: " ↕"; }
table.data tbody tr:hover { background: #f7f9fc; }
table.data td a { font-weight: 600; text-decoration: none; }
table.data td a:hover { text-decoration: underline; }
table.data tfoot td { font-weight: 700; color: var(--navy); border-top: 2px solid var(--navy); border-bottom: 0; background: var(--wash); }
td.flag { color: var(--bad); font-weight: 700; }
table.data td.wrap { white-space: normal; min-width: 14rem; text-align: left; }
@media (max-width: 1100px) { table.data th, table.data td { padding: .5rem .5rem; } }
/* On tablets a wide table scrolls sideways; its first column (the name) stays in view. */
@media (min-width: 641px) {
  .table-wrap table.data th:first-child, .table-wrap table.data td:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); }
  .table-wrap table.data thead th:first-child, .table-wrap table.data tfoot td:first-child { background: var(--wash); }
}

/* ---------- Badges ---------- */
.badge-outcome { display: inline-block; padding: .12rem .5rem; border-radius: 2px; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: #eceef1; color: #4b5563; }
.badge-outcome.o3 { background: #e4ebf6; color: var(--blue-dark); }
.badge-outcome.o4 { background: #d3dff2; color: var(--navy); }
.badge-outcome.o5 { background: #fde6cf; color: #7a4310; }
.pill { display: inline-block; padding: .08rem .5rem; border-radius: 2px; font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: #eceef1; color: var(--muted); }
.pill.sample { background: #fdf1e4; color: #7a4310; }
.pill.off { background: #f7e4e4; color: var(--bad); }

/* ---------- Detail pages ---------- */
.detail-grid { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.5rem; margin: 0; }
.detail-grid dt { color: var(--muted); font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; padding-top: .15rem; }
.detail-grid dd { margin: 0; color: var(--ink); }
.note { border-left: 3px solid var(--olive); padding: .5rem .8rem; margin-bottom: .6rem; background: #fef8f1; }
.note .meta { font-size: .75rem; color: var(--muted); font-weight: 600; }
.link-card { border-top: 3px solid var(--olive); }
.invite-link { word-break: break-all; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; background: var(--wash); padding: .6rem; border-left: 3px solid var(--olive); }
.pager { display: flex; gap: .75rem; align-items: center; justify-content: flex-end; margin-top: .9rem; font-size: .85rem; }

/* ---------- Forms ---------- */
.form-card { max-width: 54rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem 1.25rem; }
.form-grid label { display: flex; flex-direction: column; gap: .3rem; font-size: .7rem; color: var(--navy); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.form-grid label .muted, .form-grid label .text-danger { text-transform: none; letter-spacing: 0; font-weight: 400; }
.form-grid .form-control, .form-grid .form-select { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid input[type=number] { max-width: 6rem; }

/* ---------- Actions ---------- */
.action { border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 2px; padding: .75rem 1rem; margin-bottom: .6rem; background: var(--panel); }
.action.overdue { border-left-color: var(--red); }
.action.done { border-left-color: var(--good); background: #f8fbf9; }
.action.done h3 { color: var(--muted); }
.action .meta { font-size: .75rem; color: var(--muted); }
.action-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .15rem; }
.action h3 { font-size: .98rem; font-weight: 700; margin: 0; }
.action-body { margin-top: .35rem; }
.action-done-note { margin-top: .35rem; font-size: .8rem; color: var(--good); font-weight: 600; }
.action-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .65rem; padding-top: .6rem; border-top: 1px dashed var(--line); }
.action-done-form { display: flex; gap: .5rem; flex: 1 1 22rem; max-width: 32rem; }
.action-done-form .form-control { flex: 1; }
.flash { margin-bottom: 1rem; }

/* ---------- Sign-in pages ---------- */
body.public { background: var(--navy); }
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-hero { position: relative; color: #fff; padding: 3rem clamp(1.5rem, 5vw, 4.5rem); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  background: linear-gradient(160deg, var(--blue) 0%, rgba(21,71,153,.82) 55%, var(--navy) 100%), var(--navy); }
.auth-hero::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.07) 1.5px, transparent 1.5px); background-size: 22px 22px; pointer-events: none; }
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero .brand-mark { color: #fff; font-size: 2.6rem; }
.auth-hero .brand-product { color: #fff; }
.auth-hero .brand-divider { background: rgba(255,255,255,.3); }
.auth-title { font-family: var(--display); font-size: clamp(2.2rem, 4.4vw, 3.6rem); line-height: 1.05; text-transform: none; letter-spacing: 0; margin: 2rem 0 1rem; color: #fff; }
.auth-title span { display: block; font-weight: 300; }
.auth-title strong { display: block; font-weight: 600; }
.auth-lead { max-width: 30rem; color: rgba(255,255,255,.9); font-size: 1rem; font-family: var(--reading); }
.auth-points { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .55rem; color: rgba(255,255,255,.88); font-size: .92rem; }
.auth-points li::before { content: ""; display: inline-block; width: .55rem; height: .55rem; background: var(--olive); margin-right: .7rem; }
.auth-foot { font-size: .75rem; color: rgba(255,255,255,.55); letter-spacing: .06em; text-transform: uppercase; }
.auth-panel { background: #fff; display: flex; align-items: center; justify-content: center; padding: 3rem 1.5rem; }
.auth-card { width: 100%; max-width: 24rem; }
.auth-card h1 { font-family: var(--display); font-size: 2.2rem; font-weight: 300; margin-bottom: .4rem; }
.auth-card .eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--blue); margin-bottom: .4rem; }
.auth-card label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--navy); }
.auth-card .form-control { padding: .65rem .75rem; }
.auth-links { display: flex; flex-direction: column; gap: .4rem; margin-top: 1.1rem; font-size: .85rem; }
.auth-links a { font-weight: 600; }
.no-email-note { border-left: 3px solid var(--olive); background: #fef8f1; padding: .6rem .8rem; font-size: .85rem; color: var(--text); }
.no-email-note strong { color: var(--navy); }
.auth-card .form-check-label { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text); font-size: .85rem; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 2rem 1.25rem; }
  .auth-title { margin: 1.25rem 0 .5rem; }
  .auth-points, .auth-foot { display: none; }
}
/* The access-denied page and any other bare page reuse the panel without the hero. */
.auth-single { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-single .auth-card { background: #fff; padding: 2.25rem; border-top: 4px solid var(--olive); }

/* ---------- Phones and tablets ---------- */
/* Touch screens: iOS zooms into any field under 16px, and buttons need a finger-sized target. */
@media (pointer: coarse), (max-width: 640px) {
  .form-control, .form-select, .form-control-sm, .form-select-sm { font-size: 16px; }
  .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 2.5rem; }
}
@media (max-width: 600px) {
  .auth-hero { padding: 1.5rem 1.25rem; }
  .auth-title { font-size: 1.7rem; }
  .auth-lead { display: none; }
  .auth-panel { align-items: flex-start; padding: 2rem 1.25rem; }
}
@media (max-width: 640px) {
  .page-head { padding-top: 1.4rem; padding-bottom: 1.2rem; }
  .page-head h1 { font-size: 1.4rem; }
  .card { padding: 1rem; }
  .filters label { flex: 1 1 9rem; }
  .filters .form-control, .filters .form-select { min-width: 0; width: 100%; }
  .nav-cta { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; gap: .1rem; }
  .detail-grid dd { margin-bottom: .5rem; }

  /* Tables become a stack of cards: the first cell is the card's title, the rest are
     "label ... value" lines. site.js copies each column heading into data-label. */
  .table-wrap { overflow: visible; }
  table.data, table.data tbody, table.data tfoot, table.data tr, table.data td { display: block; width: 100%; }
  table.data thead { display: none; }
  table.data tr { border: 1px solid var(--line); border-left: 3px solid var(--navy); border-radius: 2px; padding: .5rem .8rem; margin-bottom: .6rem; background: var(--panel); }
  table.data tbody tr:hover { background: var(--panel); }
  table.data td, table.data td.wrap { border: 0; padding: .2rem 0; text-align: right; white-space: normal; min-width: 0; }
  table.data td::before { content: attr(data-label); float: left; margin-right: 1rem; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); line-height: 1.6; }
  table.data td::after { content: ""; display: table; clear: both; }
  table.data td:first-child { text-align: left; font-size: 1rem; font-weight: 700; color: var(--navy); padding-bottom: .3rem; }
  table.data td:first-child::before, table.data td:not([data-label])::before { content: none; }
  table.data td:not([data-label]) { text-align: left; }
  table.data td:not([data-label]):not(:first-child) { padding-top: .5rem; }
  table.data td:empty { display: none; }
  table.data td .d-flex { justify-content: flex-start !important; flex-wrap: wrap; }
  table.data td .form-select { display: inline-block; width: auto; max-width: 60%; }
  table.data tfoot tr { background: var(--wash); border-left-color: var(--olive); }
  table.data tfoot td { background: none; border: 0; }
}

@media print {
  .no-print, .filters, .mainnav, .topbar, .sample-banner, .site-footer { display: none !important; }
  body { background: #fff; }
  .page-head { background: none !important; color: var(--navy); border-bottom: 2px solid var(--navy); margin: 0 0 1rem; padding: 0 0 .5rem; }
  .page-head h1, .page-head p { color: var(--navy) !important; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}
