:root {
  --mci-blaze-orange: #ff6600;
  --mci-dark-navy: #002060;
  --mci-white: #ffffff;
  --mci-black: #000000;
  --mci-orange-dark: #e55a00;
  --mci-orange-pale: #fff0e6;
  --mci-mid-blue: #003399;
  --mci-bpoaas-blue: #2f70d9;
  --mci-gray-800: #333333;
  --mci-gray-200: #eeeeee;
  --mci-font-family: "Quicksand", Calibri, Arial, sans-serif;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-alt: #f9fafc;
  --text: var(--mci-gray-800);
  --muted: #5c6675;
  --line: var(--mci-gray-200);
  --green: var(--mci-blaze-orange);
  --green-2: var(--mci-orange-dark);
  --soft: var(--mci-orange-pale);
  --warn: var(--mci-blaze-orange);
  --danger: #b42318;
  --shadow: 0 .65rem 1.75rem rgba(0, 32, 96, .1);
  --topbar-bg: #000f30;
  --topbar-text: var(--mci-white);
  --topbar-muted: #dbe5ff;
  --topbar-line: var(--mci-blaze-orange);
  --topbar-control-bg: rgba(255, 255, 255, .08);
  --topbar-control-border: rgba(255, 255, 255, .24);
}

[data-theme="dark"] {
  --bg: #00133d;
  --panel: #001b52;
  --panel-alt: #002060;
  --text: var(--mci-white);
  --muted: #c7d3ec;
  --line: #214682;
  --soft: #002b7f;
  --shadow: 0 .65rem 1.75rem rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: linear-gradient(180deg, rgba(0, 32, 96, .05), rgba(0, 32, 96, 0)), var(--bg);
  color: var(--text);
  font-family: var(--mci-font-family);
  font-size: 14px;
}
a { color: inherit; text-decoration: none; }
.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 22px;
  background: var(--topbar-bg);
  border-bottom: 3px solid var(--topbar-line);
  color: var(--topbar-text);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 310px; }
.brand-meta span { display: block; color: var(--topbar-muted); font-size: 12px; }
.brand-logo {
  display: inline-block;
  flex: 0 0 auto;
  width: 68px;
  height: 31px;
  background: url("/assets/mci-logo.svg") center / contain no-repeat;
}
.brand-logo-title {
  display: inline-flex;
  align-items: baseline;
  flex: 0 0 auto;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}
.mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.16);
  font-weight: 800;
}
nav { display: flex; gap: 6px; flex: 1; }
nav a, .ghost {
  border: 1px solid var(--topbar-control-border);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--topbar-control-bg);
  color: var(--topbar-text);
}
.account { display: flex; align-items: center; gap: 10px; }
.account-menu {
  position: relative;
  z-index: 5;
}
.account-link {
  border: 1px solid var(--topbar-control-border);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--topbar-control-bg);
  color: var(--topbar-text);
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.account-link::-webkit-details-marker { display: none; }
.account-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}
.account-menu-panel a,
.account-menu-panel .menu-button {
  width: 100%;
  min-height: 36px;
  justify-content: flex-start;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  font-weight: 700;
  text-align: left;
}
.account-menu-panel a:hover,
.account-menu-panel .menu-button:hover,
.account-menu-panel .menu-button.active {
  background: var(--soft);
  border-color: var(--line);
  color: var(--green);
}
.shell { padding: 18px; max-width: 1480px; margin: 0 auto; }
.notice {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.notice.success { border-color: rgba(9,116,59,.35); color: var(--green); }
.notice.error { border-color: rgba(180,35,24,.35); color: var(--danger); }
.notice.warning { border-color: rgba(210,132,0,.4); color: #d28400; }
.toolbar, .panel, .metric-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.toolbar { padding: 14px; margin-bottom: 14px; }
.filters, .upload-form, .inline {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}
label { display: grid; gap: 6px; color: var(--muted); }
input, select, textarea, button, .button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  font: inherit;
}
textarea {
  min-width: 260px;
  padding: 10px 12px;
  resize: vertical;
}
.category-form {
  align-items: flex-start;
}
.category-form input[name="name"],
.category-table input[name="name"] {
  width: 320px;
  max-width: 100%;
}
.category-form textarea[name="description"],
.category-table textarea[name="description"] {
  width: min(620px, 100%);
}
.category-table th:nth-child(1),
.category-table td:nth-child(1) {
  width: 340px;
}
.category-table th:nth-child(2),
.category-table td:nth-child(2) {
  width: 660px;
}
.category-table th:nth-child(3),
.category-table td:nth-child(3) {
  width: 120px;
}
.category-table th:nth-child(4),
.category-table td:nth-child(4) {
  width: 210px;
}
.category-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.proposal-table th:nth-child(1),
.proposal-table td:nth-child(1) {
  width: 220px;
}
.proposal-table th:nth-child(3),
.proposal-table td:nth-child(3) {
  width: 110px;
}
.proposal-table th:nth-child(5),
.proposal-table td:nth-child(5) {
  width: 360px;
}
.proposal-table td strong,
.proposal-table td small {
  display: block;
}
.proposal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.proposal-action-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.proposal-action-form select {
  width: 170px;
}
.upload-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.analysis-start-form {
  align-items: flex-end;
}
.compact-run-name-label {
  align-items: start;
  font-size: 12px;
  gap: 4px;
}
.compact-run-name-input {
  min-height: 30px;
  width: 180px;
  padding: 0 8px;
}
.upload-actions button,
.upload-actions .button {
  min-height: 30px;
  padding: 0 8px;
}
.compact-action-button {
  min-height: 30px;
  padding: 0 8px;
}
.compact-upload-control {
  min-height: 30px;
  padding: 3px 8px;
}
.compact-upload-control::file-selector-button {
  margin: 0 8px 0 0;
}
button, .button {
  cursor: pointer;
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}
button.danger, .button.danger {
  background: var(--danger);
  border-color: var(--danger);
}
.button.ghost, button.ghost {
  background: transparent;
  color: inherit;
  border-color: var(--line);
}
button:disabled,
button.action-disabled,
.button.action-disabled,
.button[aria-disabled="true"],
button.danger:disabled,
button.danger.action-disabled,
.button.danger.action-disabled,
.button.danger[aria-disabled="true"],
button.ghost:disabled,
button.ghost.action-disabled,
.button.ghost.action-disabled,
.button.ghost[aria-disabled="true"] {
  cursor: not-allowed;
  background: #8b95a5;
  border-color: #8b95a5;
  color: #eef2f7;
  opacity: .82;
  pointer-events: none;
}
.action-spinner {
  width: 1.05em;
  height: 1.05em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  margin: 0 auto;
  animation: action-spinner-rotate .7s linear infinite;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@keyframes action-spinner-rotate {
  to { transform: rotate(360deg); }
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.metric-grid article { padding: 18px; }
.metric-grid span, .panel-head span, small { color: var(--muted); }
.metric-grid strong { display: block; font-size: 28px; margin: 6px 0; }
.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.grid.two { grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr); }
.panel { padding: 16px; margin-bottom: 14px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}
.trend-filter {
  flex: 0 0 auto;
}
.trend-filter select {
  min-width: 180px;
}
h1, h2 { margin: 0; }
h2 { font-size: 18px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(160px, 3fr) 130px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
}
.bar { height: 10px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.spark {
  min-height: 220px;
  display: flex;
  align-items: end;
  gap: 12px;
  padding-top: 20px;
}
.spark div { display: grid; gap: 8px; justify-items: center; flex: 1; }
.spark i { width: 100%; max-width: 34px; background: var(--green); border-radius: 6px 6px 0 0; }
.spark small { font-size: 11px; }
.spark .empty {
  align-self: center;
  width: 100%;
  text-align: center;
}
.progress-summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 10px 0;
}
.progress-summary strong { font-size: 34px; }
.progress-track {
  height: 14px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width .25s ease;
}
.dashboard-stack {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}
.monitor-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  border-top: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-size: 12px; }
.responses-table .date-cell {
  white-space: nowrap;
  width: 100px;
}
.responses-table .action-cell {
  min-width: 360px;
}
.responses-table .action-cell .inline {
  align-items: center;
  flex-wrap: nowrap;
}
.responses-table .action-cell select {
  min-width: 230px;
}
.responses-table .action-cell button {
  flex: 0 0 auto;
}
.mapping-form {
  display: grid;
  gap: 14px;
}
.mapping-table th:nth-child(1),
.mapping-table td:nth-child(1) {
  width: 260px;
}
.mapping-table th:nth-child(2),
.mapping-table td:nth-child(2) {
  width: 380px;
}
.mapping-table td {
  padding-top: 2px;
  padding-bottom: 2px;
}
.mapping-table select {
  width: 100%;
  min-width: 260px;
  min-height: 28px;
  padding: 0 6px;
}
.processing-preview-table {
  table-layout: auto;
}
.processing-preview-table th,
.processing-preview-table td {
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}
.processing-preview-table th:first-child,
.processing-preview-table td:first-child {
  width: 52px;
}
.processing-preview-table .preview-comment-cell {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.preview-toggle {
  display: inline;
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  line-height: inherit;
  vertical-align: baseline;
}
.preview-toggle:hover {
  text-decoration: underline;
}
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--green);
  padding: 0 10px;
  font-weight: 700;
  font-size: 12px;
}
.empty { color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; }
.check input { min-height: auto; }
body.public-shell {
  min-height: 100dvh;
  background:
    linear-gradient(135deg, rgba(0, 32, 96, .97), rgba(0, 15, 48, .98)),
    var(--mci-dark-navy);
  color: var(--mci-white);
  font-family: var(--mci-font-family);
  font-size: .95rem;
}
.public-main {
  color: var(--mci-white);
}
.brand-lockup {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .55rem;
  line-height: 1;
}
.brand-wordmark {
  font-family: var(--mci-font-family);
  font-size: clamp(1.35rem, 3vw, 2.15rem);
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}
.brand-wordmark .brand-mci {
  color: var(--mci-blaze-orange);
}
.brand-wordmark .brand-bpo {
  color: var(--mci-bpoaas-blue);
}
.app-title {
  color: inherit;
  font-size: clamp(1.05rem, 2vw, 1.55rem);
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}
.public-shell .app-title {
  color: var(--mci-white);
}
.login-logo-title {
  display: inline-flex;
  align-items: baseline;
  flex: 0 0 auto;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}
