:root {
  --bg: #eef3f8;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: #ffffff;
  --text: #223041;
  --muted: #66788a;
  --line: #d8e0e8;
  --line-strong: #bcc8d6;
  --primary: #1f6aa5;
  --primary-strong: #164f7d;
  --accent: #d5e6f6;
  --accent-soft: #f2f7fb;
  --success: #dcf5e8;
  --error: #fde8e5;
  --shadow: 0 8px 24px rgba(15, 35, 56, 0.08);
  --radius: 12px;
  --radius-sm: 6px;
  --font: "Segoe UI Variable Text", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text);
  background: linear-gradient(180deg, #eff3f7 0%, #e8edf4 100%);
}

body.popup-layout-body {
  min-height: 100vh;
  overflow-y: auto;
  background:
    radial-gradient(circle at top right, rgba(31, 106, 165, 0.12), transparent 34%),
    linear-gradient(180deg, #edf3f8 0%, #e2ebf4 100%);
}

a { color: inherit; text-decoration: none; }

code {
  background: rgba(11, 106, 162, 0.08);
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
}

.shell {
  display: grid;
  grid-template-columns: 176px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 14px 0;
  background: linear-gradient(180deg, #202939 0%, #212d3f 100%);
  color: #f5fbff;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  padding: 0 16px 18px;
  margin-bottom: 8px;
}

.brand-title { font-weight: 700; letter-spacing: 0.08em; font-size: 1.55rem; }
.brand-subtitle { color: rgba(245, 251, 255, 0.72); font-size: 0.88rem; }

.nav { display: grid; gap: 4px; }

.nav-section-title {
  padding: 0 16px 8px;
  color: rgba(226, 235, 245, 0.46);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
}

.nav-link {
  margin: 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-weight: 600;
  font-size: 0.92rem;
}

.nav-link.active, .nav-link:hover {
  background: linear-gradient(180deg, rgba(255,255,255,0.2), rgba(255,255,255,0.12));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

.nav-group {
  display: grid;
  gap: 4px;
}

.nav-group summary {
  list-style: none;
  cursor: pointer;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-group-toggle::after {
  content: "▸";
  font-size: 0.78rem;
  color: rgba(245, 251, 255, 0.72);
  transition: transform 0.18s ease;
}

.nav-group[open] .nav-group-toggle::after {
  transform: rotate(90deg);
}

.nav-submenu {
  display: grid;
  gap: 4px;
}

.nav-sublink {
  margin-left: 20px;
  font-size: 0.88rem;
}

.content { padding: 0 12px 18px; }
.content-standalone {
  padding: 0 0 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin: 0 -12px 12px;
  padding: 14px 18px;
  background: #1a2434;
  color: #f4f8fc;
}

.topbar-copy {
  display: grid;
  gap: 2px;
}

.topbar-eyebrow {
  color: rgba(218, 229, 241, 0.72);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
}

.topbar h1, .hero-copy h2 { margin: 0; }
.topbar h1 { font-size: 1.35rem; font-weight: 700; }
.topbar-spacer { min-height: 1px; }

.eyebrow, .hero-kicker, .grid-caption {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
}

.status-pill {
  color: rgba(241, 246, 252, 0.78);
  font-size: 0.82rem;
}

.stack { display: grid; gap: 14px; }

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 14px;
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(242,247,251,0.98)),
    linear-gradient(90deg, rgba(47, 110, 166, 0.08), rgba(240, 181, 93, 0.06));
}

.hero-copy p,
.entry-toolbar-copy p {
  margin-bottom: 0;
  color: var(--muted);
  max-width: 72ch;
}

.toolbar {
  display: flex;
  gap: 16px;
  align-items: end;
  margin-bottom: 12px;
}

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

.grow { flex: 1; }

.field-group { display: grid; gap: 5px; }

.field-group label, .section-title {
  font-weight: 600;
  color: #294763;
}

.field-group label {
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.section-title { margin-bottom: 10px; font-size: 1.02rem; }

input, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  min-height: 32px;
}

select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  min-height: 32px;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(15, 108, 189, 0.72);
  box-shadow: 0 0 0 2px rgba(15, 108, 189, 0.12);
  background: white;
}

textarea { resize: vertical; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  padding: 7px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 32px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

.button.primary {
  background: linear-gradient(180deg, #1b7cd3, var(--primary));
  color: white;
}

.button.secondary {
  background: linear-gradient(180deg, #ffffff, #f3f6f9);
  color: var(--primary-strong);
  border: 1px solid rgba(15, 108, 189, 0.14);
}

.button.small { padding: 8px 12px; font-size: 0.92rem; }
.button.is-disabled {
  pointer-events: none;
  opacity: 0.48;
}

.grid-caption {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
}

.data-grid {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.data-grid thead { background: linear-gradient(180deg, #f8fbfd, #e8eff5); }

.data-grid th, .data-grid td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #edf2f7;
  vertical-align: top;
}

.data-grid tbody tr:hover { background: rgba(11, 106, 162, 0.04); }
.data-grid th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4f667a;
}

.grid-input {
  min-height: 30px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.88rem;
}

.cell-title { font-weight: 700; }
.cell-subtitle { margin-top: 4px; color: var(--muted); font-size: 0.88rem; }
.text-right { text-align: right !important; }

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

.span-2 { grid-column: span 2; }

.alert {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.alert.success { background: var(--success); color: #13613d; }
.alert.error { background: var(--error); color: #992e1b; }
.field-validation { color: #b1392a; font-size: 0.85rem; }
.empty-state { text-align: center; color: var(--muted); }
.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;
}

.merchant-page {
  display: grid;
  gap: 12px;
}

.merchant-page-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  padding: 0 4px;
}

.page-kicker {
  color: var(--muted);
  font-size: 0.86rem;
}

.merchant-page-header h2,
.merchant-list-header h3,
.merchant-hero h3 {
  margin: 0;
}

.merchant-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
}

.merchant-hero-copy {
  padding: 16px 18px;
  color: white;
  background:
    linear-gradient(132deg, transparent 0, transparent 68%, rgba(255, 255, 255, 0.92) 68.2%, rgba(255, 255, 255, 0.98) 100%),
    linear-gradient(90deg, #1f5f95 0%, #1a5b90 55%, #dbe7f4 100%);
}

.merchant-hero-copy p {
  margin: 6px 0 0;
  color: rgba(245, 250, 255, 0.9);
}

.merchant-hero-copy .hero-kicker {
  color: rgba(242, 248, 255, 0.78);
}

.merchant-hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(116px, 1fr));
  gap: 10px;
  align-content: center;
  padding: 12px 16px 12px 0;
}

.hero-metric-card,
.summary-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  padding: 12px 14px;
}

.hero-metric-card strong,
.summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.55rem;
  font-weight: 700;
  color: #203041;
}

.hero-metric-card strong {
  font-size: 1.18rem;
}

.merchant-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.merchant-list-panel {
  padding: 0;
  overflow: hidden;
}

.merchant-header-details {
  margin: 0;
}

.merchant-header-toggle {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px 14px;
  list-style: none;
  cursor: pointer;
  border: 1px solid #cfdae6;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbfd 0%, #eef4f9 100%);
  box-shadow: 0 6px 18px rgba(15, 35, 56, 0.06);
}

.merchant-header-toggle::-webkit-details-marker {
  display: none;
}

.merchant-header-toggle-label {
  display: block;
  color: #294763;
  font-size: 0.9rem;
  font-weight: 700;
}

.merchant-header-toggle-note {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.merchant-header-toggle::after {
  content: "Collapse";
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #31536f;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.merchant-header-details:not([open]) .merchant-header-toggle {
  margin-bottom: 0;
}

.merchant-header-details:not([open]) .merchant-header-toggle::after {
  content: "Expand";
}

.merchant-header-details-body {
  display: grid;
}

.merchant-list-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #e6edf5;
  background: linear-gradient(180deg, #fafbfd 0%, #f4f7fa 100%);
}

.merchant-list-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.merchant-list-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 160px auto auto;
  gap: 8px;
  align-items: center;
}

.merchant-list-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #e9eff5;
  background: white;
}

.merchant-list-nav {
  display: flex;
  gap: 8px;
}

.merchant-table-wrap {
  border: 0;
  border-radius: 0;
}

.merchant-grid {
  min-width: 920px;
}

.merchant-grid th {
  background: #f7f9fc;
}

.merchant-grid td {
  padding-top: 10px;
  padding-bottom: 10px;
}

.merchant-number {
  font-variant-numeric: tabular-nums;
  color: #33485f;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-chip-active {
  background: #e6f4ec;
  color: #22653d;
}

.status-chip-inactive {
  background: #f3f5f8;
  color: #5f6c79;
}

.table-link {
  color: var(--primary);
  font-weight: 600;
}

.table-link:hover {
  color: var(--primary-strong);
}

.entry-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto auto;
  gap: 12px;
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(243,246,249,0.96)),
    linear-gradient(90deg, rgba(15, 108, 189, 0.05), rgba(255, 255, 255, 0));
}

