/* Reset & base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  background: #f5f6f7;
  color: #1f2329;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: #fff;
}

.center-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: #8a8f99;
}

.hidden {
  display: none;
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  padding: 16px;
  border-bottom: 1px solid #e5e6eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
}

.header-copy {
  min-width: 0;
}

.form-description {
  margin: 4px 0 0;
  font-size: 12px;
  color: #8a8f99;
}

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

.management-entry {
  border: 1px solid #c9d6ff;
  border-radius: 6px;
  padding: 6px 9px;
  background: #f3f6ff;
  color: #245bdb;
  font-size: 12px;
  white-space: nowrap;
}

.user-name {
  font-size: 12px;
  color: #8a8f99;
}

/* Spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e6eb;
  border-top-color: #3370ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Form sections */
section {
  padding: 16px;
  border-bottom: 8px solid #f5f6f7;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  color: #4e5969;
  margin-bottom: 6px;
  font-weight: 500;
}

.req {
  color: #f53f3f;
}

.hint {
  font-size: 12px;
  color: #86909c;
  margin-top: 4px;
}

input[type=text],
input[type=password],
input[type=date],
input[type=number],
input[type=search],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  box-sizing: border-box;
  min-height: 40px;
  font-family: inherit;
  color: #1f2329;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #3370ff;
  box-shadow: 0 0 0 2px rgba(51, 112, 255, 0.1);
}

.multi-select-menu .multi-select-option.hidden {
  display: none;
}

textarea {
  resize: vertical;
  min-height: 60px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2386909c' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Date range */
.date-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-range input {
  flex: 1;
}

.date-range span {
  color: #86909c;
}

/* Details (dynamic rows) */
#details-container .detail-row {
  background: #f7f8fa;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
}

.detail-row .detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.detail-row .btn-remove {
  background: none;
  border: none;
  color: #f53f3f;
  font-size: 12px;
  cursor: pointer;
  min-height: 32px;
  padding: 4px 8px;
}

.btn-add {
  background: none;
  border: 1px dashed #3370ff;
  color: #3370ff;
  padding: 8px 12px;
  border-radius: 6px;
  width: 100%;
  cursor: pointer;
  font-size: 13px;
  min-height: 40px;
}

/* Attachments */
#attachments-container .attachment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #f7f8fa;
  border-radius: 6px;
  margin-bottom: 6px;
}

.attachment-item .file-info {
  flex: 1;
  overflow: hidden;
}

.attachment-item .file-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-item .file-size {
  font-size: 11px;
  color: #86909c;
}

.attachment-item .btn-remove {
  background: none;
  border: none;
  color: #f53f3f;
  cursor: pointer;
  margin-left: 8px;
  min-height: 32px;
  padding: 4px 8px;
}

/* Buttons */
.btn-primary {
  background: #3370ff;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
  min-height: 40px;
}

.btn-primary:hover {
  background: #2860e0;
}

.btn-primary:disabled {
  background: #a8c4f5;
  cursor: not-allowed;
}

.btn-secondary {
  background: #f2f3f5;
  color: #4e5969;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  min-height: 40px;
}

.btn-secondary:hover {
  background: #e5e6eb;
}

.actions {
  padding: 16px;
  display: flex;
  gap: 8px;
}

.actions .btn-primary,
.actions .btn-secondary {
  flex: 1;
}

/* Precheck results */
#precheck-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Field-level inline errors */
.field-has-error input,
.field-has-error select,
.field-has-error textarea {
  border-color: #f53f3f;
  background: #fff7f7;
}

.field-error-inline {
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
  background: #ffece8;
  color: #f53f3f;
}

.field-error-inline::before {
  content: "!";
  display: inline-block;
  width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  background: #f53f3f;
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  margin-right: 6px;
  vertical-align: middle;
}

.precheck-status {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 13px;
}

.precheck-status.pass {
  background: #e8ffea;
  color: #00b42a;
}

.precheck-status.blocked {
  background: #ffece8;
  color: #f53f3f;
}

