.expense-memory-settings {
  display: grid;
  gap: 20px;
}

.expense-memory-safety-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 18px 0;
  padding: 11px 12px;
  border: 1px solid #cfe3da;
  border-radius: 8px;
  background: #f3faf7;
  color: #315f52;
  font-size: 12px;
  line-height: 1.6;
}

.expense-memory-safety-note i {
  flex: 0 0 auto;
  margin-top: 1px;
  font-size: 17px;
}

.expense-memory-scope-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.expense-memory-scope-switch button {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid #d8e2ec;
  border-radius: 8px;
  background: #ffffff;
  color: #52677a;
  text-align: left;
  cursor: pointer;
}

.expense-memory-scope-switch button:hover,
.expense-memory-scope-switch button.active {
  border-color: var(--theme-primary, #3a7ca5);
  background: color-mix(in srgb, var(--theme-primary-soft, #eaf4fa) 45%, #ffffff);
}

.expense-memory-scope-switch strong {
  color: #17324a;
  font-size: 13px;
}

.expense-memory-scope-switch span {
  font-size: 11px;
  line-height: 1.5;
}

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

.expense-memory-form-grid .field-wide {
  grid-column: 1 / -1;
}

.expense-memory-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.expense-memory-primary-button,
.expense-memory-refresh-button,
.expense-memory-item-actions button,
.expense-memory-inline-editor button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border: 1px solid #d6e1eb;
  border-radius: 7px;
  background: #ffffff;
  color: #31556f;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.expense-memory-primary-button {
  border-color: var(--theme-primary, #3a7ca5);
  background: var(--theme-primary, #3a7ca5);
  color: #ffffff;
}

.expense-memory-primary-button:disabled,
.expense-memory-refresh-button:disabled,
.expense-memory-inline-editor button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.expense-memory-list-head {
  align-items: center;
}

.expense-memory-list-head > div:first-child {
  min-width: 0;
}

.expense-memory-list-head h4,
.expense-memory-list-head p {
  margin: 0;
}

.expense-memory-list-head p {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
}

.expense-memory-state {
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #64748b;
  font-size: 13px;
}

.expense-memory-state.is-error {
  color: #b42318;
}

.expense-memory-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.expense-memory-item {
  padding: 14px;
  border: 1px solid #dce6ef;
  border-radius: 9px;
  background: #ffffff;
}

.expense-memory-item > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.expense-memory-item > header > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.expense-memory-item > header strong {
  color: #17324a;
  font-size: 13px;
}

.expense-memory-scope-badge,
.expense-memory-status {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: #edf4f8;
  color: #31556f;
  font-size: 10px;
  font-weight: 850;
}

.expense-memory-scope-badge.is-enterprise {
  background: #e8f1ff;
  color: #245596;
}

.expense-memory-status.is-active {
  background: #e8f7ef;
  color: #287653;
}

.expense-memory-status.is-revoked,
.expense-memory-status.is-expired,
.expense-memory-status.is-suppressed {
  background: #f1f3f5;
  color: #65727e;
}

.expense-memory-item dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 13px 0 0;
}

.expense-memory-item dl > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.expense-memory-item dt,
.expense-memory-item dd {
  margin: 0;
}

.expense-memory-item dt {
  color: #8190a0;
  font-size: 10px;
}

.expense-memory-item dd {
  color: #334155;
  font-size: 11px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.expense-memory-item-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 13px;
}

.expense-memory-item-actions button.danger,
.expense-memory-inline-editor button.danger {
  border-color: #efc7c3;
  color: #b42318;
}

.expense-memory-inline-editor {
  display: grid;
  grid-template-columns: minmax(140px, 0.6fr) minmax(120px, 0.4fr) minmax(220px, 1fr);
  gap: 9px;
  margin-top: 13px;
  padding: 12px;
  border: 1px solid #cfe0ee;
  border-radius: 8px;
  background: #f7fbfe;
}

.expense-memory-inline-editor.is-danger {
  grid-template-columns: 1fr;
  border-color: #efc7c3;
  background: #fff8f7;
}

.expense-memory-inline-editor p {
  margin: 0;
  color: #7a3b35;
  font-size: 11px;
  line-height: 1.55;
}

.expense-memory-inline-editor input {
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #d5e0ea;
  border-radius: 7px;
  color: #26394a;
  font-size: 12px;
}

.expense-memory-inline-editor > div {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 900px) {
  .expense-memory-item dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .expense-memory-inline-editor {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .expense-memory-scope-switch,
  .expense-memory-form-grid,
  .expense-memory-item dl {
    grid-template-columns: 1fr;
  }

  .expense-memory-item > header {
    align-items: flex-start;
  }

  .expense-memory-form-actions,
  .expense-memory-item-actions {
    justify-content: stretch;
  }

  .expense-memory-primary-button,
  .expense-memory-item-actions button {
    flex: 1;
  }
}