.entry-toolbar-copy h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.entry-toolbar-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 8px;
}

.metric-card {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.metric-card strong {
  display: block;
  margin-top: 2px;
  font-size: 0.95rem;
  font-weight: 600;
}

.metric-label,
.section-kicker {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.64rem;
}

.sticky-actions {
  align-self: start;
  position: sticky;
  top: 10px;
}

.entry-ribbon {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.7);
}

.ribbon-link {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  white-space: nowrap;
  color: #35516a;
  font-weight: 600;
  font-size: 0.88rem;
}

.ribbon-link:hover,
.ribbon-link.active {
  background: white;
  border-color: var(--line);
  box-shadow: 0 4px 10px rgba(33, 58, 86, 0.08);
}

.entry-layout {
  display: block;
}

.entry-main {
  display: grid;
  gap: 12px;
}

.entry-main-full {
  width: 100%;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 10px;
}

.section-header .section-title {
  margin: 2px 0 0;
}

.section-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #36556f;
  font-size: 0.72rem;
  font-weight: 600;
}

.entry-section {
  padding: 12px;
}

.compact-grid {
  display: grid;
  gap: 10px;
}

.compact-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-grid .span-2 { grid-column: span 2; }
.compact-grid .span-4 { grid-column: span 4; }

.field-strong input {
  font-weight: 600;
}