.precheck-status.warning {
  background: #fff7e8;
  color: #ff7d00;
}

.issue-group {
  margin-bottom: 12px;
}

.issue-group-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  padding-left: 8px;
  border-left: 3px solid;
}

.issue-group.high .issue-group-title {
  color: #f53f3f;
  border-color: #f53f3f;
}

.issue-group.medium .issue-group-title {
  color: #ff7d00;
  border-color: #ff7d00;
}

.issue-group.low .issue-group-title {
  color: #3370ff;
  border-color: #3370ff;
}

.issue-item {
  background: #f7f8fa;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 6px;
}

.issue-item .issue-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
}

.issue-item .issue-message {
  font-size: 12px;
  color: #86909c;
}

/* Submit section */
#submit-section .field {
  margin-bottom: 16px;
}

#submit-section .field label {
  display: block;
  font-size: 13px;
  color: #4e5969;
  margin-bottom: 6px;
  font-weight: 500;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #4e5969;
  margin: 12px 0;
}

.checkbox-label input[type=checkbox] {
  width: 16px;
  height: 16px;
}

/* Result section */
#result-section {
  text-align: center;
  padding: 24px 16px;
}

.result-link {
  display: inline-block;
  color: #3370ff;
  text-decoration: none;
  padding: 10px 20px;
  border: 1px solid #3370ff;
  border-radius: 6px;
  font-size: 14px;
  margin-top: 12px;
  min-height: 40px;
  line-height: 20px;
}

.result-link:hover {
  background: #3370ff;
  color: #fff;
}

.result-new-draft {
  display: block;
  width: 100%;
  margin-top: 12px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 9999;
  max-width: 80%;
  text-align: center;
  transition: opacity 0.3s;
}

.toast.error {
  background: rgba(245, 63, 63, 0.9);
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ===== app.js class-name alignment ===== */

/* Toast error variant (app.js uses 'toast-error') */
.toast.toast-error {
  background: rgba(245, 63, 63, 0.9);
}

/* Auth error text */
.auth-error {
  color: #f53f3f;
  font-size: 14px;
  margin-bottom: 12px;
  text-align: center;
}

/* Detail sub-fields (dynamic rows in renderDetails) */
.detail-field {
  margin-bottom: 8px;
}

.detail-field:last-child {
  margin-bottom: 0;
}

.detail-date-input {
  cursor: pointer;
}

.detail-label {
  display: block;
  font-size: 12px;
  color: #86909c;
  margin-bottom: 4px;
}


.native-multi-select {
  display: none;
}

.native-single-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  opacity: 0;
  pointer-events: none;
}

.single-select-picker {
  position: relative;
  z-index: auto;
}

.single-select-picker.is-open { z-index: 130; }

.single-select-toggle {
  position: relative;
  width: 100%;
  min-height: 42px;
  padding: 9px 38px 9px 12px;
  border: 1px solid #c9cdd4;
  border-radius: 8px;
  background: #fff;
  color: #86909c;
  font-family: inherit;
  font-size: 14px;
  line-height: 22px;
  text-align: left;
  cursor: pointer;
}

.single-select-toggle::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 13px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #86909c;
  border-bottom: 1.5px solid #86909c;
  transform: translateY(-70%) rotate(45deg);
  transition: transform .16s ease;
}

.single-select-toggle[aria-expanded='true'] {
  border-color: #3370ff;
  box-shadow: 0 0 0 3px rgba(51, 112, 255, .1);
}

.single-select-toggle[aria-expanded='true']::after {
  transform: translateY(-25%) rotate(225deg);
}

