:root {
  --bg: #f5f8fc;
  --surface: #ffffff;
  --surface-soft: #f9fbfe;
  --ink: #061739;
  --muted: #62708a;
  --line: #dce5f0;
  --navy: #06214a;
  --navy-deep: #021733;
  --blue: #1f68b7;
  --teal: #159ca5;
  --teal-dark: #08717c;
  --green: #0f8f70;
  --amber: #eb8b0a;
  --red: #bd4545;
  --shadow: 0 12px 30px rgba(16, 39, 74, 0.08);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  letter-spacing: 0;
}

body.auth-checking .sidebar,
body.auth-checking .app-shell,
body.auth-required .sidebar,
body.auth-required .app-shell {
  visibility: hidden;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(3, 18, 38, 0.26), rgba(5, 58, 88, 0.18)),
    url("/Pic/Backgroundpicture.png") center center / cover no-repeat;
}

.auth-gate[hidden] {
  display: none;
}

.auth-landing-trigger {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.auth-panel {
  position: relative;
  width: min(380px, 100%);
  padding: 26px 24px 18px;
  border: 1px solid rgba(131, 218, 255, 0.45);
  border-radius: 20px;
  color: #f4fbff;
  background:
    linear-gradient(180deg, rgba(24, 61, 106, 0.68), rgba(12, 31, 59, 0.76)),
    rgba(10, 28, 54, 0.42);
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 24px rgba(86, 193, 255, 0.2);
  transition: opacity 180ms ease, transform 180ms ease;
}

.auth-panel::before,
.auth-panel::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(120, 205, 255, 0.18);
  border-radius: 16px;
  pointer-events: none;
}

.auth-panel::after {
  inset: auto 18px 18px auto;
  width: 72px;
  height: 72px;
  border-left: 0;
  border-top: 0;
}

.auth-gate.landing-collapsed .auth-panel {
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  pointer-events: none;
}

.auth-gate:not(.landing-collapsed) .auth-landing-trigger {
  display: none;
}

.auth-brand {
  margin-bottom: 14px;
  text-align: center;
}

.auth-brand strong,
.auth-brand span {
  display: block;
}

.auth-brand strong {
  font-size: 34px;
  line-height: 1.08;
  color: #ffffff;
  text-shadow: 0 2px 18px rgba(83, 195, 255, 0.22);
}