.contact-editor-list {
  display: grid;
  gap: 10px;
}

.contact-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 10px;
}

.contact-card-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e7eef5;
}

.contact-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #294763;
}

.contact-card-badge {
  padding: 4px 7px;
  border-radius: 999px;
  background: #f3f7fb;
  border: 1px solid #d6e2ee;
  color: #4a647b;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}

.contact-grid {
  gap: 8px;
}

.contact-grid .field-group {
  gap: 4px;
}

.contact-grid .field-group label {
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #5f7488;
}

.merchant-detail-page {
  display: grid;
  gap: 12px;
}

.applicant-detail-popup-shell {
  max-width: 1480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 18px;
  overflow-y: auto;
}

.applicant-detail-popup-form {
  gap: 16px;
}

.applicant-detail-popup-header {
  padding: 14px 16px;
  align-items: center;
  border: 1px solid #d7e2ee;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(241,246,250,0.98));
  box-shadow: 0 10px 28px rgba(15, 35, 56, 0.08);
}

.applicant-detail-popup-kicker {
  color: #5b748c;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.applicant-detail-popup-panel {
  padding: 0;
  overflow: hidden;
}

.applicant-detail-popup-tabs {
  padding-top: 12px;
}

.applicant-detail-popup-content {
  overflow: visible;
}

.applicant-detail-popup-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.merchant-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding: 2px 4px 0;
}

.merchant-detail-header h2,
.detail-hero-main h3,
.workspace-name {
  margin: 0;
}

.merchant-detail-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.merchant-detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.merchant-detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,247,251,0.98)),
    linear-gradient(92deg, rgba(15,108,189,0.06), rgba(255,255,255,0));
}

.detail-hero-main {
  padding: 18px 20px;
  background:
    linear-gradient(120deg, transparent 0, transparent 76%, rgba(240, 245, 251, 0.94) 76.2%, rgba(248, 250, 253, 0.98) 100%),
    linear-gradient(90deg, rgba(20, 44, 71, 0.04), rgba(255, 255, 255, 0));
}

.detail-hero-main h3 {
  font-size: 1.2rem;
  color: #21415f;
}

.detail-hero-main p {
  margin: 6px 0 0;
  color: var(--muted);
}

.detail-hero-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  padding: 16px 18px 16px 0;
  align-content: center;
}

.detail-stat-card {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dbe4ef;
}

