body {
  background: #d8e8f1;
}

.password-lock-active nav,
.password-lock-active main {
  filter: blur(7px);
  pointer-events: none;
  user-select: none;
}

.password-lock-active .modal-backdrop.show {
  opacity: .78;
  backdrop-filter: blur(3px);
}

.app-shell {
  max-width: 1180px;
}

.navbar-brand {
  font-weight: 700;
}

.navbar .nav-link {
  border-radius: 6px;
  margin: 0 2px;
}

.navbar .nav-link.active {
  background: #d8e8f1;
  color: #0b3551;
  font-weight: 800;
}

.card {
  border-radius: 8px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.page-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: #212529;
}

.page-subtitle {
  margin-top: 4px;
  color: #6c757d;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.metric-card {
  display: block;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.metric-card .card {
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.metric-card:hover .card {
  transform: translateY(-1px);
  box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .08) !important;
}

.metric-label {
  color: #6c757d;
  font-size: .82rem;
  font-weight: 700;
}

.metric-value {
  margin-top: 2px;
  font-size: 1.9rem;
  line-height: 1;
  font-weight: 800;
}

.toolbar-card .card-body {
  padding: 14px;
}

.modern-table {
  --bs-table-bg: #fff;
}

.modern-table thead th {
  background: #f5f7fb;
  color: #495057;
  font-size: .82rem;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid #dee2e6;
}

.modern-table tbody td {
  text-align: center;
  border-bottom: 1px solid #eef1f4;
}

.modern-table th:nth-child(even),
.modern-table td:nth-child(even) {
  background-color: rgba(248, 249, 250, .78);
}

.modern-table th:nth-child(odd),
.modern-table td:nth-child(odd) {
  background-color: rgba(255, 255, 255, .98);
}

.modern-table tbody tr:last-child td {
  border-bottom: 0;
}

.modern-table .table-section-row td {
  background: #d7e8f1 !important;
  color: #17324d;
  border-top: 1px solid #bfd3df;
  border-bottom: 1px solid #bfd3df;
}

.modern-table .primary-cell {
  font-weight: 800;
  color: #212529;
}

.month-button-row .btn {
  min-width: 54px;
}

.legacy-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 28px;
  color: #198754;
  font-size: 1.15rem;
  font-weight: 800;
}

.muted-dash {
  color: #adb5bd;
}

.white-space-pre {
  white-space: pre-line;
}

.notice-item {
  padding: 10px 0 8px;
  border-bottom: 1px solid #d7e2ea;
}

.notice-item:last-child {
  border-bottom: 0;
}

.notice-view-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.notice-text {
  min-width: 0;
}

.notice-title {
  margin-bottom: 2px;
}

.notice-body {
  line-height: 1.32;
}