.auth-brand span {
  margin-top: 7px;
  color: rgba(223, 239, 255, 0.82);
  font-weight: 600;
  font-size: 15px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.auth-tab {
  min-height: 38px;
  display: grid;
  place-items: center;
  border-bottom: 1px solid rgba(180, 216, 255, 0.16);
  color: rgba(218, 232, 248, 0.76);
  font-weight: 600;
  font-size: 14px;
}

.auth-tab.active {
  color: #ffffff;
  border-radius: 12px;
  border: 1px solid rgba(124, 208, 255, 0.3);
  background: linear-gradient(180deg, rgba(100, 180, 255, 0.18), rgba(66, 131, 243, 0.1));
  box-shadow: inset 0 -2px 0 rgba(123, 208, 255, 0.9), 0 8px 20px rgba(76, 156, 255, 0.18);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form + .auth-form {
  margin-top: 12px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: rgba(222, 236, 252, 0.84);
  font-size: 12px;
  font-weight: 600;
}

.auth-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(151, 201, 255, 0.28);
  border-radius: 10px;
  padding: 0 14px;
  color: #ffffff;
  background: rgba(11, 25, 48, 0.3);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.auth-form input::placeholder {
  color: rgba(205, 222, 241, 0.48);
}

.auth-form input:focus {
  border-color: rgba(114, 202, 255, 0.78);
  box-shadow: 0 0 0 3px rgba(87, 187, 255, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.auth-form button {
  min-height: 46px;
  border: 1px solid rgba(121, 209, 255, 0.34);
  border-radius: 10px;
  color: #ffffff;
  background: linear-gradient(180deg, rgba(91, 194, 255, 0.96), rgba(55, 121, 230, 0.94));
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(54, 127, 244, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.auth-form button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.auth-form .text-button {
  min-height: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(205, 227, 255, 0.92);
}

.admin-form,
.admin-user-form {
  display: grid;
  gap: 12px;
}

.admin-access-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-form input,
.admin-user-form input,
.admin-user-form select {
  width: 100%;
}

.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.checkbox-label input {
  width: 16px;
  height: 16px;
}

.auth-message {
  min-height: 20px;
  margin: 14px 0 0;
  color: rgba(214, 231, 248, 0.84);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.auth-message.error {
  color: #ffd0d0;
}

.auth-footnote {
  margin: 14px 0 0;
  color: rgba(207, 228, 247, 0.62);
  font-size: 11.5px;
  text-align: center;
}

@media (max-width: 900px) and (orientation: portrait) {
  .auth-gate {
    background:
      linear-gradient(180deg, rgba(5, 16, 33, 0.16), rgba(5, 28, 56, 0.2)),
      url("/Pic/BackgroundpictureforPhone.png") center center / cover no-repeat;
  }
}

@media (max-width: 640px) {
  .auth-gate {
    padding: 18px 14px;
  }

  .auth-panel {
    width: min(100%, 360px);
    padding: 22px 16px 16px;
    border-radius: 18px;
  }

  .auth-panel::before {
    inset: 8px;
    border-radius: 14px;
  }

  .auth-panel::after {
    right: 14px;
    bottom: 14px;
    width: 56px;
    height: 56px;
  }

  .auth-brand strong {
    font-size: 30px;
  }

  .auth-brand span {
    font-size: 14px;
  }

  .auth-tabs {
    gap: 8px;
    margin-bottom: 16px;
  }

  .auth-tab {
    min-height: 36px;
    font-size: 13px;
  }

  .auth-form {
    gap: 12px;
  }

  .auth-form input,
  .auth-form button {
    min-height: 46px;
  }

  .auth-message {
    font-size: 12.5px;
  }

  .auth-footnote {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .auth-gate {
    padding: 14px 12px;
  }

  .auth-panel {
    width: min(100%, 340px);
    padding: 20px 14px 14px;
  }

  .auth-brand strong {
    font-size: 27px;
  }

  .auth-brand span {
    font-size: 13px;
  }

  .auth-tabs {
    margin-bottom: 14px;
  }

  .auth-form label {
    gap: 6px;
    font-size: 11.5px;
  }

  .auth-form input,
  .auth-form button {
    min-height: 44px;
    border-radius: 9px;
  }

  .auth-message,
  .auth-footnote {
    line-height: 1.35;
  }
}

button,
select,
input {
  font: inherit;
}

button,
a,
select {
  min-height: 34px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  color: #ffffff;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  padding: 0 4px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
}

.brand strong,
.brand span {
  display: block;
  line-height: 1;
}

.brand strong {
  font-size: 30px;
  letter-spacing: 0;
}

.brand span {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 800;
  color: #bed3ec;
}

.mobile-menu-button {
  display: none;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.mobile-menu-button span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: #ffffff;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  color: #e9f2ff;
  text-decoration: none;
  font-size: 14px;
}

.side-nav a.active,
.side-nav a:hover {
  background: linear-gradient(90deg, #286fc0, #124e91);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.nav-icon {
  width: 24px;
  color: #9fc1e9;
  font-size: 11px;
  font-weight: 800;
}

.active-filter-card {
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-account {
  margin-top: auto;
  display: grid;
  gap: 9px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-account strong {
  min-width: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-logout {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
  font-weight: 800;
  cursor: pointer;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.16);
}

.sidebar-admin-link {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(255, 184, 77, 0.45);
  border-radius: 6px;
  color: #ffe8bf;
  background: rgba(255, 184, 77, 0.12);
  font-weight: 800;
  cursor: pointer;
}

.sidebar-admin-link:hover,
.sidebar-admin-link.active {
  background: rgba(255, 184, 77, 0.22);
  color: #ffffff;
}

.sidebar-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: #c8dbf3;
  margin-bottom: 10px;
}

#activeFilters {
  display: grid;
  gap: 10px;
}

.filter-chip {
  display: grid;
  gap: 5px;
}

.filter-chip span {
  color: #c8dbf3;
  font-size: 12px;
}

.filter-chip strong {
  padding: 9px 10px;
  border-radius: 6px;
  background: rgba(36, 112, 188, 0.55);
  font-size: 13px;
  line-height: 1.25;
}

.filter-empty {
  color: #c8dbf3;
  font-size: 13px;
}

.clear-link {
  margin-top: 14px;
  color: #65b8ff;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.app-shell {
  min-width: 0;
  padding: 18px 16px 26px;
}

.agent-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.agent-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  min-height: 50px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.agent-tab:hover {
  border-color: #b7cae3;
  background: #eaf3ff;
}

.agent-tab.active {
  border-color: var(--blue);
  background: linear-gradient(135deg, #e2f0ff, #c5e0ff);
  box-shadow: 0 6px 16px rgba(31, 104, 183, 0.18);
}

.agent-tab-body {
  display: grid;
  gap: 2px;
  line-height: 1.2;
}

.agent-tab-body strong {
  font-size: 14px;
}

.agent-tab-body small {
  color: var(--muted);
  font-size: 11px;
}

.run-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #c2cad6;
}

.run-dot.ok {
  background: var(--green);
}

.run-dot.error {
  background: var(--red);
}

.run-dot.running {
  background: var(--amber);
  box-shadow: 0 0 0 0 rgba(235, 139, 10, 0.55);
  animation: pulse 1.4s infinite ease-out;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(235, 139, 10, 0.5);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(235, 139, 10, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(235, 139, 10, 0);
  }
}

.agent-scope {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: var(--shadow);
}

.agent-scope-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.agent-scope-main strong {
  font-size: 16px;
}

.agent-scope p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.lookback-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.lookback-control select {
  min-width: 105px;
}

.agent-picker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.agent-picker select {
  min-width: 170px;
}

.open-data-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #f6f9ff, #ecf3fc);
  box-shadow: var(--shadow);
}

.open-data-bar .open-data-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.open-data-bar .open-data-info strong {
  font-size: 13px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--navy);
}

.open-data-bar .open-data-info span {
  font-size: 13px;
}

.open-data-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.open-data-source-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #054a83;
  background: #d3e9ff;
  margin-left: 6px;
}

.respondents-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  margin-left: 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #4d2570;
  background: #f0e0fa;
  cursor: help;
}

.respondents-name-list {
  display: grid;
  gap: 4px;
  min-width: 220px;
  max-width: 320px;
}

.respondents-name-list span {
  display: block;
  overflow: hidden;
  padding: 3px 7px;
  border: 1px solid #dbe6f2;
  border-radius: 6px;
  background: #f8fbff;
  color: #17324d;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.respondents-name-list em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.respondents-block {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.respondents-block h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.respondents-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
}

.respondents-table th,
.respondents-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  text-align: left;
}

.respondents-table tr.winner {
  background: #ecfbf3;
}

.respondents-table tr.winner td {
  font-weight: 700;
}

.winner-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  color: #075f4b;
  background: #b6f0d6;
}

.side-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  color: #e9f2ff;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.side-nav-link.active,
.side-nav-link:hover {
  background: linear-gradient(90deg, #286fc0, #124e91);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.view-panel {
  display: block;
}

.view-panel[hidden] {
  display: none;
}

.command-bar[hidden],
#filtersPanel[hidden],
#statusBanner[hidden],
body.admin-mode .command-bar,
body.admin-mode #filtersPanel,
body.admin-mode #statusBanner {
  display: none !important;
}

.kpi-strip-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.admin-database-kpis {
  margin-top: 12px;
}

.admin-database-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.admin-workspace {
  min-width: 0;
  min-height: calc(100vh - 32px);
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #f6f8fb;
  color: #132033;
  overflow: hidden;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.admin-workspace-header {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 18px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #dbe3ee;
  background: #ffffff;
}

.admin-top-tabs {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

.admin-top-tab {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #d2dce9;
  border-radius: 999px;
  background: #f8fafc;
  color: #42526a;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.admin-top-tab:hover,
.admin-top-tab.active {
  border-color: #2768b2;
  background: #eaf3ff;
  color: #0f4f93;
  box-shadow: 0 6px 14px rgba(39, 104, 178, 0.12);
}

.admin-title-block {
  display: grid;
  justify-items: start;
  gap: 5px;
  min-width: 0;
}

.admin-title-block span {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid #d7e2ef;
  border-radius: 999px;
  color: #607086;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.admin-title-block h1 {
  margin: 0;
  color: #10243b;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.12;
  white-space: nowrap;
}

.admin-status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  border-bottom: 1px solid #dbe3ee;
  background: #dbe3ee;
}

.admin-status-strip > div {
  min-width: 0;
  padding: 10px 12px;
  background: #ffffff;
}

.admin-status-strip span,
.admin-status-strip small {
  display: block;
  color: #64758d;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.admin-status-strip strong {
  display: block;
  overflow: hidden;
  color: #16283d;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-workspace-message {
  margin: 12px 14px 0;
}

.admin-section-panel {
  min-width: 0;
  padding: 16px 14px 18px;
}

.admin-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px 14px;
}

.admin-section-heading h2 {
  margin: 0;
  color: #132033;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.15;
}

.admin-group-kpis {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-group-kpis span {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #d6e1ec;
  border-radius: 8px;
  background: #ffffff;
  color: #63738a;
  font-size: 12px;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.admin-group-kpis strong {
  color: #113457;
  font-size: 15px;
  font-weight: 900;
}

.admin-group-body {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.admin-table-block {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid #d9e3ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.admin-table-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #dbe3ee;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.admin-table-heading h3 {
  margin: 0;
  color: #12263d;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.2;
}

.admin-table-heading p,
.admin-table-heading span {
  margin: 4px 0 0;
  color: #62758e;
  font-size: 12px;
  line-height: 1.35;
}

.admin-table-heading > span {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #edf6f2;
  color: #21734e;
  font-weight: 800;
  line-height: 1;
}

.admin-data-table {
  min-width: 1120px;
  font-size: 12.5px;
}

.admin-data-table th {
  background: #f6f8fb;
  color: #31435a;
  font-size: 11px;
  font-weight: 900;
  text-transform: none;
  white-space: nowrap;
}

.admin-data-table td {
  vertical-align: top;
  color: #24364b;
}

.admin-data-table tbody tr:hover {
  background: #f9fcff;
}

.admin-company-link {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: #0d57a1;
  font: inherit;
  font-weight: 900;
  text-align: left;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.admin-company-link:hover {
  color: #083b70;
}

.admin-users-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-actions .toolbar-button,
.admin-actions button,
.admin-form-actions .toolbar-button,
.admin-form-actions button {
  min-width: 110px;
}

.kpi.top-performer .kpi-icon {
  background: linear-gradient(135deg, #fbbf24, #d97706);
}

.kpi.top-performer strong {
  color: #b45309;
}

.analytics-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.analytics-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.analytics-toolbar-right {
  display: grid;
  justify-items: end;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
}

.analytics-search input {
  width: min(260px, 30vw);
}

.analytics-toolbar-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.analytics-panel {
  padding: 0;
  overflow: hidden;
}

.analytics-table {
  min-width: 880px;
}

.analytics-table th {
  padding: 11px 12px;
}

.analytics-table th.sort-col {
  cursor: pointer;
  user-select: none;
}

.analytics-table th.sort-col:hover {
  background: linear-gradient(180deg, #eaf2fb, #d9e8f8);
}

.analytics-table td {
  padding: 12px;
  vertical-align: middle;
}

.analytics-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.analytics-table tbody tr:hover {
  background: #f3f8ff;
}

.rank-col {
  width: 56px;
  text-align: center;
}

.num-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rank-pill {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e5edf7;
  color: #3a4d6b;
  font-weight: 900;
  font-size: 13px;
}

.rank-pill.rank-1 {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  color: #6c3a02;
}

.rank-pill.rank-2 {
  background: linear-gradient(135deg, #e5e7eb, #9ca3af);
  color: #1f2937;
}

.rank-pill.rank-3 {
  background: linear-gradient(135deg, #fed7aa, #c2410c);
  color: #4d1604;
}

.entity-cell strong {
  display: block;
  font-size: 13px;
}

.entity-cell span {
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

.analytics-dialog {
  width: min(960px, calc(100vw - 32px));
  max-height: 90vh;
}

.analytics-dialog #analyticsDialogBody {
  padding: 24px 24px 28px;
  overflow-y: auto;
  max-height: 90vh;
}

.analytics-detail-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-right: 96px;
}

.analytics-detail-header h2 {
  margin: 0 0 6px;
}

.analytics-detail-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.kpi-card {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.kpi-card span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-card strong {
  font-size: 17px;
  letter-spacing: -0.2px;
  color: var(--ink);
}

.detail-block {
  margin-top: 22px;
}

.detail-block h3 {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #1f3a64;
}

.analytics-detail-table {
  width: 100%;
  border-collapse: collapse;
}

.analytics-detail-table th,
.analytics-detail-table td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  text-align: left;
  vertical-align: top;
}

.analytics-detail-table th {
  background: #f4f7fb;
  font-weight: 800;
  color: #233657;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.analytics-detail-table tbody tr:hover {
  background: #f8fbff;
}

.analytics-detail-table strong {
  display: block;
}

.analytics-detail-table .muted {
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

.agency-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agency-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef3fb;
  color: #1f3a64;
  font-size: 12px;
}

.agency-pill strong {
  font-weight: 700;
}

.agency-pill .muted {
  font-size: 11px;
}

.year-bars {
  display: grid;
  gap: 10px;
}

.year-bar-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  font-size: 12px;
}

.year-bar-label {
  font-weight: 800;
  color: #1f3a64;
}

.year-bar-track {
  height: 14px;
  background: #eef3fb;
  border-radius: 6px;
  overflow: hidden;
}

.year-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #36bec6, #08717c);
}

.year-bar-meta {
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .analytics-detail-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .analytics-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .analytics-search input {
    width: 100%;
  }
}

/* Category navigation inside Companies / Projects views */
.category-nav {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.category-nav-inline {
  min-width: min(760px, 100%);
  margin-bottom: 0;
  box-shadow: none;
}

.category-nav-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.category-nav-label {
  flex: 0 0 auto;
  min-width: 88px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}

.category-nav-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.category-btn-sub {
  font-size: 12px;
  padding: 7px 12px;
}

.category-btn:hover {
  border-color: #b7cae3;
  background: #eaf3ff;
}

.category-btn.active {
  border-color: var(--blue);
  background: linear-gradient(135deg, #ecf4ff, #d8e9ff);
  color: #0f3f78;
}

.agent-picker[hidden] {
  display: none;
}

/* Admin "Intel" cell button on Companies table */
.intel-btn {
  padding: 6px 14px;
  border: 1px solid rgba(255, 184, 77, 0.55);
  border-radius: 999px;
  background: linear-gradient(135deg, #ffb84d, #f9a01b);
  color: #2b1700;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.intel-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(249, 160, 27, 0.35);
}

/* Company Intelligence modal */
.company-intel-dialog {
  width: min(1180px, 96vw);
  max-width: 96vw;
  max-height: 92vh;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 22px 60px rgba(8, 28, 60, 0.35);
}
.company-intel-dialog::backdrop {
  background: rgba(7, 18, 38, 0.55);
  backdrop-filter: blur(2px);
}

.company-intel-shell {
  display: grid;
  gap: 16px;
  padding: 20px 22px 24px;
  max-height: 92vh;
  overflow-y: auto;
}

.company-intel-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.company-intel-title .kicker {
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #b8731e;
  text-transform: uppercase;
}
.company-intel-title h2 {
  margin: 4px 0 0;
  font-size: 22px;
}
.company-intel-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.company-intel-limitations {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed rgba(249, 160, 27, 0.45);
  border-radius: 8px;
  background: rgba(255, 244, 218, 0.6);
  color: #6b4500;
  font-size: 12.5px;
  line-height: 1.45;
}

.ci-intel-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.ci-intel-kpis span {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d9e4f0;
  border-radius: 8px;
  background: #f7fbff;
  color: #5f7188;
  font-size: 11.5px;
  font-weight: 800;
}

.ci-intel-kpis strong {
  color: #10243b;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
}

.company-intel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.company-intel-panel {
  padding: 14px 16px;
}
.company-intel-panel.wide {
  grid-column: 1 / -1;
}
.company-intel-panel h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.ci-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ci-helper {
  margin: 0 0 8px;
  font-size: 12px;
}

.company-intel-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}
.company-intel-form label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.company-intel-form input,
.company-intel-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  font-size: 13.5px;
  font-family: inherit;
}
.company-intel-form textarea {
  resize: vertical;
  min-height: 56px;
}
.company-intel-form label:has(textarea) {
  grid-column: 1 / -1;
}
.inline-input {
  display: flex;
  gap: 6px;
}
.inline-input input {
  flex: 1;
}

.ci-list-editor {
  display: grid;
  gap: 10px;
}
.ci-list-card {
  position: relative;
  padding: 10px 36px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}
.ci-list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}
.ci-field {
  display: grid;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}
.ci-field.wide {
  grid-column: 1 / -1;
}
.ci-field input,
.ci-field textarea {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  font-size: 13px;
  font-family: inherit;
}
.ci-list-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(220, 60, 60, 0.1);
  color: #b3261e;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.ci-list-remove:hover {
  background: rgba(220, 60, 60, 0.22);
}
.ci-empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

.ci-search-targets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.ci-search-card {
  display: grid;
  gap: 5px;
  min-height: 108px;
  padding: 12px;
  border: 1px solid #d9e4f0;
  border-radius: 8px;
  background: #ffffff;
  color: #1d3551;
  text-decoration: none;
}

.ci-search-card:hover {
  border-color: #2b6fb6;
  box-shadow: 0 8px 18px rgba(18, 71, 120, 0.12);
}

.ci-search-card strong {
  font-size: 13px;
}

.ci-search-card span,
.ci-search-card small {
  color: #66778d;
  font-size: 11.5px;
  line-height: 1.35;
}

.ci-admin-records,
.ci-source-ledger {
  display: grid;
  gap: 12px;
}

.ci-admin-record-section {
  display: grid;
  gap: 6px;
}

.ci-admin-record-section h4 {
  margin: 0;
  color: #1b2d43;
  font-size: 13px;
  font-weight: 900;
}

.ci-mini-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #ffffff;
}

.ci-mini-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 12px;
}

.ci-mini-table th,
.ci-mini-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e4ebf3;
  text-align: left;
  vertical-align: top;
}

.ci-mini-table th {
  background: #f6f8fb;
  color: #344962;
  font-weight: 900;
  white-space: nowrap;
}

.ci-mini-table td {
  color: #24364b;
}

.land-sale-table {
  width: 100%;
  min-width: 1320px;
  table-layout: fixed;
}

.land-sale-table th,
.land-sale-table td {
  overflow-wrap: anywhere;
}

.land-sale-table th {
  position: sticky;
  top: 0;
  z-index: 4;
}

.land-sale-table thead tr.table-filter-row th {
  top: 42px;
  z-index: 3;
}

.land-sale-table th:first-child,
.land-sale-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #ffffff;
  box-shadow: 1px 0 0 #dbe4ef;
}

.land-sale-table thead th:first-child {
  z-index: 7;
  background: #f6f8fb;
}

.land-sale-table thead tr.table-filter-row th:first-child {
  z-index: 6;
}

.land-sale-table th:nth-child(1),
.land-sale-table td:nth-child(1) { width: 220px; }
.land-sale-table th:nth-child(2),
.land-sale-table td:nth-child(2) { width: 150px; }
.land-sale-table th:nth-child(3),
.land-sale-table td:nth-child(3) { width: 110px; }
.land-sale-table th:nth-child(4),
.land-sale-table td:nth-child(4) { width: 150px; }
.land-sale-table th:nth-child(5),
.land-sale-table td:nth-child(5) { width: 235px; }
.land-sale-table th:nth-child(6),
.land-sale-table td:nth-child(6) { width: 88px; }
.land-sale-table th:nth-child(7),
.land-sale-table td:nth-child(7),
.land-sale-table th:nth-child(8),
.land-sale-table td:nth-child(8),
.land-sale-table th:nth-child(9),
.land-sale-table td:nth-child(9) { width: 96px; }
.land-sale-table th:nth-child(10),
.land-sale-table td:nth-child(10),
.land-sale-table th:nth-child(11),
.land-sale-table td:nth-child(11) { width: 74px; }
.land-sale-table th:nth-child(12),
.land-sale-table td:nth-child(12) { width: 100px; }
.land-sale-table th:nth-child(13),
.land-sale-table td:nth-child(13),
.land-sale-table th:nth-child(14),
.land-sale-table td:nth-child(14) { width: 92px; }
.land-sale-table th:nth-child(15),
.land-sale-table td:nth-child(15) { width: 70px; }

.land-sale-table .title-cell strong {
  color: #10243b;
  font-weight: 900;
}

.land-sale-table .title-cell span {
  color: #66778d;
  font-size: 11.5px;
}

.land-sale-bids {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.land-sale-bid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  padding: 6px 7px;
  border-radius: 6px;
  background: #eef9f2;
  color: #06214a;
  font-size: 11.5px;
  line-height: 1.25;
}

.land-sale-bid.invalid {
  background: #fff3e0;
}

.land-sale-bid span {
  min-width: 0;
}

.land-sale-bid strong {
  font-weight: 900;
  white-space: nowrap;
}

.land-sale-bid small,
.land-sale-bid em {
  grid-column: 1 / -1;
  color: #62758e;
  font-style: normal;
}

@media (max-width: 760px) {
  .land-sale-table {
    min-width: 1280px;
    font-size: 11.5px;
  }

  .land-sale-table th:first-child,
  .land-sale-table td:first-child {
    width: 190px;
    min-width: 190px;
    max-width: 190px;
  }
}

.ci-count {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eaf1fb;
  color: #1f4a86;
  font-size: 11.5px;
  font-weight: 800;
}

.ci-history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.ci-history-card {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}
.ci-history-card.ongoing {
  background: #fff9eb;
  border-color: rgba(249, 160, 27, 0.4);
}
.ci-history-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.ci-history-date {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.ci-history-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-top: 4px;
  color: #335078;
}
.ci-history-value {
  font-weight: 800;
  color: #1f4a86;
}
.ci-history-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 11.5px;
}
.ci-history-foot a {
  color: var(--blue);
  text-decoration: none;
}

@media (max-width: 900px) {
  .company-intel-grid,
  .company-intel-form,
  .ci-intel-kpis,
  .ci-list-grid {
    grid-template-columns: 1fr;
  }
}

/* Scope toggle + group chips inside the Companies view */
.scope-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.scope-bar-left,
.scope-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.scope-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}

.scope-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}

.scope-toggle-btn {
  padding: 7px 14px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.scope-toggle-btn.active {
  background: var(--navy);
  color: #ffffff;
}

.group-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.group-chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.group-chip.sub {
  background: #f4f7fb;
  color: #3a4d6b;
}

.group-chip:hover {
  border-color: var(--blue);
}

.group-chip.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

/* Group summary cards (above the companies table) */
.group-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.group-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface);
  cursor: pointer;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--blue);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.group-card.construction {
  border-top-color: var(--amber);
}