.single-select-toggle.has-value { color: #1d2129; }

.single-select-menu {
  position: absolute;
  z-index: 120;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid #e5e6eb;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(29, 33, 41, .14);
}

.single-select-menu.drop-up,
.related-menu.drop-up {
  top: auto;
  bottom: calc(100% + 5px);
}

.single-select-option {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #1d2129;
  font-family: inherit;
  font-size: 14px;
  line-height: 22px;
  text-align: left;
  cursor: pointer;
}

.single-select-option:hover,
.single-select-option:focus-visible { background: #f2f3f5; outline: none; }
.single-select-option.selected { color: #245bdb; background: #edf3ff; font-weight: 500; }
.single-select-option.selected::after { content: '✓'; float: right; }

.multi-select {
  position: relative;
  z-index: auto;
}

.multi-select.is-open { z-index: 110; }

.multi-select-toggle {
  width: 100%;
  min-height: 42px;
  padding: 9px 36px 9px 12px;
  border: 1px solid #c9cdd4;
  border-radius: 6px;
  background: #fff;
  color: #86909c;
  font-size: 14px;
  line-height: 22px;
  text-align: left;
  position: relative;
}

.multi-select-toggle::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2386909c' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transform: translateY(-50%);
  transition: transform 0.16s ease;
}

.multi-select-toggle[aria-expanded='true']::after {
  transform: translateY(-50%) rotate(180deg);
}

.multi-select-toggle.has-value {
  color: #1d2129;
}

.multi-select-menu {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 260px;
  overflow-y: auto;
  padding: 6px 0;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.multi-select-menu .multi-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 12px;
  font-size: 14px;
}

.multi-select-option:active {
  background: #f2f3f5;
}

.multi-select-option input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.date-period-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
  margin-bottom: 14px;
}

.form-description {
  margin: 4px 0 0;
  color: #86909c;
  font-size: 13px;
}

.section-title {
  margin: 0 0 20px;
  color: #1d2129;
  font-size: 17px;
  font-weight: 600;
}

#travel-dates-field > label:not(:first-child) {
  margin-top: 4px;
}

#travel_duration[readonly] {
  background: #f7f8fa;
  color: #4e5969;
}

/* Delete button (detail rows + attachments) */
.btn-del {
  background: none;
  border: none;
  color: #f53f3f;
  font-size: 12px;
  cursor: pointer;
  min-height: 32px;
  padding: 4px 8px;
  white-space: nowrap;
}

/* Attachment row (app.js uses attachment-row/info/name/meta) */
.attachment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #f7f8fa;
  border-radius: 6px;
  margin-bottom: 6px;
}

.attachment-info {
  flex: 1;
  overflow: hidden;
}

.attachment-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.attachment-meta {
  font-size: 11px;
  color: #86909c;
}

/* Per-detail slot upload (付款凭证/发票) */
.detail-attach {
  background: #fafbfc;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 4px;
}

.slot-attach-list {
  margin-bottom: 6px;
}

.btn-small {
  padding: 4px 10px !important;
  font-size: 12px !important;
  min-height: 28px !important;
  width: auto !important;
}

/* Precheck status line (app.js uses precheck-status-line/status-ok/status-block) */
.precheck-status-line {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
}

.precheck-status-line.status-ok {
  background: #e8ffea;
  color: #00b42a;
}

.precheck-status-line.status-block {
  background: #ffece8;
  color: #f53f3f;
}

.precheck-confirm {
  font-size: 12px;
  color: #ff7d00;
  margin-top: 4px;
}

/* Issue group severity (app.js uses issue-high/medium/other) */
.issue-group.issue-high .issue-group-title {
  color: #f53f3f;
  border-color: #f53f3f;
}

.issue-group.issue-medium .issue-group-title {
  color: #ff7d00;
  border-color: #ff7d00;
}

.issue-group.issue-other .issue-group-title {
  color: #3370ff;
  border-color: #3370ff;
}

/* Result section */
.result-title {
  font-size: 18px;
  font-weight: 600;
  color: #00b42a;
  margin-bottom: 12px;
}

.result-code {
  font-size: 13px;
  color: #4e5969;
  margin-bottom: 8px;
}

/* 2026 H5 form refresh: mobile-first cards and compact attachment lists */
#app {
  max-width: 720px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.03);
}

.header {
  display: block;
  padding: 20px 24px 16px;
}

