.mdlsel {
  position: relative;
  display: inline-flex;
  min-width: 0;
}

.mdlsel-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  min-width: 0;
  max-width: 100%;
}

.mdlsel-trigger:hover {
  background: var(--bg-hover);
}

.mdlsel-trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
  text-align: left;
}

.mdlsel-chevron {
  flex: 0 0 auto;
  color: var(--text-muted);
}

.mdlsel-menu {
  position: fixed;
  z-index: 10000;
  min-width: 150px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px;
  box-shadow: 0 6px 18px var(--shadow);
}

.mdlsel-row-wrap {
  position: relative;
}

.mdlsel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: var(--text);
  font-size: 12px;
  padding: 5px 8px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.mdlsel-row:hover,
.mdlsel-row--open {
  background: var(--bg-hover);
}

.mdlsel-row--selected {
  color: var(--accent);
}

.mdlsel-sub {
  position: absolute;
  top: 0;
  left: 100%;
  margin-left: 2px;
  z-index: 10001;
  min-width: 200px;
  max-width: 280px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px;
  box-shadow: 0 6px 18px var(--shadow);
}

.mdlsel-sub--left {
  left: auto;
  right: 100%;
  margin-left: 0;
  margin-right: 2px;
}

.mdlsel-sub .mdlsel-row span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.mdlsel-loading {
  color: var(--text-muted);
  font-size: 11px;
  padding: 5px 8px;
}
/* Generic Modal Styles */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 350px;
  max-width: 90%;
  max-height: 80%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.modal-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.modal-section {
  margin-bottom: 16px;
}

.modal-section h4 {
  margin: 0 0 6px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 1px;
  border-bottom: 1px solid var(--border);
}

.modal-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 0;
  transition: color 0.15s ease;
}

.modal-checkbox:hover {
  color: var(--text);
}

.modal-checkbox input[type='checkbox'] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

/* Column grouping styles */
.column-group {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px;
  margin-bottom: 4px;
  background: var(--bg-base);
}

.column-header {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.column-header input[type='checkbox']:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.subtext-options {
  margin-left: 16px;
  padding-top: 2px;
  border-top: 1px solid var(--border);
}

.subtext-option {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.subtext-option:hover {
  color: var(--text-dim);
}

.modal-input-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-input-group label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  margin: 0;
}

.modal-input-group input {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s ease;
}

.modal-input-group input:focus {
  border-color: var(--accent);
}

.modal-input-group input::placeholder {
  color: var(--text-muted);
}

.slip-amounts-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slip-amount-row {
  display: flex;
  gap: 6px;
}

.slip-amount-row input {
  width: 64px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s ease;
}

.slip-amount-row input:focus {
  border-color: var(--accent);
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

.modal-button-group {
  display: flex;
  gap: 6px;
}

/* Button styles for modals */
.modal-button {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg-alt);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-button:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.modal-button--primary,
.modal-button--save {
  background: var(--accent);
  color: var(--text);
  border-color: var(--accent);
}

.modal-button--primary:hover,
.modal-button--save:hover {
  background: #0070cc;
  border-color: #0070cc;
}

.modal-button--reset {
  background: #d32f2f;
  color: var(--text);
  border-color: #d32f2f;
}

.modal-button--reset:hover {
  background: #b71c1c;
  border-color: #b71c1c;
}