.group-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(31, 104, 183, 0.18);
}

.group-card header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.group-card-tag {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--blue);
  padding: 2px 7px;
  background: #ecf3fb;
  border-radius: 999px;
}

.group-card.construction .group-card-tag {
  color: #8a4e09;
  background: #fdf3e0;
}

.group-card header strong {
  font-size: 14px;
}

.group-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  font-size: 12px;
}

.group-card-stats div {
  display: grid;
  gap: 2px;
}

.group-card-stats span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.group-card-stats strong {
  font-size: 14px;
}

/* Group pill inside the companies table */
.group-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 9px;
  margin-right: 4px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #0d3470;
  background: #e0ecfb;
}

.group-pill.construction {
  color: #6b3d05;
  background: #fde7c4;
}

.group-pill-count {
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  font-weight: 800;
}

/* Sources dialog */
.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.source-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: var(--surface-soft);
  display: grid;
  gap: 10px;
}

.source-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.source-card header strong {
  display: block;
  font-size: 14px;
}

.source-card header .muted {
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

.source-card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: #344a6a;
}

.source-status-pill {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: #def1e1;
  color: #186a3b;
}

.source-status-planned {
  background: #fff1d2;
  color: #8a5b03;
}

.source-status-unregistered {
  background: #f1d8d8;
  color: #882020;
}