/* Management is a global, low-frequency administrator tool, not part of the reimbursement flow. */
.header-copy {
  padding-right: 132px;
}

.header-actions {
  position: absolute;
  top: 18px;
  right: 24px;
  gap: 8px;
}

.management-entry {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 5px 8px;
  background: transparent;
  color: #4e62ca;
  font-size: 12px;
  font-weight: 500;
}

.management-entry:hover {
  background: #f1f4ff;
  color: #245bdb;
}

.management-entry:focus-visible {
  outline: 2px solid #8da4ff;
  outline-offset: 2px;
}

section {
  padding: 22px 24px;
}

.field-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.field-heading label {
  margin-bottom: 0;
}

.details-summary {
  color: #86909c;
  font-size: 12px;
  white-space: nowrap;
}

#details-container .detail-row {
  padding: 0;
  overflow: hidden;
  border: 1px solid #e5e6eb;
  border-radius: 10px;
  background: #fff;
  margin-bottom: 14px;
}

.detail-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 14px;
  border-bottom: 1px solid #e5e6eb;
  background: #f7f8fa;
}

.detail-card-header strong {
  font-size: 14px;
  font-weight: 600;
}

.detail-delete {
  border: 0;
  background: transparent;
  color: #f53f3f;
  font-size: 12px;
  cursor: pointer;
  padding: 8px 0 8px 12px;
}

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

.detail-card-body > .detail-field {
  margin-bottom: 14px;
}

.detail-card-body > .detail-field:last-child {
  margin-bottom: 0;
}

.detail-label {
  color: #4e5969;
  font-size: 12px;
  font-weight: 500;
}

.detail-attach {
  padding: 12px;
  border: 1px dashed #c9cdd4;
  border-radius: 8px;
  background: #fafbfc;
}

.slot-attach-list:empty {
  display: none;
}

.slot-attach-list:not(:empty) {
  margin: 8px 0;
}

.detail-attach .upload-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  width: 100%;
  border-radius: 6px;
  background: #eef3ff;
  color: #3370ff;
  font-size: 13px;
  cursor: pointer;
  margin: 0;
  font-weight: 500;
}

.attachment-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid #e5e6eb;
  border-radius: 7px;
  background: #fff;
}

.attachment-type-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.attachment-type-icon.is-pdf {
  background: #f53f3f;
}

.attachment-type-icon.is-image {
  background: #3370ff;
}

.attachment-info {
  min-width: 0;
}

.attachment-name {
  color: #1d2129;
  font-weight: 500;
}

.attachment-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.attachment-action {
  width: auto;
  min-height: 32px;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: #3370ff;
  font-size: 12px;
  cursor: pointer;
}

.attachment-action.danger {
  color: #f53f3f;
}

.actions {
  position: sticky;
  z-index: 20;
  bottom: 0;
  padding: 12px 24px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid #e5e6eb;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.preview-overlay {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.58);
}

.preview-overlay.hidden {
  display: none;
}

.preview-panel {
  display: flex;
  flex-direction: column;
  width: min(920px, 100%);
  height: min(760px, 92vh);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid #e5e6eb;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #4e5969;
  font-size: 26px;
  cursor: pointer;
}

.preview-content {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f2f3f5;
  color: #86909c;
}

.attachment-viewer {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
}

@media (max-width: 560px) {
  .header,
  section {
    padding-left: 16px;
    padding-right: 16px;
  }

  .header-copy {
    padding-right: 112px;
  }

  .header-actions {
    right: 16px;
  }

  .actions {
    padding-left: 16px;
    padding-right: 16px;
  }

  .attachment-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .attachment-actions {
    grid-column: 2;
    justify-content: flex-end;
  }
}

/* Native-style payee account picker */
.account-picker {
  position: relative;
}

.account-toggle {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 8px 38px 8px 12px;
  border: 1px solid #c9cdd4;
  border-radius: 6px;
  background: #fff;
  color: #86909c;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.account-toggle::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2386909c' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  transform: translateY(-50%);
  transition: transform 0.16s ease;
}