.detail-stat-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.02rem;
  font-weight: 700;
  color: #203548;
}

.merchant-detail-workspace {
  padding: 0;
  overflow: hidden;
}

.workspace-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #e3ebf3;
  background: linear-gradient(180deg, #fbfcfd 0%, #f5f8fb 100%);
}

.workspace-name {
  font-size: 1rem;
  font-weight: 700;
  color: #234462;
}

.workspace-note,
.profile-section-note {
  color: var(--muted);
  font-size: 0.75rem;
}

.merchant-detail-tabs {
  gap: 6px;
  padding: 10px 12px 0;
  border-bottom: 1px solid #dfe8f1;
  background: linear-gradient(180deg, rgba(252,253,254,0.96), rgba(247,249,252,0.96));
}

.merchant-detail-tabs .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: -1px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  color: #4a6278;
  font-weight: 600;
  font-size: 1.12rem;
}

.merchant-detail-tabs .nav-link:hover {
  border-color: #d7e2ed #d7e2ed #dfe8f1;
  background: rgba(255, 255, 255, 0.8);
}

.merchant-detail-tabs .nav-link.active {
  color: #20415f;
  background: white;
  border-color: #d7e2ed #d7e2ed white;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e8f1fb;
  color: #235586;
  font-size: 0.72rem;
  font-weight: 700;
}

.merchant-detail-content {
  padding: 0;
  background: white;
}

.merchant-detail-content .tab-pane {
  padding: 0;
}

.profile-section-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #e6edf5;
  background: #fff;
}

.profile-section-header .section-title {
  margin: 0;
}

.merchant-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #edf2f7;
  gap: 1px;
}

.merchant-field {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: white;
}