.source-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
  font-size: 12px;
}

.source-meta div span {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 800;
  color: var(--muted);
}

.source-meta strong {
  font-size: 12px;
}

.source-fields {
  font-size: 11.5px;
  color: #2c4768;
}

.source-fields span {
  display: inline-block;
  margin: 2px 4px 0 0;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ecf3fb;
  font-size: 11px;
}

.source-link {
  font-size: 12px;
  font-weight: 800;
  color: var(--teal-dark);
}

.brand strong {
  letter-spacing: 1.2px;
  font-size: 22px;
}

.refresh-all {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}

.refresh-all:hover {
  background: #08326a;
}

.command-controls-toggle {
  justify-self: end;
  width: 42px;
  height: 34px;
  min-height: 34px;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.command-controls-toggle:hover,
.command-controls-toggle[aria-expanded="true"] {
  border-color: #b9c9dd;
  background: #eaf3ff;
}

.command-bar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 10px;
  min-height: 52px;
  padding: 0 0 16px;
}

.source-row,
.command-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.source-row {
  color: #233657;
  font-size: 13px;
  white-space: normal;
}

.command-actions {
  justify-content: flex-start;
  min-width: 0;
}

.connected-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: #087354;
  font-weight: 800;
  background: #dcf5ec;
  border-radius: 6px;
}