.account-toggle[aria-expanded='true'] {
  border-color: #3370ff;
  box-shadow: 0 0 0 2px rgba(51, 112, 255, 0.1);
}

.account-toggle[aria-expanded='true']::after {
  transform: translateY(-50%) rotate(180deg);
}

.account-toggle-name {
  color: #1d2129;
  font-weight: 500;
}

.account-toggle-bank {
  color: #86909c;
  font-size: 11px;
}

.account-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  overflow: hidden;
  border: 1px solid #e5e6eb;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.account-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  margin: 4px;
  padding: 8px 10px;
  border-radius: 5px;
  background: #f2f3f5;
  cursor: pointer;
}

.account-option.selected {
  background: #eef3ff;
  box-shadow: inset 0 0 0 1px #8aabff;
}

.account-option.hidden {
  display: none;
}

.account-bank-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #5b83db;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.account-option-detail {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: start;
  gap: 2px 7px;
  min-width: 0;
}

.account-option-detail strong {
  font-size: 13px;
  font-weight: 500;
}

.account-option-detail em {
  padding: 1px 5px;
  border-radius: 3px;
  background: #e8efff;
  color: #3370ff;
  font-size: 10px;
  font-style: normal;
}

.account-option-detail small {
  grid-column: 1 / -1;
  overflow: hidden;
  color: #86909c;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-add {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 0;
  border-top: 1px solid #f2f3f5;
  background: #fff;
  color: #3370ff;
  text-align: left;
  cursor: pointer;
}

.account-modal-overlay {
  position: fixed;
  z-index: 10020;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.48);
}

.account-modal-overlay.hidden {
  display: none;
}