.notice-actions {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.notice-action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.notice-action-buttons form {
  margin: 0;
}

.notice-date {
  margin-top: 2px;
  text-align: right;
}

.notice-edit-form {
  padding: 10px;
  background: #f7fbfd;
  border: 1px solid #d7e5ed;
  border-radius: 8px;
}

.status-badge {
  min-width: 74px;
}

.signature-pad {
  width: 100%;
  height: 220px;
  background: #fff;
  border: 1px dashed #adb5bd;
  border-radius: 8px;
  touch-action: none;
}

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

.profile-info-grid > div {
  min-height: 74px;
  padding: 14px;
  background: #f8fbfd;
  border: 1px solid #d6e3eb;
  border-radius: 8px;
}

.detail-label {
  color: #5f7080;
  font-size: .82rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.detail-value {
  color: #111827;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.profile-action-row {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 12px;
}

.pdf-password-action {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.profile-account-password-action {
  margin-top: 0;
  flex-shrink: 0;
}

.signature-preview-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: #f8fbfd;
  border: 1px solid #d6e3eb;
  border-radius: 8px;
}

.signature-preview-image {
  max-width: 240px;
  max-height: 82px;
  object-fit: contain;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

@media (max-width: 767.98px) {
  .profile-info-grid {
    grid-template-columns: 1fr;
  }

  .profile-action-row {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }

  .pdf-password-action {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-action-row .btn {
    width: 100%;
  }

  .profile-account-password-action {
    margin-top: 0;
  }

  .signature-preview-panel {
    align-items: flex-start;
    flex-direction: column;
  }
}

.table td,
.table th {
  vertical-align: middle;
}

.compact-label {
  color: #6c757d;
  font-size: .875rem;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill {
  min-width: 92px;
  padding: 8px 12px;
  font-size: .95rem;
}

.detail-section .card-body {
  padding: 18px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #c7dce8;
  border: 1px solid rgba(92, 122, 140, .18);
  border-radius: 8px;
}

.section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #212529;
}

.collapsible-title {
  border: 1px solid rgba(92, 122, 140, .18);
  cursor: pointer;
}

.collapsible-title:hover {
  background: #bdd5e3;
}

.section-meta {
  color: #6c757d;
  font-size: .875rem;
  white-space: nowrap;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 22px;
  row-gap: 12px;
}

.info-item,
.info-stack > div {
  min-width: 0;
}

.info-label {
  margin-bottom: 3px;
  color: #6c757d;
  font-size: .8rem;
  font-weight: 700;
}

.info-value {
  min-height: 24px;
  color: #343a40;
  overflow-wrap: anywhere;
}

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

.detail-data-table {
  --bs-table-bg: #fff;
  border-collapse: separate;
  border-spacing: 0;
}

.detail-data-table thead th {
  background: #f5f7fb;
  color: #495057;
  font-size: .82rem;
  font-weight: 800;
  white-space: nowrap;
  border-bottom: 1px solid #dee2e6;
}

.detail-data-table tbody td {
  border-bottom: 1px solid #eef1f4;
}

.detail-data-table tbody tr:last-child td {
  border-bottom: 0;
}

.application-table tbody tr.application-group-end > td,
.modern-table tbody tr.application-group-end > td,
.application-table tbody td.application-group-boundary,
.modern-table tbody td.application-group-boundary {
  border-bottom: 2px solid #a9c1cf !important;
}

.trade-report-edit-table {
  table-layout: fixed;
  min-width: 980px;
}

.trade-report-edit-table th:nth-child(1),
.trade-report-edit-table td:nth-child(1) {
  width: 44px;
}

.trade-report-edit-table th:nth-child(2),
.trade-report-edit-table td:nth-child(2) {
  width: 140px;
}

.trade-report-edit-table th:nth-child(3),
.trade-report-edit-table td:nth-child(3) {
  width: 190px;
}

.trade-report-edit-table th:nth-child(4),
.trade-report-edit-table td:nth-child(4) {
  width: 70px;
}

.trade-report-edit-table th:nth-child(5),
.trade-report-edit-table td:nth-child(5) {
  width: 82px;
}

.trade-report-edit-table th:nth-child(6),
.trade-report-edit-table td:nth-child(6) {
  width: 140px;
}

.trade-report-edit-table th:nth-child(7),
.trade-report-edit-table td:nth-child(7) {
  width: 160px;
  text-align: right;
}

.trade-report-edit-table th:nth-child(8),
.trade-report-edit-table td:nth-child(8) {
  width: 66px;
  text-align: center;
}

.trade-report-edit-table .form-control {
  width: 100%;
  min-width: 0;
}

.trade-report-edit-table .trade-edit-quantity,
.trade-report-edit-table .trade-edit-price {
  text-align: right;
}

.trade-report-edit-table .trade-edit-amount {
  white-space: nowrap;
}

.reason-box {
  padding: 12px;
  background: #f8f9fa;
  border: 1px solid #eef1f4;
  border-radius: 8px;
  white-space: pre-wrap;
}

.detail-side-card {
  top: 16px;
  z-index: 1;
}

.col-lg-4 > .detail-section + .detail-section {
  margin-top: 18px;
}

.form-label {
  font-weight: 700;
}

.approval-form-card {
  background: #d1e3ed;
}

.approval-form-footer {
  background: transparent;
  border-top: 1px solid rgba(0, 0, 0, .08);
}

.approval-form-card .form-control,
.approval-form-card .form-select {
  background-color: #fff;
}

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

.span-1 { grid-column: span 1; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; }
.span-12 { grid-column: span 12; }

.account-edit-block {
  padding: 12px;
  background: rgba(255, 255, 255, .35);
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 8px;
}

.account-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.policy-check-panel {
  padding: 12px;
  border: 1px solid rgba(44, 88, 112, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .34);
}

.policy-check-panel-disabled {
  opacity: .72;
}

.policy-check-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
}

.policy-check-row + .policy-check-row {
  border-top: 1px solid rgba(44, 88, 112, .14);
}

.policy-check-text {
  font-size: .92rem;
  color: #21313c;
}

.policy-check-actions .btn {
  min-width: 86px;
}

.policy-summary-box {
  padding: 12px;
  border-radius: 8px;
  background: #f5f9fb;
  border: 1px solid #d7e5ed;
}

.review-policy-box {
  padding: 12px;
  border: 1px solid #b7d1df;
  border-radius: 8px;
  background: #eef7fb;
}

.review-policy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(44, 88, 112, .14);
}

.review-policy-label {
  font-size: .9rem;
  color: #263946;
}

.admin-user-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #eef1f4;
}

.admin-save-bar {
  display: flex;
  justify-content: flex-end;
  padding: 16px 20px 20px;
  border-top: 1px solid #eef1f4;
  background: #fff;
}

.compliance-action-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.compliance-review-form {
  margin-top: 14px;
}

.compliance-action-group .btn {
  min-height: 40px;
  font-weight: 700;
}

.comment-template-box {
  border: 1px solid #d6dee6;
  border-radius: 6px;
  background: #fbfcfd;
  padding: 10px 12px;
}

.comment-template-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  font-size: .92rem;
  white-space: nowrap;
}