.connected-pill::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0d946c;
}

.refresh-button,
.search-button,
.toolbar-button,
.pager-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
  flex: 0 0 auto;
}

.refresh-button {
  color: #0d3470;
}

.search-button {
  border-color: var(--blue);
  color: #ffffff;
  background: var(--blue);
}

.search-button:hover {
  background: #155aa2;
}

.refresh-button::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid #1f68b7;
  border-right-color: transparent;
  border-radius: 50%;
}

.refresh-button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.search-box {
  position: relative;
  flex: 1 1 360px;
}

.search-box input {
  width: 100%;
  height: 40px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

.search-box::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 14px;
  width: 12px;
  height: 12px;
  border: 2px solid #3d4d67;
  border-radius: 50%;
}

.filters-panel {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.filters-panel.collapsed {
  display: none;
}

.filters-panel label,
.table-actions label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.opportunity-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  color: var(--ink) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  white-space: nowrap;
}

.opportunity-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
}

select {
  min-width: 120px;
  height: 36px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

.compact-select {
  width: auto;
}

.status-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.status-dot {
  flex: 0 0 auto;
  margin-top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
}

.status-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.new-records-link {
  justify-self: start;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #005eb8;
  font: inherit;
  font-weight: 900;
  text-decoration: underline;
  cursor: pointer;
}

.new-records-link:hover {
  color: #003f7f;
}

.record-mode-button.active {
  border-color: #1f68b7;
  color: #ffffff;
  background: #1f68b7;
}

.table-sort-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #005eb8;
  font: inherit;
  font-weight: 900;
  text-decoration: underline;
  cursor: pointer;
}