.merchant-field label {
  margin: 0;
  color: #6b7e92;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.merchant-field input,
.merchant-field textarea {
  min-height: 28px;
  padding: 5px 0;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid #d9e4ef;
  background: transparent;
  box-shadow: none;
}

.merchant-field input[readonly] {
  color: #405769;
}

.merchant-field input:focus,
.merchant-field textarea:focus {
  border-color: rgba(15, 108, 189, 0.72);
  box-shadow: inset 0 -1px 0 rgba(15, 108, 189, 0.72);
}

.merchant-field.span-2 {
  grid-column: span 2;
}

.merchant-field.span-4 {
  grid-column: span 4;
}

.contact-table-wrap {
  border: 0;
  border-radius: 0;
}

.contact-grid-table {
  min-width: 840px;
}

.contact-grid-table th {
  background: #fafbfd;
}

.contact-grid-table td {
  background: white;
}

.contact-inline-input {
  min-height: 28px;
  padding: 5px 0;
  border: 0;
  border-bottom: 1px solid #d9e4ef;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.contact-inline-input:focus {
  box-shadow: inset 0 -1px 0 rgba(15, 108, 189, 0.72);
}

.contact-status-cell {
  width: 130px;
}

.contact-status-input {
  max-width: 88px;
}

.contact-row-new td {
  background: #fbfdff;
}

.merchant-empty-state {
  padding: 24px 16px;
}

@media (max-width: 1080px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { padding-bottom: 20px; }
  .content { padding: 20px; }
  .entry-toolbar { grid-template-columns: 1fr; }
  .merchant-hero,
  .merchant-list-header,
  .merchant-list-meta,
  .merchant-page-header { grid-template-columns: 1fr; flex-direction: column; align-items: stretch; }
  .merchant-summary-grid { grid-template-columns: 1fr; }
  .merchant-list-toolbar { grid-template-columns: 1fr; }
  .merchant-hero-metrics { padding: 0 16px 16px; }
  .merchant-detail-hero { grid-template-columns: 1fr; }
  .detail-hero-meta {
    grid-template-columns: 1fr;
    padding: 0 16px 16px;
  }
}

@media (max-width: 768px) {
  .topbar, .toolbar, .grid-caption, .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .compact-grid-4 { grid-template-columns: 1fr; }
  .compact-grid .span-2,
  .compact-grid .span-4 { grid-column: auto; }
  .entry-toolbar-metrics { grid-template-columns: 1fr; }
  .contact-card-header { align-items: stretch; }
  .merchant-hero-metrics { grid-template-columns: 1fr; }
  .merchant-detail-header,
  .workspace-top,
  .profile-section-header {
    flex-direction: column;
    align-items: stretch;
  }
  .merchant-detail-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .merchant-info-grid {
    grid-template-columns: 1fr;
  }
  .merchant-field.span-2,
  .merchant-field.span-4 {
    grid-column: auto;
  }
  .applicant-detail-popup-shell {
    padding: 10px;
  }
  .applicant-detail-popup-grid {
    grid-template-columns: 1fr;
  }
}

/* Compatibility layer for views authored with Bootstrap 5 utility classes. */
.container-fluid { width: 100%; }
.row {
  --grid-gap-x: 1rem;
  --grid-gap-y: 0;
  display: flex;
  flex-wrap: wrap;
  margin-top: calc(-1 * var(--grid-gap-y));
  margin-right: calc(-0.5 * var(--grid-gap-x));
  margin-left: calc(-0.5 * var(--grid-gap-x));
}
.row > * {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  padding-right: calc(var(--grid-gap-x) * 0.5);
  padding-left: calc(var(--grid-gap-x) * 0.5);
  margin-top: var(--grid-gap-y);
}
.g-0 { --grid-gap-x: 0; --grid-gap-y: 0; }
.g-2 { --grid-gap-x: 0.5rem; --grid-gap-y: 0.5rem; }
.g-3 { --grid-gap-x: 1rem; --grid-gap-y: 1rem; }

.d-flex { display: flex !important; }
.d-grid { display: grid !important; }
.flex-column { flex-direction: column !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }
.align-items-stretch { align-items: stretch !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }

.col-12 { flex: 0 0 auto; width: 100%; }
.col-lg-3,
.col-lg-9,
.col-md-4,
.col-md-auto { flex: 0 0 auto; width: 100%; }

.p-0 { padding: 0 !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.pt-3 { padding-top: 1rem !important; }
.pb-0 { padding-bottom: 0 !important; }
.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
.py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.h-100 { height: 100% !important; }

.text-white { color: #fff !important; }
.text-secondary { color: var(--muted) !important; }
.text-center { text-align: center !important; }
.text-end { text-align: right !important; }
.text-nowrap { white-space: nowrap !important; }
.text-uppercase { text-transform: uppercase !important; }
.small { font-size: 0.875em !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold { font-weight: 700 !important; }
.fs-5 { font-size: 1.25rem !important; }
.display-6 { font-size: clamp(1.8rem, 3vw, 2.5rem) !important; line-height: 1.1; }
.h5 { font-size: 1.08rem; }
.opacity-75 { opacity: 0.75 !important; }

.bg-white { background: #fff !important; }
.bg-light { background: #f4f7fa !important; }
.border { border: 1px solid var(--line) !important; }
.border-0,
.card.border-0 { border: 0 !important; }
.border-bottom-0 { border-bottom: 0 !important; }
.rounded-3 { border-radius: 1rem !important; }
.overflow-hidden { overflow: hidden !important; }
.shadow-sm { box-shadow: 0 8px 24px rgba(15, 35, 56, 0.08) !important; }

.card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.card-header {
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid #e6edf5;
  background: linear-gradient(180deg, #fafbfd 0%, #f4f7fa 100%);
}
.card-body { padding: 1rem; }

.form-control,
.form-select {
  width: 100%;
  min-height: 38px;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.96);
}
.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: rgba(15, 108, 189, 0.72);
  box-shadow: 0 0 0 2px rgba(15, 108, 189, 0.12);
}
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
}
.btn-sm {
  min-height: 32px;
  padding: 0.35rem 0.7rem;
  font-size: 0.9rem;
}
.btn-primary {
  background: linear-gradient(180deg, #1b7cd3, var(--primary));
  border-color: var(--primary);
  color: #fff;
}
.btn-outline-secondary {
  background: #fff;
  border-color: var(--line-strong);
  color: #4a6278;
}
.btn-outline-primary {
  background: #fff;
  border-color: rgba(15, 108, 189, 0.28);
  color: var(--primary);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.page-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: #38506a;
}
.page-item.disabled .page-link {
  opacity: 0.6;
  pointer-events: none;
}

.table-responsive { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}
.table th,
.table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
  text-align: left;
}
.table-light th,
.table thead th {
  background: #f7f9fc;
  color: #4f667a;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.table-hover tbody tr:hover { background: rgba(11, 106, 162, 0.04); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.text-bg-success { background: #e6f4ec; color: #22653d; }
.text-bg-secondary { background: #f3f5f8; color: #5f6c79; }

.nav-tabs {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 10px 12px 0;
  list-style: none;
  border-bottom: 1px solid #dfe8f1;
}
.nav-item { margin: 0; }
.tab-content > .tab-pane { display: none; }
.tab-content > .active { display: block; }
.fade { opacity: 1; transition: opacity 0.15s linear; }

@media (min-width: 768px) {
  .flex-md-row { flex-direction: row !important; }
  .align-items-md-center { align-items: center !important; }
  .col-md-4 { width: 33.333333%; }
  .col-md-auto { width: auto; }
}

@media (min-width: 992px) {
  .flex-lg-row { flex-direction: row !important; }
  .align-items-lg-end { align-items: end !important; }
  .col-lg-3 { width: 25%; }
  .col-lg-9 { width: 75%; }
}

@media (min-width: 1200px) {
  .flex-xl-row { flex-direction: row !important; }
  .align-items-xl-start { align-items: flex-start !important; }
}

.application-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
}

.application-shell-single {
  grid-template-columns: minmax(0, 1fr);
}

.application-rail {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 12px;
  border: 1px solid #cfd9e4;
  border-radius: 12px;
  background: linear-gradient(180deg, #f3f6fa 0%, #e6edf5 100%);
  box-shadow: var(--shadow);
}

.application-rail-title {
  margin-bottom: 4px;
  color: #51687d;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.application-rail-link {
  display: block;
  padding: 10px 12px;
  border: 1px solid #d6dfeb;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: #294763;
  font-weight: 600;
}

.application-rail-link.active,
.application-rail-link:hover {
  border-color: #aac4df;
  background: linear-gradient(180deg, #ffffff, #eef5fb);
}

.application-workspace {
  min-width: 0;
}

.application-commandbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid #c9d7e5;
  border-radius: 12px;
  background: linear-gradient(180deg, #d8e5f3 0%, #c7d7e9 48%, #eef3f9 100%);
  box-shadow: var(--shadow);
}

.application-commandbar h2 {
  margin: 2px 0 0;
  font-size: 1.35rem;
}

.application-kicker {
  color: #4c6983;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.application-summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.application-summary-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #d4deea;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 14px rgba(15, 35, 56, 0.05);
}

.application-summary-card span {
  color: #60758a;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.application-summary-card strong {
  font-size: 1.22rem;
}

.application-grid-card .card-header {
  padding: 12px 14px 0;
}

.application-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.application-toolbar-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.application-search {
  min-width: 320px;
}

.application-page-size {
  min-width: 120px;
}

.application-grid-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 10px;
}

.application-table {
  min-width: 0;
  table-layout: fixed;
}

.application-table th,
.application-table td {
  padding: 0.45rem 0.5rem;
  font-size: 0.8rem;
  vertical-align: top;
}

.application-remark {
  min-width: 240px;
  max-width: 320px;
}

.application-table th:nth-child(1),
.application-table td:nth-child(1) {
  width: 52px;
}

.application-table th:nth-child(2),
.application-table td:nth-child(2),
.application-table th:nth-child(3),
.application-table td:nth-child(3),
.application-table th:nth-child(6),
.application-table td:nth-child(6),
.application-table th:nth-child(9),
.application-table td:nth-child(9) {
  white-space: nowrap;
}

.application-table th:nth-child(4),
.application-table td:nth-child(4),
.application-table th:nth-child(7),
.application-table td:nth-child(7),
.application-table th:nth-child(8),
.application-table td:nth-child(8) {
  width: 110px;
}

.application-table th:nth-child(5),
.application-table td:nth-child(5) {
  width: 22%;
}

.application-table th:nth-child(10),
.application-table td:nth-child(10) {
  width: 96px;
}

.application-table td {
  word-break: break-word;
}

@media (max-width: 1199px) {
  .application-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991px) {
  .application-shell {
    grid-template-columns: 1fr;
  }

  .application-commandbar,
  .application-toolbar,
  .application-grid-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .application-search {
    min-width: 0;
    width: 100%;
  }

}

@media (max-width: 767px) {
  .application-summary-strip {
    grid-template-columns: 1fr;
  }
}