.comment-inline-input {
  width: 64px;
  min-width: 50px;
  height: 28px;
  padding: 2px 6px;
}

.comment-inline-input-short {
  width: 72px;
}

.comment-rank-input {
  width: 132px;
}

.item-review-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.comment-item-summary {
  padding: 10px 12px;
  border: 1px solid #b8d0df;
  border-radius: 6px;
  background: #e7f2f8;
  color: #163447;
  font-weight: 700;
}

.submission-form-grid {
  display: grid;
  grid-template-columns: 220px 132px minmax(260px, 340px) minmax(280px, 1fr) 118px;
  gap: 12px;
  align-items: end;
}

.submission-month-input {
  max-width: 150px;
}

.submission-action-field {
  justify-self: end;
  width: 120px;
}

.pdf-preview-content {
  height: min(92vh, 920px);
  max-height: 92vh;
}

.pdf-preview-body {
  flex: 1 1 auto;
  height: calc(92vh - 132px);
  min-height: 620px;
}

.mini-stat {
  background: #f8fafc;
  border: 1px solid #dbe7ef;
  border-radius: 6px;
  color: #415466;
  font-size: 0.9rem;
  padding: 10px 12px;
}

.mini-stat strong {
  color: #071827;
  display: block;
  font-size: 1.05rem;
  margin-top: 2px;
}

.missing-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.application-filter-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  padding-bottom: 2px;
}

.application-filter-field {
  display: flex !important;
  align-items: center !important;
  gap: 8px;
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: max-content;
}

.application-filter-field .form-label,
.application-filter-row .btn {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0;
  white-space: nowrap;
}

.application-filter-field .form-select {
  width: 122px !important;
  min-width: 122px;
  flex: 0 0 122px;
}

.application-filter-field input[name="stock_name"] {
  width: 170px !important;
  min-width: 170px;
  flex: 0 0 170px;
}

.application-filter-field input[type="date"] {
  width: 148px !important;
  min-width: 148px;
  flex: 0 0 148px;
}

.missing-filter-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.missing-filter-field .form-label {
  white-space: nowrap;
}

.missing-filter-row input[type="month"] {
  width: 128px;
}

.missing-filter-row .btn {
  white-space: nowrap;
}

.missing-submission-row {
  cursor: pointer;
}

.missing-submission-row:hover,
.missing-submission-row:focus {
  background: #eef7fb;
  outline: 2px solid rgba(13, 110, 253, 0.18);
  outline-offset: -2px;
}

.trade-method-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(96px, 1fr));
}

.trade-method-group .btn {
  border-radius: 0;
  white-space: nowrap;
}

.trade-method-group .btn:first-of-type {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

.trade-method-group .btn:last-of-type {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
  }

  .page-actions,
  .page-actions .btn {
    width: 100%;
  }

  .detail-header {
    flex-direction: column;
  }

  .detail-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .detail-header-actions .btn,
  .detail-header-actions .badge {
    width: 100%;
    text-align: center;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .detail-section .card-body {
    padding: 14px;
  }

  .section-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .notice-view-row {
    flex-direction: column;
  }

  .notice-actions {
    width: 100%;
    align-items: flex-start;
  }

  .notice-action-buttons {
    flex-wrap: wrap;
  }

  .notice-action-buttons .btn {
    flex: 1 1 auto;
  }

  .notice-date {
    text-align: left;
  }

  .detail-data-table {
    min-width: 720px;
  }

  .account-section-head {
    flex-direction: column;
  }

  .account-section-head .btn {
    width: 100%;
  }

  .form-grid-line {
    grid-template-columns: 1fr;
  }
  .span-2,
  .span-3,
  .span-4,
  .span-6,
  .span-8,
  .span-9,
  .span-12 {
    grid-column: span 1;
  }

  .trade-method-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .policy-check-row {
    grid-template-columns: 1fr;
  }

  .policy-check-actions {
    width: 100%;
  }

  .policy-check-actions .btn {
    flex: 1 1 0;
  }

  .compliance-action-group {
    grid-template-columns: 1fr;
  }

  .comment-template-row {
    flex-wrap: wrap;
    white-space: normal;
  }

  .submission-form-grid {
    grid-template-columns: 1fr;
  }

  .submission-month-input {
    max-width: none;
  }

  .submission-action-field {
    justify-self: stretch;
    width: 100%;
  }

  .pdf-preview-content {
    height: 92vh;
    max-height: 92vh;
  }

  .pdf-preview-body {
    height: calc(92vh - 132px);
    min-height: 520px;
  }

  .missing-filter-row {
    flex-wrap: nowrap !important;
    overflow-x: auto;
  }

  .missing-filter-field {
    width: auto;
    justify-content: flex-start;
  }

  .application-filter-row {
    flex-wrap: nowrap !important;
    overflow-x: auto;
  }

  .application-filter-field {
    width: auto;
    min-width: max-content;
    justify-content: flex-start;
  }
}
