:root {
  --ink: #17213c;
  --muted: #667085;
  --line: #d7deee;
  --panel: #ffffff;
  --bg: #f5f7ff;
  --accent: #4361ee;
  --accent-2: #315fb7;
  --violet: #7654e8;
  --sky: #1b9aaa;
  --sun: #f4a340;
  --warn: #a76013;
  --danger: #a83246;
}

* {
  letter-spacing: 0;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(103, 96, 239, 0.11), transparent 24rem),
    radial-gradient(circle at 90% 18%, rgba(27, 154, 170, 0.12), transparent 26rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  width: min(1480px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 760;
}

.console-topbar {
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  background: linear-gradient(118deg, #253a83 0%, #3c5ad8 44%, #168e9a 100%);
  box-shadow: 0 18px 42px rgba(47, 72, 169, 0.24);
  color: #fff;
}

.console-topbar .eyebrow,
.console-topbar .user-panel,
.console-topbar .metric span {
  color: rgba(255, 255, 255, 0.77);
}

.console-topbar .metric {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.console-topbar .metric strong,
.console-topbar .phase-row strong {
  color: #fff;
}

.console-topbar .role-pill {
  background: rgba(255, 255, 255, 0.17);
  color: #fff;
}

.console-topbar .btn-outline-secondary {
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
}

.console-topbar .btn-outline-secondary:hover {
  border-color: #fff;
  background: #fff;
  color: #334a9b;
}

.topbar-brand {
  display: block;
  width: 164px;
  height: auto;
  margin-bottom: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(12, 26, 78, 0.2);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-panel {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.account-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.account-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(12, 26, 82, 0.2);
}

.account-avatar {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, #f9bd68, #f1746d);
  color: #4c2850;
  font-size: 13px;
  font-weight: 850;
}

.account-details {
  display: grid;
  gap: 1px;
  line-height: 1.15;
}

.account-details strong {
  color: #fff;
  font-size: 12px;
}

.account-details span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 700;
}

.btn-audit,
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  border-radius: 9px;
  font-size: 11px;
}

.btn-audit {
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.btn-audit:hover,
.btn-audit:focus-visible {
  border-color: #fff;
  background: #fff;
  color: #344999;
}

.btn-logout {
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: transparent;
  color: #fff;
}

.btn-logout:hover,
.btn-logout:focus-visible {
  border-color: #ffd7d7;
  background: rgba(174, 41, 64, 0.24);
  color: #fff;
}

.btn-audit svg,
.btn-logout svg {
  width: 14px;
  height: 14px;
}

.login-shell {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
  position: relative;
}

body:has(.login-shell) {
  background:
    radial-gradient(circle at 18% 20%, rgba(117, 84, 232, 0.34), transparent 29rem),
    radial-gradient(circle at 84% 78%, rgba(15, 157, 138, 0.28), transparent 27rem),
    linear-gradient(135deg, #18234b 0%, #314f9c 47%, #167f8c 100%);
}

.login-shell::before,
.login-shell::after {
  position: fixed;
  z-index: -1;
  width: min(32vw, 360px);
  height: min(32vw, 360px);
  border-radius: 50%;
  content: "";
  filter: blur(2px);
}

.login-shell::before {
  top: 8%;
  left: 9%;
  background: rgba(250, 191, 75, 0.16);
}

.login-shell::after {
  right: 8%;
  bottom: 6%;
  background: rgba(126, 102, 246, 0.18);
}

.login-card {
  width: min(470px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.58) !important;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 26px 68px rgba(14, 24, 65, 0.34);
}

.login-card-body {
  padding: 38px;
}

.login-brand {
  margin-bottom: 24px;
}

.login-brand img {
  display: block;
  width: 205px;
  height: auto;
}

.login-card h1 {
  margin: 0;
  font-size: 31px;
  font-weight: 760;
}

.login-subtitle {
  margin: 10px 0 26px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.login-input-group .input-group-text {
  width: 52px;
  justify-content: center;
  border-color: var(--line);
  border-right: 0;
  background: #f8fafc;
  color: var(--accent);
}

.login-input-group .input-group-text svg {
  width: 18px;
  height: 18px;
}

.login-input-group .form-floating {
  flex: 1 1 auto;
}

.login-input-group .form-control {
  min-height: 58px;
  border-color: var(--line);
  border-left: 0;
}

.login-input-group .form-control:focus {
  border-color: #7aaec1;
  box-shadow: 0 0 0 0.25rem rgba(23, 107, 135, 0.13);
}

.login-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 52px;
  margin-top: 6px;
  font-size: 15px;
  font-weight: 750;
  border: 0;
  background: linear-gradient(100deg, #4d5fe3, #6b4cdc 56%, #168f9a);
  box-shadow: 0 12px 24px rgba(72, 81, 203, 0.27);
}

.login-submit:hover,
.login-submit:focus-visible {
  background: linear-gradient(100deg, #3b4fd1, #5b3dcc 56%, #0d7e87);
  box-shadow: 0 14px 28px rgba(72, 81, 203, 0.36);
}

.login-submit svg {
  width: 18px;
  height: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(40, 52, 102, 0.08);
}

.metric {
  padding: 18px 20px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.75fr);
  gap: 18px;
}

.panel {
  padding: 20px;
}

.intake-panel {
  border-top: 4px solid #5c69e7;
}

.launch-panel {
  border-top: 4px solid #0d9b8c;
}

.queue-panel {
  border-top: 4px solid #825de4;
}

.log-panel {
  border-top: 4px solid #e6a13a;
}

.calibration-panel {
  border-top: 4px solid #2196b0;
}

.panel-main {
  min-width: 0;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 760;
}

.panel-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.stacked-form {
  display: grid;
  gap: 12px;
}

.button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.icon-btn {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.icon-btn svg,
.icon-btn i {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.icon-btn .spinner-border {
  width: 15px;
  height: 15px;
  border-width: 2px;
}

.checkpoint {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #f1d6ad;
  border-radius: 8px;
  background: #fff8ee;
  color: #71460c;
}

.calibration-note {
  border-color: #c8d9f2;
  background: #eef5ff;
  color: #285792;
}

.automation-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 20px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

.automation-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.automation-options input.form-control {
  width: 76px;
}

.automation-options .folder-mode-select {
  width: 142px;
}

.auto-calibration-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

.auto-calibration-bar label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auto-calibration-bar input.form-control {
  width: 72px;
}

.auto-calibration-note {
  color: var(--muted);
  font-size: 13px;
}

.auto-calibration-result {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid #c8d9f2;
  border-radius: 8px;
  background: #eef5ff;
  color: #285792;
}

.auto-calibration-result div,
.auto-calibration-result {
  min-width: 0;
}

.auto-calibration-result strong {
  display: inline-block;
  min-width: 112px;
}

.auto-calibration-result span {
  color: inherit;
  overflow-wrap: anywhere;
}

.auto-calibration-error {
  border-color: #f1bdc5;
  background: #fff0f2;
  color: var(--danger);
}

.queue-table-wrap {
  max-height: 520px;
}

.queue-table {
  min-width: 1500px;
}

.queue-status-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  padding: 2px 0 5px;
  scrollbar-width: thin;
}

.queue-status-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.queue-status-tab:hover {
  border-color: #9db7c4;
  color: var(--ink);
}

.queue-status-tab.active {
  border-color: #6b4ed0;
  background: #f0ecff;
  color: #4f35ad;
}

.queue-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #edf2f6;
  color: inherit;
  font-size: 11px;
}

.queue-status-tab.active .queue-tab-count {
  background: #ffffff;
}

.queue-filter-bar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbfd;
}

.queue-filter-bar label {
  display: grid;
  flex: 1 1 150px;
  gap: 4px;
  min-width: 145px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.queue-filter-bar .queue-filter-search {
  flex: 2 1 240px;
  min-width: 220px;
}

.queue-clear-filters {
  flex: 0 0 auto;
}

.queue-filter-summary {
  flex: 1 0 100%;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.queue-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fbfd;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.pdf-name {
  max-width: 260px;
  font-weight: 720;
  word-break: break-word;
}

.row-note {
  max-width: 320px;
  margin-top: 4px;
  color: var(--warn);
  font-size: 12px;
}

.summary-month-filter {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.summary-month-filter select {
  width: auto;
  max-width: 220px;
}

.status-cell {
  min-width: 190px;
}

.failure-reason {
  margin-top: 0.4rem;
  color: #a12a2a;
  font-size: 0.78rem;
  line-height: 1.3;
  white-space: normal;
}

.failure-page-link {
  display: inline-block;
  margin-top: 0.3rem;
  font-size: 0.78rem;
}

.failure-page-link[hidden],
.failure-reason[hidden] {
  display: none;
}

.doc-title-input {
  min-width: 180px;
}

.dob-input {
  min-width: 104px;
}

.document-month-input {
  min-width: 118px;
}

.upload-date {
  display: inline-block;
  color: #526777;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.queue-edit-field[readonly] {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  cursor: default;
}

tr.is-editing .queue-edit-field {
  border-color: #9fc4d2;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.08);
}

.row-actions {
  display: flex;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef3f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-ready,
.status-ready-to-upload,
.status-ready-to-import,
.status-scan-folder-opened,
.status-uploaded,
.status-signed,
.status-dry-run-ok {
  background: #e8f0ff;
  color: #315fb7;
}

.status-action-needed,
.status-needs-review,
.status-needs-calibration,
.status-dry-run-warning {
  background: #fff2df;
  color: var(--warn);
}

.status-failed {
  background: #ffeaee;
  color: var(--danger);
}

.status-running,
.status-in-progress {
  background: #e7f0ff;
  color: #1d5aa6;
}

.status-in-queue {
  background: #f0edff;
  color: #5a43a6;
}

.status-stopped,
.status-other {
  background: #eef1f4;
  color: #526777;
}

#documentTable tr[hidden] {
  display: none !important;
}

.empty-state {
  padding: 42px 16px !important;
  color: var(--muted);
  text-align: center;
}

.locator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.locator-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.locator-item strong {
  display: inline-block;
}

.locator-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.locator-group {
  display: block;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.optional-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e8f0ff;
  color: #315fb7;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.locator-action {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 8px;
  min-width: 112px;
}

.coords {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.log-box {
  height: 432px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #111827;
}

.log-line {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  color: #d1d5db;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.log-line span {
  color: #8da2bf;
}

.log-warning {
  color: #fbbf24;
}

.log-error {
  color: #fca5a5;
}

body:has(.console-grid) .app-shell {
  width: min(1760px, calc(100vw - 24px));
  min-height: 100vh;
  overflow: visible;
  padding: 10px 0;
}

.toast-container {
  z-index: 1080;
  width: min(420px, calc(100vw - 24px));
}

.app-toast {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #dce3eb;
  border-left: 4px solid #9aaabd;
  background: #f8fafc;
  color: #334155;
  box-shadow: 0 16px 40px rgba(23, 32, 42, 0.19);
}

.app-toast .toast-body {
  padding: 14px 14px 14px 16px;
  font-size: 14px;
  line-height: 1.4;
}

.app-toast .btn-close {
  filter: none;
}

.app-toast-success,
.app-toast-info {
  border-left-color: #8fa3bb;
  background: #f8fafc !important;
  color: #334155;
}

.app-toast-warning {
  border-left-color: #b9a47d;
  background: #fbfaf7 !important;
  color: #5e5545;
}

.app-toast-danger {
  border-left-color: #bd9099;
  background: #fbf8f8 !important;
  color: #5e3b43;
}

.btn {
  font-weight: 700;
}

.form-control:focus,
.form-check-input:focus {
  border-color: #7aaec1;
  box-shadow: 0 0 0 0.25rem rgba(23, 107, 135, 0.13);
}

.form-check-input {
  width: 1.1em;
  height: 1.1em;
  border: 2px solid #526889;
  background-color: #fff;
  box-shadow: 0 0 0 1px rgba(82, 104, 137, 0.1);
}

.form-check-input:not(:checked) {
  background-color: #fff;
}

.form-check-input:checked {
  border-color: #5364d9;
  background-color: #5364d9;
}

.console-topbar {
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.brand-block {
  min-width: 230px;
}

.console-topbar h1 {
  font-size: 26px;
}

.compact-metrics {
  flex: 1;
  grid-template-columns: repeat(4, minmax(92px, 1fr));
  gap: 8px;
  margin: 0;
}

.compact-metrics .metric {
  padding: 10px 12px;
}

.compact-metrics .metric span {
  font-size: 11px;
}

.compact-metrics .metric strong {
  margin-top: 4px;
  font-size: 22px;
}

.automation-state {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: 360px;
  font-size: 13px;
}

.automation-state-label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.automation-state .badge {
  padding: 5px 9px;
  color: #33457c;
  font-size: 11px;
}

.automation-state .text-bg-primary {
  background: #f3b760 !important;
  color: #513257 !important;
}

.automation-state strong {
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-run-open {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.live-run-open:hover {
  background: rgba(255, 255, 255, 0.24);
}

.live-run-open svg {
  width: 14px;
  height: 14px;
}

.live-run-viewer {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1080;
  display: grid;
  width: min(430px, calc(100vw - 36px));
  overflow: hidden;
  border: 1px solid #cbd5ea;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(18, 30, 73, 0.32);
}

.live-run-viewer[hidden] {
  display: none;
}

.live-run-viewer.is-maximized {
  inset: 14px;
  width: auto;
  height: auto;
  border-radius: 10px;
}

.live-run-header,
.live-run-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.live-run-header {
  padding: 10px 12px;
  border-bottom: 1px solid #dbe2f0;
  background: linear-gradient(105deg, #f7f8ff, #eff9fa);
}

.live-run-heading {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
}

.live-run-heading h2,
.live-run-heading p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-run-heading h2 {
  font-size: 13px;
  font-weight: 800;
}

.live-run-heading p {
  max-width: 260px;
  color: #64718a;
  font-size: 11px;
}

.live-run-indicator {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #8a96aa;
  box-shadow: 0 0 0 4px rgba(138, 150, 170, 0.13);
}

.live-run-indicator.is-running {
  background: #1caa78;
  box-shadow: 0 0 0 4px rgba(28, 170, 120, 0.15);
  animation: live-run-pulse 1.8s ease-in-out infinite;
}

.live-run-indicator.is-error {
  background: #c33f58;
  box-shadow: 0 0 0 4px rgba(195, 63, 88, 0.14);
}

.live-run-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
}

.live-run-icon-button {
  display: grid;
  width: 29px;
  height: 29px;
  padding: 0;
  place-items: center;
  border: 1px solid #cbd5e7;
  border-radius: 7px;
  background: #fff;
  color: #34466f;
}

.live-run-icon-button:hover {
  border-color: #8d9ece;
  background: #f2f5ff;
}

.live-run-icon-button svg {
  width: 14px;
  height: 14px;
}

.live-run-stage {
  position: relative;
  display: grid;
  min-height: 220px;
  max-height: 40vh;
  overflow: auto;
  place-items: center;
  background: #182238;
}

.live-run-viewer.is-maximized .live-run-stage {
  min-height: 0;
  max-height: none;
}

.live-run-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.live-run-placeholder {
  display: grid;
  max-width: 320px;
  padding: 26px;
  place-items: center;
  color: #dce5f5;
  text-align: center;
}

.live-run-placeholder[hidden] {
  display: none;
}

.live-run-placeholder svg {
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
  color: #8fa6d9;
}

.live-run-placeholder strong {
  font-size: 13px;
}

.live-run-placeholder span {
  margin-top: 4px;
  color: #aab8d0;
  font-size: 11px;
}

.live-run-footer {
  padding: 7px 11px;
  border-top: 1px solid #dbe2f0;
  color: #68758d;
  font-size: 10px;
}

.live-run-footer time {
  font-weight: 750;
}

@keyframes live-run-pulse {
  50% {
    box-shadow: 0 0 0 7px rgba(28, 170, 120, 0.05);
  }
}

.console-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  height: auto;
  min-height: 0;
  align-items: stretch;
}

.left-rail,
.right-rail {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: visible;
}

.left-rail {
  grid-column: 1 / -1;
  grid-template-columns: minmax(340px, 0.8fr) minmax(0, 1.2fr);
  align-items: stretch;
}

.right-rail {
  grid-column: 1 / -1;
  grid-template-columns: 1fr;
}

.console-grid .panel {
  min-height: 0;
  padding: 10px;
}

.left-rail > .panel {
  height: 100%;
}

.compact-heading {
  align-items: center;
  margin-bottom: 10px;
}

.compact-heading h2,
.queue-heading h2 {
  font-size: 16px;
}

.queue-heading {
  align-items: center;
  margin-bottom: 10px;
}

.queue-heading p {
  font-size: 12px;
}

.run-eligibility-message {
  margin: -2px 0 9px;
  padding: 7px 10px;
  border: 1px solid #e3c7cd;
  border-left: 4px solid #ba8994;
  border-radius: 8px;
  background: #fbf8f8;
  color: #65424a;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

#runSelectedBtn:disabled {
  border-color: #bdc7d4;
  background: #c9d1dc;
  color: #657386;
  cursor: not-allowed;
  opacity: 0.8;
}

.compact-tabs .nav-link {
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.intake-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid #e1e6fa;
  border-radius: 13px;
  background: linear-gradient(135deg, #f2f4ff, #eefafa);
}

.intake-tabs .nav-item {
  display: flex;
}

.intake-tabs .nav-link {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  border-radius: 9px;
  color: #53617e;
  transition: background-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

.intake-tabs .nav-link svg {
  width: 15px;
  height: 15px;
}

.intake-tabs .nav-link:hover {
  background: rgba(255, 255, 255, 0.7);
  color: #354364;
}

.intake-tabs #upload-tab.active {
  background: linear-gradient(120deg, #4f60df, #7654e8);
  box-shadow: 0 7px 16px rgba(91, 87, 219, 0.26);
  color: #fff;
}

.intake-tabs #path-tab.active {
  background: linear-gradient(120deg, #168d9c, #0f9d8a);
  box-shadow: 0 7px 16px rgba(13, 145, 142, 0.24);
  color: #fff;
}

.intake-upload-button,
.intake-auto-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  border: 0;
  color: #fff;
  font-weight: 800;
}

.intake-upload-button {
  justify-self: start;
  width: 142px;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 10px;
  background: linear-gradient(120deg, #4f60df, #7654e8);
  box-shadow: 0 6px 14px rgba(91, 87, 219, 0.22);
}

.intake-auto-button {
  min-height: 30px;
  background: linear-gradient(120deg, #168d9c, #0f9d8a);
  box-shadow: 0 6px 14px rgba(13, 145, 142, 0.2);
}

.intake-upload-button:hover,
.intake-auto-button:hover,
.intake-upload-button:focus-visible,
.intake-auto-button:focus-visible {
  color: #fff;
  transform: translateY(-1px);
}

.intake-upload-button:hover,
.intake-upload-button:focus-visible {
  background: linear-gradient(120deg, #4254d3, #6542d3);
}

.intake-auto-button:hover,
.intake-auto-button:focus-visible {
  background: linear-gradient(120deg, #117d8a, #0b8877);
}

.intake-upload-button svg,
.intake-auto-button svg {
  width: 15px;
  height: 15px;
}

.compact-form {
  display: grid;
  gap: 6px;
}

.field {
  display: grid;
  gap: 2px;
  margin: 0;
}

.field span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.field.full {
  min-width: 0;
}

.split-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.compact-row {
  justify-content: space-between;
}

.launch-form .form-control,
.compact-form .form-control {
  min-height: 26px;
  padding-top: 3px;
  padding-bottom: 3px;
  font-size: 11px;
}

.launch-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.launch-form .field.full,
.launch-form .split-fields {
  grid-column: span 2;
}

.author-default-check {
  grid-column: span 2;
  align-self: center;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.live-preview-access-setting {
  grid-column: span 2;
  align-self: center;
  margin: 0;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.live-preview-access-setting small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.35;
}

.author-name-field[readonly] {
  background: #f3f6f9;
  color: var(--muted);
}

.launch-form > .button-row {
  grid-column: 1 / -1;
}

.compact-checkpoint {
  margin-top: 8px;
  padding: 7px 8px;
  font-size: 11px;
}

.queue-panel {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 430px;
}

.automation-options-wrap {
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

.automation-options-wrap summary {
  cursor: pointer;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.automation-options {
  gap: 8px 12px;
  padding: 8px 10px;
  margin: 0;
  border: 0;
}

.automation-options label {
  font-size: 12px;
}

.automation-options input.form-control {
  width: 62px;
  height: 28px;
  padding: 3px 6px;
}

.queue-table-wrap {
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 0;
  scrollbar-gutter: stable;
}

.queue-table-wrap::-webkit-scrollbar {
  height: 12px;
  width: 12px;
}

.queue-table-wrap::-webkit-scrollbar-thumb {
  border: 3px solid #f8fafc;
  border-radius: 999px;
  background: #8aa1b5;
}

.queue-table-wrap::-webkit-scrollbar-track {
  background: #f8fafc;
}

.queue-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.queue-table th,
.queue-table td {
  padding: 6px 5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-table th {
  line-height: 1.15;
  overflow-wrap: anywhere;
  white-space: normal;
}

.queue-table-admin .queue-col-select {
  width: 2.5%;
}

.queue-table-admin .queue-col-pdf {
  width: 15%;
}

.queue-table-admin .queue-col-mrn {
  width: 6.5%;
}

.queue-table-admin .queue-col-first,
.queue-table-admin .queue-col-last {
  width: 8%;
}

.queue-table-admin .queue-col-dob {
  width: 7%;
}

.queue-table-admin .queue-col-month {
  width: 8.5%;
}

.queue-table-admin .queue-col-uploaded {
  width: 7.5%;
}

.queue-table-admin .queue-col-document-name {
  width: 13%;
}

.queue-table-admin .queue-col-status {
  width: 8%;
}

.queue-table-admin .queue-col-actions {
  width: 16%;
}

.queue-table-rpa .queue-col-select {
  width: 3%;
}

.queue-table-rpa .queue-col-pdf {
  width: 18%;
}

.queue-table-rpa .queue-col-mrn {
  width: 8%;
}

.queue-table-rpa .queue-col-first,
.queue-table-rpa .queue-col-last {
  width: 10%;
}

.queue-table-rpa .queue-col-dob {
  width: 9%;
}

.queue-table-rpa .queue-col-month {
  width: 11%;
}

.queue-table-rpa .queue-col-uploaded {
  width: 9%;
}

.queue-table-rpa .queue-col-document-name {
  width: 14%;
}

.queue-table-rpa .queue-col-status {
  width: 8%;
}

.queue-table .form-control-sm {
  width: 100%;
  min-width: 0;
  padding-right: 4px;
  padding-left: 4px;
  font-size: 11px;
}

.pdf-name {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  white-space: nowrap;
}

.pdf-name,
.doc-title-input {
  min-width: 0;
}

.row-note {
  max-width: 220px;
}

.status-pill {
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 4px 6px;
  font-size: 11px;
  text-overflow: ellipsis;
}

.row-actions {
  gap: 4px;
  flex-wrap: wrap;
  white-space: normal;
}

.row-actions .btn {
  min-width: 0;
  padding: 3px 5px;
  font-size: 11px;
}

.doc-title-input,
.dob-input {
  min-width: 0;
}

.log-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  min-height: 320px;
}

.log-panel.is-collapsed {
  min-height: 0;
}

.log-panel.is-collapsed .compact-heading,
.calibration-panel.is-collapsed .compact-heading {
  margin-bottom: 0;
}

.log-box {
  flex: 1;
  height: 300px;
  min-height: 220px;
}

.log-box[hidden] {
  display: none;
}

.calibration-panel {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-heading-actions form {
  margin: 0;
}

#calibrationContent[hidden] {
  display: none;
}

.auto-calibration-bar {
  gap: 8px;
  padding: 8px;
  margin-bottom: 8px;
}

.auto-calibration-bar label {
  font-size: 12px;
}

.auto-calibration-result {
  padding: 8px;
  margin-bottom: 8px;
  font-size: 12px;
}

.locator-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  overflow: auto;
  max-height: 340px;
  padding-right: 2px;
}

.locator-item {
  align-items: center;
  padding: 9px;
}

.locator-item p {
  display: none;
}

.locator-group {
  font-size: 10px;
}

.locator-item strong,
.coords {
  font-size: 12px;
}

.audit-page {
  width: min(1420px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.audit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding: 20px 24px;
  border-radius: 18px;
  background: linear-gradient(118deg, #253a83, #3c5ad8 49%, #168e9a);
  box-shadow: 0 18px 42px rgba(47, 72, 169, 0.24);
}

.audit-branding {
  display: flex;
  align-items: center;
  gap: 16px;
}

.audit-branding img {
  width: 160px;
  height: auto;
  padding: 6px 9px;
  border-radius: 9px;
  background: #fff;
}

.audit-branding p {
  margin: 0 0 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.audit-branding h1 {
  margin: 0;
  color: #fff;
  font-size: 28px;
  font-weight: 760;
}

.audit-back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  color: #334a9b;
  font-weight: 800;
}

.audit-back-button svg,
.audit-filter-actions svg {
  width: 15px;
  height: 15px;
}

.audit-filter-panel,
.audit-results-panel {
  margin-bottom: 16px;
}

.audit-filter-panel {
  border-top: 4px solid #4f60df;
}

.audit-results-panel {
  border-top: 4px solid #168e9a;
}

.audit-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 12px;
}

.audit-filters .field {
  gap: 5px;
}

.audit-filters .field span {
  color: #53617e;
}

.audit-filter-actions {
  display: flex;
  gap: 8px;
}

.audit-filter-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  white-space: nowrap;
}

.audit-table-wrap {
  max-height: min(66vh, 720px);
}

.audit-table {
  min-width: 980px;
  margin-bottom: 0;
}

.audit-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f3f6ff;
  color: #53617e;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.audit-table th,
.audit-table td {
  padding: 12px 14px;
}

.audit-table tbody tr:hover {
  background: #f8faff;
}

.audit-time,
.audit-details {
  color: #566581;
  font-size: 12px;
}

.audit-action {
  color: #2c4894;
  font-weight: 750;
}

.audit-role {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  background: #edf2ff;
  color: #3d58ad;
  font-size: 11px;
  font-weight: 800;
  text-transform: capitalize;
}

.audit-role-admin {
  background: #f2ebff;
  color: #6643bc;
}

.audit-role-rpa {
  background: #e7f3ff;
  color: #2865a9;
}

@media (max-width: 1100px) {
  .workspace-grid,
  .locator-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-panel {
    width: 100%;
    justify-items: start;
  }

  .account-toolbar {
    justify-content: flex-start;
  }

  .compact-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .audit-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1320px) {
  body:has(.console-grid) .app-shell {
    height: auto;
    overflow: visible;
  }

  .queue-table-wrap,
  .log-box,
  .locator-grid {
    max-height: 420px;
  }
}

@media (max-width: 900px) {
  .console-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .left-rail,
  .right-rail {
    grid-column: auto;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .left-rail > .panel {
    height: auto;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 24px, 1480px);
    padding-top: 18px;
  }

  .topbar h1 {
    font-size: 26px;
  }

  .panel-heading,
  .locator-item {
    flex-direction: column;
  }

  .locator-action {
    justify-items: start;
  }

  .compact-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .split-fields {
    grid-template-columns: 1fr;
  }

  .launch-form {
    grid-template-columns: 1fr;
  }

  .launch-form .field.full,
  .launch-form .split-fields,
  .author-default-check,
  .live-preview-access-setting,
  .launch-form > .button-row {
    grid-column: 1 / -1;
  }

  .queue-filter-bar label,
  .queue-filter-bar .queue-filter-search {
    flex-basis: 100%;
    min-width: 0;
  }

  .queue-clear-filters {
    width: 100%;
  }

  .login-card-body {
    padding: 28px 22px;
  }

  .audit-page {
    width: min(100vw - 24px, 1420px);
    padding-top: 16px;
  }

  .audit-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .audit-branding {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .audit-filters {
    grid-template-columns: 1fr;
  }

  .audit-filter-actions .btn {
    flex: 1;
  }
}

/* Auto uploads: saved cloud connection and period controls in the intake rail. */
#autoUploadPanel [hidden] { display: none !important; }
.auto-upload-help { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
#autoCloudStatus { margin-top: 12px; }
.auto-upload-progress { margin: 12px 0 6px; padding: 10px 12px; border: 1px solid #dce4ef; border-radius: 10px; background: #f5f8fc; font-size: 12px; overflow-wrap: anywhere; }
.auto-upload-progress p { margin: 5px 0 0; }
.auto-upload-progress a { display: inline-block; margin-top: 8px; }
#autoUploadForm .button-row { flex-wrap: wrap; }
.record-status-dialog { border: 1px solid #d5dce5; border-radius: 12px; padding: 24px; width: min(460px, 92vw); }
.record-status-dialog::backdrop { background: rgb(15 23 42 / 45%); }
.record-status-dialog h2 { font-size: 1.25rem; }