.logo-mci { color: var(--mci-blaze-orange); }
.logo-bpo { color: var(--mci-bpoaas-blue); }
.public-shell .login-card {
  background: rgba(0, 15, 48, .92) !important;
  border: 1px solid rgba(255, 255, 255, .18) !important;
  border-radius: .5rem !important;
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, .3);
}
.public-shell .login-card .card-body {
  background: transparent !important;
  color: var(--mci-white) !important;
}
.public-shell .login-card label,
.public-shell .login-card .form-check-label {
  color: var(--mci-white);
  display: inline-block;
  font-weight: 600;
}
.public-shell .login-card .form-control {
  min-height: auto;
  color: var(--mci-white);
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .32);
  padding: .375rem .75rem;
  line-height: 1.5;
}
.public-shell .login-card .form-control:focus {
  color: var(--mci-white);
  background: rgba(255, 255, 255, .12);
}
.public-shell .login-card .form-control::placeholder {
  color: rgba(255, 255, 255, .65);
}
.public-shell .login-card h2 {
  margin-top: 0;
  padding-bottom: .45rem;
  border-bottom: 1px solid rgba(255, 255, 255, .18);
  border-bottom-color: rgba(255, 255, 255, .18);
  color: var(--mci-white);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}
.public-shell .login-card .form-check {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding-left: 0;
}
.public-shell .login-card .form-check-input {
  width: 1rem;
  min-width: 1rem;
  height: 1rem;
  min-height: 1rem;
  margin: 0;
  padding: 0;
  background-color: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .32);
  border-radius: .2rem;
}
.public-shell .login-card .form-check-input:checked {
  background-color: var(--mci-blaze-orange);
  border-color: var(--mci-blaze-orange);
}
.public-shell .login-card .btn-primary {
  min-height: 2.65rem;
  justify-content: center;
  width: 100%;
  border-radius: .375rem !important;
  background: var(--mci-blaze-orange) !important;
  border-color: var(--mci-blaze-orange) !important;
  color: var(--mci-white) !important;
  font-weight: 700;
  letter-spacing: .03em;
}
.public-shell .login-card .btn-primary:hover,
.public-shell .login-card .btn-primary:focus {
  background: var(--mci-orange-dark) !important;
  border-color: var(--mci-orange-dark) !important;
}
.settings-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
  gap: 14px;
  align-items: end;
}
.admin-settings-form {
  display: grid;
  margin: 0;
}
.grid.two.admin-settings-grid {
  align-items: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.admin-settings-form .settings-fields {
  display: grid;
  gap: 14px;
}
.admin-settings-form .settings-fields label {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 150px minmax(0, 1fr);
}
.admin-settings-form .settings-fields label span {
  color: var(--muted);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.admin-settings-form .settings-fields input,
.admin-settings-form .settings-fields select {
  width: 100%;
}
.details-list {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  row-gap: 14px;
  column-gap: 22px;
  margin: 0;
}
.details-list > div { display: contents; }
.details-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 26px;
  text-transform: uppercase;
}
.details-list dd {
  margin: 0;
  min-width: 0;
  font-size: 16px;
  font-weight: 650;
  line-height: 26px;
  overflow-wrap: anywhere;
}
.switch-form { margin: 0; }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--text);
  cursor: pointer;
}
.switch-row span {
  display: grid;
  gap: 4px;
}
.switch-row strong {
  font-size: 16px;
  color: var(--text);
}
.switch-row small { color: var(--muted); }
.switch-row input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}
.switch-row i {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  transition: background .18s ease, border-color .18s ease;
}
.switch-row i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .22);
  transition: transform .18s ease;
}
.switch-row input:checked + i {
  border-color: var(--green);
  background: var(--green);
}
.switch-row input:checked + i::after {
  transform: translateX(16px);
}
.switch-row input:focus-visible + i {
  outline: 2px solid var(--green-2);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .topbar, .account, nav { align-items: stretch; flex-direction: column; }
  .brand { min-width: 0; }
  .account-menu-panel { position: static; margin-top: 8px; }
  .metric-grid, .grid.two { grid-template-columns: 1fr; }
  .panel-head { align-items: stretch; flex-direction: column; }
  .trend-filter select { width: 100%; }
  .bar-row { grid-template-columns: 1fr; }
  .settings-form, .admin-settings-form .settings-fields label, .grid.two.admin-settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767.98px) {
  .brand-lockup {
    align-items: flex-start;
    flex-direction: column;
    gap: .25rem;
  }

  .app-title {
    white-space: normal;
  }
}