.account-modal-panel {
  width: min(620px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.account-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 20px;
  border-bottom: 1px solid #e5e6eb;
}

.account-modal-body {
  padding: 20px;
}

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

.account-form-field {
  margin-bottom: 16px;
}

.account-form-field > label {
  display: block;
  margin-bottom: 6px;
  color: #4e5969;
  font-size: 13px;
  font-weight: 500;
}

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

.cascade-picker {
  position: relative;
}

.branch-picker-input {
  padding-right: 38px !important;
}

.branch-picker-chevron {
  pointer-events: none;
}

.cascade-picker:focus-within .branch-picker-input {
  border-color: #3370ff;
  box-shadow: 0 0 0 2px rgba(51, 112, 255, 0.1);
  outline: 0;
}

.cascade-toggle {
  position: relative;
  width: 100%;
  min-height: 40px;
  padding: 8px 38px 8px 12px;
  border: 1px solid #c9cdd4;
  border-radius: 6px;
  background: #fff;
  color: #86909c;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cascade-toggle:focus,
.cascade-toggle[aria-expanded='true'] {
  border-color: #3370ff;
  box-shadow: 0 0 0 2px rgba(51, 112, 255, 0.12);
  outline: 0;
}

.cascade-toggle.has-value { color: #1d2129; }

.cascade-chevron {
  position: absolute;
  top: 50%;
  right: 13px;
  color: #86909c;
  font-size: 18px;
  line-height: 1;
  transform: translateY(-58%);
}

.cascade-menu {
  position: absolute;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  max-height: 250px;
  margin-top: 4px;
  overflow: hidden;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.cascade-menu.hidden { display: none; }

.branch-cascade-menu {
  display: block;
  max-height: 230px;
  overflow-y: auto;
}

/* The account modal scrolls, so branch suggestions are portalled to <body>
   while open. This keeps the native-style list above the modal's clipping edge. */
.branch-cascade-menu.branch-menu-floating {
  position: fixed;
  z-index: 10030;
  margin-top: 0;
}

.branch-cascade-list { padding: 4px; }

.branch-cascade-option {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: #fff;
  color: #1d2129;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.branch-cascade-option:hover, .branch-cascade-option.active { background: #f2f3f5; }

.branch-cascade-empty {
  display: block;
  padding: 14px 10px;
  color: #86909c;
  font-size: 12px;
}

.cascade-column {
  min-height: 180px;
  max-height: 250px;
  overflow-y: auto;
  border-right: 1px solid #f2f3f5;
  padding: 4px;
}

.cascade-column:last-child { border-right: 0; background: #fafbfc; }

.cascade-option {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #4e5969;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.cascade-option:hover, .cascade-option.active { background: #f2f3f5; }
.cascade-option.selected { color: #3370ff; font-weight: 500; }
.cascade-native-value { display: none; }

.account-field-hint {
  margin: 6px 0 0;
  color: #86909c;
  font-size: 11px;
}

.related-picker {
  position: relative;
}

.related-toggle {
  position: relative;
  width: 100%;
  min-height: 42px;
  padding: 9px 38px 9px 12px;
  overflow: hidden;
  border: 1px solid #c9cdd4;
  border-radius: 6px;
  background: #fff;
  color: #86909c;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-toggle.has-value { color: #1d2129; }

.related-toggle::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 12px;
  height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2386909c' d='M6 8L1 3h10z'/%3E%3C/svg%3E") center/12px no-repeat;
  transform: translateY(-50%);
}

.related-toggle[aria-expanded='true'] {
  border-color: #3370ff;
  box-shadow: 0 0 0 2px rgba(51, 112, 255, 0.1);
}

.related-toggle[aria-expanded='true']::after { transform: translateY(-50%) rotate(180deg); }

.related-menu {
  position: absolute;
  z-index: 35;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid #e5e6eb;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.related-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-height: 62px;
  padding: 9px 72px 9px 10px;
  border: 0;
  border-radius: 5px;
  background: #fff;
  text-align: left;
}

.related-option:hover, .related-option:active { background: #f2f3f5; }
.related-option strong { color: #1d2129; font-size: 13px; font-weight: 500; }
.related-option span { margin-top: 4px; color: #86909c; font-size: 11px; }
.related-option em { position: absolute; top: 10px; right: 10px; color: #3370ff; font-size: 11px; font-style: normal; }
.picker-empty { padding: 20px 12px; color: #86909c; font-size: 12px; text-align: center; }

.account-type-options {
  display: flex;
  gap: 24px;
  min-height: 36px;
  align-items: center;
}

.account-type-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 400;
}

.account-type-options input {
  width: 16px;
  height: 16px;
  accent-color: #3370ff;
}

.account-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 18px;
}

.account-modal-cancel,
.account-modal-confirm {
  min-width: 84px;
  min-height: 38px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.account-modal-cancel {
  border: 1px solid #c9cdd4;
  background: #fff;
  color: #4e5969;
}

.account-modal-confirm {
  border: 0;
  background: #3370ff;
  color: #fff;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 560px) {
  .account-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .account-modal-panel {
    max-height: 88vh;
    border-radius: 14px 14px 0 0;
  }

  .account-modal-body {
    padding: 16px;
  }

  .account-form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

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

/* Form progress */
.form-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 14px 24px;
  border-bottom: 1px solid #e5e6eb;
  background: #fff;
  list-style: none;
}

.form-steps li {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #86909c;
  font-size: 12px;
}

.form-steps li:not(:last-child)::after {
  content: '';
  position: absolute;
  z-index: 0;
  top: 11px;
  left: calc(50% + 42px);
  width: calc(100% - 84px);
  height: 1px;
  background: #e5e6eb;
}

.form-steps li span {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f2f3f5;
  color: #86909c;
}

.form-steps li.active {
  color: #3370ff;
  font-weight: 600;
}

.form-steps li.active span {
  background: #3370ff;
  color: #fff;
}

.form-steps li.complete span {
  background: #e8ffea;
  color: #00b42a;
}

/* Searchable department multiselect */
.multi-select-toggle {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  overflow: visible;
  padding-right: 38px;
}

.multi-select-placeholder {
  overflow: hidden;
  color: #86909c;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.department-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 260px;
  overflow: hidden;
  padding: 2px 5px 2px 7px;
  border-radius: 4px;
  background: #f2f3f5;
  color: #1d2129;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.department-chip > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.department-chip-remove {
  flex: 0 0 auto;
  color: #86909c;
  font-size: 15px;
  line-height: 16px;
  cursor: pointer;
}

.multi-select-menu {
  max-height: 360px;
  padding: 0;
  overflow: hidden;
}

.multi-select-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px 8px;
}

.multi-select-count {
  color: #86909c;
  font-size: 12px;
}

.multi-select-search {
  width: calc(100% - 28px) !important;
  min-height: 38px !important;
  margin: 0 14px 8px;
  padding-left: 34px !important;
  background: #f2f3f5;
}

.multi-select-options {
  max-height: 220px;
  overflow-y: auto;
  border-top: 1px solid #f2f3f5;
  border-bottom: 1px solid #f2f3f5;
}

.multi-select-menu .multi-select-option {
  position: relative;
  justify-content: flex-start;
  min-height: 46px;
  margin: 0;
  padding: 9px 14px;
  border-bottom: 1px solid #f2f3f5;
  color: #1d2129;
  font-weight: 400;
}

.multi-select-menu .multi-select-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.multi-select-menu .multi-select-option:hover {
  background: #f2f3f5;
}

.multi-select-menu .multi-select-option.selected {
  color: #3370ff;
}

.multi-select-menu .multi-select-option.selected::after {
  content: '✓';
  position: absolute;
  right: 14px;
  color: #3370ff;
  font-size: 14px;
}

.multi-select-footer {
  display: none;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  padding: 10px 14px;
}

.multi-select-clear,
.multi-select-done {
  min-height: 38px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.multi-select-clear {
  border: 1px solid #c9cdd4;
  background: #fff;
  color: #4e5969;
}

.multi-select-done {
  border: 0;
  background: #3370ff;
  color: #fff;
}

.multi-select-backdrop {
  display: none;
}

/* Selectors must overlay the form at every breakpoint. Keeping their menus
   absolutely positioned prevents opening a selector from moving later fields. */
.single-select-picker.is-open,
.related-picker:has(.related-menu:not(.hidden)) {
  z-index: 160;
}

/* Do not raise an entire form card when a selector opens. The picker itself
   owns the overlay layer, so the white card background cannot cover the
   following reimbursement sections. */

/* Detail cards previously clipped their absolutely-positioned travel menus. */
#details-container .detail-row {
  overflow: visible;
}

#details-container .detail-card-header {
  border-radius: 10px 10px 0 0;
}

/* Payee account is one semantic component with explicit subfields */
.account-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid #e5e6eb;
  border-radius: 10px;
  background: #fafbfc;
}

.field .account-subfield {
  display: block;
  margin: 0;
  color: #4e5969;
  font-size: 12px;
  font-weight: 500;
}

.account-subfield > span {
  display: block;
  margin-bottom: 5px;
}

.account-card-number {
  grid-column: 1 / -1;
}

@media (max-width: 560px) {
  .form-steps {
    padding-left: 12px;
    padding-right: 12px;
  }

  .form-steps li:not(:last-child)::after {
    left: calc(50% + 30px);
    width: calc(100% - 60px);
  }

  .department-chip {
    max-width: 100%;
  }

  .multi-select-menu {
    position: fixed;
    z-index: 1002;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    max-height: 72vh;
    border: 0;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.16);
  }

  .multi-select-options {
    max-height: calc(72vh - 150px);
  }

  .multi-select-footer {
    display: grid;
  }

  .multi-select-backdrop:not(.hidden) {
    position: fixed;
    z-index: 1001;
    inset: 0;
    display: block;
    background: rgba(0, 0, 0, 0.42);
  }

  body.picker-open {
    overflow: hidden;
  }

  .account-card {
    grid-template-columns: 1fr;
  }

  .account-card-number {
    grid-column: auto;
  }
}