.table-sort-link:hover {
  color: #003f7f;
}

.status-banner.error .status-dot {
  background: var(--red);
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 12px;
}

.kpi {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  padding: 18px 18px;
  border-right: 1px solid var(--line);
}

.kpi:last-child {
  border-right: 0;
}

.kpi-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #35bdc2, #08717c);
  color: #ffffff;
  font-weight: 900;
  font-size: 18px;
}

.kpi-icon.trophy {
  background: linear-gradient(135deg, #0ca981, #06745e);
}

.kpi-icon.people {
  background: linear-gradient(135deg, #006d8e, #023c69);
}

.kpi-icon.value {
  font-size: 24px;
}

.kpi-icon.warning {
  background: linear-gradient(135deg, #f6a62a, #e57605);
}

.kpi-label {
  display: block;
  color: #273a5c;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.kpi strong {
  display: block;
  font-size: 30px;
  line-height: 1;
  margin-bottom: 6px;
}

.kpi small {
  color: var(--muted);
}

.summary-result {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
  gap: 12px;
  margin-bottom: 12px;
}

.summary-hero,
.summary-side {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-hero {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(6, 33, 74, 0.96), rgba(7, 113, 124, 0.9)),
    var(--navy);
  color: #ffffff;
}

.summary-hero::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -100px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
}

.section-kicker {
  display: block;
  margin-bottom: 10px;
  color: #aee9ed;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-hero h2 {
  position: relative;
  max-width: 780px;
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
}

.summary-hero p {
  position: relative;
  max-width: 760px;
  margin: 10px 0 0;
  color: #d7e9f7;
  line-height: 1.48;
}

.summary-badges {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.summary-badge {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(4px);
}

.summary-badge small {
  color: #b9d9ec;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-badge strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-side {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
}

.summary-side-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
}

.summary-side-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-side-heading strong {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--teal-dark);
}

.summary-signal-list {
  display: grid;
  gap: 0;
  align-content: start;
}

.summary-signal {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.summary-signal:last-child {
  border-bottom: 0;
}

.summary-signal span {
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-signal strong {
  overflow: hidden;
  color: #10274a;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-signal small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.overview-breakdown-grid .wide-panel {
  grid-row: span 2;
}

.service-value-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.service-value-card {
  display: grid;
  text-align: left;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 6px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.service-value-card:hover {
  transform: translateY(-1px);
  border-color: #b7c8dc;
  box-shadow: 0 10px 22px rgba(13, 35, 68, 0.09);
}

.service-value-card span {
  color: #273a5c;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.service-value-card strong {
  overflow-wrap: anywhere;
  font-size: 24px;
  line-height: 1.08;
}

.service-value-card small {
  color: var(--muted);
  line-height: 1.35;
}

.service-value-card.service-ac {
  border-left-color: var(--green);
}

.service-value-card.service-cs {
  border-left-color: var(--blue);
}

.service-value-card.service-architect {
  border-left-color: #7c4d9d;
}

.service-value-card.service-main {
  border-left-color: var(--amber);
}

.service-value-card.service-piling {
  border-left-color: var(--teal-dark);
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.9fr) minmax(300px, 0.9fr);
  gap: 12px;
  margin-bottom: 12px;
}

.overview-timeline-grid {
  grid-template-columns: minmax(0, 1fr);
}

.panel,
.watch-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 14px;
  min-width: 0;
}

.panel-heading,
.table-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

h2,
p {
  margin-top: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 17px;
}

.panel-heading p,
.table-heading p {
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.35;
}

.combo-chart {
  min-height: 320px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.combo-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 20px;
  color: #263756;
  font-size: 12px;
  margin-bottom: 4px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chart-note {
  margin: -1px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.legend-bar,
.legend-line {
  width: 26px;
  height: 6px;
  border-radius: 999px;
  background: var(--teal);
}

.legend-line {
  height: 4px;
  background: var(--navy);
}

.grid line {
  stroke: #dce5f0;
  stroke-width: 1;
}

.bars rect {
  fill: url("#barGradient");
}

.combo-chart svg .bars rect {
  fill: var(--teal);
  opacity: 0.92;
}

.combo-chart text {
  fill: #4d5b73;
  font-size: 9px;
  font-weight: 800;
}

.combo-chart .axis-label {
  fill: #334765;
  font-size: 8.5px;
}

.combo-chart .axis-caption text {
  fill: #6b7890;
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.value-line {
  fill: none;
  stroke: var(--navy);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dots circle {
  fill: var(--navy);
  stroke: #ffffff;
  stroke-width: 2;
}

.bar-chart {
  display: grid;
  gap: 12px;
  padding-top: 3px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(120px, 1.7fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.bar-row:hover .bar-fill {
  filter: saturate(1.2);
}

.premium-bar-chart .bar-row {
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1.5fr);
  padding: 8px;
  border: 1px solid #e3ebf5;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.bar-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 12px;
}

.bar-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-meta span {
  color: var(--muted);
}

.bar-track {
  position: relative;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf3f8;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #36bec6, #08717c);
}

.source-count-chart {
  display: grid;
  gap: 10px;
}

.source-count-row {
  display: grid;
  grid-template-columns: minmax(82px, 0.8fr) minmax(140px, 1.5fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #e3ebf5;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.source-count-row:hover {
  border-color: #b7c8dc;
  box-shadow: 0 8px 18px rgba(13, 35, 68, 0.08);
}

.source-count-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-count-track {
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf3f8;
}

.source-count-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f68b7, #36bec6);
}

.source-count-row strong {
  font-size: 13px;
}

.watch-row {
  display: grid;
  grid-template-columns: 170px 170px minmax(240px, 1fr) minmax(250px, auto);
  gap: 12px;
  margin-bottom: 12px;
}

.watch-card {
  padding: 14px;
}

.watch-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.watch-card strong {
  display: block;
  font-size: 28px;
  margin-top: 5px;
}

.message-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.watch-actions-card {
  display: grid;
  align-content: start;
  gap: 10px;
}

.watch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-heading {
  padding: 14px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
}

.table-panel > .table-wrap {
  max-height: min(72vh, 760px);
  overflow: auto;
}

.table-panel > .table-wrap table thead th {
  position: sticky;
  top: 0;
  z-index: 8;
  box-shadow: 0 1px 0 var(--line);
}

.table-panel > .table-wrap table thead tr.table-filter-row th {
  top: 39px;
  z-index: 7;
}

table {
  width: 100%;
  min-width: 1240px;
  border-collapse: collapse;
}

.project-table {
  min-width: 1480px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
  font-size: 13px;
}

th:last-child,
td:last-child {
  border-right: 0;
}

th {
  color: #253657;
  background: linear-gradient(180deg, #ffffff, #f7f9fc);
  font-size: 12px;
  font-weight: 900;
}

.table-filter-row th {
  padding: 8px 10px;
  background: #f4f8fd;
}

.table-filter-select {
  width: 100%;
  min-width: 118px;
  height: 32px;
  padding: 5px 8px;
  border: 1px solid #cbd9ea;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f8fbff;
}

tbody tr.new-record td,
tbody tr.new-record .entity-cell strong,
tbody tr.new-record .title-cell,
tbody tr.new-record .title-cell span,
tbody tr.new-record .muted {
  color: #1f68b7;
}

.compact-table td {
  padding-top: 7px;
  padding-bottom: 7px;
}

.title-cell {
  max-width: 310px;
  font-weight: 700;
  line-height: 1.28;
}

.title-cell span,
.muted {
  color: var(--muted);
  font-weight: 500;
}

/* Excel-style sheet tabs for the Opportunities view */
.sheet-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 0 6px;
  border-bottom: 2px solid var(--line, #dce5f0);
  margin-bottom: 0;
}
.sheet-tab {
  appearance: none;
  border: 1px solid var(--line, #dce5f0);
  border-bottom: none;
  background: var(--surface-soft, #f3f6fb);
  color: var(--muted, #62708a);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  position: relative;
  top: 2px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.sheet-tab:hover {
  background: #e9eff8;
  color: var(--ink, #061739);
}
.sheet-tab.active {
  background: var(--surface, #ffffff);
  color: var(--ink, #061739);
  border-color: var(--line, #dce5f0);
  border-bottom: 2px solid var(--surface, #ffffff);
}
.sheet-panel {
  border-top-left-radius: 0;
}

/* Awarded Accredited Checking projects table */
.awarded-ac-panel {
  margin-top: 0;
}
.awarded-ac-table th,
.awarded-ac-table td {
  vertical-align: top;
}
.awarded-ac-title a {
  font-weight: 600;
}
.awarded-ac-winner {
  font-weight: 600;
}
.awarded-ac-awardee,
.awarded-ac-value {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
}
.awarded-ac-awardee small,
.awarded-ac-value small {
  max-width: 220px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}
.award-warning-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid #f1b76b;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a4d00;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}
.award-value-note {
  display: inline-block;
  margin-top: 4px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
}
.awarded-ac-bids {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
}
.awarded-ac-bid {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
}
.awarded-ac-bid.is-winner {
  background: rgba(34, 160, 86, 0.14);
  font-weight: 600;
}
.awarded-ac-bid.matches-source-value {
  background: rgba(241, 183, 107, 0.18);
  border: 1px dashed rgba(154, 77, 0, 0.28);
}
.respondents-table tr.matches-source-value td {
  background: rgba(241, 183, 107, 0.14);
}
.awarded-ac-bid-amount {
  white-space: nowrap;
  color: var(--muted);
}
.awarded-ac-bid.is-winner .awarded-ac-bid-amount {
  color: inherit;
}
.compact-input {
  padding: 6px 10px;
  border: 1px solid var(--line, #dce5f0);
  border-radius: 8px;
  font-size: 13px;
  min-width: 200px;
}

/* MDT status badges */
.mdt-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.mdt-status.status-open { background: rgba(37, 99, 235, 0.14); color: #1d4ed8; }
.mdt-status.status-pending { background: rgba(217, 119, 6, 0.16); color: #b45309; }
.mdt-status.status-awarded { background: rgba(34, 160, 86, 0.16); color: #1c9c5b; }
.mdt-status.status-closed { background: rgba(107, 114, 128, 0.18); color: #4b5563; }

/* Clickable "Awarded To" company link inside tables */
.company-link {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  text-align: left;
  color: var(--navy, #06214a);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.company-link:hover {
  color: #1d4ed8;
}

/* Overview period selector */
.overview-period-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}
.overview-period-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #62708a);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* KPI year-over-year trend arrow */
.kpi-trend {
  font-size: 13px;
  font-weight: 600;
  margin-left: 4px;
}
.kpi-trend.up { color: #1c9c5b; }
.kpi-trend.down { color: #d2453d; }

/* Recent activity feed */
.recent-activity-list {
  display: flex;
  flex-direction: column;
}
.recent-activity-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line, #dce5f0);
}
.recent-activity-item:last-child {
  border-bottom: none;
}
.recent-activity-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.recent-activity-main strong {
  font-weight: 600;
  font-size: 13px;
}
.recent-activity-meta {
  font-size: 12px;
  color: var(--muted, #62708a);
}
.recent-activity-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  white-space: nowrap;
  text-align: right;
}
.recent-activity-winner {
  font-weight: 600;
  font-size: 13px;
}
.recent-activity-sub {
  font-size: 12px;
  color: var(--muted, #62708a);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 5px 9px;
  border-radius: 6px;
  color: #075f4b;
  background: #dff5ec;
  font-weight: 900;
  font-size: 12px;
}

.status-pill.awarded {
  color: #075f4b;
  background: #dff5ec;
}

.status-pill.open {
  color: #125a99;
  background: #e7f2ff;
}

.status-pill.source-watch {
  color: #6c3a02;
  background: #fff3cf;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 5px 10px;
  border-radius: 6px;
  color: #125a99;
  background: #e7f2ff;
  font-weight: 900;
  text-decoration: none;
}

.pagination-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  color: var(--muted);
}

.pager-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pager-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#pageIndicator {
  min-width: 36px;
  min-height: 34px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--navy);
  border-radius: 6px;
  font-weight: 900;
}

dialog {
  width: min(760px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(12, 29, 51, 0.22);
  padding: 0;
}

dialog::backdrop {
  background: rgba(12, 29, 51, 0.42);
}

.dialog-close {
  position: absolute;
  right: 14px;
  top: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 7px 10px;
  cursor: pointer;
}

.saved-views-dialog {
  width: min(820px, calc(100vw - 32px));
}

.saved-views-shell {
  padding: 22px;
}

.saved-views-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.saved-views-header h2 {
  margin: 0;
}

.saved-views-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 12px 0 14px;
}

.saved-views-create input {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

.saved-views-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.saved-view-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.saved-view-meta {
  display: grid;
  gap: 4px;
}

.saved-view-meta strong {
  line-height: 1.2;
}

.saved-view-meta span {
  color: var(--muted);
  font-size: 12px;
}

.saved-view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#detailBody {
  padding: 24px;
}

#detailBody h2 {
  margin-right: 96px;
  line-height: 1.25;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.detail-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.detail-item.wide {
  margin-top: 12px;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.warnings {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #ead4ab;
  background: #fff9ed;
  border-radius: 6px;
  color: #765113;
}

.detail-source {
  margin: 16px 0 0;
}

.source-link {
  color: var(--teal-dark);
  font-weight: 800;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

/* =====================================================================
   Responsive cascade (desktop -> phone). Reflow & scroll, keep all detail.
   ===================================================================== */

@media (max-width: 1180px) {
  body {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}

@media (max-width: 1024px) {
  .summary-result { grid-template-columns: 1fr; }
  .overview-breakdown-grid { grid-template-columns: 1fr; }
  .overview-breakdown-grid .wide-panel { grid-column: auto; }
  .analytics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
  .companies-layout { grid-template-columns: 1fr; }
  .agencies-layout { grid-template-columns: 1fr; }
}

/* Tablet / phone: sidebar becomes a compact sticky menu. */
@media (max-width: 860px) {
  body {
    grid-template-columns: 1fr;
  }
  .sidebar {
    height: auto;
    position: sticky;
    top: 0;
    z-index: 40;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
  }
  .sidebar .brand { margin-right: auto; }
  .mobile-menu-button {
    display: grid;
    align-content: center;
    gap: 5px;
  }
  .side-nav {
    display: none;
    order: 3;
    width: 100%;
    gap: 8px;
    padding: 6px 0 0;
  }
  .sidebar.menu-open .side-nav {
    display: grid;
  }
  .side-nav-link,
  .side-nav a {
    width: 100%;
    white-space: nowrap;
  }
  .sidebar-account {
    display: none;
    order: 2;
    width: 100%;
    margin-top: 0;
    padding-top: 12px;
  }
  .sidebar.menu-open .sidebar-account { display: grid; }
  .sidebar-account .sidebar-label { display: none; }
  .active-filter-card { display: none; }

  .app-shell { padding: 16px 14px 40px; gap: 16px; }

  .command-bar { grid-template-columns: 1fr; }
  .source-row { gap: 10px; font-size: 13px; }
  .summary-result { grid-template-columns: 1fr; }

  .sheet-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .sheet-tab { flex: 0 0 auto; white-space: nowrap; }

  .table-heading { flex-direction: column; align-items: stretch; gap: 10px; }
  .table-actions { flex-wrap: wrap; }
  .analytics-toolbar { flex-direction: column; align-items: stretch; }

  .combo-chart svg,
  .chart-panel svg,
  .bar-chart svg { max-width: 100%; height: auto; }

  .dialog { width: 96vw; max-height: 92vh; }
}

@media (max-width: 760px) {
  .command-bar { grid-template-columns: 1fr; }
  .filters-panel { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .saved-views-grid { grid-template-columns: minmax(0, 1fr) auto; }
  .command-bar {
    gap: 8px;
    min-height: 0;
    padding-bottom: 10px;
  }
  .source-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px 10px;
    padding-bottom: 2px;
  }
  .source-row::-webkit-scrollbar {
    display: none;
  }
  .source-row > span,
  .source-row label {
    flex: 0 0 auto;
  }
  .source-row > span {
    white-space: nowrap;
  }
  .connected-pill {
    justify-content: center;
    padding: 7px 10px;
  }
  .agent-picker,
  .lookback-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .agent-picker .compact-select,
  .lookback-control .compact-select {
    width: auto;
    max-width: 180px;
    min-width: 0;
  }
  .command-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
  }
  .search-box {
    grid-column: 1 / -1;
    width: 100%;
    flex: none;
  }
  .search-button,
  .command-actions .toolbar-button {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
  }
}

/* Phone portrait: 2-up KPIs, horizontally scrollable tables with a pinned
   first column so every data column stays available without losing context. */
@media (max-width: 560px) {
  .app-shell { padding: 12px 10px 36px; }

  .kpi-strip { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px; }
  .overview-period-bar { justify-content: flex-start; }

  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 760px; font-size: 12.5px; }
  .table-wrap th,
  .table-wrap td { padding: 8px 10px; }
  .table-wrap table thead th:first-child,
  .table-wrap table tbody td:first-child {
    position: sticky;
    left: 0;
    background: var(--surface, #ffffff);
    z-index: 2;
  }
  .table-wrap table thead th:first-child { z-index: 3; }

  .compact-select,
  .compact-input,
  .toolbar-button,
  .refresh-button,
  .pager-button,
  .sheet-tab,
  .side-nav-link,
  .side-nav a { min-height: 40px; }

  .filters-panel { grid-template-columns: 1fr 1fr; }
  .awarded-ac-bids { min-width: 160px; }

  .dialog { width: 100vw; max-height: 100vh; border-radius: 0; }
}

@media (max-width: 480px) {
  .saved-views-grid { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .kpi-strip { grid-template-columns: 1fr; }
  .filters-panel { grid-template-columns: 1fr; }
  .source-row { font-size: 12px; }
}
